Its a bomb that makes fusion when it explodes (Warning: This will break any saves that uses thdr)
Use in enclosed spaces!
local thunder = elements.allocate("NOBODY", "B")
elements.element(elements.NOBODY_PT_B, elements.element(elements.DEFAULT_PT_BCOL))
elements.property(elements.NOBODY_PT_B, "Name", "NFUS")
elements.property(elements.NOBODY_PT_B, "Description", "Creates Nuclear Fusion.")
elements.property(elements.NOBODY_PT_B, "Colour", 0xFFB9FEF7)
elements.property(elements.NOBODY_PT_B, "MenuSection", 5)
elements.property(elements.NOBODY_PT_B, "Gravity", 0)
elements.property(elements.NOBODY_PT_B, "Flammable", 0)
elements.property(elements.NOBODY_PT_B, "Explosive", 0)
elements.property(elements.NOBODY_PT_B, "Loss", 0.15)
elements.property(elements.NOBODY_PT_B, "AirLoss", 0.96)
elements.property(elements.NOBODY_PT_B, "AirDrag", 0.03)
elements.property(elements.NOBODY_PT_B, "Advection", 2)
elements.property(elements.NOBODY_PT_B, "Weight", 32)
elements.property(elements.NOBODY_PT_B, "Diffusion", 0)
elements.property(elements.NOBODY_PT_B, "Falldown", 0)
NFUSUpdate = 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, 'thdr')
end
end
tpt.set_property('life', clife - 1, x, y)
elseif clife == 1 then
tpt.set_property('type', 0, 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', 300, x, y)
return true
end
end
end
end
end
tpt.element_func(NFUSUpdate, tpt.element('nfus'))
function growth(i,x,y,s,n)
type=tpt.get_property("type",x+math.random(-1,1),y+math.random(-1,1))
if type==tpt.el.thdr.id then
tpt.parts[i].type=tpt.el.hygn.id
end
end
tpt.element_func(growth,tpt.el.thdr.id)
You could allocate an element yourself rather than overwrite THDR, but other than that, it's pretty cool!
i thought of that but desided not too...
You could do something like this:
local thdr_copy = elements.allocate("NOBODY", "THDR")
elements.element(elements.NOBODY_PT_THDR, elements.element(elements.DEFAULT_PT_THDR))
It makes your own little private copy of THDR.
thx that works!
It does? I haven't tested it, so I wasn't sure if it would need edits.
well it copies it but i have no clue on how to put it into the update function where thdr goes...
tpt.create(x + cx, y + cy, 'thdr')