Ancient Warfare 2

Ancient Warfare 2

6M Downloads

Work orders not functioning

shadowmage45 opened this issue ยท 8 comments

commented

Work orders appear non-functional -- npc stands around with no task icon when given a valid work-order slip.

commented

Does this extend to routing slips?

commented

It might -- pretty sure routing slips were working last I tested, but the work-orders never got a whole lot of testing.

commented

I'm unable to get the courier to do anything, I'm afraid. Even to simply "takematch" a piece of wheat out of an inventory. No task icon at all.

commented

..strange update on the courier. Upon joining the server today, my courier had a task icon above his head! The first time I'd ever seen it there. He wasn't doing anything though so I checked his routing slip. His current slip was the simple one I'd tried last - instructing him to pick up wheat from one chest and deposit it into another. After checking the routing slip, but without changing anything, I put it back in his GUI slot ...and it worked. He took all of the wheat from one chest and put it in the other. I tried using a different, more functional routing slip - taking wheat and seeds from the wheat farm, depositing wheat in the animal farm, taking steak and leather from the animal farm, depositing seeds, wheat and leather from the animal farm - and he walked straight to the two chests specified in his previous routing slip. Next, I removed his routing slip altogether and put the wheat back in the first chest. He proceeded to transfer it to the second chest with no active routing slip. He is correctly going to eat from the town hall regularly, going to his home point at night, etc. It's "simply" his routing/work orders that are borked.

commented

Aha! To get the courier to work, I need to place a valid routing slip in his GUI, then disconnect from the server. When I reconnect, he will be on task - and stay on task (regardless of whether that routing slip is removed) until I disconnect again.

commented

Lols :)

Sounds like there are some bugs there I need to look at and squash. Def. shouldn't need to log out. And he should stop working the moment you remove his routing slip. At least the 'routing' part of it is working :) (and that really is the tricky part...the rest should be solvable fairly easily).

commented

:) cool. I might past here what I mentioned in the message thread, if you don't mind.

In order to change the courier's task, I must:

*remove his routing slip,
*sign out (I think I must be off the server for a minimum amount of time - the time it takes to make a coffee seems adequate)
*sign in again. (This removes the task icon from above his head.)
*give the courier his new routing slip. (no task icon appears at this stage and the courier continues to pathfind randomly)
*sign back out for long enough again
*then sign back in (the task icon reappears above the couriers head and he is now following his routing slip and behaving as expected)

To make matters even more confusing, I have a chunk loader keeping my NPCs active. I have no idea what happens code-wise when I sign out to affect the courier's operation.

The actual routing part does seem to be working perfectly, however. Even with more complicated, 5 step tasks. He's possibly taking all wheat, for example, even when he's been instructed to take 2 pieces, but I've not looked into this thoroughly yet.

commented

Thanks for the info, it actually went a long way to helping me track it down (and also makes me think there might be an issue with the chunkloaders).

So... the problem was a really simple one -- the npc was never informed when his orders-slot was changed via the GUI, so he would never update the internal cached orders/state in his AI. However, if you left the orders in the slot, and log out/back in, at that point the npc -does- validate the order slot (on load from nbt), and would 'see' the updated orders. Because he was not updated from the GUI, this state would persist even after you removed/changed/re-inserted the orders.

I -know- I had this working at some point, so I must have inadvertently deleted the callback code that told the npc when his orders-slot had been changed.

Anyhow...verifying the fix now, should have it pushed to the repo shortly.