Files
Performance-Fish/Source/PerformanceFish/JobSystem/WorkGiver_MergeOptimization.cs
T
bbradson ca9321add8 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.
2023-06-03 20:24:38 +02:00

38 lines
1.1 KiB
C#

// 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/.
using Verse.AI;
namespace PerformanceFish.JobSystem;
public class WorkGiver_MergeOptimization : ClassWithFishPatches
{
public class JobOnThing_Patch : FishPatch
{
public override string Description { get; }
= "Removes mergeables from ListerMergeables if they no longer qualify as mergeable when trying to check "
+ "for a merging job on them. Vanilla RimWorld just fails and keeps them in";
public override MethodBase TargetMethodInfo { get; }
= AccessTools.Method(typeof(WorkGiver_Merge), nameof(WorkGiver_Merge.JobOnThing));
public static bool Prefix(Thing t, ref Job? __result)
{
if (t.GetSlotGroup() is not null)
return true;
RemoveFromListerMergeables(t);
__result = null;
return false;
}
private static void RemoveFromListerMergeables(Thing t)
{
var map = t.MapHeld;
map.listerMergeables.TryRemove(t);
map.listerHaulables.Check(t);
}
}
}