Advertisement
magnasiefr

Test MFE

Oct 3rd, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. local component = require('component')
  2. local sensor = component.sensor
  3. local totalCapacity = 0
  4. local totalStored = 0
  5. print("Searching for blocks handling energy")
  6. local positions = sensor.search("", -1, "energy")
  7. print("Scanning " .. #positions .. " blocks")
  8. for _,pos in ipairs(positions) do
  9. local info = sensor.scan(pos.x, pos.y, pos.z)
  10. print(" " .. info.block.label .. " @ " .. pos.x .. "," .. pos.y .. "," .. pos.z)
  11. totalStored = totalStored + info.data.energy.energyStored
  12. totalCapacity = totalCapacity + info.data.energy.maxEnergyStored
  13. end
  14. print("")
  15. print("Energy summary:")
  16. print(" Total capacity: " .. totalCapacity);
  17. print(" Total stored: " .. totalStored);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement