Files
Performance-Fish/Source/PerformanceFish/JobSystem/GenClosestPatches.cs
T
bbradson d34bc77869 1.5, added stuff, fixed stuff
- mod icon
- fixes for new vanilla clipping issues
- GenClosest optimization improving repairing, wardening, tending jobs
- caching for new ListerBuildings methods
- DynamicDrawManager single threading
- Type.GetFields caching
- StatParts analyzer category
- removed duplicate steam warning and optionally window
- added exception handling for debug menu, incidentworker, Graphic_Multi, InitializeComps, making all those now log what mod broke and not cause black screens or whatever
2024-04-27 22:31:07 +02:00

29 lines
1.0 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 PerformanceFish.Prepatching;
namespace PerformanceFish.JobSystem;
public sealed class GenClosestPatches : ClassWithFishPrepatches
{
public sealed class ClosestThingReachablePatch : FishPrepatch
{
public override string Description { get; }
= "Job scanning optimization making repairing, wardening and tending use a cache of targets where "
+ "appropriate";
public override MethodBase TargetMethodBase => methodof(GenClosest.ClosestThingReachable);
public static void Prefix(Map map, ref ThingRequest thingReq, IEnumerable<Thing>? customGlobalSearchSet)
{
if (!thingReq.CanBeFoundInRegion || customGlobalSearchSet is not ICollection<Thing> collection)
return;
if (map.listerThings.ThingsMatching(thingReq).Count > collection.Count * 5)
thingReq = ThingRequest.ForUndefined();
}
}
}