what do you think about the thing below?
--backrooms elements
--neon water
local ne = elem.allocate("ORESPAWNTPT", "NENW")
elem.element(elem.ne, elem.element(elem.DEFAULT_PT_PSTE))
elem.property(elem.ne, "Name", "NENW")
elem.property(elem.ne, "Description", "Neon water. Very healthy.")
elem.property(elem.ne, "Colour", 0xFF6AD1FD)
elem.property(elem.ne, "MenuVisible", 1)
elem.property(elem.ne, "MenuSection", elem.SC_LIQUID)
elem.property(elem.ne, "Properties", elem.TYPE_LIQUID + elem.PROP_NEUTABSORB)
--almond water
local = elem.allocate("ORESPAWNTPT", "ALMW")
elem.element(elem.a, elem.element(elem.DEFAULT_PT_PSTE))
elem.property(elem.a, "Name", "ALMW")
elem.property(elem.a, "Description", "Almond water. Healthy.")
elem.property(elem.a, "Colour", 0xFFFDEFD9)
elem.property(elem.a, "MenuVisible", 1)
elem.property(elem.a, "MenuSection", elem.SC_LIQUID)
elem.property(elem.a, "Properties", elem.TYPE_LIQUID + elem.PROP_NEUTABSORB)
--liquid pain
local = elem.allocate("ORESPAWNTPT", "LQPN")
elem.element(elem.l, elem.element(elem.DEFAULT_PT_MERC))
elem.property(elem.l, "Name", "LQPN")
elem.property(elem.l, "Description", "Liquid pain. Aggressive towards organics")
elem.property(elem.l, "Colour", 0xFFA73319)
elem.property(elem.l, "MenuVisible", 1)
elem.property(elem.l, "MenuSection", elem.SC_LIQIUD)
elem.property(elem.l, "Properties", elem.TYPE_LIQUID +)
--reactions+graphics
--neon water glowing
local function Graphics(i, colr, colg, colb)
return 1,ren.PMODE_GLOW+PMODE_FLARE+FIRE_BLEND,0,colr,colg,colb,0,106,209,253
end
tpt.element_func(Update,ne)
elements.property(ne, "Graphics", Graphics)
--neon water heals stickman
elem.property(elem.DEFAULT_PT_STKM, "Update", function(index, x, y, surround_space, nt)
local neighbors = sim.neighbors(x, y, 1, 1)
for n in neighbors do
if sim.partProperty(n, "type") == elem.ne then
local life = sim.partProperty(i, life)
sim.partProperty = life+10
sim.partKill(n)
end
end
end
return
end)
--almond water heals stickman
elem.property(elem.DEFAULT_PT_STKM, "Update", function(index, x, y, surround_space, nt)
local neighbors = sim.neighbors(x, y, 1, 1)
for n in neighbors do
if sim.partProperty(n, "type") == elem.a then
local life = sim.partProperty(i, life)
if life < 100 then
sim.partProperty = life+10
sim.partKill(n)
end
end
end
end
return
end)
--liquid pain reactions
elem.property(A, "Update", function(i, x, y, s, n)
if s ~= n then
r = sim.partID(x + math.random(-1, 1), y + math.random(-1, 1))
if r ~= nil then
local rt = sim.partProperty(r, "type")
local reaction = reactions[rt]
if reaction then
reaction(i, r)
end
end
end
end)
local reactions = {
[elem.DEFAULT_PT_PLNT] = function(i, r)
sim.partKill(r)
end,
[elem.DEFAULT_PT_WOOD] = function(i, r)
sim.partChangeType(r, elem.DEFAULT_PT_CLST)
end,
[elem.DEFAULT_PT_SAWD] = function(i, r)
sim.partChangeType(r, elem.DEFAULT_PT_CLST)
sim.partKill(i)
end,
[elem.DEFAULT_PT_COAL] = function(i, r)
sim.partChangeType(r, elem.DEFAULT_PT_GLAS)
end,
[elem.DEFAULT_PT_BCOL] = function(i, r)
sim.partChangeType(r, elem.DEFAULT_PT_BGLA)
end,
[elem.DEFAULT_PT_YEST] = function(i, r)
sim.partChangeType(r, elem.DEFAULT_PT_DUST)
end,
[elem.DEFAULT_PT_GEL] = function(i, r)
sim.partChangeType(r, elem.DEFAULT_PT_ACID)
sim.partProperty(r, "life", 1000)
sim.partKill(i)
end,
[elem.DEFAULT_PT_WAX] = function(i, r)
sim.partChangeType(r, elem.DEFAULT_PT_DESL)
end,
[elem.DEFAULT_PT_MWAX] = function(i, r)
sim.partChangeType(r, elem.DEFAULT_PT_DESL)
end,
}
I'd write the sitckman update function like this:
--neon water heals stickman local stickman_props = elem.element(elem.DEFAULT_PT_STKM) stickman_props["Update"] = function(index, x, y, surround_space, nt) for neighbor in sim.neighbors(x, y, 1, 1, elem.ne) do sim.partProperty(index, sim.FIELD_LIFE, sim.partProperty(index, sim.FIELD_LIFE) + 10) sim.partKill(neighbor) end end elem.element(elem.DEFAULT_PT_STKM, stickman_props)
I personally would implement this in the neon water update function because stickman can only have a single update function.