//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); } } }
//Make sure offhand weapons are never stored first in the list. static void Postfix(Pawn_EquipmentTracker __instance, ThingWithComps newEq) { ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage(); ThingWithComps primary = __instance.Primary; if (primary != null && store != null && store.TryGetExtendedDataFor(primary, out ExtendedThingWithCompsData twcData) && twcData.isOffHand) { ThingOwner <ThingWithComps> equipment = Traverse.Create(__instance).Field("equipment").GetValue <ThingOwner <ThingWithComps> >(); if (equipment != null) { equipment.Remove(primary); __instance.AddOffHandEquipment(primary); } } }