From d990a1921804d7462f1f709b2e7f928ab3897da3 Mon Sep 17 00:00:00 2001 From: Benedikt Ziemons Date: Sun, 2 Jun 2024 17:01:39 +0200 Subject: [PATCH] Fix alignging order resource status --- orders.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/orders.lua b/orders.lua index 86e98c7..dbd2cb7 100644 --- a/orders.lua +++ b/orders.lua @@ -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")