1 #include "simulation/ElementCommon.h"
2
3 static int update(UPDATE_FUNC_ARGS);
4 static int graphics(GRAPHICS_FUNC_ARGS);
5 static void create(ELEMENT_CREATE_FUNC_ARGS);
6
Element_WARP()7 void Element::Element_WARP()
8 {
9 Identifier = "DEFAULT_PT_WARP";
10 Name = "WARP";
11 Colour = PIXPACK(0x101010);
12 MenuVisible = 1;
13 MenuSection = SC_NUCLEAR;
14 Enabled = 1;
15
16 Advection = 0.8f;
17 AirDrag = 0.00f * CFDS;
18 AirLoss = 0.9f;
19 Loss = 0.70f;
20 Collision = -0.1f;
21 Gravity = 0.0f;
22 Diffusion = 3.00f;
23 HotAir = 0.000f * CFDS;
24 Falldown = 0;
25
26 Flammable = 0;
27 Explosive = 0;
28 Meltable = 0;
29 Hardness = 30;
30
31 Weight = 1;
32
33 HeatConduct = 100;
34 Description = "Displaces other elements.";
35
36 Properties = TYPE_GAS|PROP_LIFE_DEC|PROP_LIFE_KILL;
37
38 LowPressure = IPL;
39 LowPressureTransition = NT;
40 HighPressure = IPH;
41 HighPressureTransition = NT;
42 LowTemperature = ITL;
43 LowTemperatureTransition = NT;
44 HighTemperature = ITH;
45 HighTemperatureTransition = NT;
46
47 Update = &update;
48 Graphics = &graphics;
49 Create = &create;
50 }
51
update(UPDATE_FUNC_ARGS)52 static int update(UPDATE_FUNC_ARGS)
53 {
54 int trade, r, rx, ry;
55 if (parts[i].tmp2>2000)
56 {
57 parts[i].temp = 10000;
58 sim->pv[y/CELL][x/CELL] += (parts[i].tmp2/5000) * CFDS;
59 if (RNG::Ref().chance(1, 50))
60 sim->create_part(-3, x, y, PT_ELEC);
61 }
62 for ( trade = 0; trade<5; trade ++)
63 {
64 rx = RNG::Ref().between(-1, 1);
65 ry = RNG::Ref().between(-1, 1);
66 if (BOUNDS_CHECK && (rx || ry))
67 {
68 r = pmap[y+ry][x+rx];
69 if (!r)
70 continue;
71 if (TYP(r)!=PT_WARP&&TYP(r)!=PT_STKM&&TYP(r)!=PT_STKM2&&TYP(r)!=PT_DMND&&TYP(r)!=PT_CLNE&&TYP(r)!=PT_BCLN&&TYP(r)!=PT_PCLN)
72 {
73 parts[i].x = parts[ID(r)].x;
74 parts[i].y = parts[ID(r)].y;
75 parts[ID(r)].x = x;
76 parts[ID(r)].y = y;
77 parts[ID(r)].vx = RNG::Ref().chance(-2, 1) + 0.5f;
78 parts[ID(r)].vy = RNG::Ref().between(-2, 1);
79 parts[i].life += 4;
80 pmap[y][x] = r;
81 pmap[y+ry][x+rx] = PMAP(i, parts[i].type);
82 trade = 5;
83 }
84 }
85 }
86 return 0;
87 }
88
graphics(GRAPHICS_FUNC_ARGS)89 static int graphics(GRAPHICS_FUNC_ARGS)
90 {
91 *colr = *colg = *colb = *cola = 0;
92 *pixel_mode &= ~PMODE;
93 return 0;
94 }
95
create(ELEMENT_CREATE_FUNC_ARGS)96 static void create(ELEMENT_CREATE_FUNC_ARGS)
97 {
98 sim->parts[i].life = RNG::Ref().between(70, 164);
99 }
100