diff --git a/1.4/Assemblies/VFEF.dll b/1.4/Assemblies/VFEF.dll index 2af25c2..6063436 100644 Binary files a/1.4/Assemblies/VFEF.dll and b/1.4/Assemblies/VFEF.dll differ diff --git a/Source/VFEF/Building_PlantGrower_NoEmptyLines.cs b/Source/VFEF/Building/Building_PlantGrower_NoEmptyLines.cs similarity index 100% rename from Source/VFEF/Building_PlantGrower_NoEmptyLines.cs rename to Source/VFEF/Building/Building_PlantGrower_NoEmptyLines.cs diff --git a/Source/VFEF/Building_Scarecrow.cs b/Source/VFEF/Building/Building_Scarecrow.cs similarity index 100% rename from Source/VFEF/Building_Scarecrow.cs rename to Source/VFEF/Building/Building_Scarecrow.cs diff --git a/Source/VFEF/CompScaresAnimals.cs b/Source/VFEF/Comps/CompScaresAnimals.cs similarity index 100% rename from Source/VFEF/CompScaresAnimals.cs rename to Source/VFEF/Comps/CompScaresAnimals.cs diff --git a/Source/VFEF/CompSprinkler.cs b/Source/VFEF/Comps/CompSprinkler.cs similarity index 100% rename from Source/VFEF/CompSprinkler.cs rename to Source/VFEF/Comps/CompSprinkler.cs diff --git a/Source/VFEF/CompProperties_ScaresAnimals.cs b/Source/VFEF/Comps/Properties/CompProperties_ScaresAnimals.cs similarity index 100% rename from Source/VFEF/CompProperties_ScaresAnimals.cs rename to Source/VFEF/Comps/Properties/CompProperties_ScaresAnimals.cs diff --git a/Source/VFEF/CompProperties_Sprinkler.cs b/Source/VFEF/Comps/Properties/CompProperties_Sprinkler.cs similarity index 100% rename from Source/VFEF/CompProperties_Sprinkler.cs rename to Source/VFEF/Comps/Properties/CompProperties_Sprinkler.cs diff --git a/Source/VFEF/DefOfs/InternalDefOf.cs b/Source/VFEF/DefOfs/InternalDefOf.cs new file mode 100644 index 0000000..2dc154a --- /dev/null +++ b/Source/VFEF/DefOfs/InternalDefOf.cs @@ -0,0 +1,20 @@ + +using RimWorld; +using Verse; + + +namespace VFEF +{ + [DefOf] + public static class InternalDefOf + { + public static ThingDef VFE_PlanterBox; + public static ThingDef VFE_PlanterBox_Tilable; + + + static InternalDefOf() + { + DefOfHelper.EnsureInitializedInCtor(typeof(InternalDefOf)); + } + } +} diff --git a/Source/VFEF/Harmony/HarmonyInstance.cs b/Source/VFEF/Harmony/HarmonyInstance.cs new file mode 100644 index 0000000..1289abb --- /dev/null +++ b/Source/VFEF/Harmony/HarmonyInstance.cs @@ -0,0 +1,43 @@ +using HarmonyLib; +using RimWorld; +using System.Reflection; +using Verse; +using System.Reflection.Emit; +using System.Collections.Generic; +using UnityEngine; +using System.Linq; +using System; +using Verse.AI; +using RimWorld.Planet; + + + +namespace VFEF +{ + + public class VFEF : Mod + { + public VFEF(ModContentPack content) : base(content) + { + var harmony = new Harmony("com.vanillafarmingexpanded"); + harmony.PatchAll(Assembly.GetExecutingAssembly()); + } + } + +} + + + + + + + + + + + + + + + + diff --git a/Source/VFEF/Harmony/PlantUtility_CanSowOnGrower.cs b/Source/VFEF/Harmony/PlantUtility_CanSowOnGrower.cs new file mode 100644 index 0000000..2b9b414 --- /dev/null +++ b/Source/VFEF/Harmony/PlantUtility_CanSowOnGrower.cs @@ -0,0 +1,27 @@ +using HarmonyLib; +using RimWorld; +using Verse; +using System.Collections.Generic; + +namespace VFEF +{ + [HarmonyPatch(typeof(PlantUtility), nameof(PlantUtility.CanSowOnGrower))] + static class VFEF_PlantUtility_CanSowOnGrower_Patch + { + + public static List plantersList = new List() { InternalDefOf.VFE_PlanterBox, InternalDefOf.VFE_PlanterBox_Tilable }; + + public static bool Postfix(bool __result, ThingDef plantDef, object obj) + { + if ((obj is Building_PlantGrower planter) && plantersList.Contains(planter.def)) + { + if (planter.def.fertility >= 0f && planter.def.fertility < plantDef.plant.fertilityMin) + { + return false; + } + } + + return __result; + } + } +} diff --git a/Source/VFEF/VFEF_SprinklersManager.cs b/Source/VFEF/MapComponents/VFEF_SprinklersManager.cs similarity index 100% rename from Source/VFEF/VFEF_SprinklersManager.cs rename to Source/VFEF/MapComponents/VFEF_SprinklersManager.cs diff --git a/Source/VFEF/VFEF.csproj b/Source/VFEF/VFEF.csproj index db296e9..52eeeba 100644 --- a/Source/VFEF/VFEF.csproj +++ b/Source/VFEF/VFEF.csproj @@ -31,6 +31,10 @@ 4 + + ..\packages\Lib.Harmony.2.2.2\lib\net472\0Harmony.dll + False + ..\..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll False @@ -48,15 +52,22 @@ - - - - - - + + + + + + + + + - + + + + + \ No newline at end of file diff --git a/Source/VFEF/packages.config b/Source/VFEF/packages.config new file mode 100644 index 0000000..c5bef78 --- /dev/null +++ b/Source/VFEF/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file