Help making "plastic" element

  • NDR149
    15th Sep 2016 Member 0 Permalink

    @TPT_PL (View Post)

    I'm helping this guy with his code now. I understand the point of dividing the x and y by 4, and I guess the 0 is the new pressure value, so what are those 3's for?

    Edit: Figured it out, and fixed the element. The method is ugly, but it works fine.

    Re-edit: Nevermind, pressure just clip through it to the other side. Uuuggghhh

    Edited 2 times by NDR149. Last: 15th Sep 2016
  • edr-01
    15th Sep 2016 Member 0 Permalink

    @TPT_PL (View Post)

     

    Hmm, doesn't work either...

    local plst = elements.allocate("MOD", "PLST")
    elements.element(elements.MOD_PT_PLST, elements.element(elements.DEFAULT_PT_WAX))
    elements.property(elements.MOD_PT_PLST, "Name", "PLST")
    elements.property(elements.MOD_PT_PLST, "Description", "Plastic, blocks electricity and air pressure . Lower melting point than most materials.")
    elements.property(elements.MOD_PT_PLST, "Colour", 0x768d96)
    elements.property(elements.MOD_PT_PLST, "Loss", 0)
    elements.property(elements.MOD_PT_PLST, "Weight", 100)
    elements.property(elements.MOD_PT_PLST, "Meltable", 1)
    elements.property(elements.MOD_PT_PLST, "Flammable", 0)
    elements.property(elements.MOD_PT_PLST, "Hardness", 65)
    elements.property(elements.MOD_PT_PLST, "HighTemperature", 973.15)
    elements.property(elements.MOD_PT_PLST, "HighTemperatureTransition", elements.DEFAULT_PT_LAVA)
    elements.property(elements.MOD_PT_PLST, "Properties", TYPE_SOLID)
    elements.property(elements.MOD_PT_PLST, "MenuSection", SC_SOLIDS)
    function PLST_Update(i, x, y, ss, nt)
    -- i: particle index
    -- x, y: particle x, y coords
    sim.pressure((x-1)/4, (y-1)/4, 0, 3, 3)
    end
    elements.property(plst, "Update", PLST_Update)

     

    Edit: I changed the update parameters:

    sim.pressure((x-1)/4, (y-1)/4, 3, 3, 3)

    When I use this, the Plastic keeps a constant pressure of 3, when I change it 0, doesn't keep the pressure in 0.

     

    Edited once by edr-01. Last: 15th Sep 2016