SANDBOX — this is a test environment. No servers are actually deployed and no real payments are charged.
Back to NxLabs

NxLabs / Vintage Story

Auto Config Lib

TBy TheInsanityGod

Auto generates ConfigLib implementation for mods that don't add their own

Auto Config Lib

Description

Requires: Config Lib


Ever wanted to edit some setting through ConfigLib's mod setting menu, only to realize the other mod doesn't have a ConfigLib implementation? Well I haven't but I'm here to try and fix this anyway.

Features:

  • Automated ConfigLib implementation for Typed Configs (meaning configs that have an actual code class associated with it)
  • World Config gets added to ConfigLib automatically as well
  • Shows description from code documentation
  • Supports data annotation attributes


This required the creator of the mod to enable the output of the documentation file

 

Suported data annotations:

  • DisplayName (sets the name in config)
  • Description (sets the description in config)
  • Category (sets the group to display this item under)
  • DefaultValue (sets the value to use for the reset button)
  • ReadOnly (sets whether this value should be editable or just displayed)
  • Browsable (sets whether this item should be visible, by default fields & properties are considered browseable(true) while methods are considered browseable(false) and yes changing this will make the method show up as  a button in the config)
  • Range (sets the minimum and maximum value for numbers, as long as the min or max is not infinite this will also turn it into a slider)
  • MaxLength (sets the maximum length of the string field, default MaxLength is 128)
  • DisplayFormat (sets the display format, currently only supports "P" for showing floats as percentages where 0 is considered 0% and 1 is considered 100%)

 

Note for modders: if you want a more complete code first config management (and not just configLib integration) then consider using InsanityLib instead

Ratings & reviews

No ratings yet

Sign in to leave a rating or comment.