public static bool canCarrySidearmInstance(ThingWithComps sidearmThing, Pawn pawn, out string errString) { //nicked from EquipmentUtility.CanEquip CompBladelinkWeapon compBladelinkWeapon = sidearmThing.TryGetComp <CompBladelinkWeapon>(); if (compBladelinkWeapon != null && compBladelinkWeapon.Biocodable && compBladelinkWeapon.CodedPawn != null && compBladelinkWeapon.CodedPawn != pawn) { errString = "BladelinkBondedToSomeoneElse".Translate(); return(false); } if (CompBiocodable.IsBiocoded(sidearmThing) && !CompBiocodable.IsBiocodedFor(sidearmThing, pawn)) { errString = "BiocodedCodedForSomeoneElse".Translate(); return(false); } if (EquipmentUtility.AlreadyBondedToWeapon(sidearmThing, pawn)) { errString = "BladelinkAlreadyBondedMessage".Translate(pawn.Named("PAWN"), pawn.equipment.bondedWeapon.Named("BONDEDWEAPON")); return(false); } if (compBladelinkWeapon != null && !compBladelinkWeapon.Biocoded && !compBladelinkWeapon.TraitsListForReading.Any(t => t.neverBond == true)) { errString = "SidearmPickupFail_NotYetBladelinkBonded".Translate(); return(false); } if (EquipmentUtility.RolePreventsFromUsing(pawn, sidearmThing, out string roleReason)) { errString = roleReason; return(false); } ThingDefStuffDefPair sidearm = sidearmThing.toThingDefStuffDefPair(); return(canCarrySidearmType(sidearm, pawn, out errString)); }