Fix error accessing work order resources
This commit is contained in:
parent
b575517317
commit
76663b9371
25
test.lua
25
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
|
||||
|
|
Loading…
Reference in a new issue