From 76663b93712cafbd53f6430a019898415ada1cb7 Mon Sep 17 00:00:00 2001 From: Benedikt Ziemons Date: Sat, 1 Jun 2024 03:43:35 +0200 Subject: [PATCH] Fix error accessing work order resources --- test.lua | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/test.lua b/test.lua index 6630e56..8f0b189 100644 --- a/test.lua +++ b/test.lua @@ -83,13 +83,13 @@ function ordersDisplay() term.write(val.target) term.write(" ") end - if val.item then - term.setCursorPos(tw-6-#val.item, line_num) - term.write(val.item) + if val.res_count then + term.setCursorPos(tw-2-#val.res_count, line_num) + term.write(val.res_count) else - term.setCursorPos(tw-6, line_num) + term.setCursorPos(tw-2, line_num) end - term.write(" ") + term.write(" ") if val.claimed then term.setTextColor(colors.yellow) term.write("C") @@ -98,14 +98,6 @@ function ordersDisplay() term.write(" ") end term.write(" ") - if val.delivering then - term.setTextColor(colors.green) - term.write("D") - term.setTextColor(colors.white) - else - term.write(" ") - end - term.write(" ") end end end @@ -259,7 +251,12 @@ function get_orders() if colony_orders ~= nil then for i, wo in pairs(colony_orders) do local res = colony.getWorkOrderResources(wo.id) - table.insert(orders, {id=wo.id, type=wo.workOrderType, target=wo.type, pos=wo.builder, resources=res, claimed=wo.isClaimed, delivering=res.delivering}) + if res == nil then + res = "0" + else + res = "" .. #res + end + table.insert(orders, {id=wo.id, type=wo.workOrderType, target=wo.type, pos=wo.builder, res_count=res, claimed=wo.isClaimed}) wait_for(config.step_sleep_time) end end