1 #include "simulation/ElementCommon.h"
2 
3 static int update(UPDATE_FUNC_ARGS);
4 static int graphics(GRAPHICS_FUNC_ARGS);
5 
Element_INVIS()6 void Element::Element_INVIS()
7 {
8 	Identifier = "DEFAULT_PT_INVIS";
9 	Name = "INVS";
10 	Colour = PIXPACK(0x00CCCC);
11 	MenuVisible = 1;
12 	MenuSection = SC_SENSOR;
13 	Enabled = 1;
14 
15 	Advection = 0.0f;
16 	AirDrag = 0.00f * CFDS;
17 	AirLoss = 0.90f;
18 	Loss = 0.00f;
19 	Collision = 0.0f;
20 	Gravity = 0.0f;
21 	Diffusion = 0.00f;
22 	HotAir = 0.000f	* CFDS;
23 	Falldown = 0;
24 
25 	Flammable = 0;
26 	Explosive = 0;
27 	Meltable = 0;
28 	Hardness = 15;
29 
30 	Weight = 100;
31 
32 	HeatConduct = 164;
33 	Description = "Invisible to particles while under pressure.";
34 
35 	Properties = TYPE_SOLID | PROP_NEUTPASS;
36 
37 	LowPressure = IPL;
38 	LowPressureTransition = NT;
39 	HighPressure = IPH;
40 	HighPressureTransition = NT;
41 	LowTemperature = ITL;
42 	LowTemperatureTransition = NT;
43 	HighTemperature = ITH;
44 	HighTemperatureTransition = NT;
45 
46 	Update = &update;
47 	Graphics = &graphics;
48 }
49 
update(UPDATE_FUNC_ARGS)50 static int update(UPDATE_FUNC_ARGS)
51 {
52 	float pressureResistance = 0.0f;
53 	if (parts[i].tmp > 0)
54 		pressureResistance = (float) parts[i].tmp;
55 	else
56 		pressureResistance = 4.0f;
57 
58 	if (sim->pv[y/CELL][x/CELL] < -pressureResistance || sim->pv[y/CELL][x/CELL] > pressureResistance)
59 		parts[i].tmp2 = 1;
60 	else
61 		parts[i].tmp2 = 0;
62 	return 0;
63 }
64 
graphics(GRAPHICS_FUNC_ARGS)65 static int graphics(GRAPHICS_FUNC_ARGS)
66 {
67 	//pv[ny/CELL][nx/CELL]>4.0f || pv[ny/CELL][nx/CELL]<-4.0f
68 	if(cpart->tmp2)
69 	{
70 		*cola = 100;
71 		*colr = 15;
72 		*colg = 0;
73 		*colb = 150;
74 		*pixel_mode = PMODE_BLEND;
75 	}
76 	return 0;
77 }
78