I want to know if it is possible for wood to stop only burning- I want to add an element that gets created whilst burning but while it works for temperature transition, it doesn't seem to detect when it's on fire as well(fire state calculated before heat?) is there a way I can cause an element to know when it's on fire and make decions before applying the burning action?
using C++ with v89.2 source
Well you can always use this:
@zBuilder (View Post)
In C/++ you have to loop over neighboring
pmap[y][x]
entries. int rx, ry, r;
for (rx = -1; rx <= 1; rx++) {
for (ry = -1; ry <= 1; ry++) {
r = pmap[y+ry][x+rx];
if (!r)
continue;
// rx, ry can be added to x,y to get absolute coordinates of placement
// pmap values are here
if ((r&0xFF) == PT_WATR) {
// do stuff
}
}
}
Edited by jacksonmj: brackets added around r&0xFF
The bit of the source code you're looking for is probably Element_FIRE::update in src/simulation/elements/FIRE.cpp. This is used by several elements (FIRE, LAVA, PLSM, PHOT, SPRK) to set nearby particles on fire.
https://github.com/simtr/The-Powder-Toy/blob/v89.2.281/src/simulation/elements/FIRE.cpp#L134-L147
jacksonmj:
The bit of the source code you're looking for is probably Element_FIRE::update in src/simulation/elements/FIRE.cpp. This is used by several elements (FIRE, LAVA, PLSM, PHOT, SPRK) to set nearby particles on fire.
https://github.com/simtr/The-Powder-Toy/blob/v89.2.281/src/simulation/elements/FIRE.cpp#L134-L147
so theoretically I could edit Fire instead and choose specific actions to elements, instead of trying to get the element it's self to respond?
edit: it also always makes an executable titled "powder legacy"- does this work differently from the regular TPT?
Yes, because fire is the thing that applies the burning action to nearby flammable elements. The flammable element itself doesn't do anything in response to nearby fire.
There are no important differences between the powder-legacy and powder executables, powder-legacy will run a bit slower but will work on older computers where powder doesn't work.