Skip to content

Commit

Permalink
v1.2
Browse files Browse the repository at this point in the history
- Added 1.1 support
  • Loading branch information
Jaxe-Dev committed Feb 24, 2020
1 parent c223c99 commit de9fd6f
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 64 deletions.
10 changes: 7 additions & 3 deletions About/About.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>

<ModMetaData>
<packageId>Jaxe.ToggleHarvest</packageId>
<name>Toggle Harvest</name>
<author>Jaxe</author>
<targetVersion>1.0.0</targetVersion>
<description>Mod Version: 1.1\n\n\nAdds an &lt;i&gt;Allow Harvest&lt;/i&gt; toggle to Growing Zones alongside the already existing &lt;i&gt;Allow Sowing&lt;/i&gt; button.</description>
<supportedVersions>
<li>1.0</li>
<li>1.1</li>
</supportedVersions>
<description>Mod Version: 1.2\n\n\nAdds an &lt;i&gt;Allow Harvest&lt;/i&gt; toggle to Growing Zones alongside the already existing &lt;i&gt;Allow Sowing&lt;/i&gt; button.</description>
</ModMetaData>
8 changes: 0 additions & 8 deletions About/Manifest.xml

This file was deleted.

15 changes: 0 additions & 15 deletions About/ModSync.xml

This file was deleted.

14 changes: 14 additions & 0 deletions LoadFolders.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<loadFolders>
<default>
<li></li>
<li>v1.1</li>
</default>
<v1.0>
<li></li>
</v1.0>
<v1.1>
<li></li>
<li>v1.1</li>
</v1.1>
</loadFolders>
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Toggle Harvest
![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)\
![Mod Version](https://img.shields.io/badge/Mod_Version-1.2-blue.svg)
![RimWorld Version](https://img.shields.io/badge/Built_for_RimWorld-1.1-blue.svg)
![Harmony Version](https://img.shields.io/badge/Powered_by_Harmony-2.0-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)

Expand All @@ -21,3 +21,13 @@ Adds an *Allow Harvest* button to Growing Zones alongside the already existing *

##### NON-STEAM INSTALLATION
- **[Download the latest release](https://github.com/Jaxe-Dev/ToggleHarvest/releases/latest) and unzip it into your *RimWorld/Mods* folder.**

---

The following base methods are patched with Harmony:
```
Postfix : RimWorld.WorkGiver_GrowerHarvest.HasJobOnCell
Postfix : RimWorld.Zone_Growing.ExposeData
Postfix : RimWorld.Zone_Growing.GetGizmos
Prefix : Verse.Profile.MemoryUtility.ClearAllMapsAndWorld
```
9 changes: 5 additions & 4 deletions Source/Mod.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.Generic;
using Harmony;
using System.Collections.Generic;
using HarmonyLib;
using RimWorld;
using Verse;

Expand All @@ -10,14 +10,15 @@ internal static class Mod
{
public const string Id = "ToggleHarvest";
public const string Name = "Toggle Harvest";
public const string Version = "1.1";
public const string Version = "1.2";

private static readonly HashSet<Zone_Growing> DisallowedZones = new HashSet<Zone_Growing>();

static Mod() => HarmonyInstance.Create(Id).PatchAll();
static Mod() => new Harmony(Id).PatchAll();

public static void Reset() => DisallowedZones.Clear();
public static bool IsAllowed(Zone_Growing zone) => !DisallowedZones.Contains(zone);

public static void SetAllowed(Zone_Growing zone, bool allowed)
{
var isDisallowed = DisallowedZones.Contains(zone);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Harmony;
using HarmonyLib;
using RimWorld;
using Verse;

Expand Down
2 changes: 1 addition & 1 deletion Source/Patch/RimWorld_Zone_Growing_ExposeData.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Harmony;
using HarmonyLib;
using RimWorld;
using Verse;

Expand Down
12 changes: 6 additions & 6 deletions Source/Patch/RimWorld_Zone_Growing_GetGizmos.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.Generic;
using Harmony;
using HarmonyLib;
using RimWorld;
using Verse;

Expand All @@ -12,11 +12,11 @@ private static void Postfix(Zone_Growing __instance, ref IEnumerable<Gizmo> __re
{
var allowHarvestCommand = new Command_Toggle
{
defaultLabel = "ToggleHarvest.CommandAllowHarvest".Translate(),
defaultDesc = "ToggleHarvest.CommandAllowHarvestDesc".Translate(),
icon = TexCommand.ForbidOff,
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<Gizmo>(__result) { allowHarvestCommand };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Harmony;
using HarmonyLib;
using Verse.Profile;

namespace ToggleHarvest.Patch
Expand Down
33 changes: 18 additions & 15 deletions Source/ToggleHarvest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D3159CFD-253F-4FA0-8846-1B44B1C6949B}</ProjectGuid>
<ProjectGuid>{F120A7C5-D60B-4DF4-B29D-08E9CDEC9452}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ToggleHarvest</RootNamespace>
<AssemblyName>ToggleHarvest</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<AllowedReferenceRelatedFileExtensions>None</AllowedReferenceRelatedFileExtensions>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
Expand All @@ -21,27 +22,28 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\Assemblies\</OutputPath>
<OutputPath>..\v1.1\Assemblies\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony, Version=1.2.0.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Assemblies\0Harmony.dll</HintPath>
<Reference Include="0Harmony, Version=2.0.0.5, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Lib.Harmony.2.0.0.5\lib\net472\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Core" />
<Reference Include="UnityEngine">
<HintPath>..\..\..\RimWorldWin64_Data\Managed\UnityEngine.dll</HintPath>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation" />
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
Expand All @@ -54,24 +56,25 @@
<Compile Include="Patch\Verse_Profile_MemoryUtility_ClearAllMapsAndWorld.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="..\.gitignore">
<Link>-\.gitignore</Link>
</Content>
<Content Include="..\About\About.xml">
<Link>-\About\About.xml</Link>
</Content>
<Content Include="..\About\Manifest.xml">
<Link>-\About\Manifest.xml</Link>
</Content>
<Content Include="..\About\ModSync.xml">
<Link>-\About\ModSync.xml</Link>
</Content>
<Content Include="..\Languages\English\Keyed\ToggleHarvest.xml">
<Link>-\Languages\English\Keyed\ToggleHarvest.xml</Link>
<SubType>Designer</SubType>
</Content>
<Content Include="..\LoadFolders.xml">
<Link>-\LoadFolders.xml</Link>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="..\README.md">
<Link>-\README.md</Link>
</None>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
10 changes: 3 additions & 7 deletions Source/ToggleHarvest.sln
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.9
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToggleHarvest", "ToggleHarvest.csproj", "{D3159CFD-253F-4FA0-8846-1B44B1C6949B}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToggleHarvest", "ToggleHarvest.csproj", "{F120A7C5-D60B-4DF4-B29D-08E9CDEC9452}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D3159CFD-253F-4FA0-8846-1B44B1C6949B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D3159CFD-253F-4FA0-8846-1B44B1C6949B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D3159CFD-253F-4FA0-8846-1B44B1C6949B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D3159CFD-253F-4FA0-8846-1B44B1C6949B}.Release|Any CPU.Build.0 = Release|Any CPU
{F120A7C5-D60B-4DF4-B29D-08E9CDEC9452}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F120A7C5-D60B-4DF4-B29D-08E9CDEC9452}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit de9fd6f

Please sign in to comment.