fix crashes, temp disable reflection caching, possibly reduce optimization in some areas, likely break 1.5

This commit is contained in:
localavaster
2026-04-14 00:12:50 -06:00
parent 9821c68999
commit 35187cf2d2
20 changed files with 275 additions and 107 deletions
@@ -3,7 +3,7 @@
// 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/.
global using LwmCompCache = PerformanceFish.Cache.ByReference<Verse.Thing, PerformanceFish.Hauling.LwmCompCacheValue>;
global using LwmCompCache = PerformanceFish.Cache.ByReference<Verse.ThingDef, PerformanceFish.Hauling.LwmCompCacheValue>;
namespace PerformanceFish.Hauling;
@@ -11,9 +11,9 @@ public record struct LwmCompCacheValue
{
public CompProperties? CompProperties;
public static CompProperties? TryGetLwmProps(Thing slotGroupParent)
public static CompProperties? TryGetLwmProps(ThingDef thingDef)
=> ModCompatibility.Types.LWM.CompProperties != null
? slotGroupParent.def.comps?.Find(static props
? thingDef.comps?.Find(static props
=> props.GetType() == ModCompatibility.Types.LWM.CompProperties)
: null;
@@ -35,4 +35,4 @@ public record struct LwmCompCacheValue
=> ModCompatibility.Types.LWM.CompProperties is { } propsType
? AccessTools.FieldRefAccess<CompProperties, int>(AccessTools.Field(propsType, name))
: null;
}
}