Advertisement
TPT_PL

Beryllium (Be)

Oct 9th, 2016
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.30 KB | None | 0 0
  1. local Be = elem.allocate("YOL0", "BERY")
  2. elem.element(Be, elem.element(elem.DEFAULT_PT_METL))
  3. elem.property(Be, "Name", "BERY")
  4. elem.property(Be, "Description", "Beryllium, breaks into slightly toxic dust.")
  5. elem.property(Be, "Color", 0x669999)
  6. elem.property(Be, "MenuSection", elem.SC_SOLIDS)
  7.  
  8. local function beryllium(i, x, y, s, nt)
  9.     if sim.pressure(x/4, y/4) >= 1 then
  10.         sim.partChangeType(i, elem.DEFAULT_PT_BRMT)
  11.         sim.partProperty(i, "tmp", 1)
  12.     end
  13. end
  14.  
  15. elem.property(Be, "Update", beryllium)
  16.  
  17. local function broken(i, x, y, s, nt)
  18.     r = sim.partID(math.random(x-1, x+1), math.random(y-1, y+1))
  19.     if r ~= nil then
  20.         if sim.partProperty(r, "type") == elem.DEFAULT_PT_BREC then
  21.             sim.partChangeType(i, elem.DEFAULT_PT_THRM)
  22.             sim.partChangeType(r, elem.DEFAULT_PT_THRM)
  23.         elseif sim.partProperty(r, "type") == elem.DEFAULT_PT_STKM or sim.partProperty(r, "type") == elem.DEFAULT_PT_STK2 or sim.partProperty(r, "type") == elem.DEFAULT_PT_FIGH then
  24.             if sim.partProperty(i, "tmp") == 1 then
  25.                 sim.partProperty(r, "life", sim.partProperty(r, "life")-1)
  26.             end
  27.         end
  28.     end
  29. end
  30.  
  31.  
  32. elem.property(elem.DEFAULT_PT_BRMT, "HighTemperatureTransition", NT)
  33. elem.property(elem.DEFAULT_PT_BRMT, "Update", broken)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement