Nuclear_Man_D

meteor_api.lua

Jul 3rd, 2022
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1.  
  2. local command_block = peripheral.wrap("right")
  3.  
  4. processor_types = {
  5. "engineering_processor_press",
  6. "logic_processor_press",
  7. "silicon_processor_press",
  8. "calculation_processor_press"
  9. }
  10.  
  11. function exec(cmd)
  12. command_block.setCommand(cmd)
  13. command_block.runCommand()
  14. end
  15.  
  16.  
  17. function setBlockRaw(x, y, z, t)
  18. exec("setblock "..x.." "..y.." "..z.." "..t)
  19. end
  20.  
  21.  
  22. function sphere(x, y, z, r, t)
  23. for i = -r, r, 1 do
  24. for j = -r, r, 1 do
  25. for k = -r, r, 1 do
  26. if math.sqrt(i*i + j*j + k*k) <= r then
  27. xi = x + i
  28. yi = y + j
  29. zi = z + k
  30. setBlockRaw(xi, yi, zi, t)
  31. end
  32. end
  33. end
  34. end
  35. end
  36.  
  37.  
  38. function spawnMeteorAt(x, y, z)
  39. sphere(x, y, z, math.random(3,5), "appliedenergistics2:sky_stone_block")
  40. proc_t = processor_types[math.random(4)]
  41. block="appliedenergistics2:sky_stone_chest{inv:{item0:{id:\"appliedenergistics2:"..proc_t.."\",Count:1b}},up:\"UP\"}"
  42. setBlockRaw(x, y, z, block)
  43. end
  44.  
  45.  
Advertisement
Add Comment
Please, Sign In to add comment