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:
@@ -113,11 +113,7 @@ public sealed class StoreUtilityPrepatches : ClassWithFishPrepatches
|
||||
var thingEvents = thing.Events();
|
||||
|
||||
if (thing is ISlotGroupParent)
|
||||
{
|
||||
thingEvents.Spawned += NotifySlotGroupCellCountChanged;
|
||||
thingEvents.Spawned += StorageSettingsPatches.InitializeSlotGroupParent;
|
||||
thingEvents.DeSpawned += NotifySlotGroupCellCountChanged;
|
||||
}
|
||||
|
||||
if (!thing.IsItem())
|
||||
return;
|
||||
@@ -126,12 +122,6 @@ public sealed class StoreUtilityPrepatches : ClassWithFishPrepatches
|
||||
thingEvents.DeregisteredAtThingGrid += TryNotifyLostThing;
|
||||
}
|
||||
|
||||
public static void NotifySlotGroupCellCountChanged(Thing slotGroupParent, Map map)
|
||||
=> NotifySlotGroupCellCountChanged(slotGroupParent);
|
||||
|
||||
public static void NotifySlotGroupCellCountChanged(Thing slotGroupParent)
|
||||
=> slotGroupParent.GetSlotGroup()?.NotifyCellCountChanged();
|
||||
|
||||
public static void TryNotifyReceivedThing(Thing thing, Map map, in IntVec3 cell)
|
||||
{
|
||||
if (cell.GetSlotGroupParent(map) is { } parent and Thing)
|
||||
@@ -370,13 +360,27 @@ public sealed class StoreUtilityPrepatches : ClassWithFishPrepatches
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
public static void TryRemoveFromListerHaulables(Thing t, StoragePriority currentPriority)
|
||||
{
|
||||
if (ModCompatibility.ActiveMods.Multiplayer | !HaulablesTickPatchActive)
|
||||
return;
|
||||
|
||||
if (t.IsInAnyStorage() /*t.IsInValidStorage()*/ && t.TryGetMapHeld() is { } map)
|
||||
map.listerHaulables.TryRemoveDirectly(t);
|
||||
|
||||
map.listerHaulables.Cache().ThingsQueuedToRemove.Add(t);
|
||||
|
||||
// remove for any storage instead of only valid storage to prevent further haul attempts until the next
|
||||
// automatic ListerHaulablesTick cycle
|
||||
}
|
||||
|
||||
private static int _haulablesTickPatchActive = int.MaxValue;
|
||||
|
||||
private static bool HaulablesTickPatchActive
|
||||
=> _haulablesTickPatchActive != int.MaxValue
|
||||
? _haulablesTickPatchActive.AsBool()
|
||||
: UpdateHaulablesTickPatchActive();
|
||||
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private static bool UpdateHaulablesTickPatchActive()
|
||||
=> (_haulablesTickPatchActive = Get<Haulables.TickPatch>().IsActive.AsInt()).AsBool();
|
||||
|
||||
public static class Debug
|
||||
{
|
||||
[Conditional("STORAGE_GROUP_DEBUG")]
|
||||
|
||||
Reference in New Issue
Block a user