public static float weightForLimitType(Pawn pawn, WeaponSearchType type) { float total = 0; IEnumerable <ThingWithComps> weapons = GettersFilters.filterForWeaponKind(pawn.getCarriedWeapons(), type); foreach (ThingWithComps thing in weapons) { switch (type) { case WeaponSearchType.MeleeCapable: if ((thing.def.IsMeleeWeapon || (thing.def.tools != null && thing.def.tools.Any((Tool x) => x.VerbsProperties.Any((VerbProperties y) => y.IsMeleeAttack))))) { total += thing.GetStatValue(StatDefOf.Mass); } break; case WeaponSearchType.Melee: if (thing.def.IsMeleeWeapon) { total += thing.GetStatValue(StatDefOf.Mass); } break; case WeaponSearchType.Ranged: if (thing.def.IsRangedWeapon) { total += thing.GetStatValue(StatDefOf.Mass); } break; case WeaponSearchType.Both: default: if (thing.def.IsWeapon) { total += thing.GetStatValue(StatDefOf.Mass); } break; } } return(total); }
public static int countForLimitType(Pawn pawn, WeaponSearchType type) { return(GettersFilters.filterForWeaponKind(pawn.getCarriedWeapons(), type).Count()); }