tlongstretch / freeserf-with-AI-plus

THIS PROJECT WAS MOVED TO 'Forkserf', GO THERE INSTEAD
https://github.com/forkserf/forkserf
GNU General Public License v3.0
1 stars 0 forks source link

mystery solved: why a Stock sometimes doesn't register as an Inventory #60

Open tlongstretch opened 3 years ago

tlongstretch commented 3 years ago

I spent a lot of time trying to understand why my Stocks were not registering as valid Inventories for serfs/resources when running FlagSearches. The building->is_inventory() call returns true, but the Flag->is_inventory() and Flag->accepts_resources() calls returned false, and the Flag-> calls are what are used to check the validity of an Inventory.

The answer is that the new Stock had no 'holder', that is it had no occupying "professional" serf. In retrospect this seems kind of obvious, but until now I had always (wrongly) assumed that Stocks do not require a serf to operate them. Clearly, they have to because somebody has to move resources OUT, even though the nearest road Transporter handles moving resources IN. I never noticed that once a Stock is completed a serf is sent to occupy it, and until that serf arrives and becomes the holder, the stock will not be a valid resource destination, even though it appears to be initialized in terms of clicking on it and seeing Inventory screens

I assume the original game operates this way also. And the reason that, in my case, a serf had not occupied the stock is almost certainly faulty pathfinding logic (which is what I was working on when I noticed this problem) preventing a serf from being sent there

I think it would be an minor improvement in the game to not show the "Inventory screens" when clicking on a Stock until the holder serf has occupied it. It would be better to show a picture of the building and a minus-sign icon until the requested serf arrives, then change to the Inventory screens once the Stock is operational.