LITH explodes when overcharged, update charge graphics
This commit is contained in:
parent
cea629c6c0
commit
943f9d6c03
@ -168,8 +168,9 @@ static int update(UPDATE_FUNC_ARGS)
|
|||||||
sim->part_change_type(i, x, y, PT_PLSM);
|
sim->part_change_type(i, x, y, PT_PLSM);
|
||||||
sim->part_change_type(ID(neighborData), x + rx, y + ry, PT_PLSM);
|
sim->part_change_type(ID(neighborData), x + rx, y + ry, PT_PLSM);
|
||||||
sim->pv[y / CELL][x / CELL] += 4.0;
|
sim->pv[y / CELL][x / CELL] += 4.0;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,6 +200,9 @@ static int update(UPDATE_FUNC_ARGS)
|
|||||||
Particle &neighbor = parts[ID(neighborData)];
|
Particle &neighbor = parts[ID(neighborData)];
|
||||||
|
|
||||||
int &neighborStoredEnergy = neighbor.ctype;
|
int &neighborStoredEnergy = neighbor.ctype;
|
||||||
|
// Transfer overcharge explosion status to nearby LITH
|
||||||
|
if (burnTimer < 1000 && storedEnergy > 90 && neighbor.life > 1000)
|
||||||
|
burnTimer = 1024;
|
||||||
if (storedEnergy > neighborStoredEnergy)
|
if (storedEnergy > neighborStoredEnergy)
|
||||||
{
|
{
|
||||||
int transfer = storedEnergy - neighborStoredEnergy;
|
int transfer = storedEnergy - neighborStoredEnergy;
|
||||||
@ -209,17 +213,22 @@ static int update(UPDATE_FUNC_ARGS)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Overcharged - begin explosion
|
||||||
|
if (burnTimer < 1000 && storedEnergy >= 100)
|
||||||
|
burnTimer = 1024;
|
||||||
if (burnTimer == 1000)
|
if (burnTimer == 1000)
|
||||||
{
|
{
|
||||||
|
burnTimer = 0;
|
||||||
sim->part_change_type(i, x, y, PT_LAVA);
|
sim->part_change_type(i, x, y, PT_LAVA);
|
||||||
if (carbonationFactor < 3)
|
if (carbonationFactor < 3)
|
||||||
{
|
{
|
||||||
self.temp = 500.f;
|
self.temp = 500.f + storedEnergy * 10;
|
||||||
self.ctype = PT_LITH;
|
self.ctype = PT_LITH;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
self.temp = 2000.f;
|
self.temp = 2000.f + storedEnergy * 10;
|
||||||
self.ctype = PT_GLAS;
|
self.ctype = PT_GLAS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,6 +237,7 @@ static int update(UPDATE_FUNC_ARGS)
|
|||||||
|
|
||||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||||
{
|
{
|
||||||
|
// Exploding lith
|
||||||
if (cpart->life >= 1000)
|
if (cpart->life >= 1000)
|
||||||
{
|
{
|
||||||
int colour = 0xFFA040;
|
int colour = 0xFFA040;
|
||||||
@ -236,12 +246,13 @@ static int graphics(GRAPHICS_FUNC_ARGS)
|
|||||||
*colb = PIXB(colour);
|
*colb = PIXB(colour);
|
||||||
*pixel_mode |= PMODE_FLARE | PMODE_GLOW;
|
*pixel_mode |= PMODE_FLARE | PMODE_GLOW;
|
||||||
}
|
}
|
||||||
else if (cpart->ctype && RNG::Ref().chance(cpart->ctype, 100))
|
// Charged lith
|
||||||
|
else if (cpart->ctype > 0)
|
||||||
{
|
{
|
||||||
int colour = 0x50A0FF;
|
int mult = RNG::Ref().between(cpart->ctype / 3, cpart->ctype) / 15;
|
||||||
*colr = PIXR(colour);
|
mult = std::min(6, mult);
|
||||||
*colg = PIXG(colour);
|
*colr -= 30 * mult;
|
||||||
*colb = PIXB(colour);
|
*colb += 20 * mult;
|
||||||
*pixel_mode |= PMODE_FLARE | PMODE_GLOW;
|
*pixel_mode |= PMODE_FLARE | PMODE_GLOW;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user