Guest User

A WICK for your NITR lamp.

a guest
May 12th, 2015
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local wick = elements.allocate("ELEMENT", "WICK")
  2. elements.element(wick, elements.element(elements.DEFAULT_PT_DMND))
  3. elements.property(wick, "Name", "WICK")
  4. elements.property(wick, "Description", "WICK. A wick for your NITR lamp.")
  5. elements.property(wick, "Colour", 0xECD5A6)
  6. elements.property(wick, "AirLoss", 0)
  7. elements.property(wick, "HeatConduct", 0)
  8.  
  9. local function wickUpdate(i,x,y,s,nt)
  10.     local clife = tpt.get_property("life", i)
  11.     local ctmp = tpt.get_property("tmp", i)
  12.     local dx = math.random(-3,3)
  13.     local dy = math.random(-3,3)
  14.     if nt > 0 then
  15.         if tpt.get_property("type", x+dx, y+dy) == elements.ELEMENT_PT_WICK then
  16.             local klife = tpt.get_property("life", x+dx, y+dy)
  17.             tpt.set_property("life", math.ceil((clife+klife)/2), i)
  18.             tpt.set_property("life", math.floor((clife+klife)/2), x+dx, y+dy)
  19.         end
  20.         if clife < 250 and tpt.get_property("type", x+dx, y+dy) == 8 then
  21.             tpt.set_property("life", clife + 250, i)
  22.             tpt.set_property("type", 0, x+dx, y+dy)
  23.         end
  24.         if ctmp == 0 and (tpt.get_property("type", x+dx, y+dy) == 4 or tpt.get_property("type", x+dx, y+dy) == 49) then
  25.             tpt.set_property("tmp", 1, i)
  26.         end
  27.     end
  28.     if ctmp == 1 then
  29.         if clife > 0 then
  30.             tpt.set_property("life", clife - 1, i)
  31.             for kx=-1,1 do
  32.                 for ky=-1,1 do
  33.                     tpt.create(x+kx, y+ky, "FIRE")
  34.                 end
  35.             end
  36.         else
  37.             for kx=-1,1 do
  38.                 for ky=-1,1 do
  39.                     tpt.create(x+kx, y+ky, "FIRE")
  40.                 end
  41.             end
  42.             tpt.delete(i)
  43.         end
  44.     end
  45. end
  46.  
  47. elements.property(wick, "Update", wickUpdate)
Advertisement
Add Comment
Please, Sign In to add comment