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:
@@ -123,10 +123,10 @@ public sealed class HediffSetPrecaching : ClassWithFishPrepatches
|
||||
public static bool Prefix(HediffSet __instance, BodyPartHeight height, BodyPartDepth depth, BodyPartTagDef? tag,
|
||||
BodyPartRecord? partParent, ref IEnumerable<BodyPartRecord> __result, out bool __state)
|
||||
{
|
||||
if (height != BodyPartHeight.Undefined
|
||||
|| depth != BodyPartDepth.Undefined
|
||||
|| tag != null
|
||||
|| partParent != null)
|
||||
if ((height != BodyPartHeight.Undefined)
|
||||
| (depth != BodyPartDepth.Undefined)
|
||||
| (tag != null)
|
||||
| (partParent != null))
|
||||
{
|
||||
__state = false;
|
||||
return true;
|
||||
@@ -173,7 +173,7 @@ public sealed class HediffSetCaching : ClassWithFishPatches
|
||||
}
|
||||
}
|
||||
|
||||
public record struct NotMissingPartsCacheValue
|
||||
public record struct NotMissingPartsCacheValue()
|
||||
{
|
||||
private int _version = -1;
|
||||
private List<Hediff> _hediffsInSet = [];
|
||||
@@ -200,13 +200,9 @@ public sealed class HediffSetCaching : ClassWithFishPatches
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => _version != _hediffsInSet._version || TickHelper.Past(_nextRefreshTick);
|
||||
}
|
||||
|
||||
public NotMissingPartsCacheValue()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public record struct HediffCacheValue
|
||||
public record struct HediffCacheValue()
|
||||
{
|
||||
private int _version = -1;
|
||||
private List<Hediff> _hediffsInSet = [];
|
||||
@@ -227,21 +223,13 @@ public sealed class HediffSetCaching : ClassWithFishPatches
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => _version != _hediffsInSet._version || TickHelper.Past(_nextRefreshTick);
|
||||
}
|
||||
|
||||
public HediffCacheValue()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public record struct VisibleHediffCacheValue
|
||||
public record struct VisibleHediffCacheValue()
|
||||
{
|
||||
public HediffCacheValue Value = new();
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Update(HediffSet set, Hediff? hediff) => Value.Update(set, hediff);
|
||||
|
||||
public VisibleHediffCacheValue()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,19 +56,10 @@ public sealed class ImmunityHandlerCaching : ClassWithFishPatches
|
||||
|
||||
public sealed class ImmunityRecordExists : FishPatch
|
||||
{
|
||||
public override List<Type> LinkedPatches { get; } = [typeof(TryAddImmunityRecord)];
|
||||
|
||||
public override string? Description { get; } = "Required by the TryAddImmunityRecord optimization.";
|
||||
|
||||
public override bool Enabled
|
||||
{
|
||||
set
|
||||
{
|
||||
if (base.Enabled == value)
|
||||
return;
|
||||
|
||||
Get<TryAddImmunityRecord>().Enabled = base.Enabled = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override MethodBase TargetMethodInfo { get; }
|
||||
= AccessTools.Method(typeof(ImmunityHandler), nameof(ImmunityHandler.ImmunityRecordExists));
|
||||
|
||||
@@ -84,19 +75,10 @@ public sealed class ImmunityHandlerCaching : ClassWithFishPatches
|
||||
|
||||
public sealed class TryAddImmunityRecord : FishPatch
|
||||
{
|
||||
public override List<Type> LinkedPatches { get; } = [typeof(ImmunityRecordExists)];
|
||||
|
||||
public override string? Description { get; }
|
||||
= "Optimization for this specific method to not run more checks than necessary.";
|
||||
|
||||
public override bool Enabled
|
||||
{
|
||||
set
|
||||
{
|
||||
if (base.Enabled == value)
|
||||
return;
|
||||
|
||||
Get<ImmunityRecordExists>().Enabled = base.Enabled = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override MethodBase TargetMethodInfo { get; }
|
||||
= AccessTools.Method(typeof(ImmunityHandler), nameof(ImmunityHandler.TryAddImmunityRecord));
|
||||
@@ -110,7 +92,7 @@ public sealed class ImmunityHandlerCaching : ClassWithFishPatches
|
||||
}
|
||||
}
|
||||
|
||||
public record struct ImmunityInfoCacheValue
|
||||
public record struct ImmunityInfoCacheValue()
|
||||
{
|
||||
private int _version = -1;
|
||||
private List<Hediff> _hediffsInSet = [];
|
||||
@@ -132,15 +114,11 @@ public sealed class ImmunityHandlerCaching : ClassWithFishPatches
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => _version != _hediffsInSet._version || TickHelper.Past(_nextRefreshTick);
|
||||
}
|
||||
|
||||
public ImmunityInfoCacheValue()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public record struct ImmunityRecordExistsCacheValue
|
||||
public record struct ImmunityRecordExistsCacheValue()
|
||||
{
|
||||
public bool Value;
|
||||
public int ImmunityListVersion;
|
||||
public int ImmunityListVersion = -2;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user