Advertisement
1ng0

ComputerCraft - Massfabricator

Jun 3rd, 2015
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.71 KB | None | 0 0
  1. ------------------
  2. -- Code by Keno --
  3. ------------------
  4. os.loadAPI("ocs/apis/sensor")
  5. local monitor = peripheral.wrap("top")
  6. local euSensor = sensor.wrap("bottom")
  7. while true do
  8.   local targets = euSensor.getTargets()
  9.   local euStorage = {stored=0,capacity=0}
  10.   for targetId, target in pairs(targets) do
  11.     if target.Name == "MFSU" then
  12.       local targetDetails = euSensor.getTargetDetails(targetId)
  13.       euStorage.stored = euStorage.stored + targetDetails.Stored
  14.       euStorage.capacity = euStorage.capacity + targetDetails.Capacity
  15.     end
  16.   end  
  17.   monitor.clear()
  18.   monitor.setCursorPos(1,1)
  19.   monitor.write(string.format("Stored "..euStorage.stored.." Capacity "..euStorage.capacity))
  20.   sleep(1.0)
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement