1 #include "simulation/ElementCommon.h" 2 3 static int update(UPDATE_FUNC_ARGS); 4 static int graphics(GRAPHICS_FUNC_ARGS); 5 Element_PVOD()6void Element::Element_PVOD() 7 { 8 Identifier = "DEFAULT_PT_PVOD"; 9 Name = "PVOD"; 10 Colour = PIXPACK(0x792020); 11 MenuVisible = 1; 12 MenuSection = SC_POWERED; 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 = 1; 29 30 Weight = 100; 31 32 HeatConduct = 251; 33 Description = "Powered VOID. When activated, destroys entering particles."; 34 35 Properties = TYPE_SOLID; 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)50static int update(UPDATE_FUNC_ARGS) 51 { 52 int r, rx, ry; 53 if (parts[i].life>0 && parts[i].life!=10) 54 parts[i].life--; 55 for (rx=-2; rx<3; rx++) 56 for (ry=-2; ry<3; ry++) 57 if (BOUNDS_CHECK && (rx || ry)) 58 { 59 r = pmap[y+ry][x+rx]; 60 if (!r) 61 continue; 62 if (TYP(r)==PT_SPRK) 63 { 64 if (parts[ID(r)].life>0 && parts[ID(r)].life<4) 65 { 66 if (parts[ID(r)].ctype==PT_PSCN) 67 parts[i].life = 10; 68 else if (parts[ID(r)].ctype==PT_NSCN) 69 parts[i].life = 9; 70 } 71 } 72 else if (TYP(r)==PT_PVOD) 73 { 74 if (parts[i].life==10&&parts[ID(r)].life<10&&parts[ID(r)].life>0) 75 parts[i].life = 9; 76 else if (parts[i].life==0&&parts[ID(r)].life==10) 77 parts[i].life = 10; 78 } 79 } 80 return 0; 81 } 82 graphics(GRAPHICS_FUNC_ARGS)83static int graphics(GRAPHICS_FUNC_ARGS) 84 { 85 int lifemod = ((cpart->life>10?10:cpart->life)*16); 86 *colr += lifemod; 87 return 0; 88 } 89