1 #include "simulation/ElementCommon.h" 2 3 static int update(UPDATE_FUNC_ARGS); 4 Element_FOG()5void Element::Element_FOG() 6 { 7 Identifier = "DEFAULT_PT_FOG"; 8 Name = "FOG"; 9 Colour = PIXPACK(0xAAAAAA); 10 MenuVisible = 1; 11 MenuSection = SC_GAS; 12 Enabled = 1; 13 14 Advection = 0.8f; 15 AirDrag = 0.00f * CFDS; 16 AirLoss = 0.4f; 17 Loss = 0.70f; 18 Collision = -0.1f; 19 Gravity = 0.0f; 20 Diffusion = 0.99f; 21 HotAir = 0.000f * CFDS; 22 Falldown = 0; 23 24 Flammable = 0; 25 Explosive = 0; 26 Meltable = 0; 27 Hardness = 30; 28 29 Weight = 1; 30 31 DefaultProperties.temp = 243.15f; 32 HeatConduct = 100; 33 Description = "Fog, created when an electric current is passed through RIME."; 34 35 Properties = TYPE_GAS|PROP_LIFE_DEC; 36 37 LowPressure = IPL; 38 LowPressureTransition = NT; 39 HighPressure = IPH; 40 HighPressureTransition = NT; 41 LowTemperature = ITL; 42 LowTemperatureTransition = NT; 43 HighTemperature = 373.15f; 44 HighTemperatureTransition = PT_WTRV; 45 46 Update = &update; 47 } 48 update(UPDATE_FUNC_ARGS)49static int update(UPDATE_FUNC_ARGS) 50 { 51 int r, rx, ry; 52 for (rx=-1; rx<2; rx++) 53 for (ry=-1; ry<2; ry++) 54 if (BOUNDS_CHECK && (rx || ry)) 55 { 56 r = pmap[y+ry][x+rx]; 57 if (!r) 58 continue; 59 if ((sim->elements[TYP(r)].Properties&TYPE_SOLID) && RNG::Ref().chance(1, 10) && parts[i].life==0 && !(TYP(r)==PT_CLNE || TYP(r)==PT_PCLN)) // TODO: should this also exclude BCLN? 60 { 61 sim->part_change_type(i,x,y,PT_RIME); 62 } 63 if (TYP(r)==PT_SPRK) 64 { 65 parts[i].life += RNG::Ref().between(0, 19); 66 } 67 } 68 return 0; 69 } 70