{"info":{"_postman_id":"3a76a586-df0c-46cc-9694-2420dc0859fd","name":"0D5: rimworld mod settings menu (PC working) download","description":"<html><head></head><body><p>Mod Config Menu\nFor an example on how to implement a mod configuration menu, \"mod settings\" there is no such thing in the context of RimWorld (at least. One of the main features of HugsLib is the ability for mods to add persistent settings that can be changed by the player. You can save your current options and load them back later with a few simple clicks in the options menu! To change the value used by the mod, simply go to the Mod Settings menu under RimWorld's Options menu. Values below 95 are not recommended. DeepStorage/ at master · lilwhitemouse/RimWorld-LWM. Change the list of new mod items in the final place \"Architect Menu\" tells you to.</p>\n<p>⬇️    ⬇️    ⬇️    ⬇️    ⬇️</p>\n<p><b>💾 ►►► <a href=\"https://download-mod.com/file-acun\">DOWNLOAD FILE</a> 🔥🔥🔥</b></p>\n<p>One of the main features of HugsLib is the ability for mods to add persistent settings that can be changed by the player. Settings can come in a variety of types- the library has built-in controls for bool , int , string and Enum. Every other type will be treated as string , unless CustomDrawer is used see below ; The easiest approach to adding settings is defining a class that extends HugsLib. All extending classes have the property Settings that contains the SettingsHandle s for that mod. Note, that setting values are stored as strings by their Name identifier, and have no known type until they are claimed by the mod that defined them. The settings XML file is stored in the user profile folder. Settings values matching their default are not written to the file. Retrieving and creating a setting value is done using the same method. This is best done during the ModBase. DefsLoaded callback, because this will give the setting handle the properly translated title and description after the player changes the game language. Titles and descriptions are used in the Mod Settings dialog to present the setting to the user. Each setting only needs to be requested once, because SettingHandle s are automatically updated with new values when modified by the user. This example creates a boolean toggle setting:. Using string. Translate to populate the title and description is optional, but a good practice. The GetHandle method returns a SettingHandle object that can be used to access the value of the setting and apply additional modifiers to it. Note, that SettingHandle s can be implicitly converted to the type of value they store, so the following ways of reading a setting value are equivalent:. Settings of type int and string are created and accessed in the same manner, and have their own input controls. Enum settings can be quite useful to create settings that can be switched between multiple states. These settings require a string identifier prefix that will be used to display the setting options in a readable format. The following example creates an enum setting with 3 options:. The fifth parameter null in the example is the optional validator method that is not required for Enum handles. When the player closes the Mod Settings dialog after changing any setting, the ModBase. SettingsChanged method is called for all mods. Depending on what your settings do, it may not even be necessary to override it, however. Requesting the handles and reading their Value property wherever it is needed may be enough, since the handle values are automatically updated. These are additional properties in SettingHandle that allow for specific configuration after the handle has been created. This is the unique Id of the setting specified as the first argument to ModSettingsPack. The name must only be unique to the mod that created the setting, and multiple mods can have settings with matching identifiers. The validator method can be passed to ModSettingsPack. GetHandle as the fifth parameter when creating a handle. It is used to ensure that values assigned to the setting by the player and those loaded from the XML file are valid. The method receives a string argument and must return a bool to indicate that the provided value is valid. The first validation happens when the handle is requested. Retuning false in the validator during that phase will discard the loaded value and the default value will be assigned to the handle. The validator is also called when the player changes settings in the menu- rejecting the passed value will simply prevent it from being assigned to the handle. The library provides some convenience validators for commons setting types. This example creates an int type handle that will only accept values from 0 to 30 inclusive :. An optional method that should return true when the setting should be displayed in the menu. Useful for settings that should appear only in Dev mode or settings dependent on the values of other settings. For some settings, the few basic editing controls will not be enough. Perhaps you will want a slider for your int setting, a dropdown list with changing options, or, perhaps, you would prefer a button that opens a custom window for editing the value. Assigning a delegate to this property allows setting handle owners to draw their own control to be displayed in the Mod Settings menu. The delegate receives a Rect argument- the screen area to do the drawing in, and must return a bool to indicate if the setting has changed during the current update. Make sure to assign SettingHandle. Value when the setting changes so that it may be properly saved. This is CustomDrawer , but with even more power. When a delegate is assigned to to this property, it will take over all drawing of the handle in the Mod Settings menu. This will replace the title label, the editing control and the hover menu. The replaced controls are easy to recreate: the editing control occupies the exact right half of the rectangle try Rect. RightHalf , the rest is the label, with Text. The hover menu can be drawn with ModSettingsWidgets. When using CustomDrawer or CustomDrawerFullWidth , this property can be used to expand the height of the setting entry. The default height is 32px. When set to true , this handle will never appear in the settings menu. This is useful for storing custom serialized data structures that should be independent of save files. Note, that the setting can still be reset when the player resets all settings for your mod while having the \"Include hidden settings\" toggle checked. It's a good idea to provide a title for this reason- it appear in the tooltip of the toggle. When true , this handle will not be saved to the XML file. Useful in conjunction with CustomDrawer for placing buttons in the settings menu. Note, that this will also remove the reset option from the context menu of the handle. Defaults to true. When enabled, the handle will have a reset option in its context menu which will set it to its default value. It's a good idea to set this to false only if you are using the setting to store important data- like player progress or achievements. Useful for int handles. An event that is dispatched each time the Value of the handle changes. This goes for manual assignment, changing the setting in the Mod Settings dialog, or resetting it to default. The event is raised immediately after the value change, and does not wait for the settings dialog to be closed. ValueChanged can be used in addition to overriding the SettingsChanged method. The callback receives the changed handle as its only parameter. This property allows handle display order to be different than their creation order. This is useful if part of your handles are created at a different time. Defaults to zero, and sorted in ascending order. It's still recommended to create all handles at game startup, so that they may be visible to the player if he opens the settings before loading a game. This property is important when changing setting values from code. For regular settings, it will be set to true automatically whenever the handle Value changes. When changing SettingHandleConvertible handles, however, it should be set to true manually. The property value affects saving: if none of the settings have HasUnsavedChanges set to true, nothing will be saved. Also, your ModBase. SettingsChanged callback will only be called if at least one of your settings has HasUnsavedChanges set to true whenever settings are saved to disk. These are custom actions that you can assign to your handle to be shown whenever its context menu is opened the hovering hamburger menu button is clicked. A good use for these are preset values- this both gives the player a limited set of options and lets them set the value freely if they choose to:. Mods that don't create a class extending ModBase can still make use of custom settings. This is done by requesting a ModSettingsPack from the settings manager:. The identifier will be used in the XML file, so avoid spaces and special characters. The type returned by the manager is the same one as a ModBase extending class would have access to through the Settings property. Not used when requesting an existing pack. GetHandle can also be called with only the handle name- this will return an existing SettingHandle or null ;. Returns true if a setting value is available. This includes already created handles, and existing values that have been loaded, but have not been claimed by a SettingHandle yet. Useful in conjunction with PeekValue. Returns the string value of a setting. If the value has already been claimed by a handle, returns the value of the handle, otherwise returns the loaded value. This is useful if you need to access the value of a setting before handles are created, or if you are looking for a setting created by another mod. See SettingHandle. ContextMenuEntries above. Same principle, but for an entire category of settings. It is possible to create settings of complex types like lists and other data structures. The key is providing methods that will convert the data structure from and to its string representation. This is done by extending HugsLib. SettingHandleConvertible and using the new type as the type of a settings handle. You can override the ShouldBeSaved and return false to prevent your object to be serialized and written to file- this is useful when the value is no longer null , but the object is still in its default state. If an exception is raised in either method, an error is displayed in the console and the handle value is reset to its default. For the custom data type to be useful, the handle should use CustomDrawer to draw a special control. Alternatively, NeverVisible could be used to create a hidden setting to store some kind of user data. Since SettingHandle can't detect changes in your custom value, it's a good idea to either set HasUnsavedChanges to true , or call ForceSaveChanges on the handle. In the first case the setting will be saved to file on game exit, the second will save the settings file immediately use sparingly, since disk activity is involved. Important: It is recommended to use null as the default value for handles with custom data types to prevent both Value and DefaultValue from referencing the same object. Be sure to check the value for null when accessing it- if CanBeReset is true , the player can reset your setting at any time. While you can serialize your values manually, there are two utility methods that can be used to automatically serialize and de-serialize a custom setting value. These are especially useful if you are working with multiple fields of different types. The only thing required are some additional annotations on your type and serialized fields:. Sometimes it is preferable to avoid adding HugsLib as a dependency, but it would still he useful to have configurable settings when the library is loaded. There is a sneaky way to accomplish that: referencing the library at compile time, but catching the TypeLoadException that gets thrown at runtime if the library is not loaded. Keep in mind, that all references to HugsLib types must be made inside a delegate wrapped in a try block with a TypeLoadException handler for this to work. This example creates a toggle setting with a default value of true. Code and idea contributed by Zenthar. Basic usage Retrieving and creating a setting value is done using the same method. Translate , HandleEnum. GetHandle \" intSpinner \" , \" title \" , \" desc \" , 0 , Validators. IntRangeValidator 0 , 30 ;. GetHandle \" dangerLevel \" , \" Danger level \" , \" Description here IntRangeValidator 0 , ; dangerLevel. GetModSettings \" modIdentifier \" , modLabel ;. Split ' '. Select int. ToList ; Log. Message nums.</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"23281725","collectionId":"3a76a586-df0c-46cc-9694-2420dc0859fd","publishedId":"VVkE7Etr","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2022-09-10T22:07:16.000Z"},"item":[]}