Added stat caching, fixed all the bugs
Added RitualObligationTriggers analyzer category, Fixed defs from other mods with broken market value breaking fish's storage patches, Fixed storage caches not updating for quality, rotting and similar changes to stored things, Fixed storage caches not updating capacity when reinstalling storage, Fixed prison labor compatibility, Improved multiplayer compatibility, Fixed ideology style dominance and altar sharing patches throwing errors instead of defaulting to disabled when not having ideology, Fixed compatibility with RIMMSqol's world pawn GC patch by disabling that patch, Fixed rare threading issues throwing errors on startup
This commit is contained in:
@@ -14,7 +14,7 @@ using IngredientCacheList
|
||||
bool Found)>;
|
||||
using OpCodes = System.Reflection.Emit.OpCodes;
|
||||
using RecipeIngredientCache
|
||||
= PerformanceFish.Cache.ByIndex<RimWorld.Bill,
|
||||
= PerformanceFish.Cache.ByInt<RimWorld.Bill,
|
||||
PerformanceFish.JobSystem.WorkGiver_DoBillOptimization.RecipeIngredientCacheValue>;
|
||||
|
||||
namespace PerformanceFish.JobSystem;
|
||||
@@ -96,7 +96,7 @@ public sealed class WorkGiver_DoBillPrepatches : ClassWithFishPrepatches
|
||||
}
|
||||
else
|
||||
{
|
||||
ref var cache = ref RecipeIngredientCache.Get.GetReference(bill);
|
||||
ref var cache = ref RecipeIngredientCache.GetOrAddReference(bill.GetLoadID());
|
||||
if (cache.thingDefs is null || cache.Dirty)
|
||||
{
|
||||
cache.thingDefs = UpdateCache(bill, r, cache.thingDefs);
|
||||
@@ -501,7 +501,7 @@ public sealed class WorkGiver_DoBillOptimization : ClassWithFishPatches
|
||||
if (thingValidatorInstance is null)
|
||||
return;
|
||||
|
||||
var cache = RecipeIngredientCache.Get[thingValidatorInstance.Bill].thingDefs;
|
||||
var cache = RecipeIngredientCache.GetOrAdd(thingValidatorInstance.Bill.loadID).thingDefs;
|
||||
if (cache is null)
|
||||
return;
|
||||
|
||||
@@ -583,7 +583,7 @@ public sealed class WorkGiver_DoBillOptimization : ClassWithFishPatches
|
||||
return;
|
||||
}
|
||||
|
||||
var cache = RecipeIngredientCache.Get[bill].thingDefs;
|
||||
var cache = RecipeIngredientCache.GetOrAdd(bill.loadID).thingDefs;
|
||||
if (cache is null)
|
||||
return;
|
||||
|
||||
@@ -599,10 +599,10 @@ public sealed class WorkGiver_DoBillOptimization : ClassWithFishPatches
|
||||
}
|
||||
}
|
||||
|
||||
public record struct RecipeIngredientCacheValue
|
||||
public record struct RecipeIngredientCacheValue()
|
||||
{
|
||||
public IngredientCacheList? thingDefs;
|
||||
private int _nextRefreshTick;
|
||||
private int _nextRefreshTick = -2;
|
||||
|
||||
public void Update(Bill bill)
|
||||
=> _nextRefreshTick = TickHelper.Add(GenTicks.TickRareInterval * 2, bill.loadID);
|
||||
|
||||
Reference in New Issue
Block a user