Fix error accessing work order resources

This commit is contained in:
Ben 2024-06-01 03:43:35 +02:00
parent b575517317
commit 76663b9371
Signed by: ben
GPG key ID: 1353F41CF1CFF2D3

View file

@ -83,11 +83,11 @@ 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(" ")
if val.claimed then
@ -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