The code:
elements.allocate('AU3FGEN', 'LASE')
elements.element(elements.AU3FGEN_PT_LASE, elements.element(elements.DEFAULT_PT_BCOL))
elements.property(elements.AU3FGEN_PT_LASE, 'Name', 'LASE')
elements.property(elements.AU3FGEN_PT_LASE, 'Description', 'A lasing material')
elements.property(elements.AU3FGEN_PT_LASE, 'Color', '0xFF0000')
elements.property(elements.AU3FGEN_PT_LASE, 'MenuSection', '10')
elements.property(elements.AU3FGEN_PT_LASE, 'Gravity', '0')
elements.property(elements.AU3FGEN_PT_LASE, 'Flammable', '0')
elements.property(elements.AU3FGEN_PT_LASE, 'Explosive', '0')
elements.property(elements.AU3FGEN_PT_LASE, 'Loss', '0')
elements.property(elements.AU3FGEN_PT_LASE, 'AirLoss', '0')
elements.property(elements.AU3FGEN_PT_LASE, 'AirDrag', '0')
elements.property(elements.AU3FGEN_PT_LASE, 'Advection', '0')
elements.property(elements.AU3FGEN_PT_LASE, 'Weight', '100')
elements.property(elements.AU3FGEN_PT_LASE, 'Diffusion', '0')
elements.property(elements.AU3FGEN_PT_LASE, 'Diffusion', '0')
elements.property(elements.AU3FGEN_PT_LASE, "Properties", elements.PROP_LIFE_DEC)
local g = function(i, x, y, s, n)
for cx = -1, 1, 2 do
for cy = -1, 1 do
if tpt.get_property("type", x + cx, y + cy) == tpt.element('phot') and tpt.get_property("life", x, y) == 0 then
vx, vy, temp = tpt.get_property("vx", x + cx, y + cy), tpt.get_property("vy", x + cx, y + cy), tpt.get_property("temp", x + cx, y + cy)
tpt.create(x + cx, y + cy, "phot")
tpt.set_property("life", 4, x, y)
tpt.set_property("vx", vx, x + cx, y + cy)
tpt.set_property("vy", vy, x + cx, y + cy)
tpt.set_property("temp", temp, x + cx, y + cy)
break
end
end
end
end
tpt.element_func(g, tpt.element('LASE'))
local function gfunc(i, r, g, b)
return 1, 0x00010001, 255, 255, 0, 0, 255, 25, 0, 0
end
tpt.graphics_func(gfunc, tpt.element('LASE'))
It's very useful for making very small lasers with a high compression rate (like this one:
Free to copy (with credit)