1 #include "simulation/ElementCommon.h" 2 3 static int update(UPDATE_FUNC_ARGS); 4 Element_BTRY()5void Element::Element_BTRY() 6 { 7 Identifier = "DEFAULT_PT_BTRY"; 8 Name = "BTRY"; 9 Colour = PIXPACK(0x858505); 10 MenuVisible = 1; 11 MenuSection = SC_ELEC; 12 Enabled = 1; 13 14 Advection = 0.0f; 15 AirDrag = 0.00f * CFDS; 16 AirLoss = 0.90f; 17 Loss = 0.00f; 18 Collision = 0.0f; 19 Gravity = 0.0f; 20 Diffusion = 0.00f; 21 HotAir = 0.000f * CFDS; 22 Falldown = 0; 23 24 Flammable = 0; 25 Explosive = 0; 26 Meltable = 0; 27 Hardness = 1; 28 29 Weight = 100; 30 31 HeatConduct = 251; 32 Description = "Battery. Generates infinite electricity."; 33 34 Properties = TYPE_SOLID; 35 36 LowPressure = IPL; 37 LowPressureTransition = NT; 38 HighPressure = IPH; 39 HighPressureTransition = NT; 40 LowTemperature = ITL; 41 LowTemperatureTransition = NT; 42 HighTemperature = 2273.0f; 43 HighTemperatureTransition = PT_PLSM; 44 45 Update = &update; 46 } 47 update(UPDATE_FUNC_ARGS)48static int update(UPDATE_FUNC_ARGS) 49 { 50 int r, rx, ry, rt; 51 for (rx=-2; rx<3; rx++) 52 for (ry=-2; ry<3; ry++) 53 if (BOUNDS_CHECK && (rx || ry) && abs(rx)+abs(ry)<4) 54 { 55 r = pmap[y+ry][x+rx]; 56 if (!r) 57 continue; 58 rt = TYP(r); 59 if (sim->parts_avg(i,ID(r),PT_INSL) != PT_INSL) 60 { 61 if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[ID(r)].life==0) 62 { 63 parts[ID(r)].life = 4; 64 parts[ID(r)].ctype = rt; 65 sim->part_change_type(ID(r),x+rx,y+ry,PT_SPRK); 66 } 67 } 68 } 69 return 0; 70 } 71