local colony = peripheral.wrap("top")
print("Building Sites: ".. colony.amountOfConstructionSites())
print("Citizens: ".. colony.amountOfCitizens())
local underAttack = "No"
if colony.isUnderAttack() then
underAttack = "Yes"
end
print("Is under attack? ".. underAttack)
print("Overall happiness: ".. math.floor(colony.getHappiness()))
print("Amount of graves: ".. colony.amountOfGraves())
print("Colony Requests")
print("----------------")
-- Get all requests
local requests = colony.getRequests()
if not requests or #requests == 0 then
print("No active requests.")
return
end
-- Keep track of which IDs we've shown (to avoid duplicates)
local shown = {}
for _, req in pairs(requests) do
if not shown[req.id] then
shown[req.id] = true -- mark as displayed
local count = req.count or 0
local itemName = "Unknown"
-- Try to pick a good item name from the list
if req.items and #req.items > 0 then
for _, item in pairs(req.items) do
if item.name then
-- Optional: namespace filter
local prefix = string.match(item.name, "^(.-):")
if prefix == "minecraft" or prefix == "minecolonies" then
itemName = item.name
break
end
end
end
-- fallback if no filtered item matched
if itemName == "Unknown" then
itemName = req.items[1].name or req.name or "Unknown"
end
elseif req.name then
itemName = req.name
end
print(string.format("%s | %d", itemName, count))
end
end