user enable/ disable the health, stamina, food and xp bar ingame, this either leads to potential null reference exceptions either from the mod talking to a bar that doesn't exist or turns an existing bar non functional without reenabling the default one
users are constantly confused that they need to restart (or how to restart) after enabling / disabling a bar, because the config description is too hidden
the mod doesn't support resource bar for the new mistlands resource Eitr yet (I'm avoiding spoilers here since I know you haven't played yet)
unbeknownst to the user, the new bar config options only do something when 'enablePlayerHudEditing' is also enabled
the default display of the custom bars is not satisfying because their positions heavily overlap due to being the default instantiated positions
users may be confused about the name of the rotation config options not specifying that they only affect the custom bars
enabling the custom food bar while having the custom health bar disabled would lead to two food bars since we disable the entire health and food bar object when enabling the custom health bar
This PR addresses these issues in the following ways:
after spawning or not spawning the bars in HUD.Awake based on the config, the mod completely ignores the config values and also never talks to the bar objects directly until the user logs out. That means that the bar classes have complete control over the bars after they were spawned and get to continue to function until they are destroyed by a logout
the config file has been edited: the bar settings now have their own section that explicitely mentions that you need to logout (full restarts also work of course, but the mod only requires HUD.Awake for a full reset). this change will reset the affected config options (and only those) for ALL users, since the config options are stored as a pair of section and name. this is okay, because hitting boolean toggles is not a lot of work and most users are probably not using the custom bars in the first place. the customized positions of bars are saved in '"9 - xDataUI","uiData"' and are therefore not affected. we use this reset opportunity to also rename the rotation config options to avoid potential confusion
the CustomElements class has been heavily modified. the three bar types shared a lot of copy pasted code. this has been refactored into a helper class which increases future maintainability. inheritance was not an option due to the heavy use of the static modifier in the existing implementation
the fork icon next to the custom food bar has been removed again. The issue was caused by its name changing from "foodicon" to "foodicon (1)" in a recent update (probably when they removed the food bars)
the custom food bar now does not spawn when the custom health bar is disabled and a warning is printed into the log to inform the user. additionally the descriptions of the custom health and food bar were updated to tell the user about this dependency. hopefully not spawning the bar instead of spawning two bars gets the user to notice their mistake more easily
the Update method of the FoodBar has been updated to reflect HUD.UpdateFood again. Food icons are now blinking again when they can be refreshed
the newly created framework has been used to add support for the resource bar of the new mistlands resource Eitr. as I have not used Eitr much I don't know if this new bar may miss out on some special visual effects (it is once again a clone of the health bar after all), but it's fully functional including when the maximum of the resource gets reset to zero
the new bars have satisfying default positions (see the attached image), including when not all of them are enabled, and no longer require 'enablePlayerHudEditing' to be enabled to function. the default positions don't affect users with already edited positions because those are loaded afterwards and override these default positions
Fixes #31
Issues that I want to address with this PR:
This PR addresses these issues in the following ways:
after spawning or not spawning the bars in HUD.Awake based on the config, the mod completely ignores the config values and also never talks to the bar objects directly until the user logs out. That means that the bar classes have complete control over the bars after they were spawned and get to continue to function until they are destroyed by a logout
the config file has been edited: the bar settings now have their own section that explicitely mentions that you need to logout (full restarts also work of course, but the mod only requires HUD.Awake for a full reset). this change will reset the affected config options (and only those) for ALL users, since the config options are stored as a pair of section and name. this is okay, because hitting boolean toggles is not a lot of work and most users are probably not using the custom bars in the first place. the customized positions of bars are saved in '"9 - xDataUI","uiData"' and are therefore not affected. we use this reset opportunity to also rename the rotation config options to avoid potential confusion
the CustomElements class has been heavily modified. the three bar types shared a lot of copy pasted code. this has been refactored into a helper class which increases future maintainability. inheritance was not an option due to the heavy use of the static modifier in the existing implementation
the fork icon next to the custom food bar has been removed again. The issue was caused by its name changing from "foodicon" to "foodicon (1)" in a recent update (probably when they removed the food bars)
the custom food bar now does not spawn when the custom health bar is disabled and a warning is printed into the log to inform the user. additionally the descriptions of the custom health and food bar were updated to tell the user about this dependency. hopefully not spawning the bar instead of spawning two bars gets the user to notice their mistake more easily
the Update method of the FoodBar has been updated to reflect HUD.UpdateFood again. Food icons are now blinking again when they can be refreshed
the newly created framework has been used to add support for the resource bar of the new mistlands resource Eitr. as I have not used Eitr much I don't know if this new bar may miss out on some special visual effects (it is once again a clone of the health bar after all), but it's fully functional including when the maximum of the resource gets reset to zero
the new bars have satisfying default positions (see the attached image), including when not all of them are enabled, and no longer require 'enablePlayerHudEditing' to be enabled to function. the default positions don't affect users with already edited positions because those are loaded afterwards and override these default positions