Advertisement
Myros27

scan V2

May 16th, 2025
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.46 KB | None | 0 0
  1. -- Script: IdentifyBuilders_Compact.lua
  2. -- Purpose: Lists ONLY the names and coordinates of builder huts in a compact format.
  3.  
  4. local COLONY_INTEGRATOR_NAME = "colonyIntegrator" -- Adjust if your peripheral has a different name
  5.  
  6. local colony = peripheral.find(COLONY_INTEGRATOR_NAME)
  7.  
  8. if not colony then
  9.     print("Error: '" .. COLONY_INTEGRATOR_NAME .. "' not found.")
  10.     return
  11. end
  12.  
  13. print("Colony Integrator found. Scanning...")
  14. print("--- Builder Huts (Name & Coords) ---")
  15.  
  16. local buildings = colony.getBuildings()
  17.  
  18. if not buildings or #buildings == 0 then
  19.     print("No buildings found.")
  20.     return
  21. end
  22.  
  23. local builderHutsFound = 0
  24. for i, building in ipairs(buildings) do
  25.     local isLikelyBuilderHut = false
  26.     -- Identify builder huts by name or type containing "builder"
  27.     if string.match(string.lower(building.name or ""), "builder") or string.match(string.lower(building.type or ""), "builder") then
  28.         isLikelyBuilderHut = true
  29.     end
  30.  
  31.     if isLikelyBuilderHut then
  32.         builderHutsFound = builderHutsFound + 1
  33.         local name = building.name or "UnknownName"
  34.         local locText = "Coords: N/A"
  35.         if building.location then
  36.             locText = "X:" .. building.location.x .. " Y:" .. building.location.y .. " Z:" .. building.location.z
  37.         end
  38.         print(name .. " @ " .. locText)
  39.     end
  40. end
  41.  
  42. if builderHutsFound == 0 then
  43.     print("No 'builder' huts identified.")
  44. end
  45.  
  46. print("--- Scan Complete ---")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement