Advertisement
Guest User

Untitled

a guest
Feb 9th, 2023
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.53 KB | None | 0 0
  1. local ElementSBOMB = elements.allocate("JUH", "SBOMB")
  2. elements.element(elements.JUH_PT_SBOMB, elements.element(elements.DEFAULT_PT_BOMB))
  3. elements.property(elements.JUH_PT_SBOMB, "Name", "BMBL")
  4. elements.property(elements.JUH_PT_SBOMB, "Description", "Bomb that flies to the left.")
  5. elements.property(elements.JUH_PT_SBOMB, "Gravity",0)
  6. local function explodeL(i,x,y,s,n)
  7.     for i=-1,1 do
  8.         for j=-1,1 do
  9.             if tpt.get_property("type", x+i, y+j)~=0 and tpt.element(tpt.get_property("type", x+i, y+j))~="BMBL" then
  10.                 tpt.set_pressure(x/4, y/4, 1, 1, 50)
  11.                 for i=-2,2 do
  12.                     for j=-2,2 do
  13.                         -- tpt.set_property("temp", 3000, x+i, y+j)
  14.                     end
  15.                 end
  16.                 tpt.set_property("temp", math.huge, x, y)
  17.                
  18.                 tpt.delete(x,y)
  19.                 tpt.create(x, y, "BOMB")
  20.                 return
  21.             else
  22.                 tpt.set_property("vx", -3, x, y)
  23.             end
  24.         end
  25.     end
  26. end
  27. tpt.element_func(explodeL,ElementSBOMB)
  28. local ElementSBOMBR = elements.allocate("JUH", "SBOMBR")
  29. elements.element(elements.JUH_PT_SBOMBR, elements.element(elements.DEFAULT_PT_BOMB))
  30. elements.property(elements.JUH_PT_SBOMBR, "Name", "BMBR")
  31. elements.property(elements.JUH_PT_SBOMBR, "Description", "Bomb that flies to the right.")
  32. elements.property(elements.JUH_PT_SBOMBR, "Gravity",0)
  33. local function explodeR(i,x,y,s,n)
  34.     for i=-1,1 do
  35.         for j=-1,1 do
  36.             if tpt.get_property("type", x+i, y+j)~=0 and tpt.element(tpt.get_property("type", x+i, y+j))~="BMBR" then
  37.                 tpt.set_pressure(x/4, y/4, 1, 1, 50)
  38.                 for i=-2,2 do
  39.                     for j=-2,2 do
  40.                         -- tpt.set_property("temp", 3000, x+i, y+j)
  41.                     end
  42.                 end
  43.                 -- tpt.set_property("temp", math.huge, x, y)
  44.                
  45.                 tpt.delete(x,y)
  46.                 tpt.create(x, y, "BOMB")
  47.                 return
  48.             else
  49.                 tpt.set_property("vx", 3, x, y)
  50.             end
  51.         end
  52.     end
  53. end
  54. tpt.element_func(explodeR,ElementSBOMBR)
  55.  
  56. local ElementLBOMB = elements.allocate("JUH", "LBOMB")
  57. elements.element(elements.JUH_PT_LBOMB, elements.element(elements.DEFAULT_PT_BOMB))
  58. elements.property(elements.JUH_PT_LBOMB, "Name", "LBMB")
  59. elements.property(elements.JUH_PT_LBOMB, "Description", "Light (weak) bomb.")
  60.  
  61. local function explodeS(i,x,y,s,n)
  62.     for i=-1,1 do
  63.         for j=-1,1 do
  64.             if tpt.get_property("type", x+i, y+j)~=0 and tpt.element(tpt.get_property("type", x+i, y+j))~="LBMB" then
  65.                 tpt.set_pressure(x/4, y/4, 1, 1, 50)
  66.                 for i=-2,2 do
  67.                     for j=-2,2 do
  68.                         tpt.set_property("temp", 3000, x+i, y+j)
  69.                     end
  70.                 end
  71.                 tpt.set_property("temp", math.huge, x, y)
  72.                 tpt.delete(x,y)
  73.                
  74.                 tpt.create(x, y, "EMBR")
  75.                 local id = tpt.get_property("type", x, y)
  76.                 tpt.delete(x,y)
  77.                
  78.                 simulation.createParts(x,y,4,4,id,0,1)
  79.                 for i,nx,ny in sim.neighbors(x,y,5,5) do
  80.                     sim.partProperty(i, sim.FIELD_TEMP, 3000)
  81.                     sim.partProperty(i, sim.FIELD_LIFE, 50)
  82.                 end
  83.                 return
  84.             else
  85.             end
  86.         end
  87.     end
  88. end
  89. tpt.element_func(explodeS,ElementLBOMB)
  90.  
  91. local ElementBBOMB = elements.allocate("JUH", "BBOMB")
  92. elements.element(elements.JUH_PT_BBOMB, elements.element(elements.DEFAULT_PT_BOMB))
  93. elements.property(elements.JUH_PT_BBOMB, "Name", "BBMB")
  94. elements.property(elements.JUH_PT_BBOMB, "Description", "Big (cluster) bomb.")
  95.  
  96. local function explodeB(i,x,y,s,n)
  97.     for i=-1,1 do
  98.         for j=-1,1 do
  99.             if tpt.get_property("type", x+i, y+j)~=0 and tpt.element(tpt.get_property("type", x+i, y+j))~="BBMB" then
  100.                 tpt.set_pressure(x/4, y/4, 1, 1, 150)
  101.                 for i=-2,2 do
  102.                     for j=-2,2 do
  103.                         -- tpt.set_property("temp", 3000, x+i, y+j)
  104.                     end
  105.                 end
  106.                 -- tpt.set_property("temp", math.huge, x, y)
  107.                 tpt.delete(x,y)
  108.                
  109.                 tpt.create(x, y, "BOMB")
  110.                 local id = tpt.get_property("type", x, y)
  111.                 tpt.delete(x,y)
  112.                
  113.                 simulation.createParts(x,y,4,4,id)
  114.                 sim.partCreate(-3, x, y, 1)
  115.                 sim.partCreate(-3, x+2, y, 1)
  116.                 sim.partCreate(-3, x-2, y, 1)
  117.                 sim.partCreate(-3, x, y+2, 1)
  118.                 sim.partCreate(-3, x, y-2, 1)
  119.                 return
  120.             else
  121.             end
  122.         end
  123.     end
  124. end
  125. tpt.element_func(explodeB,ElementBBOMB)
  126.  
  127. local ElementFBOMB = elements.allocate("JUH", "FBOMB")
  128. elements.element(elements.JUH_PT_FBOMB, elements.element(elements.DEFAULT_PT_BOMB))
  129. elements.property(elements.JUH_PT_FBOMB, "Name", "FBMB")
  130. elements.property(elements.JUH_PT_FBOMB, "Description", "Fire bomb.")
  131.  
  132. local function explodeF(i,x,y,s,n)
  133.     for i=-1,1 do
  134.         for j=-1,1 do
  135.             if tpt.get_property("type", x+i, y+j)~=0 and tpt.element(tpt.get_property("type", x+i, y+j))~="FBMB" and tpt.element(tpt.get_property("type", x+i, y+j))~="FIRE" and tpt.element(tpt.get_property("type", x+i, y+j))~="SMKE" then
  136.                 tpt.set_pressure(x/4, y/4, 1, 1, 150)
  137.                 for i=-2,2 do
  138.                     for j=-2,2 do
  139.                         -- tpt.set_property("temp", 3000, x+i, y+j)
  140.                     end
  141.                 end
  142.                 tpt.delete(x,y)
  143.                
  144.                 tpt.create(x, y, "FIRE")
  145.                 local id = tpt.get_property("type", x, y)
  146.                 tpt.delete(x,y)
  147.                
  148.                 simulation.createParts(x,y,6,6,id)
  149.                 return
  150.             else
  151.                 simulation.createParts(x,y,1,1,4)
  152.             end
  153.         end
  154.     end
  155. end
  156. tpt.element_func(explodeF,ElementFBOMB)
  157.  
  158. local ElementBULLET = elements.allocate("JUH", "BULLET")
  159. elements.element(elements.JUH_PT_BULLET, elements.element(elements.DEFAULT_PT_BOMB))
  160. elements.property(elements.JUH_PT_BULLET, "Name", "BULT")
  161. elements.property(elements.JUH_PT_BULLET, "Description", "Bullet, destroys pixels on impact.")
  162.  
  163. local function explodeBull(i,x,y,s,n)
  164.     for i=-1,1 do
  165.         for j=-1,1 do
  166.             if tpt.get_property("type", x+i, y+j)~=0 and tpt.element(tpt.get_property("type", x+i, y+j))~="BULT" then
  167.                 --tpt.set_pressure(x/4, y/4, 1, 1, 150)
  168.                 for i=-2,2 do
  169.                     for j=-2,2 do
  170.                         -- tpt.set_property("temp", 3000, x+i, y+j)
  171.                     end
  172.                 end
  173.                 tpt.delete(x,y)
  174.                 simulation.createParts(x,y,2,2,0,1,1)
  175.                 return
  176.             else
  177.             end
  178.         end
  179.     end
  180. end
  181. tpt.element_func(explodeBull,ElementBULLET)
  182.  
  183. local ElementFBULLET = elements.allocate("JUH", "FBULLET")
  184. elements.element(elements.JUH_PT_FBULLET, elements.element(elements.DEFAULT_PT_BOMB))
  185. elements.property(elements.JUH_PT_FBULLET, "Name", "FWBT")
  186. elements.property(elements.JUH_PT_FBULLET, "Description", "Firework bullet.")
  187.  
  188. local function explodeFRBull(i,x,y,s,n)
  189.     for i=-1,1 do
  190.         for j=-1,1 do
  191.             if tpt.get_property("type", x+i, y+j)~=0 and tpt.element(tpt.get_property("type", x+i, y+j))~="FWBT" and tpt.element(tpt.get_property("type", x+i, y+j))~="EMBR" then
  192.                 --tpt.set_pressure(x/4, y/4, 1, 1, 150)
  193.                 for i=-2,2 do
  194.                     for j=-2,2 do
  195.                         -- tpt.set_property("temp", 3000, x+i, y+j)
  196.                         tpt.delete(x,y)
  197.                         local part = tpt.create(x+i, y+j, "FIRW")
  198.                         tpt.set_property("tmp",1,part)
  199.                     end
  200.                 end
  201.                 return
  202.             else
  203.             end
  204.         end
  205.     end
  206. end
  207. tpt.element_func(explodeFRBull, ElementFBULLET)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement