FeanorWasWrong

oldTankStats.lua

Mar 11th, 2019
118
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 sides = require"sides"
  3.  
  4. local tank = component.tank_controller
  5.  
  6. --Fill level and capacity
  7.  
  8. tfillN = tank.getTankLevel(sides.north)
  9. tcapN = tank.getTankCapacity(sides.north)
  10.  
  11. --Percentage
  12.  
  13. tpercN = (tfillN / tcapN) * 100
  14.  
  15. --Readability
  16.  
  17. tpercN = math.floor(tpercN)
  18.  
  19. print("der Tank ist zu "..tpercN.."% gefuellt")
  20.  
  21. --Get label
  22.  
  23. tanks = {}              --Why?!
  24.  
  25. for a,b in ipairs(tank.getFluidInTank(sides.north))
  26. do
  27.     tanks[a] = {}
  28.     tanks[a].name = b.name
  29.     tanks[a].label = b.label
  30.     tanks[a].unit = b.unit
  31.     tanks[a].level = b.amount
  32.     tanks[a].capacity = b.capacity
  33.     tlabelN = b.label
  34. end
  35.  
  36. print("Fluessigkeit: "..tlabelN)
Add Comment
Please, Sign In to add comment