From 0fba28fbfd1eced40cfcbab47f65634b5df5b40a Mon Sep 17 00:00:00 2001 From: "Theodore R. Smith" Date: Thu, 2 Feb 2023 10:11:06 -0600 Subject: [PATCH] Rimworld v1.4 support. --- ED-EnhancedOptions/About/About.xml | 7 +- README.md | 3 + .../.idea.ED-EnhancedOptions/.idea/.gitignore | 13 + .../.idea.ED-EnhancedOptions/.idea/.name | 1 + .../.idea/encodings.xml | 4 + .../.idea/indexLayout.xml | 10 + .../.idea.ED-EnhancedOptions/.idea/vcs.xml | 6 + Source/1.0/ED-EnhancedOptions_1.0.csproj | 89 ------ Source/1.1/ED-EnhancedOptions_1.1.csproj | 107 ------- Source/1.2/ED-EnhancedOptions_1.2.csproj | 109 ------- Source/1.3/ED-EnhancedOptions_1.3.csproj | 107 ------- Source/ED-EnhancedOptions.sln | 43 --- .../.idea.ED-EnhancedOptions/.idea/.gitignore | 13 + .../.idea/encodings.xml | 4 + .../.idea/indexLayout.xml | 10 + .../.idea.ED-EnhancedOptions/.idea/vcs.xml | 6 + .../GameComps/GameComponent_LogFileCleanup.cs | 83 +++++ .../1.3/ModSettings_EnhancedOptions.cs | 286 ++++++++++++++++++ .../1.3/Mod_EnhancedOptions.cs | 34 +++ Source/ED-EnhancedOptions/1.3/Patcher.cs | 88 ++++++ .../ED-EnhancedOptions/1.3/Patches/Patch.cs | 52 ++++ .../1.3/Patches/PatchBlightGraphics.cs | 71 +++++ .../1.3/Patches/PatchBuildingTrap.cs | 65 ++++ .../1.3/Patches/PatchBuildingTurretGun.cs | 63 ++++ .../1.3/Patches/PatchBuildingTurretGunCE.cs | 72 +++++ .../1.3/Patches/PatchCompBreakdownable.cs | 46 +++ .../1.3/Patches/PatchCompSchedule.cs | 56 ++++ .../1.3/Patches/PatchDebug.cs | 55 ++++ .../1.3/Patches/PatchFireWatcher.cs | 57 ++++ .../1.3/Patches/PatchLetterStack.cs | 96 ++++++ .../1.3/Patches/PatchMainTabsRoot.cs | 112 +++++++ .../1.3/Patches/PatchPerfs.cs | 52 ++++ .../1.3/Patches/PatchPlant.cs | 57 ++++ .../1.3/Patches/PatchPowerNetGraphics.cs | 47 +++ .../Patches/PatchPreventGreateMemoryTrait.cs | 31 ++ .../1.3/Patches/PatchRoofCollapseBuffer.cs | 49 +++ .../1.3/Patches/PatchSkillRecord.cs | 115 +++++++ .../1.3/Patches/PatchSkillUI.cs | 92 ++++++ .../1.3/Patches/PatchTimeControls.cs | 189 ++++++++++++ .../1.3/Patches/PatchTimeSlower.cs | 57 ++++ .../1.3/Patches/PatchToils_Recipe.cs | 99 ++++++ .../1.3/Properties/AssemblyInfo.cs | 36 +++ Source/ED-EnhancedOptions/1.3/packages.config | 4 + .../ED-EnhancedOptions.csproj | 154 ++++++++++ .../ED-EnhancedOptions/ED-EnhancedOptions.sln | 28 ++ .../ED-EnhancedOptions.sln.DotSettings.user | 8 + 46 files changed, 2328 insertions(+), 458 deletions(-) create mode 100644 Source/.idea/.idea.ED-EnhancedOptions/.idea/.gitignore create mode 100644 Source/.idea/.idea.ED-EnhancedOptions/.idea/.name create mode 100644 Source/.idea/.idea.ED-EnhancedOptions/.idea/encodings.xml create mode 100644 Source/.idea/.idea.ED-EnhancedOptions/.idea/indexLayout.xml create mode 100644 Source/.idea/.idea.ED-EnhancedOptions/.idea/vcs.xml delete mode 100644 Source/1.0/ED-EnhancedOptions_1.0.csproj delete mode 100644 Source/1.1/ED-EnhancedOptions_1.1.csproj delete mode 100644 Source/1.2/ED-EnhancedOptions_1.2.csproj delete mode 100644 Source/1.3/ED-EnhancedOptions_1.3.csproj delete mode 100644 Source/ED-EnhancedOptions.sln create mode 100644 Source/ED-EnhancedOptions/.idea/.idea.ED-EnhancedOptions/.idea/.gitignore create mode 100644 Source/ED-EnhancedOptions/.idea/.idea.ED-EnhancedOptions/.idea/encodings.xml create mode 100644 Source/ED-EnhancedOptions/.idea/.idea.ED-EnhancedOptions/.idea/indexLayout.xml create mode 100644 Source/ED-EnhancedOptions/.idea/.idea.ED-EnhancedOptions/.idea/vcs.xml create mode 100644 Source/ED-EnhancedOptions/1.3/GameComps/GameComponent_LogFileCleanup.cs create mode 100644 Source/ED-EnhancedOptions/1.3/ModSettings_EnhancedOptions.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Mod_EnhancedOptions.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patcher.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/Patch.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchBlightGraphics.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchBuildingTrap.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchBuildingTurretGun.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchBuildingTurretGunCE.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchCompBreakdownable.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchCompSchedule.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchDebug.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchFireWatcher.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchLetterStack.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchMainTabsRoot.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchPerfs.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchPlant.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchPowerNetGraphics.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchPreventGreateMemoryTrait.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchRoofCollapseBuffer.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchSkillRecord.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchSkillUI.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchTimeControls.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchTimeSlower.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Patches/PatchToils_Recipe.cs create mode 100644 Source/ED-EnhancedOptions/1.3/Properties/AssemblyInfo.cs create mode 100644 Source/ED-EnhancedOptions/1.3/packages.config create mode 100755 Source/ED-EnhancedOptions/ED-EnhancedOptions.csproj create mode 100644 Source/ED-EnhancedOptions/ED-EnhancedOptions.sln create mode 100644 Source/ED-EnhancedOptions/ED-EnhancedOptions.sln.DotSettings.user diff --git a/ED-EnhancedOptions/About/About.xml b/ED-EnhancedOptions/About/About.xml index 7d1c3a8..176fea3 100644 --- a/ED-EnhancedOptions/About/About.xml +++ b/ED-EnhancedOptions/About/About.xml @@ -6,11 +6,12 @@
  • 1.0
  • 1.1
  • 1.2
  • -
  • 1.3
  • +
  • 1.3
  • +
  • 1.4
  • Jaxxa https://github.com/jaxxa/JaxxaRimworldReleaseCollection/blob/master/README.md - Version: 1.3.0.0 + Version: 1.4.0.0 Links to all my mods including non steam versions available at: https://github.com/jaxxa/JaxxaRimworldReleaseCollection/blob/master/README.md This now requires the seperate Harmony Mod: @@ -48,4 +49,4 @@ This mod adds various additional options to change the way Rimworld works. These https://github.com/pardeike/HarmonyRimWorld/releases/latest - \ No newline at end of file + diff --git a/README.md b/README.md index 2abfb04..aa84184 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,9 @@ This is the Readme for ED-EnhancedOptions #Change Log +1.4.0.0 + * Update for Rimworld 1.4 + 1.3.0.0 * Update for Rimworld 1.3 * The Numbering scheme has been changed, mostly to back to what it was, the first two will match the version of Rimworld it was built for, then the next two will be major and minor versions of the mod. diff --git a/Source/.idea/.idea.ED-EnhancedOptions/.idea/.gitignore b/Source/.idea/.idea.ED-EnhancedOptions/.idea/.gitignore new file mode 100644 index 0000000..107a548 --- /dev/null +++ b/Source/.idea/.idea.ED-EnhancedOptions/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/modules.xml +/projectSettingsUpdater.xml +/.idea.ED-EnhancedOptions.iml +/contentModel.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/Source/.idea/.idea.ED-EnhancedOptions/.idea/.name b/Source/.idea/.idea.ED-EnhancedOptions/.idea/.name new file mode 100644 index 0000000..6b71841 --- /dev/null +++ b/Source/.idea/.idea.ED-EnhancedOptions/.idea/.name @@ -0,0 +1 @@ +ED-EnhancedOptions \ No newline at end of file diff --git a/Source/.idea/.idea.ED-EnhancedOptions/.idea/encodings.xml b/Source/.idea/.idea.ED-EnhancedOptions/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/Source/.idea/.idea.ED-EnhancedOptions/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Source/.idea/.idea.ED-EnhancedOptions/.idea/indexLayout.xml b/Source/.idea/.idea.ED-EnhancedOptions/.idea/indexLayout.xml new file mode 100644 index 0000000..fa37346 --- /dev/null +++ b/Source/.idea/.idea.ED-EnhancedOptions/.idea/indexLayout.xml @@ -0,0 +1,10 @@ + + + + + ../../ED-EnhancedOptions + + + + + \ No newline at end of file diff --git a/Source/.idea/.idea.ED-EnhancedOptions/.idea/vcs.xml b/Source/.idea/.idea.ED-EnhancedOptions/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/Source/.idea/.idea.ED-EnhancedOptions/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Source/1.0/ED-EnhancedOptions_1.0.csproj b/Source/1.0/ED-EnhancedOptions_1.0.csproj deleted file mode 100644 index b281b38..0000000 --- a/Source/1.0/ED-EnhancedOptions_1.0.csproj +++ /dev/null @@ -1,89 +0,0 @@ - - - - - Debug - AnyCPU - {975C4632-336D-4100-87BB-32D726A1D86D} - Library - Properties - EnhancedDevelopment.EnhancedOptions - ED-EnhancedOptions - v3.5 - 512 - - - - false - none - false - ..\..\ED-EnhancedOptions\1.0\Assemblies\ - DEBUG;TRACE - prompt - 4 - - - none - true - ..\..\ED-EnhancedOptions\1.0\Assemblies\ - TRACE - prompt - 4 - - - - ..\..\..\..\RW-DLL\Harmony\1.2.0.1\Release\net35\0Harmony.dll - - - ..\..\..\..\RW-DLL\1.0\2408\Assembly-CSharp.dll - False - - - - - - - - - ..\..\..\..\RW-DLL\1.0\2408\UnityEngine.dll - False - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Source/1.1/ED-EnhancedOptions_1.1.csproj b/Source/1.1/ED-EnhancedOptions_1.1.csproj deleted file mode 100644 index aa181ce..0000000 --- a/Source/1.1/ED-EnhancedOptions_1.1.csproj +++ /dev/null @@ -1,107 +0,0 @@ - - - - - Debug - AnyCPU - {78B2EE68-44B2-44D8-A3CB-D30454DB696D} - Library - Properties - EnhancedDevelopment.EnhancedOptions - ED-EnhancedOptions - v4.7.2 - 512 - - - - false - none - false - ..\..\ED-EnhancedOptions\1.1\Assemblies\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - ..\..\ED-EnhancedOptions\1.1\Assemblies\ - TRACE - prompt - 4 - false - - - - ..\..\..\..\RW-DLL\Harmony\~Release 4.7.2\0Harmony.dll - False - - - ..\..\..\..\RW-DLL\1.1\Assembly-CSharp.dll - False - - - - - - - - - - ..\..\..\..\RW-DLL\1.1\UnityEngine.dll - False - - - ..\..\..\..\RW-DLL\1.1\UnityEngine.CoreModule.dll - False - - - ..\..\..\..\RW-DLL\1.1\UnityEngine.IMGUIModule.dll - False - - - ..\..\..\..\RW-DLL\1.1\UnityEngine.TextRenderingModule.dll - False - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Source/1.2/ED-EnhancedOptions_1.2.csproj b/Source/1.2/ED-EnhancedOptions_1.2.csproj deleted file mode 100644 index d295b17..0000000 --- a/Source/1.2/ED-EnhancedOptions_1.2.csproj +++ /dev/null @@ -1,109 +0,0 @@ - - - - - Debug - AnyCPU - {B0CF39DE-E739-4E98-BDAF-192C21FDD018} - Library - Properties - EnhancedDevelopment.EnhancedOptions - ED-EnhancedOptions - v4.7.2 - 512 - - - - false - none - false - ..\..\ED-EnhancedOptions\1.2\Assemblies\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - ..\..\ED-EnhancedOptions\1.2\Assemblies\ - TRACE - prompt - 4 - false - - - - ..\..\..\..\RW-DLL\Harmony\~Release 4.7.2\0Harmony.dll - False - - - ..\..\..\..\RW-DLL\1.2\Assembly-CSharp.dll - False - - - - - - - - - - ..\..\..\..\RW-DLL\1.2\UnityEngine.dll - False - False - - - ..\..\..\..\RW-DLL\1.2\UnityEngine.CoreModule.dll - False - False - - - ..\..\..\..\RW-DLL\1.2\UnityEngine.IMGUIModule.dll - False - - - ..\..\..\..\RW-DLL\1.2\UnityEngine.TextRenderingModule.dll - False - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Source/1.3/ED-EnhancedOptions_1.3.csproj b/Source/1.3/ED-EnhancedOptions_1.3.csproj deleted file mode 100644 index 8feb89b..0000000 --- a/Source/1.3/ED-EnhancedOptions_1.3.csproj +++ /dev/null @@ -1,107 +0,0 @@ - - - - - Debug - AnyCPU - {980DEC02-7956-4981-98E6-E82BB4EB6FFA} - Library - Properties - EnhancedDevelopment.EnhancedOptions - ED-EnhancedOptions - v4.7.2 - 512 - - - - false - none - false - ..\..\ED-EnhancedOptions\1.3\Assemblies\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - ..\..\ED-EnhancedOptions\1.3\Assemblies\ - TRACE - prompt - 4 - false - - - - ..\..\..\..\RW-DLL\Harmony\~Release 4.7.2\0Harmony.dll - False - - - ..\..\..\..\RW-DLL\1.3\Assembly-CSharp.dll - False - - - - - - - - - - ..\..\..\..\RW-DLL\1.3\UnityEngine.dll - False - - - ..\..\..\..\RW-DLL\1.3\UnityEngine.CoreModule.dll - False - - - ..\..\..\..\RW-DLL\1.3\UnityEngine.IMGUIModule.dll - False - - - ..\..\..\..\RW-DLL\1.3\UnityEngine.TextRenderingModule.dll - False - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Source/ED-EnhancedOptions.sln b/Source/ED-EnhancedOptions.sln deleted file mode 100644 index f528e74..0000000 --- a/Source/ED-EnhancedOptions.sln +++ /dev/null @@ -1,43 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29424.173 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ED-EnhancedOptions_1.0", "1.0\ED-EnhancedOptions_1.0.csproj", "{975C4632-336D-4100-87BB-32D726A1D86D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ED-EnhancedOptions_1.1", "1.1\ED-EnhancedOptions_1.1.csproj", "{78B2EE68-44B2-44D8-A3CB-D30454DB696D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ED-EnhancedOptions_1.2", "1.2\ED-EnhancedOptions_1.2.csproj", "{B0CF39DE-E739-4E98-BDAF-192C21FDD018}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ED-EnhancedOptions_1.3", "1.3\ED-EnhancedOptions_1.3.csproj", "{980DEC02-7956-4981-98E6-E82BB4EB6FFA}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {975C4632-336D-4100-87BB-32D726A1D86D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {975C4632-336D-4100-87BB-32D726A1D86D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {975C4632-336D-4100-87BB-32D726A1D86D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {975C4632-336D-4100-87BB-32D726A1D86D}.Release|Any CPU.Build.0 = Release|Any CPU - {78B2EE68-44B2-44D8-A3CB-D30454DB696D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {78B2EE68-44B2-44D8-A3CB-D30454DB696D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {78B2EE68-44B2-44D8-A3CB-D30454DB696D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {78B2EE68-44B2-44D8-A3CB-D30454DB696D}.Release|Any CPU.Build.0 = Release|Any CPU - {B0CF39DE-E739-4E98-BDAF-192C21FDD018}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B0CF39DE-E739-4E98-BDAF-192C21FDD018}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B0CF39DE-E739-4E98-BDAF-192C21FDD018}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B0CF39DE-E739-4E98-BDAF-192C21FDD018}.Release|Any CPU.Build.0 = Release|Any CPU - {980DEC02-7956-4981-98E6-E82BB4EB6FFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {980DEC02-7956-4981-98E6-E82BB4EB6FFA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {980DEC02-7956-4981-98E6-E82BB4EB6FFA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {980DEC02-7956-4981-98E6-E82BB4EB6FFA}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {8A973F65-A364-42F6-9EC8-4D876A8CA889} - EndGlobalSection -EndGlobal diff --git a/Source/ED-EnhancedOptions/.idea/.idea.ED-EnhancedOptions/.idea/.gitignore b/Source/ED-EnhancedOptions/.idea/.idea.ED-EnhancedOptions/.idea/.gitignore new file mode 100644 index 0000000..791083b --- /dev/null +++ b/Source/ED-EnhancedOptions/.idea/.idea.ED-EnhancedOptions/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/projectSettingsUpdater.xml +/.idea.ED-EnhancedOptions.iml +/modules.xml +/contentModel.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/Source/ED-EnhancedOptions/.idea/.idea.ED-EnhancedOptions/.idea/encodings.xml b/Source/ED-EnhancedOptions/.idea/.idea.ED-EnhancedOptions/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/Source/ED-EnhancedOptions/.idea/.idea.ED-EnhancedOptions/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Source/ED-EnhancedOptions/.idea/.idea.ED-EnhancedOptions/.idea/indexLayout.xml b/Source/ED-EnhancedOptions/.idea/.idea.ED-EnhancedOptions/.idea/indexLayout.xml new file mode 100644 index 0000000..fdfce78 --- /dev/null +++ b/Source/ED-EnhancedOptions/.idea/.idea.ED-EnhancedOptions/.idea/indexLayout.xml @@ -0,0 +1,10 @@ + + + + + ../../../ED-EnhancedOptions + + + + + \ No newline at end of file diff --git a/Source/ED-EnhancedOptions/.idea/.idea.ED-EnhancedOptions/.idea/vcs.xml b/Source/ED-EnhancedOptions/.idea/.idea.ED-EnhancedOptions/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/Source/ED-EnhancedOptions/.idea/.idea.ED-EnhancedOptions/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Source/ED-EnhancedOptions/1.3/GameComps/GameComponent_LogFileCleanup.cs b/Source/ED-EnhancedOptions/1.3/GameComps/GameComponent_LogFileCleanup.cs new file mode 100644 index 0000000..7834f6d --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/GameComps/GameComponent_LogFileCleanup.cs @@ -0,0 +1,83 @@ +/*using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions.GameComps +{ + class GameComponent_LogFileCleanup : Verse.GameComponent + { + private System.IO.FileInfo LogFile; + + public GameComponent_LogFileCleanup(Game game)// : base() + { + Log.Message("GameComponent_LogFileCleanup.GameComponent_LogFileCleanup()"); + if (LogFile != null) + { + Log.Message("GameComponent_LogFileCleanup Skipping Setup, LogFile initilised."); + return; + } + + String _FolderNamre = System.IO.Directory.GetDirectories("./").Where(d => d.Contains("Data")).FirstOrDefault(); + + if (_FolderNamre == null) + { + Log.Message("GameComponent_LogFileCleanup Failed, Folder not Found."); + return; + } + + this.LogFile = new System.IO.FileInfo("./" + _FolderNamre + "/output_log.txt"); + Log.Message("LogFile Found: " + this.LogFile.Exists.ToString()); + } + + public override void GameComponentTick() + { + base.GameComponentTick(); + + //Only Run if Enabled. + if (!Mod_EnhancedOptions.Settings.CheckLogFileSize) + { + return; + } + + //In - Game Time Ticks Real Time + //1.5 Min 60 1s + //1 Hour 60 Min 2,500 41s + //1 Day 24 Hours 60,000 16m 40s + //1 Quadrum 15 Days 900,000 4h 10m 0s + //1 Year 4 Quadrums 3,600,000 16h 40m 0s + + //Only Run every x Ticks. + if (Find.TickManager.TicksGame % 60000 != 0) + { + return; + } + + //Only Run if LogFile is Setup + if (this.LogFile == null) + { + return; + } + + this.LogFile.Refresh(); + long _FileSizeInBytes = this.LogFile.Length; + long _FileSizeInMB = _FileSizeInBytes / (1024 * 1024); + int _MaxFileSizeMB = Mod_EnhancedOptions.Settings.LogFileSizeThresholdMB; + + //Log.Message("_FileSizeInMB" + _FileSizeInMB); + if (_FileSizeInMB > _MaxFileSizeMB) + { + String _Message = "Warning: Log File Size Exceeds " + _MaxFileSizeMB + " MB - Current Size " + _FileSizeInMB + " MB. This Probably indicates repeating Errors that should be fixed."; + + //Log.Error(_Message); + Find.LetterStack.ReceiveLetter("Warning: Log File Size", _Message, RimWorld.LetterDefOf.NegativeEvent, (string)null); + Messages.Message(_Message, RimWorld.MessageTypeDefOf.NegativeEvent); + + } + } + + + } +} +*/ \ No newline at end of file diff --git a/Source/ED-EnhancedOptions/1.3/ModSettings_EnhancedOptions.cs b/Source/ED-EnhancedOptions/1.3/ModSettings_EnhancedOptions.cs new file mode 100644 index 0000000..92ac739 --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/ModSettings_EnhancedOptions.cs @@ -0,0 +1,286 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions +{ + class ModSettings_EnhancedOptions : ModSettings + { + //Un Saved + string _Buffer_LearnFactorPassionNone; + string _Buffer_LearnFactorPassionMinor; + string _Buffer_LearnFactorPassionMajor; + string _Buffer_DailyLearningSaturationAmmount; + + //Saved + public bool ShowLettersThreatBig = true; + public bool ShowLettersThreatSmall = true; + public bool ShowLettersNegativeEvent = true; + public bool ShowLettersNeutralEvent = true; + public bool ShowLettersPositiveEvent = true; + public bool ShowLettersItemStashFeeDemand = true; + + public bool LetterNamesToSuppressEnabled = false; + public string LetterNamesToSuppress = String.Empty; + public bool DebugLogLetters = false; + + public bool Plant24HEnabled = false; + public bool PlantLights24HEnabled = false; + + public bool SafeTrapEnabled = false; + public bool TurretControlEnabled = false; + public bool HidePowerConnections = false; + + public bool SuppressBreakdown = false; + //public bool LockDevMode = false; + public bool Speed4WithoutDev = false; + public bool SuppressCombatSlowdown = false; + public bool HideSpots = false; + public bool SuppressRoofColapse = false; + public bool SuppressRainFire = false; + //public bool CheckLogFileSize = false; + //public int LogFileSizeThresholdMB = 50; + public bool SupressWritingToLogFile = false; + + /* + /// + /// DrawSize of the Blight, Default 1 + /// + public float BlightScale = 1; + + /// + /// Number of the Image to use for the Blight + /// + /// 0 = Default + /// 1 = Red + /// 2 = Blue + /// 3 = Orange + /// 4 = Purple + /// + /// + public int BlightImageIndex = 0; + */ + + //public bool SuppressStrippingCremationCorps = false; + + public bool ApplyLearnChanges = false; + public int LearnFactorPassionNonePercentage = 35; + public int LearnFactorPassionMinorPercentage = 100; + public int LearnFactorPassionMajorPercentage = 150; + public int DailyLearningSaturationAmmount = 4000; + public bool PreventSkillDecay = false; + + + + public override void ExposeData() + { + base.ExposeData(); + + Scribe_Values.Look(ref ShowLettersThreatBig, "ShowLettersThreatBig", true); + Scribe_Values.Look(ref ShowLettersThreatSmall, "ShowLettersThreatSmall", true); + Scribe_Values.Look(ref ShowLettersNegativeEvent, "ShowLettersNegativeEvent", true); + Scribe_Values.Look(ref ShowLettersNeutralEvent, "ShowLettersNeutralEvent", true); + Scribe_Values.Look(ref ShowLettersPositiveEvent, "ShowLettersPositiveEvent", true); + Scribe_Values.Look(ref ShowLettersItemStashFeeDemand, "ShowLettersItemStashFeeDemand", true); + Scribe_Values.Look(ref LetterNamesToSuppressEnabled, "LetterNamesToSuppressEnabled", false); + Scribe_Values.Look(ref LetterNamesToSuppress, "LetterNamesToSuppress", String.Empty); + Scribe_Values.Look(ref DebugLogLetters, "DebugLogLetters", false); + + + Scribe_Values.Look(ref Plant24HEnabled, "Plant24HEnabled", false); + Scribe_Values.Look(ref PlantLights24HEnabled, "PlantLights24HEnabled", false); + Scribe_Values.Look(ref SafeTrapEnabled, "SafeTrapEnabled", false); + Scribe_Values.Look(ref TurretControlEnabled, "TurretControlEnabled", false); + Scribe_Values.Look(ref HidePowerConnections, "HidePowerConnections", false); + Scribe_Values.Look(ref SuppressBreakdown, "SuppressBreakdown", false); + //Scribe_Values.Look(ref LockDevMode, "LockDevMode", false); + Scribe_Values.Look(ref Speed4WithoutDev, "Speed4WithoutDev", false); + Scribe_Values.Look(ref SuppressCombatSlowdown, "SuppressCombatSlowdown", false); + + //Scribe_Values.Look(ref BlightScale, "BlightScale", 1); + //Scribe_Values.Look(ref BlightImageIndex, "BlightImageIndex", 0); + + //Scribe_Values.Look(ref SuppressStrippingCremationCorps, "SuppressStrippingCremationCorps", false); + Scribe_Values.Look(ref HideSpots, "HideSpots", false); + Scribe_Values.Look(ref SuppressRoofColapse, "SuppressRoofColapse", false); + Scribe_Values.Look(ref SuppressRainFire, "SuppressRainFire", false); + + //Scribe_Values.Look(ref CheckLogFileSize, "CheckLogFileSize", false); + //Scribe_Values.Look(ref LogFileSizeThresholdMB, "LogFileSizeThresholdMB", 50); + Scribe_Values.Look(ref SupressWritingToLogFile, "SupressWritingToLogFile", false); + + Scribe_Values.Look(ref ApplyLearnChanges, "ApplyLearnFactorChanges", false); + Scribe_Values.Look(ref LearnFactorPassionNonePercentage, "LearnFactorPassionNonePercentage", 35); + Scribe_Values.Look(ref LearnFactorPassionMinorPercentage, "LearnFactorPassionMinorPercentage", 100); + Scribe_Values.Look(ref LearnFactorPassionMajorPercentage, "LearnFactorPassionMajorPercentage", 150); + Scribe_Values.Look(ref DailyLearningSaturationAmmount, "DailyLearningSaturationAmmount", 4000); + Scribe_Values.Look(ref PreventSkillDecay, "PreventSkillDecay", false); + + + + + } + + public void DoSettingsWindowContents(Rect canvas) + { + Listing_Standard _Listing_Standard = new Listing_Standard(); + _Listing_Standard.ColumnWidth = 275f; + _Listing_Standard.Begin(canvas); + //listing_Standard.set_ColumnWidth(rect.get_width() - 4f); + + _Listing_Standard.Label("THESE SETTINGS ARE ONLY APPLIED WHEN RIMWORLD IS STARTED. After modifying them please restart Rimworld."); + _Listing_Standard.GapLine(12f); + _Listing_Standard.Label("Letter Suppression:"); + _Listing_Standard.Gap(12f); + _Listing_Standard.CheckboxLabeled("Show ThreatBig", ref ShowLettersThreatBig, "True if you want to See Any ThreatBig Letters, False will Hide them. When a Letter is Shown its Name and Type will be written to the Log."); + _Listing_Standard.CheckboxLabeled("Show ThreatSmall", ref ShowLettersThreatSmall, "True if you want to See Any ThreatSmall Letters, False will Hide them. When a Letter is Shown its Name and Type will be written to the Log."); + _Listing_Standard.CheckboxLabeled("Show NegativeEvent", ref ShowLettersNegativeEvent, "True if you want to See Any NegativeEvent Letters, False will Hide them. When a Letter is Shown its Name and Type will be written to the Log."); + _Listing_Standard.CheckboxLabeled("Show NeutralEvent", ref ShowLettersNeutralEvent, "True if you want to See Any NeutralEvent Letters, False will Hide them. When a Letter is Shown its Name and Type will be written to the Log."); + _Listing_Standard.CheckboxLabeled("Show PositiveEvent", ref ShowLettersPositiveEvent, "True if you want to See Any PositiveEvent Letters, False will Hide them. When a Letter is Shown its Name and Type will be written to the Log."); + _Listing_Standard.CheckboxLabeled("Show ItemStashFeeDemand", ref ShowLettersItemStashFeeDemand, "True if you want to See Any ItemStashFeeDemand Letters, False will Hide them. When a Letter is Shown its Name and Type will be written to the Log."); + _Listing_Standard.Gap(12f); + _Listing_Standard.CheckboxLabeled("Letter Names To Suppress Enabled", ref LetterNamesToSuppressEnabled, "True will Hide any Letters thats Name is in the following List, False to Ignore the List. List is Comma Separated. When a Letter is Shown its Name and Type will be written to the Log."); + LetterNamesToSuppress = _Listing_Standard.TextEntry(LetterNamesToSuppress, 2); + + _Listing_Standard.CheckboxLabeled("Write Debug Log Letters", ref DebugLogLetters, "True if you want to Log the Letters to the Log file, useful for finding the mane so you can suppress it."); + + + + _Listing_Standard.GapLine(12f); + + _Listing_Standard.Label("Plant 24H:"); + _Listing_Standard.CheckboxLabeled("Plant 24H", ref Plant24HEnabled, "Enable to allow Plants to Grow 24H a day."); + _Listing_Standard.CheckboxLabeled("Plant Lights 24H", ref PlantLights24HEnabled, "Enable to allow SunLamps to Shine 24H a day."); + _Listing_Standard.GapLine(12f); + _Listing_Standard.Label("Safe Trap Enabled:"); + _Listing_Standard.CheckboxLabeled("Safe Trap Enabled", ref SafeTrapEnabled, "Prevents Traps from triggering on your Colonists."); + _Listing_Standard.GapLine(12f); + _Listing_Standard.Label("Turret Control Enabled:"); + _Listing_Standard.CheckboxLabeled("Turret Control Enabled", ref TurretControlEnabled, "Allows force attack commands to be given to turrets."); + _Listing_Standard.GapLine(12f); + _Listing_Standard.Label("Hide Power Connections:"); + _Listing_Standard.CheckboxLabeled("Hide Power Connections", ref HidePowerConnections, "Hides the Small Power Connection Wires, Still show in Power overlay Mode."); + _Listing_Standard.GapLine(12f); + _Listing_Standard.Label("Suppress Breakdown:"); + _Listing_Standard.CheckboxLabeled("Suppress Breakdown", ref SuppressBreakdown, "Suppress random Breakdowns, This was hard to test so please let me know if you have any issues."); + _Listing_Standard.GapLine(12f); + //_Listing_Standard.Label("Suppress LockDevMode:"); + //_Listing_Standard.CheckboxLabeled("Suppress LockDevMode", ref LockDevMode, "Lock Dev Mode to its Current Selection."); + //_Listing_Standard.GapLine(12f); + _Listing_Standard.Label("Time Speed:"); + _Listing_Standard.CheckboxLabeled("Allow Speed4 Without Dev Mode", ref Speed4WithoutDev, "Allow Speed4 Without Dev Mode needing to be enabled, can be turned on by pressing '4'."); + _Listing_Standard.CheckboxLabeled("Suppress Combat Slowdown", ref SuppressCombatSlowdown, "Suppress Limiting Speed in Combat."); + + /* + _Listing_Standard.GapLine(12f); + _Listing_Standard.Label("Blight:"); + _Listing_Standard.Label("Blight Scale: " + BlightScale); + BlightScale = (float)Math.Round((Double)_Listing_Standard.Slider(BlightScale, 1, 10), 1); + + String _CurrentBlightImageDescription = string.Empty; + switch (BlightImageIndex) + { + case 0: + _CurrentBlightImageDescription = "Default"; + break; + case 1: + _CurrentBlightImageDescription = "Red"; + break; + case 2: + _CurrentBlightImageDescription = "Blue"; + break; + case 3: + _CurrentBlightImageDescription = "Orange"; + break; + case 4: + _CurrentBlightImageDescription = "Purple"; + break; + default: + _CurrentBlightImageDescription = "Default"; + break; + } + + + Rect _BlightSelection = _Listing_Standard.GetRect(30f); + Widgets.Label(_BlightSelection.RightHalf(), _CurrentBlightImageDescription); + if (Widgets.ButtonText(_BlightSelection.LeftHalf(), "Select Blight:")) + { + Find.WindowStack.Add( + new FloatMenu(new List { + new FloatMenuOption("Default (Green)", () => BlightImageIndex = 0), + new FloatMenuOption("Red", () => BlightImageIndex = 1), + new FloatMenuOption("Blue", () => BlightImageIndex = 2), + new FloatMenuOption("Orange", () => BlightImageIndex = 3), + new FloatMenuOption("Purple", () => BlightImageIndex = 4) + })); + } + + + _Listing_Standard.GapLine(12f); + _Listing_Standard.Label("Suppress Stripping Cremation Corps:"); + _Listing_Standard.CheckboxLabeled("SuppressStrippingCremationCorps", ref SuppressStrippingCremationCorps, "Stops Gear and Apparel from being removed from a Corps before Cremation, all gear will be lost."); + */ + + _Listing_Standard.GapLine(12f); + _Listing_Standard.Label("Hide Spots:"); + _Listing_Standard.CheckboxLabeled("Hide Spots", ref HideSpots, "Stops Marriage, Caravan Packing and Party Spots from being show all the time. They will still show when Architect menu is open or one of the spots is the first thing selected. (Only checks when menu is changed)"); + + _Listing_Standard.GapLine(12f); + _Listing_Standard.Label("Suppress Roof Colapse"); + _Listing_Standard.CheckboxLabeled("Suppress Roof Colapse", ref SuppressRoofColapse, "Stops the Roof from Collapsing when support Pillars are removed."); + + _Listing_Standard.GapLine(12f); + _Listing_Standard.Label("Suppress Rain Fire"); + _Listing_Standard.CheckboxLabeled("Suppress Rain Fire", ref SuppressRainFire, "Stops Fires from Causing Rain, Warning can burn the whole map and large fires can cause lag when they are burning."); + + _Listing_Standard.NewColumn(); + _Listing_Standard.GapLine(12f); + + _Listing_Standard.Label("Log File"); + //_Listing_Standard.Label("Current Check Size:" + LogFileSizeThresholdMB + " MB."); + //_Listing_Standard.CheckboxLabeled("Check Log File Size", ref CheckLogFileSize, "Checks once every Ingame Day the Size of the Log File, raises an Alert if the Size is > " + LogFileSizeThresholdMB.ToString() + " MB."); + //_Listing_Standard.IntAdjuster(ref LogFileSizeThresholdMB, 10, 10); + _Listing_Standard.CheckboxLabeled("Supress Writing Log to File-Tooltip", ref SupressWritingToLogFile, "When Checked log messages will no longer be written to disk.If you are using this because your log file is getting massive that indicated errors that you should really fix(or report to mod/ game developers to fix). But if you are not going to do that then you may as well use this so you don’t have to deal with Multi GB Log files cluttering you HDD/ SSD and wearing them out and it might even increase performance ingame for you, but really it would be better if you could go fix the errors."); + _Listing_Standard.GapLine(12f); + + _Listing_Standard.Label("Learning Speed Percentages:"); + + _Listing_Standard.CheckboxLabeled("Learning Changes", ref ApplyLearnChanges, "Must be enabled to apply the following settings."); + if (ApplyLearnChanges) + { + + DrawPassionPercentage(_Listing_Standard, "No Passion%: ", ref LearnFactorPassionNonePercentage, ref _Buffer_LearnFactorPassionNone, 35); + DrawPassionPercentage(_Listing_Standard, "Minor Pass%: ", ref LearnFactorPassionMinorPercentage, ref _Buffer_LearnFactorPassionMinor, 100); + DrawPassionPercentage(_Listing_Standard, "Major Pass%: ", ref LearnFactorPassionMajorPercentage, ref _Buffer_LearnFactorPassionMajor, 150); + DrawPassionPercentage(_Listing_Standard, "Daily Cap: ", ref DailyLearningSaturationAmmount, ref _Buffer_DailyLearningSaturationAmmount, 4000); + + _Listing_Standard.CheckboxLabeled("Stop Decay and GreatMemory Trait", ref PreventSkillDecay, "Stops Skill Decay and GreatMemory Trait."); + } + + _Listing_Standard.GapLine(12f); + _Listing_Standard.End(); + } + + private void DrawPassionPercentage(Listing_Standard parentListing, string description, ref int passionPercentage, ref string buffer, int defaultValue) + { + Rect _Rect = parentListing.GetRect(30f); + buffer = null; + + Listing_Standard _Listing_Text = new Listing_Standard(); + _Listing_Text.Begin(_Rect.LeftPartPixels(190)); + _Listing_Text.TextFieldNumericLabeled(description, ref passionPercentage, ref buffer); + _Listing_Text.End(); + + Listing_Standard _Listing_Button = new Listing_Standard(); + _Listing_Button.Begin(_Rect.RightPartPixels(75)); + _Listing_Button.IntSetter(ref passionPercentage, defaultValue, "Default"); + _Listing_Button.End(); + } + + }//Class + + +} //NameSpace diff --git a/Source/ED-EnhancedOptions/1.3/Mod_EnhancedOptions.cs b/Source/ED-EnhancedOptions/1.3/Mod_EnhancedOptions.cs new file mode 100644 index 0000000..31b15e8 --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Mod_EnhancedOptions.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions +{ + class Mod_EnhancedOptions : Verse.Mod + { + + public static ModSettings_EnhancedOptions Settings; + + public Mod_EnhancedOptions(ModContentPack content) : base(content) + { + Mod_EnhancedOptions.Settings = GetSettings(); + } + + public override string SettingsCategory() + { + return "ED-Enhanced Options"; + //return base.SettingsCategory(); + } + + + public override void DoSettingsWindowContents(Rect inRect) + { + Settings.DoSettingsWindowContents(inRect); + //base.DoSettingsWindowContents(inRect); + } + + } +} diff --git a/Source/ED-EnhancedOptions/1.3/Patcher.cs b/Source/ED-EnhancedOptions/1.3/Patcher.cs new file mode 100644 index 0000000..f4be910 --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patcher.cs @@ -0,0 +1,88 @@ +using EnhancedDevelopment.EnhancedOptions.Detours; +using HarmonyLib; +using RimWorld; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using UnityEngine; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions +{ + [StaticConstructorOnStartup] + internal class Patcher + { + static Patcher() + { + string _LogLocation = "EnhancedOptions.Patcher.Patcher(): "; + + Log.Message(_LogLocation + "Starting Patching."); + + //Create List of Patches + List _Patches = new List(); + _Patches.Add(new PatchDebug()); + //_Patches.Add(new PatchBlightGraphics()); + _Patches.Add(new PatchBuildingTrap()); + _Patches.Add(new PatchBuildingTurretGun()); + _Patches.Add(new PatchCompBreakdownable()); + _Patches.Add(new PatchCompSchedule()); + _Patches.Add(new PatchLetterStack()); + _Patches.Add(new PatchMainTabsRoot()); + //_Patches.Add(new PatchPerfs()); + _Patches.Add(new PatchPlant()); + _Patches.Add(new PatchPowerNetGraphics()); + _Patches.Add(new PatchTimeControls()); + _Patches.Add(new PatchTimeSlower()); + //_Patches.Add(new PatchToils_Recipe()); + _Patches.Add(new PatchRoofCollapseBuffer()); + _Patches.Add(new PatchFireWatcher()); + _Patches.Add(new PatchSkillRecord()); + _Patches.Add(new PatchSkillUI()); + //_Patches.Add(new PatchBuilding_TurretGunCE()); + _Patches.Add(new PatchPreventGreatMemoryTrait()); + + //Create Harmony Instance + + Harmony _Harmony = new HarmonyLib.Harmony("EnhancedDevelopment.WarningOptions"); + + //Iterate Patches + _Patches.ForEach(p => p.ApplyPatchIfRequired(_Harmony)); + + Log.Message(_LogLocation + "Completed Patching."); + } + + /// + /// Debug Logging Helper + /// + /// + /// + /// + public static void LogNULL(object objectToTest, String name, bool logSucess = false) + { + if (objectToTest == null) + { + Log.Error(name + " Is NULL."); + } + else if (logSucess) + { + Log.Message(name + " Is Not NULL."); + } + } + + /// + /// Logs Messages only if in Verbose Mode. + /// + /// The Message to Log if in Verbose Mode. + public static void LogMessageIfVerbose(string messageToLog) + { + if (Prefs.LogVerbose) + { + Log.Message(messageToLog); + } + } + + } + +} diff --git a/Source/ED-EnhancedOptions/1.3/Patches/Patch.cs b/Source/ED-EnhancedOptions/1.3/Patches/Patch.cs new file mode 100644 index 0000000..9315396 --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/Patch.cs @@ -0,0 +1,52 @@ +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions +{ + abstract class Patch + { + /// + /// Checks if this Patch should be applied now. + /// + /// Returns true if the Patch should be applied. + protected abstract bool ShouldPatchApply(); + + /// + /// Apply the patch. + /// + protected abstract void ApplyPatch(Harmony harmony = null); + + /// + /// The Description of this patch. + /// Mainly used for logging. + /// + /// The Patch Description. + protected abstract string PatchDescription(); + + /// + /// Checks if this Patch needs to be applied, and applies if needed. + /// + public void ApplyPatchIfRequired(Harmony harmony = null) + { + string _LogLocation = "EnhancedOptions.Patch.ApplyPatchIfRequired: "; + + if (this.ShouldPatchApply()) + { + Patcher.LogMessageIfVerbose(_LogLocation + "Applying Patch: " + this.PatchDescription()); + this.ApplyPatch(harmony); + Patcher.LogMessageIfVerbose(_LogLocation + "Applied Patch: " + this.PatchDescription()); + } + else + { + Patcher.LogMessageIfVerbose(_LogLocation + "Skipping Applying Patch: " + this.PatchDescription()); + } + } + + + + } +} diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchBlightGraphics.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchBlightGraphics.cs new file mode 100644 index 0000000..dd484dd --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchBlightGraphics.cs @@ -0,0 +1,71 @@ +using HarmonyLib; +using RimWorld; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine; +using Verse; +/* +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + class PatchBlightGraphics : Patch + { + + protected override string PatchDescription() + { + return "Blight Graphics"; + } + + protected override bool ShouldPatchApply() + { + return true; + } + + protected override void ApplyPatch(HarmonyInstance harmony = null) + { + if (Mod_EnhancedOptions.Settings.BlightImageIndex != 0) + { + String _BlightPath = string.Empty; + switch (Mod_EnhancedOptions.Settings.BlightImageIndex) + { + case 0: + _BlightPath = "Things/Plant/Blight"; + break; + case 1: + _BlightPath = "Things/Plant/Blights/Blight_Red"; + break; + case 2: + _BlightPath = "Things/Plant/Blights/Blight_Blue"; + break; + case 3: + _BlightPath = "Things/Plant/Blights/Blight_Orange"; + break; + case 4: + _BlightPath = "Things/Plant/Blights/Blight_Purple"; + break; + default: + _BlightPath = "Things/Plant/Blight"; + break; + } + + GraphicRequest requestActive = new GraphicRequest(Type.GetType("Graphic_Single"), + _BlightPath, + ShaderDatabase.DefaultShader, + new Vector2(1, + 1), + Color.white, + Color.white, + new GraphicData(), 1); + ThingDefOf.Blight.graphic.Init(requestActive); + } + + + if (Mod_EnhancedOptions.Settings.BlightScale != 1) + { + ThingDefOf.Blight.graphic.drawSize = new Vector2(Mod_EnhancedOptions.Settings.BlightScale, Mod_EnhancedOptions.Settings.BlightScale); + } + } + } +} +*/ \ No newline at end of file diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchBuildingTrap.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchBuildingTrap.cs new file mode 100644 index 0000000..40d0dbd --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchBuildingTrap.cs @@ -0,0 +1,65 @@ +using HarmonyLib; +using RimWorld; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + class PatchBuildingTrap : Patch + { + + protected override void ApplyPatch(Harmony harmony = null) + { + //Get the Origional CheckSpring Method + MethodInfo _RimWorld_BuildingTrap_CheckSpring = typeof(RimWorld.Building_Trap).GetMethod("CheckSpring", BindingFlags.NonPublic | BindingFlags.Instance); + Patcher.LogNULL(_RimWorld_BuildingTrap_CheckSpring, "_RimWorld_BuildingTrap_CheckSpring"); + + //Get the Prefix Patch + MethodInfo _CheckSpringPrefix = typeof(PatchBuildingTrap).GetMethod("CheckSpringPrefix", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_CheckSpringPrefix, "_CheckSpringPrefix"); + + //Apply the Prefix Patch + harmony.Patch(_RimWorld_BuildingTrap_CheckSpring, new HarmonyMethod(_CheckSpringPrefix), null); + } + + protected override string PatchDescription() + { + return "PatchBuildingTrap"; + } + + protected override bool ShouldPatchApply() + { + return Mod_EnhancedOptions.Settings.SafeTrapEnabled; + } + + + // prefix + // - wants instance, result and count + // - wants to change count + // - returns a boolean that controls if original is executed (true) or not (false) + public static Boolean CheckSpringPrefix(Pawn p) + { + + if (p == null) { return true; } + + if (p.Faction == null) { return true; } + + //Retuen False so the origional method is not executed. + + // if (p.Faction.IsPlayer) + + //This looks to include the Player Faction as Bring Friendly to Itself. + if (!FactionUtility.HostileTo(p.Faction, Faction.OfPlayer)) + { + //Log.Message("Friendly"); + return false; + } + //Log.Message("Hostile"); + return true; + } + } +} diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchBuildingTurretGun.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchBuildingTurretGun.cs new file mode 100644 index 0000000..b199cee --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchBuildingTurretGun.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using HarmonyLib; +using System.Reflection; +using RimWorld; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + class PatchBuildingTurretGun : Patch + { + + protected override void ApplyPatch(Harmony harmony = null) + { + //Get the Origional Property + PropertyInfo _RimWorld_BuildingTurretGun_CanSetForcedTarget = typeof(RimWorld.Building_TurretGun).GetProperty("CanSetForcedTarget", BindingFlags.NonPublic | BindingFlags.Instance); + Patcher.LogNULL(_RimWorld_BuildingTurretGun_CanSetForcedTarget, "_RimWorld_BuildingTurretGun_CanSetForcedTarget"); + + //Get the Property Getter Method + MethodInfo _RimWorld_BuildingTurretGun_CanSetForcedTarget_Getter = _RimWorld_BuildingTurretGun_CanSetForcedTarget.GetGetMethod(true); + Patcher.LogNULL(_RimWorld_BuildingTurretGun_CanSetForcedTarget_Getter, "_RimWorld_BuildingTurretGun_CanSetForcedTarget_Getter"); + + //Get the Prefix Patch + MethodInfo _CanSetForcedTargetPrefix = typeof(PatchBuildingTurretGun).GetMethod("CanSetForcedTargetPrefix", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_CanSetForcedTargetPrefix, "_CanSetForcedTargetPrefix"); + + //Apply the Prefix Patch + harmony.Patch(_RimWorld_BuildingTurretGun_CanSetForcedTarget_Getter, new HarmonyMethod(_CanSetForcedTargetPrefix), null); + } + + protected override string PatchDescription() + { + return "CanSetForcedTargetPrefix"; + } + + protected override bool ShouldPatchApply() + { + return Mod_EnhancedOptions.Settings.TurretControlEnabled; + } + + + // prefix + // - wants instance, result and count + // - wants to change count + // - returns a boolean that controls if original is executed (true) or not (false) + public static Boolean CanSetForcedTargetPrefix(ref bool __result, ref Building_TurretGun __instance) + { + + //Allow for all Turrets belonging to the Player + if (__instance.Faction == Faction.OfPlayer) + { + //Set result to true so targeting can be used and return fasle to stop origional check. + __result = true; + return false; + } + + //Retuen true so the origional method is executed. + return true; + } + } +} diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchBuildingTurretGunCE.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchBuildingTurretGunCE.cs new file mode 100644 index 0000000..5c19599 --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchBuildingTurretGunCE.cs @@ -0,0 +1,72 @@ +/*using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Harmony; +using System.Reflection; +using RimWorld; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + class PatchBuilding_TurretGunCE : Patch + { + + protected override void ApplyPatch(HarmonyInstance harmony = null) + { + //Get the Origional Property + PropertyInfo _CombatExtended_BuildingTurretGunCE_CanSetForcedTarget = typeof(CombatExtended.Building_TurretGunCE).GetProperty("CanSetForcedTarget", BindingFlags.NonPublic | BindingFlags.Instance); + Patcher.LogNULL(_CombatExtended_BuildingTurretGunCE_CanSetForcedTarget, "_CombatExtended_BuildingTurretGunCE_CanSetForcedTarget"); + + //Get the Property Getter Method + MethodInfo _CombatExtended_BuildingTurretGunCE_CanSetForcedTarget_Getter = _CombatExtended_BuildingTurretGunCE_CanSetForcedTarget.GetGetMethod(true); + Patcher.LogNULL(_CombatExtended_BuildingTurretGunCE_CanSetForcedTarget_Getter, "_CombatExtended_BuildingTurretGunCE_CanSetForcedTarget_Getter"); + + //Get the Prefix Patch + MethodInfo _CanSetForcedTargetPrefix = typeof(PatchBuilding_TurretGunCE).GetMethod("CanSetForcedTargetPrefix", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_CanSetForcedTargetPrefix, "_CanSetForcedTargetPrefix"); + + //Apply the Prefix Patch + harmony.Patch(_CombatExtended_BuildingTurretGunCE_CanSetForcedTarget_Getter, new HarmonyMethod(_CanSetForcedTargetPrefix), null); + } + + protected override string PatchDescription() + { + return "CanSetForcedTargetPrefix CombatExtended"; + } + + protected override bool ShouldPatchApply() + { + + //Check that CombatExtended.Building_TurretGunCE exists. + Type _CEType = Type.GetType("CombatExtended.Building_TurretGunCE, CombatExtended"); + if (_CEType == null) + { + Log.Message("CombatExtended.Building_TurretGunCE not found, Skipping applying Patch"); + return false; + } + + return Mod_EnhancedOptions.Settings.TurretControlEnabled; + } + + // prefix + // - wants instance, result and count + // - wants to change count + // - returns a boolean that controls if original is executed (true) or not (false) + public static Boolean CanSetForcedTargetPrefix(ref bool __result, ref Building_TurretGun __instance) + { + + //Allow for all Turrets belonging to the Player + if (__instance.Faction == Faction.OfPlayer) + { + //Set result to true so targeting can be used and return fasle to stop origional check. + __result = true; + return false; + } + + //Retuen true so the origional method is executed. + return true; + } + } +} +*/ \ No newline at end of file diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchCompBreakdownable.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchCompBreakdownable.cs new file mode 100644 index 0000000..208b27d --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchCompBreakdownable.cs @@ -0,0 +1,46 @@ +using HarmonyLib; +using RimWorld; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + + class PatchCompBreakdownable : Patch + { + protected override void ApplyPatch(Harmony harmony = null) + { + //Get the Method + MethodInfo _CompBreakdownable_CheckForBreakdown = typeof(CompBreakdownable).GetMethod("CheckForBreakdown", BindingFlags.Public | BindingFlags.Instance); + Patcher.LogNULL(_CompBreakdownable_CheckForBreakdown, "_CompBreakdownable_CheckForBreakdown"); + + //Get the Prefix + MethodInfo _CheckForBreakdownPrefix = typeof(PatchCompBreakdownable).GetMethod("CheckForBreakdownPrefix", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_CheckForBreakdownPrefix, "_CheckForBreakdownPrefix"); + + //Apply the Prefix Patch + harmony.Patch(_CompBreakdownable_CheckForBreakdown, new HarmonyMethod(_CheckForBreakdownPrefix), null); + } + + protected override string PatchDescription() + { + return "PatchCompBreakdownable"; + } + + protected override bool ShouldPatchApply() + { + return Mod_EnhancedOptions.Settings.SuppressBreakdown; + } + + public static bool CheckForBreakdownPrefix() + { + //When showing forPowerOverlay return true to allow the base method to run. + return false; + } + + } +} diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchCompSchedule.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchCompSchedule.cs new file mode 100644 index 0000000..ef1cfef --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchCompSchedule.cs @@ -0,0 +1,56 @@ +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + + class PatchCompSchedule : Patch + { + + protected override void ApplyPatch(Harmony harmony = null) + { + //Get the Origional Method + MethodInfo _CompSchedule_RecalculateAllowed = typeof(RimWorld.CompSchedule).GetMethod("RecalculateAllowed", BindingFlags.Public | BindingFlags.Instance); + Patcher.LogNULL(_CompSchedule_RecalculateAllowed, "_CompSchedule_RecalculateAllowed"); + + //Get the Prefix Patch + MethodInfo _RecalculateAllowedPrefix = typeof(PatchCompSchedule).GetMethod("RecalculateAllowedPrefix", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_RecalculateAllowedPrefix, "_RecalculateAllowedPrefix"); + + //Apply the Prefix Patch + harmony.Patch(_CompSchedule_RecalculateAllowed, new HarmonyMethod(_RecalculateAllowedPrefix), null); + } + + protected override string PatchDescription() + { + return "PatchCompSchedule(SunLamps)"; + } + + protected override bool ShouldPatchApply() + { + return Mod_EnhancedOptions.Settings.PlantLights24HEnabled; + } + + // prefix + // - wants instance, result and count + // - wants to change count + // - returns a boolean that controls if original is executed (true) or not (false) + public static Boolean RecalculateAllowedPrefix(ref RimWorld.CompSchedule __instance) + { + //Write to log to debug id the patch is running. + + if (__instance.parent.def.defName == "SunLamp") + { + __instance.Allowed = true; + return false; //Retuen False so the origional method is not executed + } + + return true; + } + } +} diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchDebug.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchDebug.cs new file mode 100644 index 0000000..c3b102e --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchDebug.cs @@ -0,0 +1,55 @@ +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + class PatchDebug : Patch + { + + protected override void ApplyPatch(Harmony harmony = null) + { + //Get the Origional Log Method + List _Debug_Log = typeof(UnityEngine.Debug).GetMethods().ToList().Where(x => x.Name.Equals("Log")).ToList(); + Patcher.LogNULL(_Debug_Log, "_Debug_Log"); + + //Get the Prefix Patch + MethodInfo _LogPrefix = typeof(PatchDebug).GetMethod("LogPrefix", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_LogPrefix, "_LogPrefix"); + + Log.Warning("########## The Mod ED-EnhancedOptions is Supressing Future calls to UnityEngine.Debug.Log, This can be changed in Mod Settings. ##########"); + //Apply the Prefix Patches + _Debug_Log.ForEach(x => harmony.Patch(x, new HarmonyMethod(_LogPrefix), null)); + + } + + protected override string PatchDescription() + { + return "Debug Log"; + } + + protected override bool ShouldPatchApply() + { + return Mod_EnhancedOptions.Settings.SupressWritingToLogFile; + } + + + // prefix + // - wants instance, result and count + // - wants to change count + // - returns a boolean that controls if original is executed (true) or not (false) + public static Boolean LogPrefix() + { + + //This is the result that will be used, note that it was passed as a ref. + //__result = false; + + //Retuen False so the origional method is not executed, overriting the false result. + return false; + } + } +} diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchFireWatcher.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchFireWatcher.cs new file mode 100644 index 0000000..236fdd3 --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchFireWatcher.cs @@ -0,0 +1,57 @@ +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + class PatchFireWatcher : Patch + { + + protected override void ApplyPatch(Harmony harmony = null) + { + //Get the Origional CheckSpring Method + PropertyInfo _RimWorld_FireWatcher_LargeFireDangerPresent = typeof(RimWorld.FireWatcher).GetProperty("LargeFireDangerPresent", BindingFlags.Public | BindingFlags.Instance); + Patcher.LogNULL(_RimWorld_FireWatcher_LargeFireDangerPresent, "_RimWorld_FireWatcher_LargeFireDangerPresent"); + + MethodInfo _RimWorld_FireWatcher_LargeFireDangerPresent_Getter = _RimWorld_FireWatcher_LargeFireDangerPresent.GetGetMethod(); + Patcher.LogNULL(_RimWorld_FireWatcher_LargeFireDangerPresent_Getter, "_RimWorld_FireWatcher_LargeFireDangerPresent_Getter"); + + + //Get the Prefix Patch + MethodInfo _SupressLargeFireDangerPresentPrefix = typeof(PatchFireWatcher).GetMethod("SupressLargeFireDangerPresentPrefix", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_SupressLargeFireDangerPresentPrefix, "_SupressLargeFireDangerPresentPrefix"); + + //Apply the Prefix Patch + harmony.Patch(_RimWorld_FireWatcher_LargeFireDangerPresent_Getter, new HarmonyMethod(_SupressLargeFireDangerPresentPrefix), null); + } + + protected override string PatchDescription() + { + return "PatchFireWatcher"; + } + + protected override bool ShouldPatchApply() + { + return Mod_EnhancedOptions.Settings.SuppressRainFire; + } + + + // prefix + // - wants instance, result and count + // - wants to change count + // - returns a boolean that controls if original is executed (true) or not (false) + public static Boolean SupressLargeFireDangerPresentPrefix(ref bool __result) + { + + //This is the result that will be used, note that it was passed as a ref. + __result = false; + + //Retuen False so the origional method is not executed, overriting the false result. + return false; + } + } +} diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchLetterStack.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchLetterStack.cs new file mode 100644 index 0000000..7ea2822 --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchLetterStack.cs @@ -0,0 +1,96 @@ +using HarmonyLib; +using RimWorld; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + + class PatchLetterStack : Patch + { + + + protected override void ApplyPatch(Harmony harmony = null) + { + //Get the Method + MethodInfo _Verse_LetterStack_ReceiveLetter = typeof(LetterStack).GetMethod("ReceiveLetter", new Type[] { typeof(Letter), typeof(string) }); + Patcher.LogNULL(_Verse_LetterStack_ReceiveLetter, "_Verse_LetterStack_ReceiveLetter"); + + //Get the Prefix + MethodInfo _ReceiveLetterPrefix = typeof(PatchLetterStack).GetMethod("ReceiveLetterPrefix", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_ReceiveLetterPrefix, "_ReceiveLetterPrefix"); + + //Apply the Prefix Patch + harmony.Patch(_Verse_LetterStack_ReceiveLetter, new HarmonyMethod(_ReceiveLetterPrefix), null); + } + + protected override string PatchDescription() + { + return "PatchLetterStack"; + } + + protected override bool ShouldPatchApply() + { + //Apply the Letter Patch, setting checking is done inside the method so this is always applied. + return true; + } + + public static bool ReceiveLetterPrefix(ref Letter let) + { + if (Mod_EnhancedOptions.Settings.DebugLogLetters) + { + Log.Message("Letter DefName: '" + let.def.defName + "' Label: '" + let.Label + "'"); + } + + if (let.def == LetterDefOf.ThreatBig & !Mod_EnhancedOptions.Settings.ShowLettersThreatBig) + { + return false; + } + + if (let.def == LetterDefOf.ThreatSmall & !Mod_EnhancedOptions.Settings.ShowLettersThreatSmall) + { + return false; + } + + if (let.def == LetterDefOf.NegativeEvent & !Mod_EnhancedOptions.Settings.ShowLettersNegativeEvent) + { + return false; + } + + if (let.def == LetterDefOf.NeutralEvent & !Mod_EnhancedOptions.Settings.ShowLettersNeutralEvent) + { + return false; + } + + if (let.def == LetterDefOf.PositiveEvent & !Mod_EnhancedOptions.Settings.ShowLettersPositiveEvent) + { + return false; + } + + //if (let.def == LetterDefOf.free & !Mod_EnhancedOptions.Settings.ShowLettersItemStashFeeDemand) + //{ + // return false; + //} + + if (Mod_EnhancedOptions.Settings.LetterNamesToSuppressEnabled) + { + List _String = Mod_EnhancedOptions.Settings.LetterNamesToSuppress.Split(',').ToList(); + if (_String.Contains(let.Label)) + { + if (Mod_EnhancedOptions.Settings.DebugLogLetters) + { + Log.Message("Matched with LetterNamesToSuppress"); + } + return false; + } + } + + // Allow any other types of Letters + return true; + } + } +} diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchMainTabsRoot.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchMainTabsRoot.cs new file mode 100644 index 0000000..05f747b --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchMainTabsRoot.cs @@ -0,0 +1,112 @@ +using HarmonyLib; +using RimWorld; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + + class PatchMainTabsRoot : Patch + { + + protected override bool ShouldPatchApply() + { + return Mod_EnhancedOptions.Settings.HideSpots; + } + + protected override void ApplyPatch(Harmony harmony = null) + { + //Get the Origional Method + MethodInfo _Building_MainTabsRoot_ToggleTab = typeof(MainTabsRoot).GetMethod("ToggleTab", BindingFlags.Public | BindingFlags.Instance); + Patcher.LogNULL(_Building_MainTabsRoot_ToggleTab, "_Building_MainTabsRoot_ToggleTab"); + + //Get the Prefix Patch + MethodInfo _SetDrawStatusPostfix = typeof(PatchMainTabsRoot).GetMethod("SetDrawStatusPostfix", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_SetDrawStatusPostfix, "_SetDrawStatusPostfix"); + + //Apply the Prefix Patch + harmony.Patch(_Building_MainTabsRoot_ToggleTab, null, new HarmonyMethod(_SetDrawStatusPostfix)); + } + + protected override string PatchDescription() + { + return "PatchMainTabsRoot - HideSpots"; + } + + // postfix + public static void SetDrawStatusPostfix(MainTabsRoot __instance) + { + if (PatchMainTabsRoot.ShouldShowSpots(__instance)) + { + ThingDefOf.MarriageSpot.drawerType = DrawerType.MapMeshAndRealTime; + ThingDefOf.CaravanPackingSpot.drawerType = DrawerType.MapMeshAndRealTime; + ThingDefOf.PartySpot.drawerType = DrawerType.MapMeshAndRealTime; + PatchMainTabsRoot.MarkMapMeshAsDirty(); + } + else + { + ThingDefOf.MarriageSpot.drawerType = DrawerType.None; + ThingDefOf.CaravanPackingSpot.drawerType = DrawerType.None; + ThingDefOf.PartySpot.drawerType = DrawerType.None; + PatchMainTabsRoot.MarkMapMeshAsDirty(); + } + } + + public static bool ShouldShowSpots(MainTabsRoot __instance) + { + if (__instance.OpenTab == null) + { + return false; + } + + if (string.Equals(__instance.OpenTab.defName, "Architect")) + { + return true; + } + + if (string.Equals(__instance.OpenTab.defName, "Inspect")) + { + Thing _FirstThing = Find.Selector.FirstSelectedObject as Thing; + + if (_FirstThing != null) + { + if (String.Equals(_FirstThing.def.defName, "MarriageSpot") || + String.Equals(_FirstThing.def.defName, "PartySpot") || + String.Equals(_FirstThing.def.defName, "CaravanPackingSpot")) + { + return true; + } + + } + } + + return false; + } + + public static void MarkMapMeshAsDirty() + { + + + + //Update the map mesh for the things that have changed + Find.CurrentMap.listerBuildings.AllBuildingsColonistOfDef(ThingDefOf.MarriageSpot).ToList().ForEach(x => + { + Find.CurrentMap.mapDrawer.MapMeshDirty(x.Position, MapMeshFlag.Things); + }); + + Find.CurrentMap.listerBuildings.AllBuildingsColonistOfDef(ThingDefOf.CaravanPackingSpot).ToList().ForEach(x => + { + Find.CurrentMap.mapDrawer.MapMeshDirty(x.Position, MapMeshFlag.Things); + }); + + Find.CurrentMap.listerBuildings.AllBuildingsColonistOfDef(ThingDefOf.PartySpot).ToList().ForEach(x => + { + Find.CurrentMap.mapDrawer.MapMeshDirty(x.Position, MapMeshFlag.Things); + }); + } + } +} diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchPerfs.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchPerfs.cs new file mode 100644 index 0000000..484fc2d --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchPerfs.cs @@ -0,0 +1,52 @@ +/*using Harmony; +using RimWorld; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + + class PatchPerfs : Patch + { + + protected override void ApplyPatch(HarmonyInstance harmony = null) + { + //Get the Origional DevMode Property + PropertyInfo _Verse_Prefs_DevMode = typeof(Verse.Prefs).GetProperty("DevMode", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_Verse_Prefs_DevMode, "_Verse_Prefs_DevMode"); + + //Get the Setter Method + MethodInfo _Verse_Prefs_DevMode_Setter = _Verse_Prefs_DevMode.GetSetMethod(true); + Patcher.LogNULL(_Verse_Prefs_DevMode_Setter, "_Verse_Prefs_DevMode_Setter"); + + //Get the Prefix + MethodInfo _DevModeSetterPrefix = typeof(PatchPerfs).GetMethod("DevModeSetterPrefix", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_DevModeSetterPrefix, "_DevModeSetterPrefix"); + + //Apply the Prefix Patch + harmony.Patch(_Verse_Prefs_DevMode_Setter, new HarmonyMethod(_DevModeSetterPrefix), null); + } + + protected override string PatchDescription() + { + return "LockDevMode"; + } + + protected override bool ShouldPatchApply() + { + return Mod_EnhancedOptions.Settings.LockDevMode; + } + + public static bool DevModeSetterPrefix() + { + //Return False to Stop from Enabling Dev Mode. + return false; + } + + } +} +*/ \ No newline at end of file diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchPlant.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchPlant.cs new file mode 100644 index 0000000..e2b1a37 --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchPlant.cs @@ -0,0 +1,57 @@ +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + class PatchPlant : Patch + { + + protected override void ApplyPatch(Harmony harmony = null) + { + //Get the Origional Resting Property + PropertyInfo _RimWorld_Plant_Resting = typeof(RimWorld.Plant).GetProperty("Resting", BindingFlags.NonPublic | BindingFlags.Instance); + Patcher.LogNULL(_RimWorld_Plant_Resting, "RimWorld_Plant_Resting"); + + //Get the Resting Property Getter Method + MethodInfo _RimWorld_Plant_Resting_Getter = _RimWorld_Plant_Resting.GetGetMethod(true); + Patcher.LogNULL(_RimWorld_Plant_Resting_Getter, "RimWorld_Plant_Resting_Getter"); + + //Get the Prefix Patch + MethodInfo _RestingGetterPrefix = typeof(PatchPlant).GetMethod("RestingGetterPrefix", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_RestingGetterPrefix, "_RestingGetterPrefix"); + + //Apply the Prefix Patch + harmony.Patch(_RimWorld_Plant_Resting_Getter, new HarmonyMethod(_RestingGetterPrefix), null); + } + + protected override string PatchDescription() + { + return "Plant24HEnabled"; + } + + protected override bool ShouldPatchApply() + { + return Mod_EnhancedOptions.Settings.Plant24HEnabled; + } + + // prefix + // - wants instance, result and count + // - wants to change count + // - returns a boolean that controls if original is executed (true) or not (false) + public static Boolean RestingGetterPrefix(ref bool __result) + { + + //This is the result that will be used, note that it was passed as a ref. + __result = false; + + //Retuen False so the origional method is not executed, overriting the false result. + return false; + } + + } +} diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchPowerNetGraphics.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchPowerNetGraphics.cs new file mode 100644 index 0000000..7bb3d55 --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchPowerNetGraphics.cs @@ -0,0 +1,47 @@ +using HarmonyLib; +using RimWorld; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + + class PatchPowerNetGraphics : Patch + { + + protected override void ApplyPatch(Harmony harmony = null) + { + //Get the Method + MethodInfo _PowerNetGraphics_PrintWirePieceConnecting = typeof(PowerNetGraphics).GetMethod("PrintWirePieceConnecting", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_PowerNetGraphics_PrintWirePieceConnecting, "_PowerNetGraphics_PrintWirePieceConnecting"); + + //Get the Prefix + MethodInfo _PrintWirePieceConnectingPrefixPrefix = typeof(PatchPowerNetGraphics).GetMethod("PrintWirePieceConnectingPrefix", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_PrintWirePieceConnectingPrefixPrefix, "_PrintWirePieceConnectingPrefixPrefix"); + + //Apply the Prefix Patch + harmony.Patch(_PowerNetGraphics_PrintWirePieceConnecting, new HarmonyMethod(_PrintWirePieceConnectingPrefixPrefix), null); + } + + protected override string PatchDescription() + { + return "PatchPowerNetGraphics"; + } + + protected override bool ShouldPatchApply() + { + return Mod_EnhancedOptions.Settings.HidePowerConnections; + } + + public static bool PrintWirePieceConnectingPrefix(bool forPowerOverlay) + { + //When showing forPowerOverlay return true to allow the base method to run, drawing the cables. + //Else stop them from being drawn. + return forPowerOverlay; + } + } +} diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchPreventGreateMemoryTrait.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchPreventGreateMemoryTrait.cs new file mode 100644 index 0000000..1805c28 --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchPreventGreateMemoryTrait.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using HarmonyLib; +using RimWorld; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + class PatchPreventGreatMemoryTrait : Patch + { + protected override void ApplyPatch(Harmony harmony = null) + { + FieldInfo _commonalityFieldInfo = typeof(TraitDef).GetField("commonality", BindingFlags.NonPublic | BindingFlags.Instance); + Patcher.LogNULL(_commonalityFieldInfo, "_commonalityFieldInfo"); + _commonalityFieldInfo.SetValue(TraitDefOf.GreatMemory, 0.0f); + } + + protected override string PatchDescription() + { + return "PatchPreventGreatMemoryTrait"; + } + + protected override bool ShouldPatchApply() + { + return Mod_EnhancedOptions.Settings.PreventSkillDecay; + } + } +} diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchRoofCollapseBuffer.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchRoofCollapseBuffer.cs new file mode 100644 index 0000000..31a8e8e --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchRoofCollapseBuffer.cs @@ -0,0 +1,49 @@ +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + class PatchRoofCollapseBuffer : Patch + { + + protected override void ApplyPatch(Harmony harmony = null) + { + //Get the Origional CheckSpring Method + MethodInfo _Verse_RoofCollapseBuffer_MarkToCollapse = typeof(RoofCollapseBuffer).GetMethod("MarkToCollapse", BindingFlags.Public | BindingFlags.Instance); + Patcher.LogNULL(_Verse_RoofCollapseBuffer_MarkToCollapse, "_Verse_RoofCollapseBuffer_MarkToCollapse"); + + //Get the Prefix Patch + MethodInfo _MarkToCollapsePrefix = typeof(PatchRoofCollapseBuffer).GetMethod("Supress_MarkToCollapse", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_MarkToCollapsePrefix, "_MarkToCollapsePrefix"); + + //Apply the Prefix Patch + harmony.Patch(_Verse_RoofCollapseBuffer_MarkToCollapse, new HarmonyMethod(_MarkToCollapsePrefix), null); + } + + protected override string PatchDescription() + { + return "PatchRoofCollapseBuffer"; + } + + protected override bool ShouldPatchApply() + { + return Mod_EnhancedOptions.Settings.SuppressRoofColapse; + } + + + // prefix + // - wants instance, result and count + // - wants to change count + // - returns a boolean that controls if original is executed (true) or not (false) + public static Boolean Supress_MarkToCollapse() + { + //Retuen False so the origional method is not executed. + return false; + } + } +} diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchSkillRecord.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchSkillRecord.cs new file mode 100644 index 0000000..bc394ee --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchSkillRecord.cs @@ -0,0 +1,115 @@ +using HarmonyLib; +using RimWorld; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + class PatchSkillRecord : Patch + { + + protected override void ApplyPatch(Harmony harmony = null) + { + //Get the Origional LearnRateFactor Method + MethodInfo _RimWorld_SkillRecord_LearnRateFactor = typeof(RimWorld.SkillRecord).GetMethod("LearnRateFactor", BindingFlags.Public | BindingFlags.Instance); + Patcher.LogNULL(_RimWorld_SkillRecord_LearnRateFactor, "_RimWorld_SkillRecord_LearnRateFactor"); + + + //Get the LearnRateFactor Prefix Patch + MethodInfo _LearnRateFactorPrefix = typeof(PatchSkillRecord).GetMethod("LearnRateFactorPrefix", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_LearnRateFactorPrefix, "_LearnRateFactorPrefix"); + + //Apply the LearnRateFactor Prefix Patch + harmony.Patch(_RimWorld_SkillRecord_LearnRateFactor, new HarmonyMethod(_LearnRateFactorPrefix), null); + + + if(Mod_EnhancedOptions.Settings.PreventSkillDecay) + { + + MethodInfo _RimWorld_SkillRecord_Interval = typeof(RimWorld.SkillRecord).GetMethod("Interval", BindingFlags.Public | BindingFlags.Instance); + Patcher.LogNULL(_RimWorld_SkillRecord_Interval, "_RimWorld_SkillRecord_Interval"); + + MethodInfo _RimWorld_SkillRecord_Interval_Prefix = typeof(PatchSkillRecord).GetMethod("IntervalPrefix", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_RimWorld_SkillRecord_Interval_Prefix, "_RimWorld_SkillRecord_Interval_Prefix"); + + harmony.Patch(_RimWorld_SkillRecord_Interval, new HarmonyMethod(_RimWorld_SkillRecord_Interval_Prefix), null); + + } + else + { + Log.Message("Skipping PreventSkillDecay"); + } + } + + protected override string PatchDescription() + { + return "PatchSkillRecord"; + } + + protected override bool ShouldPatchApply() + { + return Mod_EnhancedOptions.Settings.ApplyLearnChanges; + } + + // prefix + // - wants instance, result and count + // - wants to change count + // - returns a boolean that controls if original is executed (true) or not (false) + public static Boolean LearnRateFactorPrefix(ref float __result, ref SkillRecord __instance, bool direct = false) + { + + //This is the result that will be used, note that it was passed as a ref. + + if (DebugSettings.fastLearning) + { + __result = 200f; + return false; + } + float num; + switch (__instance.passion) + { + case Passion.None: + num = (Mod_EnhancedOptions.Settings.LearnFactorPassionNonePercentage / 100f); + break; + case Passion.Minor: + num = (Mod_EnhancedOptions.Settings.LearnFactorPassionMinorPercentage / 100f); + break; + case Passion.Major: + num = (Mod_EnhancedOptions.Settings.LearnFactorPassionMajorPercentage / 100f); + break; + default: + throw new NotImplementedException("Passion level " + __instance.passion); + } + if (!direct) + { + //Private Field acessed through Reflection + + // num *= __instance.pawn.GetStatValue(StatDefOf.GlobalLearningFactor, true); + FieldInfo _PawnProperty = typeof(SkillRecord).GetField("pawn", BindingFlags.NonPublic | BindingFlags.Instance); + //Patcher.LogNULL(_PawnProperty, "_PawnProperty", true); + Pawn _Pawn = _PawnProperty.GetValue(__instance) as Pawn; + //Patcher.LogNULL(_Pawn, "_Pawn", true); + num *= _Pawn.GetStatValue(StatDefOf.GlobalLearningFactor, true); + + if (__instance.xpSinceMidnight > Mod_EnhancedOptions.Settings.DailyLearningSaturationAmmount) + { + num *= 0.2f; + } + } + + __result = num; + + //Retuen False so the origional method is not executed, overriting the false result. + return false; + } + + public static Boolean IntervalPrefix() + { + return false; + } + } +} diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchSkillUI.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchSkillUI.cs new file mode 100644 index 0000000..d201249 --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchSkillUI.cs @@ -0,0 +1,92 @@ +using HarmonyLib; +using RimWorld; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using Verse; + + +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + class PatchSkillUI : Patch + { + + + + protected override void ApplyPatch(Harmony harmony = null) + { + //Get the Origional CheckSpring Method + MethodInfo _RimWorld_SkillUI_GetSkillDescription = typeof(RimWorld.SkillUI).GetMethod("GetSkillDescription", BindingFlags.NonPublic | BindingFlags.Static); + Patcher.LogNULL(_RimWorld_SkillUI_GetSkillDescription, "_RimWorld_SkillUI_GetSkillDescription"); + + //Get the Prefix Patch + MethodInfo _GetSkillDescriptionPrefix = typeof(PatchSkillUI).GetMethod("GetSkillDescriptionPrefix", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_GetSkillDescriptionPrefix, "_GetSkillDescriptionPrefix"); + + //Apply the Prefix Patch + harmony.Patch(_RimWorld_SkillUI_GetSkillDescription, new HarmonyMethod(_GetSkillDescriptionPrefix), null); + } + + protected override string PatchDescription() + { + return "PatchSkillUI"; + } + + protected override bool ShouldPatchApply() + { + return Mod_EnhancedOptions.Settings.ApplyLearnChanges; + } + + // prefix + // - wants instance, result and count + // - wants to change count + // - returns a boolean that controls if original is executed (true) or not (false) + public static Boolean GetSkillDescriptionPrefix(ref string __result, SkillRecord sk) + { + + StringBuilder stringBuilder = new StringBuilder(); + if (sk.TotallyDisabled) + { + stringBuilder.Append("DisabledLower".Translate().CapitalizeFirst()); + } + else + { + stringBuilder.AppendLine("Level".Translate() + " " + sk.Level + ": " + sk.LevelDescriptor); + if (Current.ProgramState == ProgramState.Playing) + { + string text = (sk.Level != 20) ? "ProgressToNextLevel".Translate() : "Experience".Translate(); + stringBuilder.AppendLine(text + ": " + sk.xpSinceLastLevel.ToString("F0") + " / " + sk.XpRequiredForLevelUp); + } + stringBuilder.Append("Passion".Translate() + ": "); + switch (sk.passion) + { + case Passion.None: + stringBuilder.Append("PassionNone".Translate((Mod_EnhancedOptions.Settings.LearnFactorPassionNonePercentage / 100f).ToStringPercent("F0"))); + break; + case Passion.Minor: + stringBuilder.Append("PassionMinor".Translate((Mod_EnhancedOptions.Settings.LearnFactorPassionMinorPercentage / 100f).ToStringPercent("F0"))); + break; + case Passion.Major: + stringBuilder.Append("PassionMajor".Translate((Mod_EnhancedOptions.Settings.LearnFactorPassionMajorPercentage / 100f).ToStringPercent("F0"))); + break; + } + if (sk.xpSinceMidnight > Mod_EnhancedOptions.Settings.DailyLearningSaturationAmmount) + { + stringBuilder.AppendLine(); + stringBuilder.Append("LearnedMaxToday".Translate(sk.xpSinceMidnight, Mod_EnhancedOptions.Settings.DailyLearningSaturationAmmount, 0.2f.ToStringPercent("F0"))); + } + } + stringBuilder.AppendLine(); + stringBuilder.AppendLine(); + stringBuilder.Append(sk.def.description); + __result = stringBuilder.ToString(); + + + //Retuen False so the origional method is not executed, overriting the false result. + return false; + } + + } +} diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchTimeControls.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchTimeControls.cs new file mode 100644 index 0000000..1d88f65 --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchTimeControls.cs @@ -0,0 +1,189 @@ +using HarmonyLib; +using RimWorld; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using UnityEngine; +using Verse; +using Verse.Sound; + +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + + class PatchTimeControls : Patch + { + + protected override void ApplyPatch(Harmony harmony = null) + { + //Get the Method + MethodInfo _RimWorld_TimeControls_DoTimeControlsGUI = typeof(RimWorld.TimeControls).GetMethod("DoTimeControlsGUI", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_RimWorld_TimeControls_DoTimeControlsGUI, "_RimWorld_TimeControls_DoTimeControlsGUI"); + + //Get the Prefix Patch + MethodInfo _DoTimeControlsGUIPrefix = typeof(EnhancedDevelopment.EnhancedOptions.Detours.TimeControls).GetMethod("DoTimeControlsGUI", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_DoTimeControlsGUIPrefix, "_DoTimeControlsGUIPrefix"); + + //Apply the Prefix Patch + harmony.Patch(_RimWorld_TimeControls_DoTimeControlsGUI, new HarmonyMethod(_DoTimeControlsGUIPrefix), null); + } + + protected override string PatchDescription() + { + return "Speed4WithoutDev"; + } + + protected override bool ShouldPatchApply() + { + return Mod_EnhancedOptions.Settings.Speed4WithoutDev; + } + } + + public static class TimeControls + { + public static readonly Vector2 TimeButSize = new Vector2(32f, 24f); + private static readonly string[] SpeedSounds = new string[5] + { + "ClockStop", + "ClockNormal", + "ClockFast", + "ClockSuperfast", + "ClockSuperfast" + }; + private static readonly TimeSpeed[] CachedTimeSpeedValues = (TimeSpeed[])Enum.GetValues(typeof(TimeSpeed)); + + private static void PlaySoundOf(TimeSpeed speed) + { + SoundDef soundDef = null; + switch (speed) + { + case TimeSpeed.Paused: + soundDef = SoundDefOf.Clock_Stop; + break; + case TimeSpeed.Normal: + soundDef = SoundDefOf.Clock_Normal; + break; + case TimeSpeed.Fast: + soundDef = SoundDefOf.Clock_Fast; + break; + case TimeSpeed.Superfast: + soundDef = SoundDefOf.Clock_Superfast; + break; + case TimeSpeed.Ultrafast: + soundDef = SoundDefOf.Clock_Superfast; + break; + } + if (soundDef != null) + { + soundDef.PlayOneShotOnCamera(null); + } + } + + public static bool DoTimeControlsGUI(Rect timerRect) + { + TickManager tickManager = Find.TickManager; + GUI.BeginGroup(timerRect); + Vector2 timeButSize = TimeControls.TimeButSize; + float x = timeButSize.x; + Vector2 timeButSize2 = TimeControls.TimeButSize; + Rect rect = new Rect(0f, 0f, x, timeButSize2.y); + for (int i = 0; i < TimeControls.CachedTimeSpeedValues.Length; i++) + { + TimeSpeed timeSpeed = TimeControls.CachedTimeSpeedValues[i]; + if (timeSpeed != TimeSpeed.Ultrafast) + { + if (Widgets.ButtonImage(rect, TexButton.SpeedButtonTextures[(uint)timeSpeed])) + { + if (timeSpeed == TimeSpeed.Paused) + { + tickManager.TogglePaused(); + PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.Pause, KnowledgeAmount.SpecificInteraction); + } + else + { + tickManager.CurTimeSpeed = timeSpeed; + PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.TimeControls, KnowledgeAmount.SpecificInteraction); + } + TimeControls.PlaySoundOf(tickManager.CurTimeSpeed); + } + if (tickManager.CurTimeSpeed == timeSpeed) + { + GUI.DrawTexture(rect, TexUI.HighlightTex); + } + rect.x += rect.width; + } + } + if (Find.TickManager.slower.ForcedNormalSpeed) + { + Widgets.DrawLineHorizontal(rect.width * 2f, rect.height / 2f, rect.width * 2f); + } + GUI.EndGroup(); + GenUI.AbsorbClicksInRect(timerRect); + UIHighlighter.HighlightOpportunity(timerRect, "TimeControls"); + if (Event.current.type == EventType.KeyDown) + { + if (KeyBindingDefOf.TogglePause.KeyDownEvent) + { + Find.TickManager.TogglePaused(); + TimeControls.PlaySoundOf(Find.TickManager.CurTimeSpeed); + PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.Pause, KnowledgeAmount.SpecificInteraction); + Event.current.Use(); + } + if (KeyBindingDefOf.TimeSpeed_Normal.KeyDownEvent) + { + Find.TickManager.CurTimeSpeed = TimeSpeed.Normal; + TimeControls.PlaySoundOf(Find.TickManager.CurTimeSpeed); + PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.TimeControls, KnowledgeAmount.SpecificInteraction); + Event.current.Use(); + } + if (KeyBindingDefOf.TimeSpeed_Fast.KeyDownEvent) + { + Find.TickManager.CurTimeSpeed = TimeSpeed.Fast; + TimeControls.PlaySoundOf(Find.TickManager.CurTimeSpeed); + PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.TimeControls, KnowledgeAmount.SpecificInteraction); + Event.current.Use(); + } + if (KeyBindingDefOf.TimeSpeed_Superfast.KeyDownEvent) + { + Find.TickManager.CurTimeSpeed = TimeSpeed.Superfast; + TimeControls.PlaySoundOf(Find.TickManager.CurTimeSpeed); + PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.TimeControls, KnowledgeAmount.SpecificInteraction); + Event.current.Use(); + } + //if (Prefs.DevMode) + //{ + if (KeyBindingDefOf.TimeSpeed_Ultrafast.KeyDownEvent) + { + Find.TickManager.CurTimeSpeed = TimeSpeed.Ultrafast; + TimeControls.PlaySoundOf(Find.TickManager.CurTimeSpeed); + Event.current.Use(); + } + if (KeyBindingDefOf.Dev_TickOnce.KeyDownEvent && tickManager.CurTimeSpeed == TimeSpeed.Paused) + { + tickManager.DoSingleTick(); + SoundDefOf.Clock_Stop.PlayOneShotOnCamera(null); + } + + //} + } + return false; + } + + } + + + [StaticConstructorOnStartup] + internal class TexButton + { + public static readonly Texture2D[] SpeedButtonTextures = new Texture2D[5] + { + ContentFinder.Get("UI/TimeControls/TimeSpeedButton_Pause", true), + ContentFinder.Get("UI/TimeControls/TimeSpeedButton_Normal", true), + ContentFinder.Get("UI/TimeControls/TimeSpeedButton_Fast", true), + ContentFinder.Get("UI/TimeControls/TimeSpeedButton_Superfast", true), + ContentFinder.Get("UI/TimeControls/TimeSpeedButton_Superfast", true) + }; + } + +} diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchTimeSlower.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchTimeSlower.cs new file mode 100644 index 0000000..1a67523 --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchTimeSlower.cs @@ -0,0 +1,57 @@ +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using Verse; + +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + + //[HarmonyPatch(typeof(Plant))] + //[HarmonyPatch("Resting_Getter")] + class PatchTimeSlower : Patch + { + + protected override void ApplyPatch(Harmony harmony = null) + { + //Get the Origional Method + MethodInfo _Verse_TimeSlower_SignalForceNormalSpeed = typeof(Verse.TimeSlower).GetMethod("SignalForceNormalSpeed", BindingFlags.Public | BindingFlags.Instance); + Patcher.LogNULL(_Verse_TimeSlower_SignalForceNormalSpeed, "_Verse_TimeSlower_SignalForceNormalSpeed"); + + //Get the Origional Method + MethodInfo _Verse_TimeSlower_SignalForceNormalSpeedShort = typeof(Verse.TimeSlower).GetMethod("SignalForceNormalSpeedShort", BindingFlags.Public | BindingFlags.Instance); + Patcher.LogNULL(_Verse_TimeSlower_SignalForceNormalSpeedShort, "_Verse_TimeSlower_SignalForceNormalSpeedShort"); + + + //Get the Prefix Patch + MethodInfo _PreventRunningPrefix = typeof(PatchTimeSlower).GetMethod("PreventRunningPrefix", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_PreventRunningPrefix, "_PreventRunningPrefix"); + + //Apply the Prefix Patch + harmony.Patch(_Verse_TimeSlower_SignalForceNormalSpeed, new HarmonyMethod(_PreventRunningPrefix), null); + harmony.Patch(_Verse_TimeSlower_SignalForceNormalSpeedShort, new HarmonyMethod(_PreventRunningPrefix), null); + } + + protected override string PatchDescription() + { + return "SuppressCombatSlowdown"; + } + + protected override bool ShouldPatchApply() + { + return Mod_EnhancedOptions.Settings.SuppressCombatSlowdown; + } + + // prefix + // - wants instance, result and count + // - wants to change count + // - returns a boolean that controls if original is executed (true) or not (false) + public static Boolean PreventRunningPrefix() + { + return false; + } + + } +} diff --git a/Source/ED-EnhancedOptions/1.3/Patches/PatchToils_Recipe.cs b/Source/ED-EnhancedOptions/1.3/Patches/PatchToils_Recipe.cs new file mode 100644 index 0000000..a59140d --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Patches/PatchToils_Recipe.cs @@ -0,0 +1,99 @@ +/*using Harmony; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using Verse; +using Verse.AI; + +namespace EnhancedDevelopment.EnhancedOptions.Detours +{ + + class PatchToils_Recipe : Patch + { + + protected override void ApplyPatch(HarmonyInstance harmony = null) + { + //Get the Origional Method + MethodInfo _Toils_Recipe_CalculateIngredients = typeof(Toils_Recipe).GetMethod("CalculateIngredients", BindingFlags.NonPublic | BindingFlags.Static); + Patcher.LogNULL(_Toils_Recipe_CalculateIngredients, "_Toils_Recipe_CalculateIngredients"); + + //Get the Prefix Patch + MethodInfo _CalculateIngredientsPrefix = typeof(PatchToils_Recipe).GetMethod("CalculateIngredientsPrefix", BindingFlags.Public | BindingFlags.Static); + Patcher.LogNULL(_CalculateIngredientsPrefix, "_CalculateIngredientsPrefix"); + + //Apply the Prefix Patch + harmony.Patch(_Toils_Recipe_CalculateIngredients, new HarmonyMethod(_CalculateIngredientsPrefix), null); + } + + protected override string PatchDescription() + { + return "SuppressStrippingCremationCorps"; + } + + protected override bool ShouldPatchApply() + { + return Mod_EnhancedOptions.Settings.SuppressStrippingCremationCorps; + } + + // prefix + // - wants instance, result and count + // - wants to change count + // - returns a boolean that controls if original is executed (true) or not (false) + public static Boolean CalculateIngredientsPrefix(Job job, Pawn actor, ref List __result) + { + UnfinishedThing unfinishedThing = job.GetTarget(TargetIndex.B).Thing as UnfinishedThing; + if (unfinishedThing != null) + { + List ingredients = unfinishedThing.ingredients; + job.RecipeDef.Worker.ConsumeIngredient(unfinishedThing, job.RecipeDef, actor.Map); + job.placedThings = null; + //return ingredients; + __result = ingredients; + return false; + } + List list = new List(); + if (job.placedThings != null) + { + for (int i = 0; i < job.placedThings.Count; i++) + { + if (job.placedThings[i].Count <= 0) + { + Log.Error("PlacedThing " + job.placedThings[i] + " with count " + job.placedThings[i].Count + " for job " + job); + } + else + { + Thing thing = (job.placedThings[i].Count >= job.placedThings[i].thing.stackCount) ? job.placedThings[i].thing : job.placedThings[i].thing.SplitOff(job.placedThings[i].Count); + job.placedThings[i].Count = 0; + if (list.Contains(thing)) + { + Log.Error("Tried to add ingredient from job placed targets twice: " + thing); + } + else + { + list.Add(thing); + + //Check if the Name of the Recipe is "CremateCorpse", if so do not strip. + if (!string.Equals(job.RecipeDef.defName, "CremateCorpse")) + { + IStrippable strippable = thing as IStrippable; + if (strippable != null) + { + strippable.Strip(); + } + } + } + } + } + } + job.placedThings = null; + + // return list; + __result = list; + return false; + } + + } +} +*/ \ No newline at end of file diff --git a/Source/ED-EnhancedOptions/1.3/Properties/AssemblyInfo.cs b/Source/ED-EnhancedOptions/1.3/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..e2eca79 --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ED-Plants24H")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ED-Plants24H")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("975c4632-336d-4100-87bb-32d726a1d86d")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Source/ED-EnhancedOptions/1.3/packages.config b/Source/ED-EnhancedOptions/1.3/packages.config new file mode 100644 index 0000000..c1dc9e9 --- /dev/null +++ b/Source/ED-EnhancedOptions/1.3/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Source/ED-EnhancedOptions/ED-EnhancedOptions.csproj b/Source/ED-EnhancedOptions/ED-EnhancedOptions.csproj new file mode 100755 index 0000000..0180263 --- /dev/null +++ b/Source/ED-EnhancedOptions/ED-EnhancedOptions.csproj @@ -0,0 +1,154 @@ + + + + + Debug + AnyCPU + {675CE9D5-460C-496A-A6A9-8D3873EDCC88} + Library + Properties + ED-EnhancedOptions + ED-EnhancedOptions + v4.8 + 512 + + 8 + + + true + full + false + DEBUG;TRACE;RIMWORLD12 + prompt + 4 + /rimworld/1.2/Mods/ED-EnhancedOptions/1.2/Assemblies + + + true + TRACE;RIMWORLD12 + prompt + 4 + /rimworld/1.2/Mods/ED-EnhancedOptions/1.2/Assemblies + + + /rimworld/1.3/Mods/ED-EnhancedOptions/1.3/Assemblies + RIMWORLD13 + + + /rimworld/1.4/Mods/ED-EnhancedOptions/1.4/Assemblies + RIMWORLD14 + + + + + + + + + + + + + + + + /rimworld/1.3/RimWorldLinux_Data/Managed/Assembly-CSharp.dll + False + + + + + + + + + + + /rimworld/1.3/RimWorldLinux_Data/Managed/UnityEngine.dll + False + + + /rimworld/1.3/RimWorldLinux_Data/Managed/UnityEngine.CoreModule.dll + False + + + + + + + + + + + + + /rimworld/1.4/RimWorldLinux_Data/Managed/Assembly-CSharp.dll + False + + + /rimworld/1.4/RimWorldLinux_Data/Managed/UnityEngine.dll + False + + + /rimworld/1.4/RimWorldLinux_Data/Managed/UnityEngine.CoreModule.dll + False + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ..\..\..\..\..\rimworld\1.4\Mods\Harmony\Current\Assemblies\0Harmony.dll + + + ..\..\..\..\..\rimworld\1.4\RimWorldLinux_Data\Managed\Assembly-CSharp.dll + + + ..\..\..\..\..\rimworld\1.4\RimWorldLinux_Data\Managed\UnityEngine.dll + + + ..\..\..\..\..\rimworld\1.4\RimWorldLinux_Data\Managed\UnityEngine.CoreModule.dll + + + ..\..\..\..\..\rimworld\1.2\RimWorldLinux_Data\Managed\UnityEngine.IMGUIModule.dll + + + + + diff --git a/Source/ED-EnhancedOptions/ED-EnhancedOptions.sln b/Source/ED-EnhancedOptions/ED-EnhancedOptions.sln new file mode 100644 index 0000000..a369869 --- /dev/null +++ b/Source/ED-EnhancedOptions/ED-EnhancedOptions.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30309.148 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBD}") = "ED-EnhancedOptions", "ED-EnhancedOptions.csproj", "{675CE9D5-460C-496A-A6A9-8D3873EDCC88}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Release v1.2|Any CPU = Release v1.2|Any CPU + Release v1.3|Any CPU = Release v1.3|Any CPU + Release v1.4|Any CPU = Release v1.4|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {675CE9D5-460C-496A-A6A9-8D3873EDCC88}.Release v1.2|Any CPU.ActiveCfg = Release v1.2|Any CPU + {675CE9D5-460C-496A-A6A9-8D3873EDCC88}.Release v1.2|Any CPU.Build.0 = Release v1.2|Any CPU + {675CE9D5-460C-496A-A6A9-8D3873EDCC88}.Release v1.3|Any CPU.ActiveCfg = Release v1.3|Any CPU + {675CE9D5-460C-496A-A6A9-8D3873EDCC88}.Release v1.3|Any CPU.Build.0 = Release v1.3|Any CPU + {675CE9D5-460C-496A-A6A9-8D3873EDCC88}.Release v1.4|Any CPU.ActiveCfg = Release v1.4|Any CPU + {675CE9D5-460C-496A-A6A9-8D3873EDCC88}.Release v1.4|Any CPU.Build.0 = Release v1.4|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {FDBBF6BA-4E0E-4D27-81CA-55526FD8EA78} + EndGlobalSection +EndGlobal diff --git a/Source/ED-EnhancedOptions/ED-EnhancedOptions.sln.DotSettings.user b/Source/ED-EnhancedOptions/ED-EnhancedOptions.sln.DotSettings.user new file mode 100644 index 0000000..4243f99 --- /dev/null +++ b/Source/ED-EnhancedOptions/ED-EnhancedOptions.sln.DotSettings.user @@ -0,0 +1,8 @@ + + True + True + True + True + <AssemblyExplorer> + <Assembly Path="/rimworld/1.2/RimWorldLinux_Data/Managed/Assembly-CSharp.dll" /> +</AssemblyExplorer> \ No newline at end of file