Ludeon Forums

RimWorld => Mods => Releases => Topic started by: Kiame on June 29, 2017, 02:50:53 PM

Title: [Mod Util] Add Support for Save Storage Settings
Post by: Kiame on June 29, 2017, 02:50:53 PM
These are instructions for others who want to add support for Save Storage Settings (https://ludeon.com/forums/index.php?topic=34075.0) to their mods. Specifically "Save Settings" and "Load Settings" buttons (gizmos) to save ThingFilters to a file.

The dll can be downloaded from here: https://github.com/KiameV/rimworld-SaveStorageSettings/releases/download/1.0util/SaveStorageSettingsUtil.zip

To integrate this mod:

public override IEnumerable<Gizmo> GetGizmos()
{
      IEnumerable<Gizmo> enumerables = base.GetGizmos();

      return SaveStorageSettingsUtil.SaveStorageSettingsGizmoUtil.AddSaveLoadGizmos(
              enumerables, // The parent's returned gizmos
              "Custom_Mod",  // The location where saved settings will be located, specifically SaveStorageSettings/Custom_Mod in this case
              this.settings.filter); // The ThingFilters to save
}


Some additional notes:

How it works
SaveStorageSettingsUtil will check the first time AddSaveLoadGizmos is called to see if the mod SaveStorageSettings. If the mod is installed (load order does not matter in game) the Save and Load gizmos will be added. If the mod is not installed, the buttons will not be added with nothing added to the logs.

SaveStorageSettingsUtil does have another public method Exists which returns True if the mod SaveStorageSettings is loaded in game. This may be helpful for Mod Settings maybe? I just thought i'd leave it public in case anyone could think of a reason it would be useful.
Title: Re: [Mod Util] Add Support for Save Storage Settings
Post by: Kiame on June 17, 2018, 08:22:23 PM
Updated for 1.0