Skip to content

Commit

Permalink
Merge pull request #787 from zymex22/issue779
Browse files Browse the repository at this point in the history
Fixed "Started 10 Jobs" Job Errors
  • Loading branch information
Sn1p3rr3c0n authored May 12, 2024
2 parents 8dac843 + 73d3edf commit af4c25c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Source/ProjectRimFactory/Common/ConditionalPatchHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ public void PatchHandler(bool patch)
AccessTools.Method(typeof(RimWorld.Building_Storage), "Accepts", new Type[] { typeof(Verse.Thing) }),
AccessTools.Method(typeof(ProjectRimFactory.Common.HarmonyPatches.Patch_Building_Storage_Accepts), "Prefix")
);
public static TogglePatch Patch_StorageSettings_AllowedToAccept = new TogglePatch(
AccessTools.Method(typeof(RimWorld.StorageSettings), "AllowedToAccept", new Type[] { typeof(Verse.Thing) }),
AccessTools.Method(typeof(ProjectRimFactory.Common.HarmonyPatches.Patch_StorageSettings_AllowedToAccept), "Prefix")
);
public static TogglePatch Patch_ForbidUtility_IsForbidden = new TogglePatch(
AccessTools.Method(typeof(RimWorld.ForbidUtility), "IsForbidden", new Type[] { typeof(Thing), typeof(Pawn) }),
AccessTools.Method(typeof(ProjectRimFactory.Common.HarmonyPatches.Patch_ForbidUtility_IsForbidden), "Prefix")
Expand Down Expand Up @@ -113,6 +117,7 @@ private static void updatePatchStorage()
Patch_FloatMenuMakerMap_ChoicesAtFor.PatchHandler(state);
Patch_Building_Storage_Accepts.PatchHandler(state);
Patch_ForbidUtility_IsForbidden.PatchHandler(state);
Patch_StorageSettings_AllowedToAccept.PatchHandler(state);
}

public static void Register(Building_MassStorageUnit building)
Expand Down
26 changes: 26 additions & 0 deletions Source/ProjectRimFactory/Common/HarmonyPatches/PatchStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ static bool Prefix(Thing t, Pawn pawn, out bool __result)
}
}

// TODO Check if we still need that in 1.5
class Patch_Building_Storage_Accepts
{
static bool Prefix(Building_Storage __instance, Thing t, out bool __result)
Expand All @@ -47,6 +48,31 @@ static bool Prefix(Building_Storage __instance, Thing t, out bool __result)
}
}

// 1.5 Stuff
class Patch_StorageSettings_AllowedToAccept
{
static bool Prefix(IStoreSettingsParent ___owner, Thing t, out bool __result)
{
__result = false;
if (___owner is Building_Storage storage)
{
//Check if pawn input is forbidden
if ((storage as IForbidPawnInputItem)?.ForbidPawnInput ?? false)
{
//#699 #678
//This check is needed to support the use of the Limit function for the IO Ports
if (storage.Position != t.Position)
{
return false;
}
}
}


return true;
}
}

class Patch_FloatMenuMakerMap_ChoicesAtFor
{
static bool Prefix(Vector3 clickPos, Pawn pawn, out List<FloatMenuOption> __result)
Expand Down

0 comments on commit af4c25c

Please sign in to comment.