Closed SkyJumper409x closed 2 months ago
Also, this closes #21
I also disabled IPS calculation if the IPS Label not visible, this came with its own quirk though. Even if save_config_and_exit() is running, Singleton._process(_delta) is still called every frame. The ConfigHandler.current_config.free() call in save_config_and_exit() will cause errors if an attempt is made to access ConfigHandler.current_config after it is free()'d to avoid this, Singleton.exiting is set to true when save_config_and_exit() is called, and ConfigHandler.current_config.show_ips will not be accessed by Singleton._process(_delta) if Singleton.exiting is true.
I had this also happen in InputBar.gd
. I searched all files for the regex func _process[\s\S\n]*?config[\s\S\n]*?
to find other process methods accessing ConfigHandler.current_config
and InputBar.gd
seemed to be the only other script where that is the case.
(Unrelated to IPS)
So this is more than it needed to be but uh: I added a config value called
show_ips
in theSettings
Section. I didn't like having lots of duplicate code forButtonHamburger.gd
andIPS.gd
, so I renamedButtonHamburger.gd
toHideableUI.gd
so it can be reused.If a node has the HideableUI script, it must have a metadata bool called
show_on_hover
, which indicates if the UI element should be visible on hover (This is enabled for the Hamburger Button, but disabled for the IPS Label)The
IPS.gd
-specific code was moved intoSingleton.gd
pretty simply. However, the litttle bit of hamburger-specific code inButtonHamburger.gd
was not easy to split. (I considered rewriting parts of the program in C# to use Interfaces for inheriting multiple scripts, but that felt a little overkill :3.) The code is in ConfigHandler now. I tried putting it in Singleton, but that did not work, as Singleton would try to access config values before ConfigHandler could assign them.I also disabled IPS calculation if the IPS Label not visible, this came with its own quirk though. Even if
save_config_and_exit()
is running,Singleton._process(_delta)
is still called every frame. TheConfigHandler.current_config.free()
call insave_config_and_exit()
will cause errors if an attempt is made to accessConfigHandler.current_config
after it isfree()
'd to avoid this,Singleton.exiting
is set to true whensave_config_and_exit()
is called, andConfigHandler.current_config.show_ips
will not be accessed bySingleton._process(_delta)
ifSingleton.exiting
is true.