pmotschmann / Evolve

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

Improve tab refresh behavior #1125

Open yarukishi opened 2 months ago

yarukishi commented 2 months ago

The code to refresh governor actions generally assumes that it is being executed on the tab where the action is made visible. However, Evolve has building and research queues, so these triggers might happen while the GUI is viewing any tab. Update the restrictions so that governor tasks are immediately refreshed even without Preload Tab Content enabled.

The defineGovernor() function now accordingly checks for its own visibility before it redraws the GUI.

Some completely missing governor tab refreshes, such as when adding or removing Slavery or Cannibalism, or when researching certain technologies, have also been added.

Additionally, remove various instances where the resource panel was deleted and redrawn, which seems to be legacy that isn't required anymore. This is especially nice when building Mass Ejectors, because those would redraw the resource sidebar every single time a new one was built, causing that part of the page to flash. The simple action of unlocking crates / containers is good enough to make those resources visible, to add the + buttons for per-resource storage management, and for the associated storage type to appear within the modal. I didn't experimentally confirm that alchemy is the same way.

Containers may be unlocked by any building that grants them, because, unlike crates, containers aren't mandatory to progress in the game. Add a variety of checks for this, so even a user whose first container is provided by a building other than the container port or wharf can get the proper unlocks.

I tested most of the early game stuff that doesn't rely on being in Magic. I didn't specifically test any of the changes in space or the changes related to alchemy. In both of those cases, the code changes generally follow the same format as something that I did test.

yarukishi commented 2 months ago

Additional commit 6035efd is to address another user reported bug, where the research queue does not appear after researching Personal Assistant. This is another case where the condition was only checking for tabLoad, without considering the current tab selection for single tab rendering mode.

Discord link: https://discord.com/channels/586926974585274373/586926975185321985/1236215371997122610

I didn't specifically test this fix before pushing the code.