Fix alignging order resource status

This commit is contained in:
Ben 2024-06-02 17:01:39 +02:00
parent 20e844488a
commit d990a19218
Signed by: ben
GPG key ID: 0F54A7ED232D3319

View file

@ -16,7 +16,7 @@ local function fetch(wait_for)
if colony.isInColony() then
for i, wo in pairs(colony.getWorkOrders()) do
local resources = colony.getWorkOrderResources(wo.id)
local res_status = "?/?/0"
local resStatus = "?/?/0"
if resources ~= nil then
local unavailable_count = 0
local deliver_count = 0
@ -28,9 +28,9 @@ local function fetch(wait_for)
deliver_count = deliver_count + 1
end
end
res_status = unavailable_count .. "/" .. deliver_count .. "/" .. #resources
resStatus = unavailable_count .. "/" .. deliver_count .. "/" .. #resources
end
listframes.updateItemAt(currentIdx, {id=wo.id, type=wo.workOrderType, target=wo.type, pos=wo.builder, res_status=res_status, claimed=wo.isClaimed})
listframes.updateItemAt(currentIdx, {id=wo.id, type=wo.workOrderType, target=wo.type, pos=wo.builder, status=resStatus, claimed=wo.isClaimed})
currentIdx = currentIdx + 1
wait_for(config.step_sleep_time)
end
@ -50,13 +50,14 @@ local function drawEntry(win, obj)
win.write(" ")
end
local padding
if obj.res_status then
padding = winhlp.alignRightPadding(win, #obj.res_status + 4)
win.write(" " .. obj.res_status)
if obj.status then
padding = winhlp.alignRightPadding(win, #obj.status + 4)
win.write(string.format("%" .. padding+1 .. "s", " "))
win.write(obj.status .. " ")
else
padding = winhlp.alignRightPadding(win, 3)
win.write(string.format("%" .. padding+1 .. "s", " "))
end
win.write(string.format("%" .. padding+1 .. "s", " "))
if obj.claimed then
win.setTextColor(colors.green)
win.write("C")