I'm trying to make a GATE element that does logic, but my function doesn't work. Can anyone help? Here is the update function:
function spawninout(i,x,y,s,n)
if tpt.get_property("tmp",x,y)==0 then
if tpt.get_property("type",x-2,y)==tpt.el.sprk.id or tpt.get_property("type",x+2,y)==tpt.el.sprk.id then
tpt.set_property("type",tpt.el.sprk.id,x,y+2)
end
end
tpt.delete(x-2,y)
tpt.delete(x+2,y)
tpt.delete(x,y+2)
tpt.create(x-2,y,"metl")
tpt.create(x+2,y,"metl")
tpt.create(x,y+2,"metl")
end
tpt.element_func(spawninout,elements.MOD_PT_GATE)
This doesn't cause any errors and the METL spawning works properly (this element is only intended for use as a 1 pixel dot), its just that it doesn't output.