Plutonium-241 Script Error

  • Elias2013
    30th March Member 0 Permalink

    Hello I have been trying to create a script about Plutonium-241 but there is an error when executing the script that causes the game to become unresponsive and I had to turn to the Powder Toy community to solve the script I use version 99.3 and I have the Autorun.lua

     

    local pu241 = elements.allocate("PEXP", "P241")

    -- Establecimiento de propiedades del elemento
    elements.element(pu241, elem.element(elem.DEFAULT_PT_TTAN))
    elements.property(pu241, "Name", "P241")
    elements.property(pu241, "Description", "Plutonium-241 is an isotope of plutonium that explodes under certain extreme conditions.")
    elements.property(pu241, "Color", 0xFFB0A050)
    elements.property(pu241, "MenuSection", elem.SC_NUCLEAR)
    elements.property(pu241, "Properties", elem.PROP_NEUTPASS + elem.TYPE_SOLID + elem.PROP_RADIOACTIVE + elem.PROP_CONDUCTS + elem.PROP_LIFE_DEC)
    elements.property(pu241, "HighTemperature", 5000)
    elements.property(pu241, "HighPressure", 255)
    elements.property(pu241, "TickRate", 100) -- 

    -- Función de actualización del Pu-241
    local function pu241Update(i, x, y, s, n)
    local itemp = sim.partProperty(i, "temp")
    local pressure = sim.pressure(x / 4, y / 4)
    local ticks_left = sim.partProperty(i, "life") -- 

    if ticks_left > 0 then
    sim.partProperty(i, "life", ticks_left - 1) -- 
    elseif ticks_left == 0 then

    sim.ambientAirTemp(sim.ambientAirTemp() + 1000) -- 
    sim.partProperty(i, "temp", 10000) --  
    sim.partProperty(i, "life", -1) --

    for _ = 1, 2000 do
    sim.partCreate(-3, x, y, elem.DEFAULT_PT_PROT) --

    end
    for _ = 1, 1200 do
    sim.partCreate(-3, x, y, elem.DEFAULT_PT_NEUT) --
    end

    for dx = -5, 5 do
    for dy = -5, 5 do
    if math.random() < 0.1 then
    sim.partCreate(-3, x + dx, y + dy, elem.DEFAULT_PT_FIRE) -- 

    end
    end
    end
    end
    end


    elements.property(pu241, "Update", pu241Update)

  • LBPHacker
    30th March Developer 0 Permalink
    This does not make the game unresponsive for me, but it can be very laggy. Maybe your computer is just slow. Also, unless I remove the line that attempts to set TickRate, it just generally just doesn't work, because that's not a valid element property.