52 lines
2.4 KiB
C#
52 lines
2.4 KiB
C#
|
|
using System.Collections.Generic;
|
||
|
|
using Verse;
|
||
|
|
|
||
|
|
namespace BlaxDefaults
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// 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.
|
||
|
|
/// </summary>
|
||
|
|
public class BlaxDefaultsSettings : ModSettings
|
||
|
|
{
|
||
|
|
/// <summary>Master switch. Off: no hook applies anything; the defaults file is kept.</summary>
|
||
|
|
public bool enabled = true;
|
||
|
|
/// <summary>New stockpiles start from their type's default.</summary>
|
||
|
|
public bool stockpileDefaults = true;
|
||
|
|
/// <summary>New storage buildings start from their kind's default.</summary>
|
||
|
|
public bool storageDefaults = true;
|
||
|
|
/// <summary>New production bills get the values of "Every new bill".</summary>
|
||
|
|
public bool billDefaults = true;
|
||
|
|
/// <summary>The settings page and one message per session name active mods that set the same defaults.</summary>
|
||
|
|
public bool warnOverlaps = true;
|
||
|
|
/// <summary>Package ids whose overlap message the player dismissed with "Don't remind me".</summary>
|
||
|
|
public List<string> dismissedOverlaps = new List<string>();
|
||
|
|
|
||
|
|
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<string>();
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>Back to the shipped values. Leaves the defaults file alone.</summary>
|
||
|
|
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<string>();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|