Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require('component')
- local sensor = component.sensor
- local totalCapacity = 0
- local totalStored = 0
- print("Searching for blocks handling energy")
- local positions = sensor.search("", -1, "energy")
- print("Scanning " .. #positions .. " blocks")
- for _,pos in ipairs(positions) do
- local info = sensor.scan(pos.x, pos.y, pos.z)
- print(" " .. info.block.label .. " @ " .. pos.x .. "," .. pos.y .. "," .. pos.z)
- totalStored = totalStored + info.data.energy.energyStored
- totalCapacity = totalCapacity + info.data.energy.maxEnergyStored
- end
- print("")
- print("Energy summary:")
- print(" Total capacity: " .. totalCapacity);
- print(" Total stored: " .. totalStored);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement