Exemplo n.º 1
0
        private static ThinkResult InsertMountingJobs(Pawn pawn, Pawn closestAnimal, LocalTargetInfo target, LocalTargetInfo secondTarget, ref ExtendedPawnData pawnData, ExtendedPawnData animalData, Pawn_JobTracker __instance, ThinkResult __result)
        {
            ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage();

            //__instance.jobQueue.EnqueueFirst(dismountJob);
            if (pawn.CanReserve(target) && pawn.CanReserve(closestAnimal))
            {
                Job oldJob = __result.Job;

                ExtendedPawnData pawnDataTest = store.GetExtendedDataFor(pawn);
                pawnDataTest.targetJob = oldJob;
                Job mountJob  = new Job(GUC_JobDefOf.Mount, closestAnimal);
                Job rideToJob = new Job(GU_RR_JobDefOf.RideToJob, closestAnimal, target);

                if (pawnData.mount != null)
                {
                    __instance.jobQueue.EnqueueFirst(oldJob);
                    __result = new ThinkResult(rideToJob, __result.SourceNode, __result.Tag, false);
                }
                else
                {
                    __instance.jobQueue.EnqueueFirst(oldJob);
                    __instance.jobQueue.EnqueueFirst(rideToJob);
                    __result = new ThinkResult(mountJob, __result.SourceNode, __result.Tag, false);
                }
            }
            return(__result);
        }
Exemplo n.º 2
0
        static void Postfix(ref Pawn_JobTracker __instance, ref ThinkResult __result)
        {
            Pawn pawn = Traverse.Create(__instance).Field("pawn").GetValue <Pawn>();

            if (!pawn.RaceProps.IsMechanoid)
            {
                return;
            }

            ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage();

            if (store != null)
            {
                //de-activate if should auto recharge and power is very low.
                ExtendedPawnData pawnData = store.GetExtendedDataFor(pawn);
                if (pawn.ShouldRecharge() &&
                    pawn.IsActivated()
                    )
                {
                    pawn.drafter.Drafted = false;
                    pawnData.isActive    = false;
                }
            }
            if (pawn.Downed)
            {
                return;
            }
            if (pawn.IsHacked() && pawn.IsActivated() && pawn.health.hediffSet.HasHediff(WTH_DefOf.WTH_TargetingHackedPoorly))
            {
                HackedPoorlyEvent(pawn);
            }
        }
        static void Postfix(ref Pawn p, ref float __result)
        {
            ExtendedDataStorage store = GiddyUpCore.Base.Instance.GetExtendedDataStorage();

            if (store == null)//this check is needed because some mods call this function on world load
            {
                return;
            }

            ExtendedPawnData pawnData = store.GetExtendedDataFor(p);

            if (pawnData == null || pawnData.caravanRider == null)
            {
                return;
            }
            else
            {
                //new solution A - more forgiving
                //float riderTotalMass = pawnData.caravanRider.GetStatValue(StatDefOf.Mass);
                //float riderGearInvMass = MassUtility.GearAndInventoryMass(pawnData.caravanRider);
                //float riderBodyMass = riderTotalMass - riderGearInvMass;
                //__result -= riderBodyMass;
                //__result = Math.Max(__result, 0f);

                //new solution B - more restrictive
                float riderTotalMass   = pawnData.caravanRider.GetStatValue(StatDefOf.Mass);
                float riderGearInvMass = MassUtility.GearAndInventoryMass(pawnData.caravanRider);
                float riderBodyMass    = riderTotalMass - riderGearInvMass;
                float riderCapacity    = MassUtility.Capacity(pawnData.caravanRider);
                float riderGrossMass   = riderBodyMass + riderCapacity;
                __result -= riderGrossMass;
                __result  = Math.Max(__result, 0f);
            }
        }
Exemplo n.º 4
0
        static void Postfix(Pawn_JobTracker __instance, ref ThinkResult __result)
        {
            Pawn pawn = Traverse.Create(__instance).Field("pawn").GetValue <Pawn>();

            if (!pawn.IsColonistPlayerControlled)
            {
                return;
            }
            ExtendedDataStorage store    = Base.Instance.GetExtendedDataStorage();
            ExtendedPawnData    pawnData = store.GetExtendedDataFor(pawn);

            if (store == null || pawnData == null)
            {
                return;
            }

            if (pawnData.owning == null || !pawnData.owning.Spawned || pawnData.owning.Downed || pawnData.owning.Dead || pawnData.mount != null)
            {
                return;
            }

            LocalTargetInfo target             = DistanceUtility.GetFirstTarget(__result.Job, TargetIndex.A);
            float           pawnTargetDistance = DistanceUtility.QuickDistance(pawnData.owning.Position, target.Cell);

            if (pawnTargetDistance > 10 || __result.Job.def == JobDefOf.LayDown || __result.Job.def == JobDefOf.Research || pawn.InMentalState || pawn.Dead || pawn.Downed)
            {
                if (pawnData.owning.jobs.curJob != null && pawnData.owning.jobs.curJob.def == JobDefOf.Wait)
                {
                    pawnData.owning.jobs.EndCurrentJob(JobCondition.InterruptForced);
                }
                ExtendedPawnData animalData = store.GetExtendedDataFor(pawnData.owning);
                pawnData.owning    = null;
                animalData.ownedBy = null;
            }
        }
Exemplo n.º 5
0
        public override void TickRare()
        {
            MaybeTalkGibberish();
            DrainMoodAfterTickRare();
            if (CurMoodCategory == Mood.Mad && !goingRogue)
            {
                MaybeGoRogue();
            }
            if (textTimeout > 0)
            {
                textTimeout--;
            }
            foreach (Building_TurretGun turret in controlledTurrets)
            {
                if (turret.DestroyedOrNull())
                {
                    CancelControlTurret(turret);
                }
            }
            ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage();

            if (store != null)
            {
                ExtendedMapData mapData = store.GetExtendedDataFor(this.Map);
                mapData.rogueAI = this;
            }
        }
Exemplo n.º 6
0
 public override void WorldLoaded()
 {
     _extendedDataStorage = UtilityWorldObjectManager.GetUtilityWorldObject <ExtendedDataStorage>();
     _extendedDataStorage.Cleanup();
     base.WorldLoaded();
     LessonAutoActivator.TeachOpportunity(GUC_ConceptDefOf.GUC_Animal_Handling, OpportunityType.GoodToKnow);
 }
        // Token: 0x06000022 RID: 34 RVA: 0x00003818 File Offset: 0x00001A18
        public static bool COWTryGetOffHandEquipment(this Pawn_EquipmentTracker instance, out ThingWithComps result)
        {
            result = null;
            bool flag = instance.pawn.HasMissingArmOrHand();
            bool result2;

            if (flag)
            {
                result2 = false;
            }
            else
            {
                ExtendedDataStorage extendedDataStorage = Base.Instance.GetExtendedDataStorage();
                foreach (ThingWithComps thingWithComps in instance.AllEquipmentListForReading)
                {
                    ExtendedThingWithCompsData extendedThingWithCompsData;
                    bool flag2 = extendedDataStorage.TryGetExtendedDataFor(thingWithComps, out extendedThingWithCompsData) && extendedThingWithCompsData.isOffHand;
                    if (flag2)
                    {
                        result = thingWithComps;
                        return(true);
                    }
                }
                result2 = false;
            }
            return(result2);
        }
Exemplo n.º 8
0
        static bool Prefix(Pawn __instance, Vector3 drawLoc, bool flip = false)
        {
            ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage();

            if (store == null)
            {
                return(true);
            }
            ExtendedPawnData pawnData = store.GetExtendedDataFor(__instance);

            if (pawnData != null && pawnData.mount != null)
            {
                drawLoc = pawnData.mount.Drawer.DrawPos;

                if (pawnData.drawOffset != -1)
                {
                    drawLoc.z = pawnData.mount.Drawer.DrawPos.z + pawnData.drawOffset;
                }
                if (__instance.Rotation == Rot4.South)
                {
                    AnimalRecord value;
                    bool         found = Base.drawSelecter.Value.InnerList.TryGetValue(pawnData.mount.def.defName, out value);
                    if (found && value.isSelected)
                    {
                        drawLoc.y = pawnData.mount.Drawer.DrawPos.y - 1;
                    }
                }
                __instance.Drawer.DrawAt(drawLoc);
                return(false);
            }
            return(true);
        }
Exemplo n.º 9
0
        private static IEnumerable <Gizmo> AddHackedPawnGizmos(Pawn __instance, ExtendedDataStorage store)
        {
            ExtendedPawnData pawnData = store.GetExtendedDataFor(__instance);

            yield return(CreateGizmo_SearchAndDestroy(__instance, pawnData));

            Need_Power       powerNeed       = __instance.needs.TryGetNeed <Need_Power>();
            Need_Maintenance maintenanceNeed = __instance.needs.TryGetNeed <Need_Maintenance>();

            if (powerNeed != null)
            {
                yield return(CreateGizmo_AutoRecharge(__instance, powerNeed));
            }
            HediffSet hediffSet = __instance.health.hediffSet;

            if (!__instance.IsColonistPlayerControlled)
            {
                if (__instance.apparel != null)
                {
                    foreach (Gizmo apparelGizmo in __instance.apparel.GetGizmos())
                    {
                        yield return(apparelGizmo);
                    }
                }
            }
            if (__instance.workSettings != null)
            {
                yield return(CreateGizmo_Work(__instance, pawnData));

                if (powerNeed != null)
                {
                    yield return(CreateGizmo_WorkThreshold(__instance, powerNeed));
                }
            }
            if (maintenanceNeed != null)
            {
                yield return(CreateGizmo_MaintenanceThreshold(__instance, maintenanceNeed));
            }
            if (hediffSet.HasHediff(WTH_DefOf.WTH_SelfDestruct))
            {
                yield return(CreateGizmo_SelfDestruct(__instance, pawnData));
            }
            if (hediffSet.HasHediff(WTH_DefOf.WTH_RepairModule))
            {
                yield return(CreateGizmo_SelfRepair(__instance, pawnData));
            }
            if (hediffSet.HasHediff(WTH_DefOf.WTH_RepairModule) && hediffSet.HasHediff(WTH_DefOf.WTH_RepairArm))
            {
                yield return(CreateGizmo_Repair(__instance, pawnData));
            }
            if (hediffSet.HasHediff(WTH_DefOf.WTH_BeltModule))
            {
                yield return(CreateGizmo_EquipBelt(__instance, pawnData));
            }
            if (hediffSet.HasHediff(WTH_DefOf.WTH_OverdriveModule))
            {
                yield return(CreateGizmo_Overdrive(__instance, pawnData));
            }
        }
Exemplo n.º 10
0
        public override void WorldLoaded()
        {
            base.WorldLoaded();

            _extendedDataStorage = Find.World.GetComponent <ExtendedDataStorage>();
            _extendedDataStorage.Cleanup();
            LessonAutoActivator.TeachOpportunity(GUC_ConceptDefOf.GUC_Animal_Handling, OpportunityType.GoodToKnow);
        }
Exemplo n.º 11
0
 public override void WorldLoaded()
 {
     if (_extendedDataStorage == null)
     {
         _extendedDataStorage = Find.World.GetComponent <ExtendedDataStorage>();
     }
     base.WorldLoaded();
 }
Exemplo n.º 12
0
        static void Postfix(Pawn_JobTracker __instance, ref ThinkResult __result)
        {
            Pawn pawn = Traverse.Create(__instance).Field("pawn").GetValue <Pawn>();


            if (pawn.IsColonistPlayerControlled || pawn.RaceProps.Animal)
            {
                return;
            }

            LocalTargetInfo target = DistanceUtility.GetFirstTarget(__result.Job, TargetIndex.A);

            if (!target.IsValid)
            {
                return;
            }

            ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage();

            if (store == null)
            {
                return;
            }

            //Log.Message("wrong duty");
            ExtendedPawnData PawnData = store.GetExtendedDataFor(pawn);
            Lord             lord     = pawn.GetLord();

            if (lord == null)
            {
                return;
            }
            QueuedJob qJob = pawn.jobs.jobQueue.FirstOrFallback(null);

            if (qJob != null && (qJob.job.def == GUC_JobDefOf.Dismount))
            {
                return;
            }

            Log.Message("curLordToil: " + pawn.GetLord().CurLordToil.ToString() + ", pawn name: " + pawn.Name);
            Log.Message("lordJob: " + pawn.GetLord().LordJob + ", pawn name: " + pawn.Name);
            Log.Message("lord.CurLordToil.GetType().Name" + lord.CurLordToil.GetType().Name);

            if (lord.CurLordToil is LordToil_ExitMapAndEscortCarriers)
            {
                if (PawnData.owning != null && PawnData.mount == null && !PawnData.owning.Downed && PawnData.owning.Spawned)
                {
                    mountAnimal(__instance, pawn, PawnData, ref __result);
                }
            }
            else if (lord.CurLordToil.GetType().Name == "LordToil_DefendTraderCaravan" || lord.CurLordToil is LordToil_DefendPoint) //first option is internal class, hence this way of accessing.
            {
                if (PawnData.mount != null)
                {
                    parkAnimal(__instance, pawn, PawnData);
                }
            }
        }
        static void Postfix(JobDriver_Mount __instance)
        {
            ExtendedDataStorage store      = Base.Instance.GetExtendedDataStorage();
            ExtendedPawnData    pawnData   = store.GetExtendedDataFor(__instance.pawn);
            ExtendedPawnData    animalData = store.GetExtendedDataFor(__instance.Mount);

            pawnData.owning    = __instance.Mount;
            animalData.ownedBy = __instance.pawn;
        }
Exemplo n.º 14
0
        static void Postfix(Thing item)
        {
            ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage();

            if (store != null && item is ThingWithComps eq && store.TryGetExtendedDataFor(eq, out ExtendedThingWithCompsData result))
            {
                store.DeleteExtendedDataFor(eq);
            }
        }
Exemplo n.º 15
0
 public override void WorldLoaded()
 {
     //Failsafe if other mods prevent the store from being loaded during MapComponentsInitializing
     if (_extendedDataStorage == null)
     {
         _extendedDataStorage = UtilityWorldObjectManager.GetUtilityWorldObject <ExtendedDataStorage>();
     }
     base.WorldLoaded();
 }
Exemplo n.º 16
0
        public static void Postfix(Pawn_DraftController __instance)
        {
            ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage();

            if (store != null && !__instance.Drafted)
            {
                ExtendedPawnData pawnData = store.GetExtendedDataFor(__instance.pawn);
                pawnData.SD_enabled = false;
            }
        }
Exemplo n.º 17
0
 static void Postfix(Pawn pawn, ref bool __result)
 {
     if (__result && pawn.IsFormingCaravan())
     {
         ExtendedDataStorage store = GiddyUpCore.Base.Instance.GetExtendedDataStorage();
         var caravanRider          = store.GetExtendedDataFor(pawn).caravanRider;
         __result = caravanRider == null;
         return;
     }
 }
Exemplo n.º 18
0
        /*
         * public static bool HasHackedLocomotion(this Pawn pawn)
         * {
         *  if (pawn.health != null && (pawn.health.hediffSet.HasHediff(WTH_DefOf.WTH_LocomotionHacked)))
         *  {
         *      return true;
         *  }
         *  else
         *  {
         *      return false;
         *  }
         * }
         */

        public static Pawn RemoteControlLink(this Pawn pawn)
        {
            ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage();

            if (store != null)
            {
                ExtendedPawnData pawnData = Base.Instance.GetExtendedDataStorage().GetExtendedDataFor(pawn);
                return(pawnData.remoteControlLink);
            }
            return(null);
        }
Exemplo n.º 19
0
        public static bool IsActivated(this Pawn pawn)
        {
            ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage();

            if (store != null)
            {
                ExtendedPawnData pawnData = store.GetExtendedDataFor(pawn);
                return(pawnData.isActive);
            }
            return(false);
        }
