Wildfrost

Wildfrost

48 ratings
Config Manager
   
Award
Favorite
Favorited
Unfavorite
Tools
Tags: Mod
File Size
Posted
Updated
1.080 MB
Mar 8, 2024 @ 9:37pm
Jun 5 @ 8:50am
44 Change Notes ( view )

Subscribe to download
Config Manager

In 1 collection by Hopeless
Configurables
30 items
Description
Adds a Journal button to modify configs for all currently ACTIVE mods, and allows modders to customise their appearance and behaviour


NOTE: If the configs don't automatically update ingame, first try resubscribing to Config Manager and delete your mod's config.cfg. If all else fails, report to me @Hopeful on Discord


Customisation for your mod
Without this mod as a dependency
Without requiring this mod as a dependency, you can still do minimal customisation:
  • Set the description through the comment parameter in your ConfigItem. Make sure new lines use "\n//".
  • Set predefined options by using bool or an enum type as the value of your ConfigItem
You can use sprites using <sprite name="your sprite"> (or <sprite=..> or even <spr=..> for short) in the desc, but keywords and card popups don't work yet. By default this works with the base game stuff, but you can add your own by adding a sprite asset with my VFX & SFX Tools

With this mod as a dependency
In general, each mod has its own ConfigSection in the Journal which contains a ConfigItem for each config. If there are no (visible) configs, then this section won't show up.

Attributes: The main meat
For modders adding this to your mod, you can add any of these new attributes when you define each config item:
  • ConfigManagerTitle : The title to display for this item
  • ConfigManagerDesc : The description to display when hovered. Use this if you want rich text tags like <align> or <voffset>
  • ConfigInput : Adds a button to manually input the config. When used with Options, will only choose between the predefined options, or the range if used with Slider.
  • ConfigOptions : Adds left/right buttons to swap between predefined options. When used with an enum, it will automatically replace _ with spaces
  • ConfigSlider : Adds a slider with a predefined range. Can use with float or int. This shows the current value under the title
  • HideInConfigManager : By default, this item won't show up in the Journal unless any ShowIfConfig is defined

Making manual changes to the config or appearance
Manually make changes to the config (similar to toggling charms with my Unlock Selector mod).
  • ConfigManager.SaveConfig() : This method is missing from the api for some reason so I added it here
  • ConfigManager.ConfigItem : For each config in your mod:
    • configItem.UpdateDesc() : Change the hover popup, possibly overriding the text preprocessing. Same as doing "desc = str"
    • configItem.UpdateTitle() : Change the title displayed. Same as doing "title = str"

Conditional visibility attributes
You can use any number of these to specify when a config should/shouldn't be visible. Optionally set priority parameters if using HideIf and ShowIf together
  • HideIfConfig : This item won't show up in the Journal if the specified config item (by field name) takes some value
  • ShowIfConfig : Use to override HideIf or HideInConfigManager if needed

Events
The main thing here is OnConfigChanged, which is useful for when you need to reload your mod after disabling/enabling any DataFile objects for example (see Miya's blood mod in progress)
  • ConfigManager.OnModLoaded : Event after any mod loads
  • ConfigManager.OnModUnloaded : Event after any mod unloads
  • configSection.OnConfigChanged : Event after a config's value is saved for each mod
I didn't realise the ModLoaded/Unloaded were already part of the api so wtv
1 Comments
Hopeless  [author] Apr 20 @ 3:28pm 
This mod's GUID is hope.wildfrost.configs