BombBloke

partTerm Example - Burning Computer

May 21st, 2016
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.28 KB | None | 0 0
  1. if not partTerm then
  2.     if not (fs.exists("partTerm") or fs.exists(shell.resolve("partTerm"))) then
  3.         shell.run("pastebin get hR8p9ML4 partTerm")
  4.         os.loadAPI(shell.resolve("partTerm"))
  5.     else os.loadAPI(fs.exists("partTerm") and "partTerm" or shell.resolve("partTerm")) end
  6. end
  7.  
  8. partTerm.removeAll()
  9. partTerm.setDensity(1)
  10.  
  11. local parts = 5
  12.  
  13. local x, y, z = commands.getBlockPosition()
  14. x, y, z = x + 0.5, y + 1, z + 0.5  -- Top-center of the block.
  15.  
  16. local heatPad = partTerm.createWindow(x, y, z, 5, 5, colours.black)
  17. heatPad.setParticle("mobSpell")
  18. heatPad.setAngles(0, 90)
  19.  
  20. local smoke = {colours.red, colours.orange, colours.grey, colours.white, colours.black}
  21.  
  22. local particles = {}
  23. for i = 1, parts do particles[i] = {["colour"] = i, ["x"] = math.random(5), ["y"] = math.random(5)} end
  24.  
  25. parallel.waitForAny(
  26.     function()
  27.         while true do
  28.             for i = 1, parts do
  29.                 local thisPart = particles[i]
  30.                
  31.                 if thisPart.colour > 5 then
  32.                     particles[i] = {["colour"] = i, ["x"] = math.random(5), ["y"] = math.random(5)}
  33.                 else
  34.                     heatPad.setCursorPos(thisPart.x, thisPart.y)
  35.                     heatPad.setBackgroundColour(smoke[thisPart.colour])
  36.                     heatPad.write(" ")
  37.                     thisPart.colour = thisPart.colour + 1
  38.                 end
  39.             end
  40.            
  41.             sleep(0.5)
  42.         end
  43.     end,
  44.    
  45.     partTerm.render
  46. )
Add Comment
Please, Sign In to add comment