using System.Collections.Generic; using Verse; namespace BlaxDefaults { /// /// Mod settings: the toggles and the dismissed overlap warnings only. The defaults themselves live in /// their own file (DefaultsLibrary, DefaultsFile), never here: a mod settings file that fails to load is /// replaced by fresh settings on the next write. /// public class BlaxDefaultsSettings : ModSettings { /// Master switch. Off: no hook applies anything; the defaults file is kept. public bool enabled = true; /// New stockpiles start from their type's default. public bool stockpileDefaults = true; /// New storage buildings start from their kind's default. public bool storageDefaults = true; /// New production bills get the values of "Every new bill". public bool billDefaults = true; /// The settings page and one message per session name active mods that set the same defaults. public bool warnOverlaps = true; /// Package ids whose overlap message the player dismissed with "Don't remind me". public List dismissedOverlaps = new List(); public override void ExposeData() { base.ExposeData(); Scribe_Values.Look(ref enabled, "enabled", true); Scribe_Values.Look(ref stockpileDefaults, "stockpileDefaults", true); Scribe_Values.Look(ref storageDefaults, "storageDefaults", true); Scribe_Values.Look(ref billDefaults, "billDefaults", true); Scribe_Values.Look(ref warnOverlaps, "warnOverlaps", true); Scribe_Collections.Look(ref dismissedOverlaps, "dismissedOverlaps", LookMode.Value); if (Scribe.mode == LoadSaveMode.PostLoadInit || Scribe.mode == LoadSaveMode.LoadingVars) dismissedOverlaps ??= new List(); } /// Back to the shipped values. Leaves the defaults file alone. public void Reset() { var d = new BlaxDefaultsSettings(); enabled = d.enabled; stockpileDefaults = d.stockpileDefaults; storageDefaults = d.storageDefaults; billDefaults = d.billDefaults; warnOverlaps = d.warnOverlaps; dismissedOverlaps = new List(); } } }