Advertisement
CCHacker132

Vessel Refuel

Jan 6th, 2021
1,099
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.57 KB | None | 0 0
  1. term.clear()
  2.  
  3. local engines = {peripheral.find('minecraft:archiengine')}
  4.  
  5. while true do
  6.     term.clear()
  7.     term.setCursorPos(1,2)
  8.     term.setTextColor(colors.lightBlue)
  9.     local manipulator = peripheral.find('manipulator')
  10.     local ender = manipulator.getEnder()
  11.     local totalAmount = 0
  12.     for i,v in pairs(engines) do
  13.        local amount = 0
  14.        for _ = 1,4 do
  15.            amount = amount + ender.pushItems(peripheral.getName(v),1)
  16.        end
  17.        totalAmount = totalAmount + amount
  18.        if amount > 0 then
  19.            print('Added '..amount..' items to engine '..i)
  20.        end
  21.     end
  22.     print()
  23.     term.setTextColor(colors.green)
  24.     print('Total fuel restocked: '..totalAmount)
  25.     term.setTextColor(colors.yellow)
  26.     print('Average fuel stocked per engine: '..totalAmount/#engines)
  27.     local filledAmount = 0
  28.     for i,v in pairs(engines) do
  29.         for ii,vv in pairs(v.list()) do
  30.             filledAmount = filledAmount + vv.count
  31.         end
  32.     end
  33.     term.setTextColor(colors.orange)
  34.     print('Total fuel levels: '..filledAmount..'/'..#engines*256)
  35.     if totalAmount > 0 then
  36.         term.setTextColor(colors.cyan)
  37.         write('Fueling: ')
  38.         local success = (filledAmount==#engines*256)
  39.         if success then
  40.             term.setTextColor(colors.green)
  41.             print('Successful')
  42.         else
  43.             term.setTextColor(colors.red)
  44.             print('Failed')
  45.         end
  46.     end
  47.     term.setTextColor(colors.white)
  48.     print()
  49.     print('Press any button to re-fuel . . .')
  50.     os.pullEvent('key_up')
  51. end
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement