Advertisement
TPT_PL

Waah, so dangerous

Oct 24th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.45 KB | None | 0 0
  1. --Kerosine, rocket fuel.
  2. local element1 = elements.allocate("L0L", "KERO")
  3. elements.element(elements.L0L_PT_KERO, elements.element(elements.DEFAULT_PT_BCOL))
  4. elements.property(elements.L0L_PT_KERO, "Name", "KERO")
  5. elements.property(elements.L0L_PT_KERO, "Description", "Kerosine, burns very hot, used in rocket fuel.")
  6. elements.property(elements.L0L_PT_KERO, "Colour", 0x3399ff)
  7. elements.property(elements.L0L_PT_KERO, "MenuSection", elem.SC_EXPLOSIVE)
  8. elements.property(elements.L0L_PT_KERO, "Gravity", .5)
  9. elements.property(elements.L0L_PT_KERO, "Flammable", 0)
  10. elements.property(elements.L0L_PT_KERO, "Explosive", 0)
  11. elements.property(elements.L0L_PT_KERO, "Loss", 1)
  12. elements.property(elements.L0L_PT_KERO, "Falldown", 2)
  13. elements.property(elements.L0L_PT_KERO, "AirLoss", .5)
  14. elements.property(elements.L0L_PT_KERO, "AirDrag", .01)
  15. elements.property(elements.L0L_PT_KERO, "Advection", .01)
  16. elements.property(elements.L0L_PT_KERO, "Weight", 50)
  17. elements.property(elements.L0L_PT_KERO, "Diffusion", 0)
  18. KEROUpdate = function(i, x, y, s, n)
  19.     local clife = tpt.get_property('life', x, y)
  20.     if clife > 1 then
  21.         for cx = -1, 1, 2 do
  22.             for cy = -1, 1, 2 do
  23.                 tpt.create(x + cx, y + cy, 'plsm')
  24.             end
  25.         end
  26.         tpt.set_property('life', clife - 1, x, y)
  27.     elseif clife == 1 then
  28.         tpt.set_property('type', 0, x, y)
  29.     elseif s > 0 then
  30.         for cx = -1, 1, 2 do
  31.             for cy = -1, 1, 2 do
  32.                 if tpt.get_property('type', x + cx, y + cy) == 4 or tpt.get_property('type', x + cx, y + cy) == 49 then
  33.                     tpt.set_property('life', 20, x, y)
  34.                     return true
  35.                 end
  36.             end
  37.         end
  38.     end
  39. end
  40. tpt.element_func(KEROUpdate, tpt.element('kero'))
  41.  
  42. --Acidic napalm
  43. local element2 = elements.allocate("L0L", "CHEM")
  44. elements.element(elements.L0L_PT_CHEM, elements.element(elements.DEFAULT_PT_BCOL))
  45. elements.property(elements.L0L_PT_CHEM, "Name", "CHEM")
  46. elements.property(elements.L0L_PT_CHEM, "Description", "Toxic chemicals, release CAUS when in contact with fire.")
  47. elements.property(elements.L0L_PT_CHEM, "Colour", 0xccff33)
  48. elements.property(elements.L0L_PT_CHEM, "MenuSection", elem.SC_LIQUID)
  49. elements.property(elements.L0L_PT_CHEM, "Gravity", .5)
  50. elements.property(elements.L0L_PT_CHEM, "Flammable", 0)
  51. elements.property(elements.L0L_PT_CHEM, "Explosive", 0)
  52. elements.property(elements.L0L_PT_CHEM, "Loss", 1)
  53. elements.property(elements.L0L_PT_CHEM, "Falldown", 2)
  54. elements.property(elements.L0L_PT_CHEM, "AirLoss", .5)
  55. elements.property(elements.L0L_PT_CHEM, "AirDrag", .01)
  56. elements.property(elements.L0L_PT_CHEM, "Advection", .01)
  57. elements.property(elements.L0L_PT_CHEM, "Weight", 50)
  58. elements.property(elements.L0L_PT_CHEM, "Diffusion", 0)
  59. elements.property(elements.L0L_PT_CHEM, "Hardness", 0)
  60.  
  61.  
  62. CHEMUpdate = function(i, x, y, s, n)
  63.     local clife = tpt.get_property('life', x, y)
  64.     if clife > 1 then
  65.         for cx = -1, 1, 2 do
  66.             for cy = -1, 1, 2 do
  67.                 tpt.create(x + cx, y + cy, 'caus')
  68.             end
  69.         end
  70.         tpt.set_property('life', clife - 1, x, y)
  71.     elseif clife == 1 then
  72.         tpt.set_property('type', elem.DEFAULT_PT_ACID, x, y)
  73.     elseif s > 0 then
  74.         for cx = -1, 1, 2 do
  75.             for cy = -1, 1, 2 do
  76.                 if tpt.get_property('type', x + cx, y + cy) == 4 or tpt.get_property('type', x + cx, y + cy) == 49 or tpt.get_property('type', x + cx, y + cy) == elem.DEFAULT_PT_CAUS or tpt.get_property('type', x + cx, y + cy) == elem.DEFAULT_PT_ACID then
  77.                     tpt.set_property('life', 20, x, y)
  78.                     return true
  79.                 end
  80.             end
  81.         end
  82.     end
  83. end
  84. tpt.element_func(CHEMUpdate, tpt.element('chem'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement