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_CLST()7 void Element::Element_CLST()
8 {
9 	Identifier = "DEFAULT_PT_CLST";
10 	Name = "CLST";
11 	Colour = PIXPACK(0xE4A4A4);
12 	MenuVisible = 1;
13 	MenuSection = SC_POWDERS;
14 	Enabled = 1;
15 
16 	Advection = 0.7f;
17 	AirDrag = 0.02f * CFDS;
18 	AirLoss = 0.94f;
19 	Loss = 0.95f;
20 	Collision = 0.0f;
21 	Gravity = 0.2f;
22 	Diffusion = 0.00f;
23 	HotAir = 0.000f	* CFDS;
24 	Falldown = 1;
25 
26 	Flammable = 0;
27 	Explosive = 0;
28 	Meltable = 2;
29 	Hardness = 2;
30 
31 	Weight = 55;
32 
33 	HeatConduct = 70;
34 	Description = "Clay dust. Produces paste when mixed with water.";
35 
36 	Properties = TYPE_PART;
37 
38 	LowPressure = IPL;
39 	LowPressureTransition = NT;
40 	HighPressure = IPH;
41 	HighPressureTransition = NT;
42 	LowTemperature = ITL;
43 	LowTemperatureTransition = NT;
44 	HighTemperature = 1256.0f;
45 	HighTemperatureTransition = PT_LAVA;
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 r, rx, ry;
55 	float cxy = 0;
56 	for (rx=-2; rx<3; rx++)
57 		for (ry=-2; ry<3; ry++)
58 			if (BOUNDS_CHECK && (rx || ry))
59 			{
60 				r = pmap[y+ry][x+rx];
61 				if (!r)
62 					continue;
63 				if (TYP(r)==PT_WATR)
64 				{
65 					if (RNG::Ref().chance(1, 1500))
66 					{
67 						sim->create_part(i, x, y, PT_PSTS);
68 						sim->kill_part(ID(r));
69 					}
70 				}
71 				else if (TYP(r)==PT_NITR)
72 				{
73 					sim->create_part(i, x, y, PT_BANG);
74 					sim->create_part(ID(r), x+rx, y+ry, PT_BANG);
75 				}
76 				else if (TYP(r)==PT_CLST)
77 				{
78 					if(parts[i].temp <195)
79 						cxy = 0.05;
80 					else if(parts[i].temp <295)
81 						cxy = 0.015;
82 					else if(parts[i].temp <350)
83 						cxy = 0.01;
84 					else
85 						cxy = 0.005;
86 					parts[i].vx += cxy*rx;
87 					parts[i].vy += cxy*ry;//These two can be set not to calculate over 350 later. They do virtually nothing over 0.005.
88 				}
89 			}
90 	return 0;
91 }
92 
graphics(GRAPHICS_FUNC_ARGS)93 static int graphics(GRAPHICS_FUNC_ARGS)
94 {
95 	int z = (cpart->tmp - 5) * 16;//speckles!
96 	*colr += z;
97 	*colg += z;
98 	*colb += z;
99 	return 0;
100 }
101 
create(ELEMENT_CREATE_FUNC_ARGS)102 static void create(ELEMENT_CREATE_FUNC_ARGS)
103 {
104 	sim->parts[i].tmp = RNG::Ref().between(0, 6);
105 }
106