Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 11th, 2012  |  syntax: Lua  |  size: 1.69 KB  |  hits: 31  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. desl_breach = 0
  2. fire_sensors = {}
  3. fsn = 128
  4. for i=1, fsn do
  5.         fire_sensors[i] = false
  6. end
  7. tpt.el.desl.description="Modified desl"
  8. math.randomseed(os.time())
  9. tpt.setfpscap(50)
  10.  
  11. function desl_clog(i,x,y,surround_space,nt)
  12.    local found_bmtl = false
  13.    if tpt.get_property("type",x+1,y)==tpt.el.bmtl.id then
  14.       found_bmtl = true
  15.    end
  16.    if tpt.get_property("type",x-1,y)==tpt.el.bmtl.id then
  17.       found_bmtl = true
  18.    end
  19.    if tpt.get_property("type",x,y+1)==tpt.el.bmtl.id then
  20.       found_bmtl = true
  21.    end
  22.    if tpt.get_property("type",x,y-1)==tpt.el.bmtl.id then
  23.       found_bmtl = true
  24.    end
  25.    if found_bmtl then
  26.       tpt.set_property("type","GEL",x,y)
  27.           desl_breach = 100
  28.    end
  29. end
  30.  
  31. function fire_sensor(i,x,y,surround_space_nt)
  32.    local found_fire = false
  33.    if tpt.get_property("type",x+1,y)==tpt.el.fire.id then
  34.       found_fire = true
  35.    end
  36.    if tpt.get_property("type",x-1,y)==tpt.el.fire.id then
  37.       found_fire = true
  38.    end
  39.    if tpt.get_property("type",x,y+1)==tpt.el.fire.id then
  40.       found_fire = true
  41.    end
  42.    if tpt.get_property("type",x,y-1)==tpt.el.fire.id then
  43.       found_fire = true
  44.    end
  45.    if found_fire then
  46.       fire_sensors[math.floor(tpt.get_property("temp",x,y)+0.5)] = true
  47.    else
  48.       fire_sensors[math.floor(tpt.get_property("temp",x,y)+0.5)] = false
  49.    end
  50. end
  51.  
  52. function text_display()
  53.         if desl_breach>=1 then
  54.                 desl_breach = desl_breach - 1
  55.                 tpt.drawtext(32,32,"Containment Breach")
  56.         end
  57.         sections = "Fire: "
  58.         for i=1, fsn do
  59.                 if fire_sensors[i] then
  60.                         sections = sections .. i .. " "
  61.                 end
  62.         end
  63.         tpt.drawtext(32,42,sections)
  64. end
  65.  
  66. tpt.element_func(desl_clog,tpt.el.desl.id,1)
  67. tpt.register_step(text_display)