1 #include "simulation/ElementCommon.h"
2 
3 static int update(UPDATE_FUNC_ARGS);
4 
Element_IRON()5 void Element::Element_IRON()
6 {
7 	Identifier = "DEFAULT_PT_IRON";
8 	Name = "IRON";
9 	Colour = PIXPACK(0x707070);
10 	MenuVisible = 1;
11 	MenuSection = SC_SOLIDS;
12 	Enabled = 1;
13 
14 	Advection = 0.0f;
15 	AirDrag = 0.00f * CFDS;
16 	AirLoss = 0.90f;
17 	Loss = 0.00f;
18 	Collision = 0.0f;
19 	Gravity = 0.0f;
20 	Diffusion = 0.00f;
21 	HotAir = 0.000f	* CFDS;
22 	Falldown = 0;
23 
24 	Flammable = 0;
25 	Explosive = 0;
26 	Meltable = 1;
27 	Hardness = 50;
28 
29 	Weight = 100;
30 
31 	HeatConduct = 251;
32 	Description = "Rusts with salt, can be used for electrolysis of WATR.";
33 
34 	Properties = TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC|PROP_HOT_GLOW;
35 
36 	LowPressure = IPL;
37 	LowPressureTransition = NT;
38 	HighPressure = IPH;
39 	HighPressureTransition = NT;
40 	LowTemperature = ITL;
41 	LowTemperatureTransition = NT;
42 	HighTemperature = 1687.0f;
43 	HighTemperatureTransition = PT_LAVA;
44 
45 	Update = &update;
46 }
47 
update(UPDATE_FUNC_ARGS)48 static int update(UPDATE_FUNC_ARGS)
49 {
50 	int r, rx, ry;
51 	if (parts[i].life)
52 		return 0;
53 	for (rx=-1; rx<2; rx++)
54 		for (ry=-1; ry<2; ry++)
55 			if (BOUNDS_CHECK && (rx || ry))
56 			{
57 				r = pmap[y+ry][x+rx];
58 				switch TYP(r)
59 				{
60 				case PT_SALT:
61 					if (RNG::Ref().chance(1, 47))
62 						goto succ;
63 					break;
64 				case PT_SLTW:
65 					if (RNG::Ref().chance(1, 67))
66 						goto succ;
67 					break;
68 				case PT_WATR:
69 					if (RNG::Ref().chance(1, 1200))
70 						goto succ;
71 					break;
72 				case PT_O2:
73 					if (RNG::Ref().chance(1, 250))
74 						goto succ;
75 					break;
76 				case PT_LO2:
77 					goto succ;
78 				default:
79 					break;
80 				}
81 			}
82 	return 0;
83 succ:
84 	sim->part_change_type(i,x,y,PT_BMTL);
85 	parts[i].tmp = RNG::Ref().between(20, 29);
86 	return 0;
87 }
88