Exemplo n.º 20
0
        static void Postfix(ref Pawn_JobTracker __instance, ref ThinkResult __result)
        {
            Pawn pawn = Traverse.Create(__instance).Field("pawn").GetValue <Pawn>();

            if (!pawn.RaceProps.IsMechanoid)
            {
                return;
            }

            ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage();

            if (store != null)
            {
                //de-activate if should auto recharge and power is very low.
                ExtendedPawnData pawnData  = store.GetExtendedDataFor(pawn);
                Need_Power       powerNeed = pawn.needs.TryGetNeed(WTH_DefOf.WTH_Mechanoid_Power) as Need_Power;
                if (powerNeed != null &&
                    powerNeed.CurCategory >= PowerCategory.LowPower &&
                    pawnData.shouldAutoRecharge &&
                    pawn.IsActivated()
                    )
                {
                    pawn.drafter.Drafted = false;
                    pawnData.isActive    = false;
                }
            }

            if (pawn.Faction == Faction.OfPlayer && pawn.IsHacked() && !pawn.IsActivated() && pawn.OnBaseMechanoidPlatform() && pawn.CanReserve(pawn.CurrentBed()))
            {
                Job job = new Job(WTH_DefOf.WTH_Mechanoid_Rest, pawn.CurrentBed());
                job.count = 1;
                __result  = new ThinkResult(job, __result.SourceNode, __result.Tag, false);
            }

            if (pawn.Downed)
            {
                return;
            }


            if (pawn.IsHacked() && pawn.IsActivated() && pawn.health.hediffSet.HasHediff(WTH_DefOf.WTH_TargetingHackedPoorly))
            {
                HackedPoorlyEvent(pawn);
            }
            if (pawn.Faction == Faction.OfPlayer && pawn.IsHacked() && !pawn.IsActivated() && !pawn.OnBaseMechanoidPlatform() && __result.Job.def != WTH_DefOf.WTH_Mechanoid_Rest)
            {
                Building_BaseMechanoidPlatform closestAvailablePlatform = Utilities.GetAvailableMechanoidPlatform(pawn, pawn);
                if (closestAvailablePlatform != null && pawn.CanReserve(closestAvailablePlatform))
                {
                    Job job = new Job(WTH_DefOf.WTH_Mechanoid_Rest, closestAvailablePlatform);
                    __result = new ThinkResult(job, __result.SourceNode, __result.Tag, false);
                }
            }
        }
Exemplo n.º 21
0
        private static void DisableCommandIfMechanoidPowerLow(Pawn_DraftController __instance, Command_Toggle toggleCommand)
        {
            ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage();

            if (store != null)
            {
                if (__instance.pawn.ShouldRecharge())
                {
                    toggleCommand.Disable("WTH_Reason_PowerLow".Translate());
                }
            }
        }
Exemplo n.º 22
0
        static void Postfix(Pawn_DraftController __instance)
        {
            ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage();

            if (store != null)
            {
                ExtendedPawnData pawnData = store.GetExtendedDataFor(__instance.pawn);
                if (__instance.Drafted)
                {
                    pawnData.isActive = true;
                }
            }
        }
        public static bool IsOffHand(this ThingWithComps instance)
        {
            ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage();

            if (store != null)
            {
                if (store.TryGetExtendedDataFor(instance, out ExtendedThingWithCompsData twcData))
                {
                    return(twcData.isOffHand);
                }
            }
            return(false);
        }
Exemplo n.º 24
0
        //Tag offhand equipment so it can be recognised as offhand equipment during later evaluations.
        public static void AddOffHandEquipment(this Pawn_EquipmentTracker instance, ThingWithComps newEq)
        {
            ThingOwner <ThingWithComps> equipment = Traverse.Create(instance).Field("equipment").GetValue <ThingOwner <ThingWithComps> >();
            ExtendedDataStorage         store     = Base.Instance.GetExtendedDataStorage();

            if (store != null)
            {
                store.GetExtendedDataFor(newEq).isOffHand = true;
                LessonAutoActivator.TeachOpportunity(DW_DefOff.DW_Penalties, OpportunityType.GoodToKnow);
                LessonAutoActivator.TeachOpportunity(DW_DefOff.DW_Settings, OpportunityType.GoodToKnow);
                equipment.TryAdd(newEq, true);
            }
        }
