geode icon indicating copy to clipboard operation
geode copied to clipboard

Add `setSettingName` and `setSettingDescription` methods to `Mod`

Open TheBearodactyl opened this issue 9 months ago • 5 comments

v2 bc neovim fucked with formatting last time (used notepad++ this time)

TheBearodactyl avatar Feb 20 '25 02:02 TheBearodactyl

Why does this add methods to Mod directly? What's the use case for this? Does it warrant having a quick-access method in Mod?

HJfod avatar May 31 '25 20:05 HJfod

updated my fork

TheBearodactyl avatar May 31 '25 23:05 TheBearodactyl

Why does this add methods to Mod directly? What's the use case for this? Does it warrant having a quick-access method in Mod?

well for one they're companion methods to the get methods so it'd be kinda weird NOT to have them directly in Mod. like imagine if a class had a getter for foo and the setter was in a completely different class for no reason. it'd just be unnecessarily complicated opposed to having both the getter and setter in the same class. and the reason they exist is to make customizing setting menus easier (e.g. if someone makes a localization mod and they want to add support for setting menus and not just the base game)

TheBearodactyl avatar Jun 01 '25 00:06 TheBearodactyl

If this is just for localization, I'd rather add a dedicated localization API that'd let people provide a JSON file or something with translations listed. Allowing changing setting names and descriptions arbitarily at runtime seems like a bad move that'll confuse users when suddenly their setting has a different name.

If we do add this, I will say there should not be setters in Mod. Yes the getters are there, but the getters are meant to be used much much more frequently than a setter would be, and for the usecases provided I think people can write two more lines of code to set the value. Having it be in Mod directly both bloats its interface and makes it more encouraging to misuse.

HJfod avatar Jun 01 '25 07:06 HJfod

fair enough. still gonna keep this open though until said localization api is a thing though

TheBearodactyl avatar Jun 01 '25 17:06 TheBearodactyl