nicolos17

MineColonies Monitoring

Jul 24th, 2021 (edited)
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.48 KB | None | 0 0
  1. while true do
  2. local buildings = colony.getBuildings()
  3. local wo = colony.getWorkOrders()
  4.  
  5. if wo ~= nil then
  6.  
  7. monitor = peripheral.wrap("right")
  8. monitor.clear()
  9. monitor.setCursorPos(1,1)
  10.  
  11. --for k,v in pairs(wo[2]) do
  12.     --print(k..tostring(v))
  13. --end
  14.  
  15. monitor.write("Work in  progress")
  16. lineNumber = 2
  17.  
  18. for i=1,#wo do
  19.     if wo[i].type == "building" then
  20.         builder = "Cox"
  21.         if wo[i].claimedByBuilding.x == 85 then
  22.             builder = "Glober"
  23.         end
  24.         monitor.setCursorPos(1,lineNumber)
  25.         monitor.write(wo[i].upgrade.." "..builder)
  26.         lineNumber = lineNumber + 1
  27.         monitor.setCursorPos(1,lineNumber)
  28.  
  29.         ressources = colony.getWorkOrderResources(wo[i].id)
  30.         if ressources ~= nil then
  31.             --print(ressources)
  32.             for j=1,#ressources do
  33.                 --print(ressources[j])
  34.                 r2 = ressources[j]
  35.                
  36.                 if r2.status ~= "NOT_NEEDED" then
  37.                     monitor.write(r2.item.name:gsub("minecraft:", "").." "..r2.item.count)
  38.                     lineNumber = lineNumber + 1
  39.                     monitor.setCursorPos(1,lineNumber)
  40.                 end
  41.             end
  42.         end
  43.         lineNumber = lineNumber + 1
  44.         monitor.setCursorPos(1,lineNumber)
  45.     end
  46. end
  47.  
  48. for i=1,#buildings do
  49.     --monitor.setCursorPos(1,lineNumber)
  50.     b = buildings[i]
  51.     built = tostring(b.built)
  52.     wip = tostring(b.wip)
  53.     level = b.level
  54.     type = b.type
  55.    
  56.     if b.wip then
  57.         --monitor.write(type.." "..level)
  58.         lineNumber = lineNumber + 1
  59.     end
  60. end
  61. end
  62. sleep(5)
  63. end
Add Comment
Please, Sign In to add comment