1 #include "simulation/ElementCommon.h"
2 
3 static int update(UPDATE_FUNC_ARGS);
4 
Element_FSEP()5 void Element::Element_FSEP()
6 {
7 	Identifier = "DEFAULT_PT_FSEP";
8 	Name = "FSEP";
9 	Colour = PIXPACK(0x63AD5F);
10 	MenuVisible = 1;
11 	MenuSection = SC_EXPLOSIVE;
12 	Enabled = 1;
13 
14 	Advection = 0.7f;
15 	AirDrag = 0.02f * CFDS;
16 	AirLoss = 0.96f;
17 	Loss = 0.80f;
18 	Collision = 0.0f;
19 	Gravity = 0.1f;
20 	Diffusion = 0.00f;
21 	HotAir = 0.000f	* CFDS;
22 	Falldown = 1;
23 
24 	Flammable = 0;
25 	Explosive = 0;
26 	Meltable = 0;
27 	Hardness = 30;
28 
29 	Weight = 70;
30 
31 	HeatConduct = 70;
32 	Description = "Fuse Powder. Burns slowly like FUSE.";
33 
34 	Properties = TYPE_PART;
35 
36 	LowPressure = IPL;
37 	LowPressureTransition = NT;
38 	HighPressure = IPH;
39 	HighPressureTransition = NT;
40 	LowTemperature = ITL;
41 	LowTemperatureTransition = NT;
42 	HighTemperature = ITH;
43 	HighTemperatureTransition = NT;
44 
45 	DefaultProperties.life = 50;
46 
47 	Update = &update;
48 }
49 
update(UPDATE_FUNC_ARGS)50 static int update(UPDATE_FUNC_ARGS)
51 {
52 	int r, rx, ry;
53 	if (parts[i].life<=0) {
54 		r = sim->create_part(i, x, y, PT_PLSM);
55 		if (r!=-1)
56 			parts[r].life = 50;
57 		return 1;
58 	}
59 	else if (parts[i].life < 40) {
60 		parts[i].life--;
61 		if (RNG::Ref().chance(1, 10)) {
62 			r = sim->create_part(-1, x + RNG::Ref().between(-1, 1), y + RNG::Ref().between(-1, 1), PT_PLSM);
63 			if (r>-1)
64 				parts[r].life = 50;
65 		}
66 	}
67 	else {
68 		for (rx=-2; rx<3; rx++)
69 			for (ry=-2; ry<3; ry++)
70 				if (BOUNDS_CHECK && (rx || ry))
71 				{
72 					r = pmap[y+ry][x+rx];
73 					if (!r)
74 						continue;
75 					if ((TYP(r)==PT_SPRK || (parts[i].temp>=(273.15+400.0f))) && parts[i].life>40 && RNG::Ref().chance(1, 15))
76 					{
77 						parts[i].life = 39;
78 					}
79 				}
80 	}
81 	return 0;
82 }
83