Starter Fluid

  • FeynmanLogomaker
    22nd Sep 2013 Member 1 Permalink

    local element1 = elements.allocate("FLEL", "STFL")
    elements.element(elements.FLEL_PT_STFL, elements.element(elements.DEFAULT_PT_BCOL))
    elements.property(elements.FLEL_PT_STFL, "Name", "STFL")
    elements.property(elements.FLEL_PT_STFL, "Description", "Starter Fluid - Long-burning liquid, good for starting fires.")
    elements.property(elements.FLEL_PT_STFL, "Colour", 0xFFC090)
    elements.property(elements.FLEL_PT_STFL, "MenuSection", 5)
    elements.property(elements.FLEL_PT_STFL, "Gravity", .5)
    elements.property(elements.FLEL_PT_STFL, "Flammable", 0)
    elements.property(elements.FLEL_PT_STFL, "Explosive", 0)
    elements.property(elements.FLEL_PT_STFL, "Loss", 1)
    elements.property(elements.FLEL_PT_STFL, "AirLoss", .5)
    elements.property(elements.FLEL_PT_STFL, "AirDrag", .01)
    elements.property(elements.FLEL_PT_STFL, "Advection", .01)
    elements.property(elements.FLEL_PT_STFL, "Weight", 30)
    elements.property(elements.FLEL_PT_STFL, "Diffusion", 0)
    elements.property(elements.FLEL_PT_STFL, "Falldown", 2)

    STFLUpdate = function(i, x, y, s, n)
    local clife = tpt.get_property('life', x, y)
    if clife > 1 then
    for cx = -1, 1, 2 do
    for cy = -1, 1, 2 do
    tpt.create(x + cx, y + cy, 'plsm')
    end
    end
    tpt.set_property('life', clife - 1, x, y)
    elseif clife == 1 then
    tpt.set_property('type', 0, x, y)
    elseif tpt.get_property('temp', x, y) >= 1273.15 then
    tpt.set_property('life', 100, x, y)
    elseif s > 0 then
    for cx = -1, 1, 2 do
    for cy = -1, 1, 2 do
    if tpt.get_property('type', x + cx, y + cy) == 4 or tpt.get_property('type', x + cx, y + cy) == 49 then
    tpt.set_property('life', 100, x, y)
    return true
    end
    end
    end
    end
    end

    tpt.element_func(STFLUpdate, tpt.element('STFL'))

     

    This script creates STFL: Starter Fluid. It can catch fire on contact with FIRE or PLSM, or by being heated past 1000 degrees. Once it catches fire, it will burn for 100 frames, using a method similar to BCOL.

     

    It's meant as lighter fluid, but of course it is good for bombs too :)
    Edited 2 times by FeynmanLogomaker. Last: 21st Sep 2013
  • fireball5000
    22nd Sep 2013 Member 0 Permalink

    Lol that's a fun element! If it was a powder it would be like a more realistic Thermite.

  • Dingolo
    22nd Sep 2013 Member 0 Permalink
    @fireball5000 (View Post)
    You can make it a powder easily by changing the falldown value.
  • Nobody905
    25th Sep 2013 Member 0 Permalink

    I used that function as a model for making my black powder explode with lots of smoke. Nice.

     

    EDIT: I can't just make multiple properties work. How?

    Edited 2 times by Nobody905. Last: 24th Sep 2013
  • FeynmanLogomaker
    25th Sep 2013 Member 0 Permalink

    Which 'multiple properties' are you trying to use, and how?

     

    Maybe could you post your code here? I could try to debug it...

  • Nobody905
    27th Sep 2013 Member 0 Permalink

    @FeynmanLogomaker (View Post)

     I'm trying to use PROP_NEUTABSORB.

     It just doesn't work.

  • FeynmanLogomaker
    27th Sep 2013 Member 0 Permalink

    Ah, I don't really know much about those. :/

  • jacob1
    27th Sep 2013 Developer 0 Permalink
    @Nobody905 (View Post)
    elem.property(elem.SOMETHING, "Properties", elem.PROP_NEUTABSORB+elem.OTHER_PROPERTY+elem.ANOTHER_PROPERTY)

    you could also use bit.or, but this is easier
  • Nobody905
    27th Sep 2013 Member 0 Permalink

    @jacob1 (View Post)

     Oh thanks, didn't know about the elem. part

    EDIT: Will there be a property for the materials to absorb PROT too? I want to make lead and it should block all radiation.

    Edited once by Nobody905. Last: 27th Sep 2013
  • jacob1
    27th Sep 2013 Developer 0 Permalink
    I don't think there is, you might have to just look around your current particle and check whether there is a PROT near or on top of your particle. PROT goes through everything so I probably won't add a property to stop that.

    Also elem is just a shortcut for element, most api's have shortcuts (sim, gfx, ren)