Lots of new optimizations utilizing prepatcher
To start, this mod now requires Prepatcher and Fishery. New optimizations include: gene ticking improvements, world object improvements, hediff optimizations, world pawn gc optimizations, better mothballing, dds support, ContentFinder caching, additions and changes to reflection caching, as well as various other additions. Multiplayer support has been improved too, but should be considered highly experimental. The WorkGiver_DoBill bug is fixed in this build. Multiple patches aiming to improve RimWorld's load time have been added too.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2022 bradson
|
||||
// Copyright (c) 2023 bradson
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
@@ -9,8 +9,13 @@ public class StoreUtilityPatches : ClassWithFishPatches
|
||||
{
|
||||
public class IsInValidBestStorage_Patch : FishPatch
|
||||
{
|
||||
public override string Description => "Patches IsInValidBestStorage to immediately remove things from haulables when they're found to be in the best storage. Default often has them checked several more times before removal happens";
|
||||
public override Delegate TargetMethodGroup => StoreUtility.IsInValidBestStorage;
|
||||
public override string Description { get; }
|
||||
= "Patches IsInValidBestStorage to immediately remove things from haulables when they're found to be in "
|
||||
+ "the best storage. Default often has them checked several more times before removal happens";
|
||||
|
||||
public override Delegate TargetMethodGroup { get; } = StoreUtility.IsInValidBestStorage;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Postfix(Thing t, bool __result)
|
||||
{
|
||||
if (__result)
|
||||
@@ -19,7 +24,8 @@ public class StoreUtilityPatches : ClassWithFishPatches
|
||||
}
|
||||
/*else if (!t.IsInValidStorage())
|
||||
{
|
||||
if (!StoreUtility.TryFindBestBetterStorageFor(t, null, t.Map, StoragePriority.Unstored, Faction.OfPlayerSilentFail, out IntVec3 _, out IHaulDestination _, needAccurateResult: false))
|
||||
if (!StoreUtility.TryFindBestBetterStorageFor(t, null, t.Map, StoragePriority.Unstored,
|
||||
Faction.OfPlayerSilentFail, out IntVec3 _, out IHaulDestination _, needAccurateResult: false))
|
||||
{
|
||||
|
||||
}
|
||||
@@ -32,19 +38,25 @@ public class StoreUtilityPatches : ClassWithFishPatches
|
||||
{
|
||||
protected IsGoodStoreCell_Patch() => FishSettings.ThreadingPatches.Add(this);
|
||||
public override bool DefaultState => false;
|
||||
public override string Description => "Lock for threading. Only needed with threading enabled and off by default";
|
||||
public override Delegate TargetMethodGroup => StoreUtility.IsGoodStoreCell;
|
||||
|
||||
public override string Description { get; }
|
||||
= "Lock for threading. Only needed with threading enabled and off by default";
|
||||
|
||||
public override Delegate TargetMethodGroup { get; } = StoreUtility.IsGoodStoreCell;
|
||||
|
||||
public static void Prefix()
|
||||
{
|
||||
if (FishSettings.ThreadingEnabled)
|
||||
Monitor.Enter(Lock);
|
||||
}
|
||||
|
||||
public static Exception Finalizer(Exception __exception)
|
||||
{
|
||||
if (FishSettings.ThreadingEnabled)
|
||||
Monitor.Exit(Lock);
|
||||
return __exception;
|
||||
}
|
||||
|
||||
private static object Lock { get; } = new();
|
||||
}
|
||||
|
||||
@@ -52,19 +64,25 @@ public class StoreUtilityPatches : ClassWithFishPatches
|
||||
{
|
||||
protected GetStatValue_Patch() => FishSettings.ThreadingPatches.Add(this);
|
||||
public override bool DefaultState => false;
|
||||
public override string Description => "Lock for threading. Only needed with threading enabled and off by default";
|
||||
public override Delegate TargetMethodGroup => StatExtension.GetStatValue;
|
||||
|
||||
public override string Description { get; }
|
||||
= "Lock for threading. Only needed with threading enabled and off by default";
|
||||
|
||||
public override Delegate TargetMethodGroup { get; } = StatExtension.GetStatValue;
|
||||
|
||||
public static void Prefix()
|
||||
{
|
||||
if (FishSettings.ThreadingEnabled)
|
||||
Monitor.Enter(Lock);
|
||||
}
|
||||
|
||||
public static Exception Finalizer(Exception __exception)
|
||||
{
|
||||
if (FishSettings.ThreadingEnabled)
|
||||
Monitor.Exit(Lock);
|
||||
return __exception;
|
||||
}
|
||||
|
||||
private static object Lock { get; } = new();
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user