Make an advanced powder toy lua mod that adds a single pythonic particle that acts like…
- User
Make an advanced powder toy lua mod that adds a single pythonic particle that acts like a solid, it's really durable and has uni-frame, and subframe regeneration. It'll have an interesting special property that'll expand inwards when a frame of itself is damaged.
Reference Script (REFERENCE ONLY):
codelocal antidest = elements.allocate("antidestruct", "anti") elements.element(antidest, elements.element(elements.DEFAULT_PT_LIFE)) elements.property(antidest, "Name", "ANCL") elements.property(antidest, "Description", "Anti-destructive self-repairing cell. Regenerates quickly and slowly populates.") elements.property(antidest, "Colour", 0x00FF00) elements.property(antidest, "MenuSection", elem.SC_LIFE) elements.property(antidest, "Properties", elem.TYPE_SOLID + elem.PROP_LIFE) local function update(i, x, y, s, nt) -- Ultra-fast self-repair sim.partProperty(i, "life", math.min(sim.partProperty(i, "life") + 5, 100)) -- Regenerates faster -- Repair damaged particles around it quickly for rx = -1, 1 do for ry = -1, 1 do local r = sim.pmap(x + rx, y + ry) if r then local rtype = sim.partProperty(r, "type") if rtype == antidest then sim.partProperty(r, "life", math.min(sim.partProperty(r, "life") + 5, 100)) -- Heal neighbors faster end end end end -- Immune to destruction and bombs: neutralize nearby destructive elements instantly for rx = -2, 2 do for ry = -2, 2 do local r = sim.pmap(x + rx, y + ry) if r then local rtype = sim.partProperty(r, "type") if rtype == elem.DEFAULT_PT_DEST or rtype == elem.DEFAULT_PT_BOMB or rtype == elem.DEFAULT_PT_FIRE or rtype == elem.DEFAULT_PT_AMTR or rtype == elem.DEFAULT_PT_THDR or rtype == elem.DEFAULT_PT_SING or rtype == elem.DEFAULT_PT_SRAD or rtype == elem.DEFAULT_PT_SMDB then sim.partKill(r) -- Completely destroy nearby harmful particles end end end end -- Slow population growth if math.random() < 0.01 then local nx, ny = x + math.random(-1, 1), y + math.random(-1, 1) if not sim.pmap(nx, ny) then sim.partCreate(-1, nx, ny, antidest) end end -- Resist pressure and temperature changes sim.pressure(x / 4, y / 4, (sim.pressure(x / 4, y / 4) + 1) / 2) sim.partProperty(i, "temp", 295.15) -- Maintain room temperature end elements.property(antidest, "Update", update) - Assistant