how can I prevent wood from only burning

  • zBuilder
    8th Mar 2014 Member 0 Permalink

    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

  • jenn4
    8th Mar 2014 Member 0 Permalink
    I would detect fire particles and replace them with itself, and then cool itself down below the burning temperature.
  • zBuilder
    8th Mar 2014 Member 0 Permalink

    jenn4:

    I would detect fire particles and replace them with itself, and then cool itself down below the burning temperature.

     

    does the partneighbors method translate well to C or is there a different method for finding nearby particles?

  • jenn4
    8th Mar 2014 Member 0 Permalink
    @zBuilder (View Post)
    I - myself - don't know how to code that, but there is something on the coding tutorial, but I'm not sure if the tutorial has been rewritten for TPT++. Anyways, you should be able to do this in a somewhat simple way, and someone with more knowledge on coding for TPT can help you whenever they get active/wake up.
  • xetalim
    8th Mar 2014 Member 1 Permalink

    Well you can always use this:

    http://boxmein.x10.mx/tptelements/#cpp

  • boxmein
    8th Mar 2014 Former Staff 0 Permalink

    @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

    Edited 5 times by boxmein, jacksonmj. Last: 8th Mar 2014
  • jacksonmj
    8th Mar 2014 Developer 1 Permalink

    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

  • zBuilder
    8th Mar 2014 Member 0 Permalink

    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?

    Edited once by zBuilder. Last: 8th Mar 2014
  • jacksonmj
    8th Mar 2014 Developer 0 Permalink

    @zBuilder (View Post)

    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.

    Edited 2 times by jacksonmj. Last: 8th Mar 2014
  • zBuilder
    8th Mar 2014 Member 0 Permalink

    is there a flag I can use to make it stop generating the legacy version?