1 #include "simulation/ElementCommon.h"
2
3 static int update(UPDATE_FUNC_ARGS);
4
Element_FRZW()5 void Element::Element_FRZW()
6 {
7 Identifier = "DEFAULT_PT_FRZW";
8 Name = "FRZW";
9 Colour = PIXPACK(0x1020C0);
10 MenuVisible = 1;
11 MenuSection = SC_CRACKER2;
12 Enabled = 1;
13
14 Advection = 0.6f;
15 AirDrag = 0.01f * CFDS;
16 AirLoss = 0.98f;
17 Loss = 0.95f;
18 Collision = 0.0f;
19 Gravity = 0.1f;
20 Diffusion = 0.00f;
21 HotAir = 0.000f * CFDS;
22 Falldown = 2;
23
24 Flammable = 0;
25 Explosive = 0;
26 Meltable = 0;
27 Hardness = 20;
28
29 Weight = 30;
30
31 DefaultProperties.temp = 120.0f;
32 HeatConduct = 29;
33 Description = "Freeze water. Hybrid liquid formed when Freeze powder melts.";
34
35 Properties = TYPE_LIQUID | PROP_LIFE_DEC;
36
37 LowPressure = IPL;
38 LowPressureTransition = NT;
39 HighPressure = IPH;
40 HighPressureTransition = NT;
41 LowTemperature = 53.0f;
42 LowTemperatureTransition = PT_ICEI;
43 HighTemperature = ITH;
44 HighTemperatureTransition = NT;
45
46 DefaultProperties.life = 100;
47
48 Update = &update;
49 }
50
update(UPDATE_FUNC_ARGS)51 static int update(UPDATE_FUNC_ARGS)
52 {
53 int r, rx, ry;
54 for (rx=-1; rx<2; rx++)
55 for (ry=-1; ry<2; ry++)
56 if (BOUNDS_CHECK && (rx || ry))
57 {
58 r = pmap[y+ry][x+rx];
59 if (!r)
60 continue;
61 if (TYP(r)==PT_WATR && RNG::Ref().chance(1, 14))
62 {
63 sim->part_change_type(ID(r),x+rx,y+ry,PT_FRZW);
64 }
65 }
66 if ((parts[i].life==0 && RNG::Ref().chance(1, 192)) || RNG::Ref().chance(100-parts[i].life, 50000))
67 {
68 sim->part_change_type(i,x,y,PT_ICEI);
69 parts[i].ctype=PT_FRZW;
70 parts[i].temp = restrict_flt(parts[i].temp-200.0f, MIN_TEMP, MAX_TEMP);
71 }
72 return 0;
73 }
74