uecasm / colony4cc

MineColonies for ComputerCraft integration addon mod for Minecraft
GNU General Public License v3.0
7 stars 8 forks source link

[1.20.1] Crush on call getWorkOrderResources or getBuilderResources #27

Closed DarkOutX closed 4 months ago

DarkOutX commented 4 months ago

Describe the bug Any method to get resources crushes game

To Reproduce Steps to reproduce the behavior:

  1. Create clear wolrd (I used plain)
  2. Create a colony
  3. Claim Town Hall
  4. Claim Builder's Hut
  5. Give spade to builder (to complete all NPC's requests)
  6. Build a computer with monitor
  7. Try to request resources with getWorkOrderResources or getBuilderResources

So I have 2 plans: Town Hall and Builder's Hut. Only plans, no buildings. And I ordered Builder's Hut to start building, so NPCs created build requests

My code example:

local monitor = peripheral.wrap("top")

monitor.clear()

local orders = colony.getWorkOrders();
local row = 1

monitor.setCursorPos(1, row);

for i=1, #orders do
    local order = orders[i]

    if order.type=="building" then
        row = i + row
        monitor.setCursorPos(0, row)

        monitor.write(" | " .. order.type .. " | " .. order.claimedByBuilding.x .. " | " .. order.claimedByBuilding.y .. " | " .. order.claimedByBuilding.z .. " |")

        local resources = colony.getWorkOrderResources(order.id)
    end 
end

Expected behavior resources = colony.getWorkOrderResources(order.id) should return table of resources (but it just crushes game)

Versions:

Additional context crash-2024-02-14_02.32.35-server.txt luaCode.txt

uecasm commented 4 months ago

Thanks for the report. MineColonies changed the API again; this will be fixed in 2.6.3.