pmotschmann / Evolve

An incremental game about evolving a civilization
Mozilla Public License 2.0
801 stars 344 forks source link

Prevent exploits to assign too many crafters on Scarletite and Quantium #1073

Closed yarukishi closed 5 months ago

yarukishi commented 5 months ago

The resources Scarletite and Quantium have limited craftsman slots, unlike other crafted resources. There are various loopholes that allow too many crafters to produce these resources. This commit plugs the holes. In addition, it fixes some UI errors where the panel to assign craftsmen did not refresh with the correct limits.

Scarletite

  1. Infernal forge checks power on request status but not whether the forges are actually powered (for craftsman cap only; smelting is correct)
  2. Infernal forge immediately removes crafters when manually powered off, but if the game is paused, then they can be reassigned again before the limit is decreased

Quantium

  1. Manually powering down buildings does not remove crafters and does not refresh the UI
  2. Loss of power or support does not remove crafters and does not refresh the UI

This change adds a routine check for available crafter slots to midLoop. It's performed immediately prior to the usual check to remove excess worker population from unavailable jobs. Also, manually powering on or off the zero gravity lab or infectious disease lab will update the UI and remove excess craftsmen.

I tested the changes to the zero gravity lab and the infernal forge. I didn't test the infectious disease lab on account of not having a post-isolation save file.

First save file: false path, can check Scarletite evolve-2024-02-10-19-59.txt

Second save file: other user's true path, can check Zero Gravity Labs quantium crafters.txt

pmotschmann commented 5 months ago

Was merged into branch 1.3.11 but github failed to close it automatically because of some rebasing