diff --git a/About/About.xml b/About/About.xml index e1a25f6..6ce55c3 100644 --- a/About/About.xml +++ b/About/About.xml @@ -3,7 +3,6 @@ Toggle Harvest Jaxe - 0.19.0 - Adds an <i>Allow Harvest</i> toggle to Growing Zones alongside the already existing <i>Allow Sowing</i> button. - https://ludeon.com/forums/index.php?topic=43552.0 + 1.0.0 + Mod Version: 1.1\n\n\nAdds an <i>Allow Harvest</i> toggle to Growing Zones alongside the already existing <i>Allow Sowing</i> button. diff --git a/About/Manifest.xml b/About/Manifest.xml new file mode 100644 index 0000000..e88c48e --- /dev/null +++ b/About/Manifest.xml @@ -0,0 +1,8 @@ + + + + ToggleHarvest + 1.1 + https://github.com/Jaxe-Dev/ToggleHarvest/master/About/Manifest.xml + https://github.com/Jaxe-Dev/ToggleHarvest/releases/latest + diff --git a/About/ModSync.xml b/About/ModSync.xml index b145516..b3dd5f8 100644 --- a/About/ModSync.xml +++ b/About/ModSync.xml @@ -3,7 +3,7 @@ 59f538ed-f86d-4506-a4a5-7e9faaa3750a ToggleHarvest - v1.0 + v1.1 False Jaxe-Dev diff --git a/README.md b/README.md index 6948b81..5896a14 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,23 @@ # Toggle Harvest -![](https://img.shields.io/badge/Version-1.0-brightgreen.svg) - -Built for **RimWorld 1.0.x / 0.19.x**\ -Powered by **Harmony**\ -Supports **ModSync RW** +![Mod Version](https://img.shields.io/badge/Mod_Version-1.1-blue.svg) +![RimWorld Version](https://img.shields.io/badge/Built_for_RimWorld-1.0-blue.svg) +![Harmony Version](https://img.shields.io/badge/Powered_by_Harmony-1.2.0.1-blue.svg)\ +![Steam Subscribers](https://img.shields.io/badge/dynamic/xml.svg?label=Steam+Subscribers&query=//table/tr[2]/td[1]&colorB=blue&url=https://steamcommunity.com/sharedfiles/filedetails/%3Fid=1499848654&suffix=+total) +![GitHub Downloads](https://img.shields.io/github/downloads/Jaxe-Dev/ToggleHarvest/total.svg?colorB=blue&label=GitHub+Downloads) +[Link to Steam Workshop page](https://steamcommunity.com/sharedfiles/filedetails/?id=1499848654)\ [Link to Ludeon Forum Post](https://ludeon.com/forums/index.php?topic=43552.0) ------------- +--- + +Adds an *Allow Harvest* button to Growing Zones alongside the already existing *Allow Sowing* button. + +--- -Adds an *Allow Harvesting* button to Growing Zones alongside the already existing *Allow Sowing* button. +##### STEAM INSTALLATION +- **[Go to the Steam Workshop page](https://steamcommunity.com/sharedfiles/filedetails/?id=1499848654) and subscribe to the mod.** ------------- +--- -##### INSTALLATION +##### NON-STEAM INSTALLATION - **[Download the latest release](https://github.com/Jaxe-Dev/ToggleHarvest/releases/latest) and unzip it into your *RimWorld/Mods* folder.** diff --git a/Source/Mod.cs b/Source/Mod.cs index ac3ced7..80f4489 100644 --- a/Source/Mod.cs +++ b/Source/Mod.cs @@ -8,9 +8,13 @@ namespace ToggleHarvest [StaticConstructorOnStartup] internal static class Mod { + public const string Id = "ToggleHarvest"; + public const string Name = "Toggle Harvest"; + public const string Version = "1.1"; + private static readonly HashSet DisallowedZones = new HashSet(); - static Mod() => HarmonyInstance.Create("ToggleHarvest").PatchAll(); + static Mod() => HarmonyInstance.Create(Id).PatchAll(); public static void Reset() => DisallowedZones.Clear(); public static bool IsAllowed(Zone_Growing zone) => !DisallowedZones.Contains(zone); diff --git a/Source/Patch/RimWorld_Zone_Growing_GetGizmos.cs b/Source/Patch/RimWorld_Zone_Growing_GetGizmos.cs index ad47a30..a0e4218 100644 --- a/Source/Patch/RimWorld_Zone_Growing_GetGizmos.cs +++ b/Source/Patch/RimWorld_Zone_Growing_GetGizmos.cs @@ -11,13 +11,13 @@ internal static class RimWorld_Zone_Growing_GetGizmos private static void Postfix(Zone_Growing __instance, ref IEnumerable __result) { var allowHarvestCommand = new Command_Toggle - { - defaultLabel = "ToggleHarvest.CommandAllowHarvest".Translate(), - defaultDesc = "ToggleHarvest.CommandAllowHarvestDesc".Translate(), - icon = TexCommand.Forbidden, - isActive = () => Mod.IsAllowed(__instance), - toggleAction = () => Mod.SetAllowed(__instance, !Mod.IsAllowed(__instance)) - }; + { + defaultLabel = "ToggleHarvest.CommandAllowHarvest".Translate(), + defaultDesc = "ToggleHarvest.CommandAllowHarvestDesc".Translate(), + icon = TexCommand.ForbidOff, + isActive = () => Mod.IsAllowed(__instance), + toggleAction = () => Mod.SetAllowed(__instance, !Mod.IsAllowed(__instance)) + }; __result = new List(__result) { allowHarvestCommand }; } diff --git a/Source/Patch/Verse_Game_InitNewGame.cs b/Source/Patch/Verse_Game_InitNewGame.cs deleted file mode 100644 index 34b99fb..0000000 --- a/Source/Patch/Verse_Game_InitNewGame.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Harmony; -using Verse; - -namespace ToggleHarvest.Patch -{ - [HarmonyPatch(typeof(Game), nameof(Game.InitNewGame))] - internal static class Verse_Game_InitNewGame - { - private static void Prefix() => Mod.Reset(); - } -} diff --git a/Source/Patch/Verse_Game_LoadGame.cs b/Source/Patch/Verse_Game_LoadGame.cs deleted file mode 100644 index ad4eeaa..0000000 --- a/Source/Patch/Verse_Game_LoadGame.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Harmony; -using Verse; - -namespace ToggleHarvest.Patch -{ - [HarmonyPatch(typeof(Game), nameof(Game.LoadGame))] - internal static class Verse_Game_LoadGame - { - private static void Prefix() => Mod.Reset(); - } -} \ No newline at end of file diff --git a/Source/Patch/Verse_Profile_MemoryUtility_ClearAllMapsAndWorld.cs b/Source/Patch/Verse_Profile_MemoryUtility_ClearAllMapsAndWorld.cs new file mode 100644 index 0000000..42f8473 --- /dev/null +++ b/Source/Patch/Verse_Profile_MemoryUtility_ClearAllMapsAndWorld.cs @@ -0,0 +1,11 @@ +using Harmony; +using Verse.Profile; + +namespace ToggleHarvest.Patch +{ + [HarmonyPatch(typeof(MemoryUtility), "ClearAllMapsAndWorld")] + internal static class Verse_Profile_MemoryUtility_ClearAllMapsAndWorld + { + private static void Prefix() => Mod.Reset(); + } +} diff --git a/Source/Properties/AssemblyInfo.cs b/Source/Properties/AssemblyInfo.cs index e214a46..ff6831d 100644 --- a/Source/Properties/AssemblyInfo.cs +++ b/Source/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ using System.Reflection; +using ToggleHarvest; -[assembly: AssemblyTitle("ToggleHarvest")] -[assembly: AssemblyProduct("ToggleHarvest")] +[assembly: AssemblyTitle(Mod.Name)] +[assembly: AssemblyProduct("RimWorld Mods by Jaxe")] [assembly: AssemblyCopyright("© Jaxe")] -[assembly: AssemblyVersion("1.0")] -[assembly: AssemblyFileVersion("1.0")] +[assembly: AssemblyVersion(Mod.Version)] diff --git a/Source/ToggleHarvest.csproj b/Source/ToggleHarvest.csproj index 21256d5..0f30009 100644 --- a/Source/ToggleHarvest.csproj +++ b/Source/ToggleHarvest.csproj @@ -51,13 +51,15 @@ - - + -\About\About.xml + + -\About\Manifest.xml + -\About\ModSync.xml diff --git a/Source/ToggleHarvest.sln b/Source/ToggleHarvest.sln index ce78fe4..08850ce 100644 --- a/Source/ToggleHarvest.sln +++ b/Source/ToggleHarvest.sln @@ -19,4 +19,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ADA5545C-FB42-43B1-8E2A-DBB63E43BBDE} + EndGlobalSection EndGlobal