pmotschmann / Evolve

An incremental game about evolving a civilization
Mozilla Public License 2.0
794 stars 343 forks source link

Strengthen checks to prevent missing workers #1128

Open yarukishi opened 2 months ago

yarukishi commented 2 months ago

There have been reports that certain situations can cause workers to be stuck in limbo:

This patch ensures that the the fastLoop does not set new workers on a job with "assigned" workers if the job is invisible and can no longer be fulfilled. It also adds some additional cases where the worker count for any invisible job is reset to 0, as a secondary protection. Finally, a few more cases where worker quantity is reset now also reset worker assignment to 0.

yarukishi commented 2 months ago

The following user save file demonstrates the issue in two different ways. First, about 300 workers are already "in the void", performing invisible work, when the save file is loaded. Second, changing the Mimic from Small to Avian can cause the 4 cement workers to be returned to the default job (lumberjack), then immediately reassigned, at a rate of 1 per fastLoop tick, to the invisible cement worker job.

This patch resolved both issues. On the mainline, the number of lumberjacks remains 18.

repro.txt