summaryrefslogtreecommitdiff
path: root/src/simulation/elements/WTRV.cpp
blob: d58b371bd87dd6a4fdd1afa77d270d7564341693 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include "simulation/Elements.h"
//#TPT-Directive ElementClass Element_WTRV PT_WTRV 23
Element_WTRV::Element_WTRV()
{
    Identifier = "DEFAULT_PT_WTRV";
    Name = "WTRV";
    Colour = PIXPACK(0xA0A0FF);
    MenuVisible = 1;
    MenuSection = SC_GAS;
    Enabled = 1;
    
    Advection = 1.0f;
    AirDrag = 0.01f * CFDS;
    AirLoss = 0.99f;
    Loss = 0.30f;
    Collision = -0.1f;
    Gravity = -0.1f;
    Diffusion = 0.75f;
    HotAir = 0.0003f	* CFDS;
    Falldown = 0;
    
    Flammable = 0;
    Explosive = 0;
    Meltable = 0;
    Hardness = 4;
    
    Weight = 1;
    
    Temperature = R_TEMP+100.0f+273.15f;
    HeatConduct = 48;
    Description = "Steam, heats up air, produced from hot water.";
    
    State = ST_GAS;
    Properties = TYPE_GAS;
    
    LowPressure = IPL;
    LowPressureTransition = NT;
    HighPressure = IPH;
    HighPressureTransition = NT;
    LowTemperature = 371.0f;
    LowTemperatureTransition = ST;
    HighTemperature = ITH;
    HighTemperatureTransition = NT;
    
    Update = &Element_WTRV::update;
    
}

//#TPT-Directive ElementHeader Element_WTRV static int update(UPDATE_FUNC_ARGS)
int Element_WTRV::update(UPDATE_FUNC_ARGS)
 {
	int r, rx, ry;
	for (rx=-2; rx<3; rx++)
		for (ry=-2; ry<3; ry++)
			if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
			{
				r = pmap[y+ry][x+rx];
				if (!r)
					continue;
				if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && !sim->legacy_enable && parts[i].temp>(273.15f+12.0f) && !(rand()%500))
				{
					sim->part_change_type(i,x,y,PT_FIRE);
					parts[i].life = 4;
					parts[i].ctype = PT_WATR;
				}
			}
	if(parts[i].temp>1273&&parts[i].ctype==PT_FIRE)
		parts[i].temp-=parts[i].temp/1000;
	return 0;
}


Element_WTRV::~Element_WTRV() {}