Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "simulation/Elements.h"
- #include "varpmap.h"
- //#TPT-Directive ElementClass Element_ASPK PT_ASPK 178
- Element_ASPK::Element_ASPK()
- {
- Identifier = "DEFAULT_PT_ASPK";
- Name = "ASPK";
- Colour = PIXPACK(0x5cb8ff);
- MenuVisible = 1;
- MenuSection = SC_ELEC;
- Enabled = 1;
- Advection = 0.4f;
- AirDrag = 0.04f * CFDS;
- AirLoss = 0.94f;
- Loss = 0.95f;
- Collision = -0.1f;
- Gravity = 0.18f;
- Diffusion = 0.00f;
- HotAir = 0.000f * CFDS;
- Falldown = 1;
- Flammable = 0;
- Explosive = 0;
- Meltable = 2;
- Hardness = 2;
- Weight = 90;
- Temperature = R_TEMP+0.0f +273.15f;
- HeatConduct = 211;
- Description = "Anti-spark. Inhibits conductors on contact.";
- State = ST_SOLID;
- Properties = TYPE_PART|PROP_LIFE_DEC;
- LowPressure = IPL;
- LowPressureTransition = NT;
- HighPressure = IPH;
- HighPressureTransition = NT;
- LowTemperature = ITL;
- LowTemperatureTransition = NT;
- HighTemperature = ITH;
- HighTemperatureTransition = NT;
- Update = &Element_ASPK::update;
- }
- //#TPT-Directive ElementHeader Element_ASPK static int update(UPDATE_FUNC_ARGS)
- int Element_ASPK::update(UPDATE_FUNC_ARGS)
- {
- int r, rx, ry, rt, a, a1, b, b1;
- a = xpmap(parts[i].tmp);
- b = xmax();
- a1 = ypmap(parts[i].tmp2, parts[i].ctype);
- b1 = ymax();
- for (rx=a; rx<b; rx++)
- for (ry=a1; ry<b1; ry++)
- if (BOUNDS_CHECK)
- {
- r = sim->photons[y+ry][x+rx];
- if (!r)
- r = pmap[y+ry][x+rx];
- if (!r)
- continue;
- if(parts[i].tmp<=0) parts[i].tmp = 1;
- if((r&0xFF)==PT_SPRK)
- {
- sim->part_change_type(r>>8, x+rx, y+ry, parts[r>>8].ctype);
- }
- if((r&0xFF)==PT_INST && parts[r>>8].life < 4)
- {
- parts[r>>8].life=4;
- }
- if((r&0xFF)==PT_FELE) sim->kill_part(r>>8);
- if((r&0xFF)==PT_WIRE && parts[r>>8].ctype!=PT_NONE)
- {
- parts[r>>8].ctype = PT_NONE;
- }
- if(a||b||a1||b1 == 0)
- {
- std::cout << "System Malfunction. Computational Error in varpmap header. Self-terminate.\n";
- system("pause");
- sim->kill_part(i);
- return 1;
- }
- }
- return(0);
- }
- Element_ASPK::~Element_ASPK() {}
Advertisement
Add Comment
Please, Sign In to add comment