Stabilize RimWorld 1.6 caches and tick optimizations

This commit is contained in:
2026-10-02 04:00:27 -04:00
parent 3199c1a85e
commit 227dcd173f
14 changed files with 209 additions and 76 deletions
@@ -15,6 +15,8 @@ public sealed class PawnRenderingOptimizations : ClassWithFishPrepatches
public sealed class IsHiddenFromPlayerPatch : FishPrepatch
{
public override bool DefaultState => true;
// not 100% on this even benefitting, bionics, scars, etc likely worsen performance here because of the extra check
// probably better to just track if a hediff adds invisibility
public override string? Description { get; }
@@ -53,6 +55,8 @@ public sealed class PawnRenderingOptimizations : ClassWithFishPrepatches
public sealed class PawnRenderTreeComputeMatrixPatch : FishPrepatch
{
public override bool DefaultState => true;
public override string? Description { get; }
= "Avoids Matrix4x4 inverse work when undoing a pivot translation in PawnRenderTree.ComputeMatrix.";
@@ -85,6 +89,8 @@ public sealed class PawnRenderingOptimizations : ClassWithFishPrepatches
public sealed class DamageFlasherCurColorPatch : FishPrepatch
{
public override bool DefaultState => true;
private static readonly AccessTools.FieldRef<DamageFlasher, int> _lastDamageTick
= AccessTools.FieldRefAccess<DamageFlasher, int>("lastDamageTick");
@@ -110,6 +116,8 @@ public sealed class PawnRenderingOptimizations : ClassWithFishPrepatches
public sealed class DamageFlasherGetDamagedMatPatch : FishPrepatch
{
public override bool DefaultState => true;
private static readonly AccessTools.FieldRef<DamageFlasher, int> _lastDamageTick
= AccessTools.FieldRefAccess<DamageFlasher, int>("lastDamageTick");