Advertisement
Guest User

Untitled

a guest
Jun 30th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.55 KB | None | 0 0
  1. local RADN = elements.allocate("RADN", "RADN")
  2.  
  3. elements.element(RADN, elements.element(elements.DEFAULT_PT_WATR))
  4.  
  5. elements.property(RADN, "Name", "RADN")
  6.  
  7. elements.property(RADN, "Description", "Radioactive Liquid. Can be activated by sparks and flames. Use sparingly.")
  8.  
  9. elements.property(RADN, "Colour", 0x512368)
  10.  
  11. elements.property(RADN, "MenuSection", elem.SC_EXPLOSIVE)
  12.  
  13. elements.property(RADN, "Temperature", 295.15)
  14.  
  15. elements.property(RADN, "Flammable", 10)
  16.  
  17. elements.property(RADN, "Explosive", 16)
  18.  
  19. local function Explode (particle_index, x_location, y_location, s, neighbours)
  20.  
  21.     local x_offset = math.random(-1, 1)
  22.  
  23.     local y_offset = math.random(-1, 1)
  24.  
  25.     local neighbour_index = simulation.partID(x_location + x_offset, y_location + y_offset)
  26.  
  27.     if simulation.partProperty(neighbour_index, "type") == elements.DEFAULT_PT_SPRK or simulation.partProperty(neighbour_index, "type") == elements.DEFAULT_PT_PLSM or simulation.partProperty(neighbour_index, "type") == elements.DEFAULT_PT_FIRE then
  28.        
  29.         simulation.partProperty(particle_index, "type", elements.DEFAULT_PT_DEUT)
  30.  
  31.         simulation.partProperty(particle_index, "life", 999999999)
  32.  
  33.         simulation.partProperty(simulation.partID(x_location - 1), "type", elements.DEFAULT_PT_NEUT)
  34.  
  35.         simulation.partProperty(simulation.partID(x_location + 1), "type", elements.DEFAULT_PT_NEUT)
  36.  
  37.         simulation.partProperty(simulation.partID(y_location - 1), "type", elements.DEFAULT_PT_NEUT)
  38.  
  39.         simulation.partProperty(simulation.partID(y_location + 1), "type", elements.DEFAULT_PT_NEUT)
  40.        
  41.     end
  42.  
  43. end
  44.  
  45. elements.property(RADN, "Update", Explode)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement