Fix CopyAllowancesFrom patch for CE Custom Ammo compatibility
Thanks to @Epicguru for spotting the erroneous patch
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -254,12 +254,11 @@ public class WorkGiver_DoBillOptimization : ClassWithFishPatches
|
|||||||
|
|
||||||
if (cachedSmallestList.Count != smallestFilter.allowedDefs.Count)
|
if (cachedSmallestList.Count != smallestFilter.allowedDefs.Count)
|
||||||
{
|
{
|
||||||
// Log.Warning($"Cached list count: {cachedSmallestList.Count}, actual filter list count: {
|
Log.Warning($"Cached list count: {cachedSmallestList.Count}, actual filter list count: {
|
||||||
// smallestFilter.allowedDefs.Count}. Forcing a refresh now to fix.");
|
smallestFilter.allowedDefs.Count}. Forcing a refresh now to fix.");
|
||||||
ThingFilterPatches.ForceSynchronizeCache(smallestFilter);
|
ThingFilterPatches.ForceSynchronizeCache(smallestFilter);
|
||||||
// Log.Warning($"New cached list count: {cachedSmallestList.Count}, actual filter list count: {
|
Log.Warning($"New cached list count: {cachedSmallestList.Count}, actual filter list count: {
|
||||||
// smallestFilter.allowedDefs.Count}.");
|
smallestFilter.allowedDefs.Count}.");
|
||||||
// didn't trigger in 1.3, but now does. Fuck
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var smallestListCount = cachedSmallestList.Count;
|
var smallestListCount = cachedSmallestList.Count;
|
||||||
|
|||||||
@@ -101,8 +101,12 @@ public class ThingFilterPatches : ClassWithFishPatches
|
|||||||
= static () => default(ThingFilter)!.CopyAllowancesFrom(null);
|
= static () => default(ThingFilter)!.CopyAllowancesFrom(null);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void Prefix(ThingFilter __instance)
|
public static void Prefix(ThingFilter __instance, ThingFilter other)
|
||||||
=> AllowedDefsListCache.GetAndCheck<AllowedDefsListCacheValue>(__instance).Defs.Clear();
|
{
|
||||||
|
var defs = AllowedDefsListCache.GetAndCheck<AllowedDefsListCacheValue>(__instance).Defs;
|
||||||
|
defs.Clear();
|
||||||
|
defs.AddRange(other.AllowedThingDefs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SetAllow_Patch : FishPatch
|
public class SetAllow_Patch : FishPatch
|
||||||
|
|||||||
Reference in New Issue
Block a user