Muzze77

TankSystem

Nov 4th, 2024 (edited)
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | None | 0 0
  1. dbcol = colors.black
  2. dtcol = colors.lime
  3.  
  4. machines = peripheral.getNames()
  5. tanks = {}
  6. for v, k in pairs(machines) do
  7.     if string.find(k,"monitor") ~= nil then
  8.         mon = peripheral.wrap(k)   
  9.     end
  10.     if string.find(k,"tank") ~= nil then
  11.         table.insert(tanks,k)
  12.     end
  13.    
  14. end
  15.  
  16.  
  17. print(#tanks .. " Tanks are loaded")
  18.  
  19.  
  20. if mon == nil then
  21.     error("No Monitor attached")
  22. end
  23. if tanks == nil then
  24.     error("No tanks attached")
  25. end
  26. function mbut(cx,cy,text,bcol,tcol)
  27.     if bcol == nil then
  28.         bcol = dbcol
  29.     end
  30.     if tcol == nil then
  31.         tcol = dtcol
  32.     end
  33.     mon.setCursorPos(cx,cy)
  34.     mon.setBackgroundColor(bcol)
  35.     mon.setTextColor(tcol)
  36.     mon.write(text)
  37.     mon.setBackgroundColor(dbcol)
  38.     mon.setTextColor(dtcol)
  39. end
  40.  
  41. x = 2
  42. y = 2
  43. for v, k in pairs(tanks) do
  44.     tank = peripheral.wrap(k)
  45.     stats  = tank.getMetadata(1)["tanks"][1]
  46.     amount = stats.amount
  47.     capacity = stats.maxAmount
  48.    
  49.    
  50.  
  51. end
Advertisement
Add Comment
Please, Sign In to add comment