akarnokd / ThePlanetCrafterMods

BepInEx+Harmony mods for the Unity/Steam game The Planet Crafter
Apache License 2.0
44 stars 29 forks source link

Improve the performance of rocket counting #8

Closed akarnokd closed 2 years ago

akarnokd commented 2 years ago

Instead of #7

For the TI details screen, we can find the hidden rocket containers and get the rocket counts O(1).

For the rocket crafting screen, we still need to scan all objects because the GPS satellites do not seem to have a hidden container. The performance is not that critical there because we do this once per opening the screen.

Credit goes to @WildCard65 for finding the hidden rocket inventories.

akarnokd commented 2 years ago

After careful consideration, relying on the hidden, and otherwise unused, inventory is risky as it may eventually be removed.

Instead, the idea is to scan for rockets upon start, then hook into the launch button and update the rocket counts right there.