mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-07-31 05:30:23 +02:00
jacksonmj: Move EMP triggering into SPRK_update 6ae719deb70d
This commit is contained in:
@@ -43,7 +43,7 @@ Element_EMP::Element_EMP()
|
|||||||
HighTemperature = ITH;
|
HighTemperature = ITH;
|
||||||
HighTemperatureTransition = NT;
|
HighTemperatureTransition = NT;
|
||||||
|
|
||||||
Update = &Element_EMP::update;
|
Update = NULL;
|
||||||
Graphics = &Element_EMP::graphics;
|
Graphics = &Element_EMP::graphics;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,31 +71,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_EMP static int update(UPDATE_FUNC_ARGS)
|
|
||||||
int Element_EMP::update(UPDATE_FUNC_ARGS)
|
|
||||||
{
|
|
||||||
if (parts[i].life)
|
|
||||||
return 0;
|
|
||||||
for (int rx =- 2; rx <= 2; rx++)
|
|
||||||
for (int ry = -2; ry <= 2; ry++)
|
|
||||||
if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
|
||||||
{
|
|
||||||
int r = pmap[y+ry][x+rx];
|
|
||||||
if (!r)
|
|
||||||
continue;
|
|
||||||
if ((r&0xFF)==PT_SPRK && parts[r>>8].life > 0 && parts[r>>8].life < 4)
|
|
||||||
{
|
|
||||||
sim->emp_trigger_count++;
|
|
||||||
sim->emp_decor += 3;
|
|
||||||
if (sim->emp_decor > 40)
|
|
||||||
sim->emp_decor = 40;
|
|
||||||
parts[i].life = 220;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//#TPT-Directive ElementHeader Element_EMP static int Trigger(Simulation *sim, int triggerCount)
|
//#TPT-Directive ElementHeader Element_EMP static int Trigger(Simulation *sim, int triggerCount)
|
||||||
int Element_EMP::Trigger(Simulation *sim, int triggerCount)
|
int Element_EMP::Trigger(Simulation *sim, int triggerCount)
|
||||||
{
|
{
|
||||||
|
@@ -239,6 +239,15 @@ int Element_SPRK::update(UPDATE_FUNC_ARGS)
|
|||||||
if (receiver==PT_NTCT||receiver==PT_PTCT)
|
if (receiver==PT_NTCT||receiver==PT_PTCT)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
case PT_EMP:
|
||||||
|
if (!parts[r>>8].life && parts[i].life > 0 && parts[i].life < 4)
|
||||||
|
{
|
||||||
|
sim->emp_trigger_count++;
|
||||||
|
sim->emp_decor += 3;
|
||||||
|
if (sim->emp_decor > 40)
|
||||||
|
sim->emp_decor = 40;
|
||||||
|
parts[r>>8].life = 220;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user