Added reaction to create PAPR
This commit is contained in:
parent
c0f248c6db
commit
692bb4ec81
@ -1097,7 +1097,7 @@ int Simulation::eval_move(int pt, int nx, int ny, unsigned *rr) const
|
|||||||
case PT_PAPR:
|
case PT_PAPR:
|
||||||
// BCOL can always pass through PAPR in order to color it
|
// BCOL can always pass through PAPR in order to color it
|
||||||
// Most elements are blocked by marked PAPR, except for certified "weird" elements where it's inverse
|
// Most elements are blocked by marked PAPR, except for certified "weird" elements where it's inverse
|
||||||
if ((pt == PT_BCOL) || (parts[ID(r)].life ^ (pt != PT_ANAR && pt != PT_BIZR && pt != PT_BIZRG)))
|
if ((pt == PT_BCOL) || (!parts[ID(r)].life != !(pt != PT_ANAR && pt != PT_BIZR && pt != PT_BIZRG)))
|
||||||
result = 2;
|
result = 2;
|
||||||
else
|
else
|
||||||
result = 0;
|
result = 0;
|
||||||
|
@ -187,7 +187,7 @@ void SimulationData::init_can_move()
|
|||||||
can_move[movingType][PT_SAWD] = 0;
|
can_move[movingType][PT_SAWD] = 0;
|
||||||
|
|
||||||
// Let most non-solids pass through unmarked PAPR
|
// Let most non-solids pass through unmarked PAPR
|
||||||
if (elements[movingType].Properties & (TYPE_GAS | TYPE_PART | TYPE_LIQUID) && (movingType != PT_FIRE && movingType != PT_SMKE))
|
if (elements[movingType].Properties & (TYPE_GAS | TYPE_PART | TYPE_LIQUID) && (movingType != PT_FIRE && movingType != PT_SMKE && movingType != PT_SAWD))
|
||||||
can_move[movingType][PT_PAPR] = 3;
|
can_move[movingType][PT_PAPR] = 3;
|
||||||
}
|
}
|
||||||
//a list of lots of things PHOT can move through
|
//a list of lots of things PHOT can move through
|
||||||
@ -239,6 +239,9 @@ void SimulationData::init_can_move()
|
|||||||
can_move[PT_TRON][PT_SWCH] = 3;
|
can_move[PT_TRON][PT_SWCH] = 3;
|
||||||
can_move[PT_SOAP][PT_OIL] = 0;
|
can_move[PT_SOAP][PT_OIL] = 0;
|
||||||
can_move[PT_OIL][PT_SOAP] = 1;
|
can_move[PT_OIL][PT_SOAP] = 1;
|
||||||
|
|
||||||
|
can_move[PT_MWAX][PT_SAWD] = 0;
|
||||||
|
can_move[PT_SAWD][PT_MWAX] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CustomGOLData *SimulationData::GetCustomGOLByRule(int rule) const
|
const CustomGOLData *SimulationData::GetCustomGOLByRule(int rule) const
|
||||||
|
@ -34,7 +34,7 @@ void Element::Element_PAPR()
|
|||||||
Flammable = 0;
|
Flammable = 0;
|
||||||
Explosive = 0;
|
Explosive = 0;
|
||||||
Meltable = 0;
|
Meltable = 0;
|
||||||
Hardness = 15;
|
Hardness = 60;
|
||||||
|
|
||||||
Weight = 100;
|
Weight = 100;
|
||||||
|
|
||||||
@ -85,6 +85,12 @@ static int update(UPDATE_FUNC_ARGS)
|
|||||||
parts[i].dcolour = 0xFF22222A;
|
parts[i].dcolour = 0xFF22222A;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Doesn't guarantee layering won't happen, but makes it far less likely
|
||||||
|
if (TYP(pmap[y][x]) == PT_SAWD)
|
||||||
|
{
|
||||||
|
parts[ID(pmap[y][x])].tmp = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Generally, these should correspond, but correct if they don't.
|
// Generally, these should correspond, but correct if they don't.
|
||||||
if (!parts[i].life != !parts[i].dcolour)
|
if (!parts[i].life != !parts[i].dcolour)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "simulation/ElementCommon.h"
|
#include "simulation/ElementCommon.h"
|
||||||
|
|
||||||
|
static int update(UPDATE_FUNC_ARGS);
|
||||||
|
|
||||||
void Element::Element_SAWD()
|
void Element::Element_SAWD()
|
||||||
{
|
{
|
||||||
Identifier = "DEFAULT_PT_SAWD";
|
Identifier = "DEFAULT_PT_SAWD";
|
||||||
@ -40,5 +42,48 @@ void Element::Element_SAWD()
|
|||||||
HighTemperature = ITH;
|
HighTemperature = ITH;
|
||||||
HighTemperatureTransition = NT;
|
HighTemperatureTransition = NT;
|
||||||
|
|
||||||
|
Update = &update;
|
||||||
Graphics = NULL; // is this needed?
|
Graphics = NULL; // is this needed?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int update(UPDATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
int nearbyWax = 0;
|
||||||
|
for (auto rx = -3; rx <= 3; rx++)
|
||||||
|
{
|
||||||
|
for (auto ry = -3; ry <= 3; ry++)
|
||||||
|
{
|
||||||
|
if (rx || ry)
|
||||||
|
{
|
||||||
|
auto r = pmap[y+ry][x+rx];
|
||||||
|
if (!r)
|
||||||
|
continue;
|
||||||
|
if (TYP(r) == PT_MWAX)
|
||||||
|
{
|
||||||
|
nearbyWax++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
parts[i].tmp += nearbyWax / 2;
|
||||||
|
if (parts[i].tmp > 100)
|
||||||
|
{
|
||||||
|
int rx = sim->rng.between(-2, 2);
|
||||||
|
int ry = sim->rng.between(-2, 2);
|
||||||
|
int p = pmap[y+ry][x+rx];
|
||||||
|
if (p && TYP(p) == PT_MWAX)
|
||||||
|
{
|
||||||
|
sim->create_part(i, x, y, PT_PAPR);
|
||||||
|
sim->kill_part(ID(p));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (parts[i].tmp > 0)
|
||||||
|
{
|
||||||
|
parts[i].vx = 0;
|
||||||
|
parts[i].vy = 0;
|
||||||
|
parts[i].tmp--;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
Reference in New Issue
Block a user