[SOLVED] FieldJobManager breaks when new fruits are installed

User avatar
Rahkiin
Former GIANTS employee
Posts: 753
Joined: Tue Jan 17, 2017 12:45 pm

[SOLVED] FieldJobManager breaks when new fruits are installed

Post by Rahkiin »

Hello,

After a while of investigation, we found a bug in the FieldJobManager:

When new fruits are installed (e.g. through AdditionalMapTypes (AMT)), the NPCs get confused! They start planting grass, poplar, oilseed, and stop planting some others.
The g_currentMission.fruits table seems to be in completely different order.

The seeder spec does work, so it is just an issue in the FJM.

baron found a hack to fix it:

If you prepend FieldJobManager:setPartitionStatus with a function that does:

Code: Select all

    fruitIndex = self.availableFruitTypeIndices[fruitIndex]
Then it is all fixed. So it seems that the fruitIndex used by the seeding in FJM is not a trustable value when other fruits are added.
The above code is not something that can go into the game, of course, just to demonstrate.

Please try it (and print g_cm.fruits with and without AMT)


- PC/Mac/PS4/XB1: All, but effect can only be reproduced on scriptable platforms
- Vehicle/Tool/Model/Object: All
- Issue: NPCs are completely confused about the seedable fruits
- Single- or Multiplayer: Where NPC runs
- Steps to reproduce: Get a map with AdditionalMapTypes and run the NPC (Lossberg, for example)


Note the severity of this bug: when an NPC seeds oilseed or poplar, the field cant be worked on until it withers again. (And if you play Seasons, that takes a while)