diff --git a/Languages/English/Keyed/Keys.xml b/Languages/English/Keyed/Keys.xml index 5708315..441e841 100644 --- a/Languages/English/Keyed/Keys.xml +++ b/Languages/English/Keyed/Keys.xml @@ -29,6 +29,11 @@ days quadrums + +Power generation multiplier: {0}% +Fuel consumption multiplier: {0}% +Enable easter eggs: + Open console Shows detailed information about the connected power network, and allows you to turn power on and off. diff --git a/Source/AntimatterAnnihilation/AntimatterAnnihilation.csproj b/Source/AntimatterAnnihilation/AntimatterAnnihilation.csproj index 2eb271c..16eaa32 100644 --- a/Source/AntimatterAnnihilation/AntimatterAnnihilation.csproj +++ b/Source/AntimatterAnnihilation/AntimatterAnnihilation.csproj @@ -127,6 +127,7 @@ + diff --git a/Source/AntimatterAnnihilation/Buildings/Building_Megumin.cs b/Source/AntimatterAnnihilation/Buildings/Building_Megumin.cs index c03a831..9758227 100644 --- a/Source/AntimatterAnnihilation/Buildings/Building_Megumin.cs +++ b/Source/AntimatterAnnihilation/Buildings/Building_Megumin.cs @@ -307,6 +307,9 @@ private void StopFireLaser() private void DoEasterEgg() { + if (!Settings.EnableEasterEggs) + return; + // It's a trash anime btw. Genuine waste of time. // You're better off watching JoJo or Cowboy Bebob or KillLaKill. AADefOf.Explosion_Voice_AA.PlayOneShotOnCamera(); diff --git a/Source/AntimatterAnnihilation/Buildings/Building_ReactorInjector.cs b/Source/AntimatterAnnihilation/Buildings/Building_ReactorInjector.cs index f1bbe11..8a0a98b 100644 --- a/Source/AntimatterAnnihilation/Buildings/Building_ReactorInjector.cs +++ b/Source/AntimatterAnnihilation/Buildings/Building_ReactorInjector.cs @@ -83,17 +83,24 @@ public float FuelBurnRate { get { + float b; switch (PowerMode) { case 0: - return 1.5f; + b = 1.5f; + break; case 1: - return 2f; + b = 2f; + break; case 2: - return 4f; + b = 4f; + break; default: - return 1.5f; + b = 1.5f; + break; } + + return b * Settings.FuelConsumeRate; } } @@ -101,17 +108,24 @@ public float PowerOutputMultiplier { get { + float b; switch (PowerMode) { case 0: - return 1f; // 30 KW, 1.5 fuel per day. + b = 1f; // 30 KW, 1.5 fuel per day. + break; case 1: - return 1.5f; // 45 KW, 2 fuel per day (more efficient, but uses all the fuel 1 accelerator produces so no extra). + b = 1.5f; // 45 KW, 2 fuel per day (more efficient, but uses all the fuel 1 accelerator produces so no extra). + break; case 2: - return 4f; // 120 KW, 4 fuel per day (the most efficient, but requires at least 2 accelerators). + b = 4f; // 120 KW, 4 fuel per day (the most efficient, but requires at least 2 accelerators). + break; default: - return 1f; + b = 1f; + break; } + + return b * Settings.PowerGenMulti; } } diff --git a/Source/AntimatterAnnihilation/ModCore.cs b/Source/AntimatterAnnihilation/ModCore.cs index ac0e28f..c0e6062 100644 --- a/Source/AntimatterAnnihilation/ModCore.cs +++ b/Source/AntimatterAnnihilation/ModCore.cs @@ -23,6 +23,8 @@ public ModCore(ModContentPack content) : base(content) PatchAll(); Log($"Patched {HarmonyInstance.GetPatchedMethods().Count()} methods."); + + GetSettings(); // Required. } private void AddHook() @@ -50,5 +52,15 @@ public static void Trace(string msg) { Verse.Log.Message(msg ?? ""); } + + public override string SettingsCategory() + { + return "Antimatter Annihilation"; + } + + public override void DoSettingsWindowContents(Rect inRect) + { + Settings.DoWindow(inRect); + } } } diff --git a/Source/AntimatterAnnihilation/Settings.cs b/Source/AntimatterAnnihilation/Settings.cs new file mode 100644 index 0000000..5482b48 --- /dev/null +++ b/Source/AntimatterAnnihilation/Settings.cs @@ -0,0 +1,46 @@ +using UnityEngine; +using Verse; + +namespace AntimatterAnnihilation +{ + public class Settings : ModSettings + { + public static float PowerGenMulti = 1f; + public static float FuelConsumeRate = 1f; + public static bool EnableEasterEggs = true; + + public override void ExposeData() + { + Scribe_Values.Look(ref PowerGenMulti, "PowerGenMulti", 1f); + Scribe_Values.Look(ref FuelConsumeRate, "FuelConsumeRate", 1f); + Scribe_Values.Look(ref EnableEasterEggs, "EnableEasterEggs", true); + } + + public static void DoWindow(Rect window) + { + DoLabel("AA.PowerGenMulti".Translate($"{PowerGenMulti*100f:F0}")); + PowerGenMulti = Widgets.HorizontalSlider(new Rect(window.x, window.y, window.width * 0.5f, 32), PowerGenMulti, 0.1f, 5f, leftAlignedLabel: "10%", rightAlignedLabel: "500%", roundTo: 0.05f); + MoveDown(32 + 10f); + + DoLabel("AA.FuelConsumeRate".Translate($"{FuelConsumeRate * 100f:F0}")); + FuelConsumeRate = Widgets.HorizontalSlider(new Rect(window.x, window.y, window.width * 0.5f, 32), FuelConsumeRate, 0.05f, 5f, leftAlignedLabel: "5%", rightAlignedLabel: "500%", roundTo: 0.05f); + MoveDown(32 + 10f); + + Widgets.CheckboxLabeled(new Rect(window.x, window.y, 350, 32), "AA.EnableEasterEggs".Translate(), ref EnableEasterEggs, placeCheckboxNearText: true); + MoveDown(32 + 10f); + + void DoLabel(string label) + { + const float HEIGHT = 32; + Widgets.Label(new Rect(window.x, window.y, window.width, HEIGHT), label); + MoveDown(HEIGHT + 10); + } + + void MoveDown(float amount) + { + window.y += amount; + window.height -= amount; + } + } + } +}