Exemplo n.º 25
0
        public static void RotChanged(Thing __instance)
        {
            if (__instance != null && !(__instance is Pawn))
            {
                return;
            }

            ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage();

            if (store == null)
            {
                return;
            }

            var pawn = __instance as Pawn;

            if (!__instance.Destroyed && pawn.jobs != null && pawn.jobs.curDriver is JobDriver_Mounted jobDriver)
            {
                var rotation = jobDriver.Rider.Rotation;
                __instance.Rotation = rotation;

                ExtendedPawnData pawnData = store.GetExtendedDataFor(jobDriver.Rider);

                if (pawnData != null && pawnData.mount != null)
                {
                    pawnData.drawOffsetCache = Vector3.zero;
                    __instance.Rotation      = rotation;

                    if (pawnData.drawOffset != -1)
                    {
                        pawnData.drawOffsetCache.z = pawnData.drawOffset;
                    }

                    if (pawnData.mount.def.HasModExtension <DrawingOffsetPatch>())
                    {
                        pawnData.drawOffsetCache += AddCustomOffsets(jobDriver.Rider, pawnData);
                    }

                    if (rotation == Rot4.South)
                    {
                        AnimalRecord value;
                        bool         found = Base.drawSelecter.Value.InnerList.TryGetValue(pawnData.mount.def.defName, out value);
                        if (found && value.isSelected)
                        {
                            pawnData.drawOffsetCache.y = -1;
                        }
                    }
                }
            }
        }
Exemplo n.º 26
0
        private static void DisableCommandIfMechanoidPowerLow(Pawn_DraftController __instance, Command_Toggle toggleCommand)
        {
            Need_Power          powerNeed = __instance.pawn.needs.TryGetNeed(WTH_DefOf.WTH_Mechanoid_Power) as Need_Power;
            ExtendedDataStorage store     = Base.Instance.GetExtendedDataStorage();

            if (powerNeed != null && store != null)
            {
                ExtendedPawnData pawnData = store.GetExtendedDataFor(__instance.pawn);
                if (pawnData.shouldAutoRecharge && powerNeed.CurCategory >= PowerCategory.LowPower)
                {
                    toggleCommand.Disable("WTH_Reason_PowerLow".Translate());
                }
            }
        }
        // Token: 0x06000021 RID: 33 RVA: 0x000037B0 File Offset: 0x000019B0
        public static void COWAddOffHandEquipment(this Pawn_EquipmentTracker instance, ThingWithComps newEq)
        {
            ThingOwner <ThingWithComps> value = Traverse.Create(instance).Field("equipment").GetValue <ThingOwner <ThingWithComps> >();
            ExtendedDataStorage         extendedDataStorage = Base.Instance.GetExtendedDataStorage();
            bool flag = extendedDataStorage != null;

            if (flag)
            {
                extendedDataStorage.GetExtendedDataFor(newEq).isOffHand = true;
                LessonAutoActivator.TeachOpportunity(DW_DefOff.DW_Penalties, 0);
                LessonAutoActivator.TeachOpportunity(DW_DefOff.DW_Settings, 0);
                value.TryAdd(newEq, true);
            }
        }
Exemplo n.º 28
0
        public static Building_RogueAI ControllingAI(this Pawn pawn)
        {
            ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage();

            if (store != null)
            {
                ExtendedPawnData pawnData = Base.Instance.GetExtendedDataStorage().GetExtendedDataFor(pawn);
                //if (pawnData.controllingAI.Spawned)
                //{
                return(pawnData.controllingAI);
                //}
            }
            return(null);
        }
Exemplo n.º 29
0
        static void Postfix(Pawn_HealthTracker __instance)
        {
            Pawn pawn = Traverse.Create(__instance).Field("pawn").GetValue <Pawn>();
            ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage();

            if (store == null)
            {
                return;
            }
            ExtendedPawnData pawnData = store.GetExtendedDataFor(pawn);

            pawnData.isActive = false;
            pawn.RemoveRemoteControlLink();
        }
Exemplo n.º 30
0
        //Make sure offhand weapons are never stored first in the list.
        static void Postfix(Pawn_EquipmentTracker __instance, ThingWithComps newEq, ref ThingOwner <ThingWithComps> ___equipment)
        {
            ExtendedDataStorage store   = Base.Instance.GetExtendedDataStorage();
            ThingWithComps      primary = __instance.Primary;

            if (primary != null && store != null && store.TryGetExtendedDataFor(primary, out ExtendedThingWithCompsData twcData) && twcData.isOffHand)
            {
                if (___equipment != null)
                {
                    ___equipment.Remove(primary);
                    __instance.AddOffHandEquipment(primary);
                }
            }
        }