
Untitled
By: a guest on
May 11th, 2012 | syntax:
Lua | size: 1.69 KB | hits: 31 | expires: Never
desl_breach = 0
fire_sensors = {}
fsn = 128
for i=1, fsn do
fire_sensors[i] = false
end
tpt.el.desl.description="Modified desl"
math.randomseed(os.time())
tpt.setfpscap(50)
function desl_clog(i,x,y,surround_space,nt)
local found_bmtl = false
if tpt.get_property("type",x+1,y)==tpt.el.bmtl.id then
found_bmtl = true
end
if tpt.get_property("type",x-1,y)==tpt.el.bmtl.id then
found_bmtl = true
end
if tpt.get_property("type",x,y+1)==tpt.el.bmtl.id then
found_bmtl = true
end
if tpt.get_property("type",x,y-1)==tpt.el.bmtl.id then
found_bmtl = true
end
if found_bmtl then
tpt.set_property("type","GEL",x,y)
desl_breach = 100
end
end
function fire_sensor(i,x,y,surround_space_nt)
local found_fire = false
if tpt.get_property("type",x+1,y)==tpt.el.fire.id then
found_fire = true
end
if tpt.get_property("type",x-1,y)==tpt.el.fire.id then
found_fire = true
end
if tpt.get_property("type",x,y+1)==tpt.el.fire.id then
found_fire = true
end
if tpt.get_property("type",x,y-1)==tpt.el.fire.id then
found_fire = true
end
if found_fire then
fire_sensors[math.floor(tpt.get_property("temp",x,y)+0.5)] = true
else
fire_sensors[math.floor(tpt.get_property("temp",x,y)+0.5)] = false
end
end
function text_display()
if desl_breach>=1 then
desl_breach = desl_breach - 1
tpt.drawtext(32,32,"Containment Breach")
end
sections = "Fire: "
for i=1, fsn do
if fire_sensors[i] then
sections = sections .. i .. " "
end
end
tpt.drawtext(32,42,sections)
end
tpt.element_func(desl_clog,tpt.el.desl.id,1)
tpt.register_step(text_display)