Пример #1
0
        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));
        }
Пример #2
0
        public static bool canCarrySidearmInstance(ThingWithComps sidearmThing, Pawn pawn, out string errString)
        {
            //nicked from EquipmentUtility.CanEquip
            CompBladelinkWeapon compBladelinkWeapon = sidearmThing.TryGetComp <CompBladelinkWeapon>();

            if (compBladelinkWeapon != null && compBladelinkWeapon.bondedPawn != null && compBladelinkWeapon.bondedPawn != pawn)
            {
                errString = "BladelinkBondedToSomeoneElse".Translate();
                return(false);
            }
            if (EquipmentUtility.IsBiocoded(sidearmThing) && pawn != sidearmThing.TryGetComp <CompBiocodableWeapon>().CodedPawn)
            {
                errString = "BiocodedCodedForSomeoneElse".Translate();
                return(false);
            }
            if (compBladelinkWeapon != null && compBladelinkWeapon.bondedPawn == null)
            {
                errString = "SidearmPickupFail_NotYetBladelinkBonded".Translate();
                return(false);
            }

            ThingDefStuffDefPair sidearm = sidearmThing.toThingDefStuffDefPair();

            return(canCarrySidearmType(sidearm, pawn, out errString));
        }
Пример #3
0
        public static float getBestStatBoost(this ThingDefStuffDefPair tool, List <StatDef> stats, out bool found)
        {
            if (tool.thing.equippedStatOffsets == null || tool.thing.equippedStatOffsets.Count == 0)
            {
                found = false;
                return(0);
            }

            //this is not great because not all stats are boosted equally
            //but its something

            float best = 0;

            found = false;
            foreach (StatModifier modifier in tool.thing.equippedStatOffsets)
            {
                if (stats.Contains(modifier.stat))
                {
                    found = true;
                    if (best < modifier.value)
                    {
                        best = modifier.value;
                    }
                }
            }
            return(best);
        }
Пример #4
0
        public static bool DrawIconForWeapon(ThingDefStuffDefPair weapon, Rect contentRect, Vector2 iconOffset, int buttonID, bool isBackground = false)
        {
            var     iconTex  = weapon.thing.uiIcon;
            Graphic g        = weapon.thing.graphicData.Graphic;
            Color   color    = weapon.getDrawColor();
            Color   colorTwo = weapon.getDrawColorTwo();
            Graphic g2       = weapon.thing.graphicData.Graphic.GetColoredVersion(g.Shader, color, colorTwo);

            var iconRect = new Rect(contentRect.x + iconOffset.x, contentRect.y + iconOffset.y, IconSize, IconSize);

            if (!contentRect.Contains(iconRect))
            {
                return(false);
            }

            if (!isBackground)
            {
                string label = weapon.getLabelCap();

                TooltipHandler.TipRegion(iconRect, label);
                MouseoverSounds.DoRegion(iconRect, SoundDefOf.Mouseover_Command);
                if (Mouse.IsOver(iconRect))
                {
                    GUI.color = iconMouseOverColor;
                    GUI.DrawTexture(iconRect, TextureResources.drawPocket);
                    //Graphics.DrawTexture(iconRect, TextureResources.drawPocket, new Rect(0, 0, 1f, 1f), 0, 0, 0, 0, iconMouseOverColor);
                }
                else
                {
                    GUI.color = iconBaseColor;
                    GUI.DrawTexture(iconRect, TextureResources.drawPocket);
                    //Graphics.DrawTexture(iconRect, TextureResources.drawPocket, new Rect(0, 0, 1f, 1f), 0, 0, 0, 0, iconBaseColor);
                }
            }

            Texture resolvedIcon;

            if (!weapon.thing.uiIconPath.NullOrEmpty())
            {
                resolvedIcon = weapon.thing.uiIcon;
            }
            else
            {
                resolvedIcon = g2.MatSingle.mainTexture;
            }
            GUI.color = color;
            GUI.DrawTexture(iconRect, resolvedIcon);
            GUI.color = Color.white;

            if (!isBackground)
            {
                if (Widgets.ButtonInvisible(iconRect, true))
                {
                    Event.current.button = buttonID;
                    return(true);
                }
            }
            return(false);
        }
Пример #5
0
 public static Color getDrawColorTwo(this ThingDefStuffDefPair pair)
 {
     if (pair.thing.graphicData != null)
     {
         return(pair.thing.graphicData.colorTwo);
     }
     return(Color.white);
 }
Пример #6
0
 public static bool isToolNotWeapon(this ThingDefStuffDefPair possibleTool)
 {
     if (
         possibleTool.thing.defName == "Gun_Fire_Ext" ||
         possibleTool.thing.defName == "VWE_Gun_FireExtinguisher"
         )
     {
         return(true);
     }
     return(false);
 }
Пример #7
0
 public static string getLabel(this ThingDefStuffDefPair pair)
 {
     if (pair.stuff != null)
     {
         return(pair.stuff.LabelAsStuff + " " + pair.thing.label);
     }
     else
     {
         return(pair.thing.label);
     }
 }
Пример #8
0
 public static Color getDrawColor(this ThingDefStuffDefPair pair)
 {
     if (pair.stuff != null)
     {
         return(pair.stuff.stuffProps.color);
     }
     if (pair.thing.graphicData != null)
     {
         return(pair.thing.graphicData.color);
     }
     return(Color.white);
 }
Пример #9
0
 public static void SelfConsume(Verb_ShootOneUse __instance)
 {
     if (__instance.caster is Pawn)
     {
         Pawn pawn = (__instance.caster as Pawn);
         ThingDefStuffDefPair weapon = __instance.EquipmentSource.toThingDefStuffDefPair();
         bool anotherFound           = WeaponAssingment.equipSpecificWeaponTypeFromInventory(pawn, weapon, false, false);
         if (!anotherFound)
         {
             WeaponAssingment.equipBestWeaponFromInventoryByPreference(pawn, DroppingModeEnum.UsedUp);
         }
     }
 }
Пример #10
0
        public static bool equipSpecificWeaponTypeFromInventory(Pawn pawn, ThingDefStuffDefPair weapon, bool dropCurrent, bool intentionalDrop)
        {
            ThingWithComps match = pawn.inventory.innerContainer.Where(t => { return(t is ThingWithComps && t.toThingDefStuffDefPair() == weapon); }).OrderByDescending(t => t.MarketValue).FirstOrDefault() as ThingWithComps;

            if (match != null)
            {
                return(equipSpecificWeaponFromInventory(pawn, match, dropCurrent, intentionalDrop));
            }
            else
            {
                return(false);
            }
        }
Пример #11
0
        public static bool isTool(this ThingDefStuffDefPair possibleTool)
        {
            if (isToolNotWeapon(possibleTool))
            {
                return(true);
            }

            if (possibleTool.thing.equippedStatOffsets != null && possibleTool.thing.equippedStatOffsets.Count > 0)
            {
                return(true);
            }

            return(false);
        }
Пример #12
0
        public static bool matchesThingDefStuffDefPair(this Thing thing, ThingDefStuffDefPair pair, bool allowPartialMatch = false)
        {
            bool retVal   = false;
            var  thisPair = thing.toThingDefStuffDefPair();

            if (thisPair.thing == pair.thing && thisPair.stuff == pair.stuff)
            {
                retVal = true;
            }
            else if (allowPartialMatch && thisPair.thing == pair.thing)
            {
                retVal = true;
            }

            return(retVal);
        }
Пример #13
0
        public static bool hasWeaponSomewhere(this Pawn pawn, ThingDefStuffDefPair weapon, int duplicatesToSkip = 0)
        {
            if (pawn == null)
            {
                Log.Warning("hasWeaponSomewhere got handed null pawn");
                return(false);
            }

            int dupesSoFar = 0;

            if (pawn.equipment != null)
            {
                if (pawn.equipment.Primary != null)
                {
                    if (pawn.equipment.Primary.matchesThingDefStuffDefPair(weapon))
                    {
                        dupesSoFar++;
                    }
                }
            }

            if (duplicatesToSkip < dupesSoFar)
            {
                return(true);
            }

            if (pawn.inventory != null)
            {
                if (pawn.inventory.innerContainer != null)
                {
                    foreach (Thing thing in pawn.inventory.innerContainer)
                    {
                        if (thing.matchesThingDefStuffDefPair(weapon))
                        {
                            dupesSoFar++;
                            if (duplicatesToSkip < dupesSoFar)
                            {
                                return(true);
                            }
                        }
                    }
                }
            }
            return(false);
        }
Пример #14
0
        public static int missingCountWeaponsOfType(this Pawn pawn, ThingDefStuffDefPair weapon, int countToSatisfy, int dupesToSkip = 0)
        {
            if (pawn == null)
            {
                Log.Warning("hasWeaponSomewhere got handed null pawn");
                return(0);
            }

            int dupesSoFar = 0;

            if (pawn.equipment != null)
            {
                if (pawn.equipment.Primary != null)
                {
                    if (pawn.equipment.Primary.matchesThingDefStuffDefPair(weapon))
                    {
                        dupesSoFar++;
                    }
                }
            }

            if (dupesSoFar - dupesToSkip >= countToSatisfy)
            {
                return(0);
            }

            if (pawn.inventory != null)
            {
                if (pawn.inventory.innerContainer != null)
                {
                    foreach (Thing thing in pawn.inventory.innerContainer)
                    {
                        if (thing.matchesThingDefStuffDefPair(weapon))
                        {
                            dupesSoFar += thing.stackCount;
                            if (dupesSoFar - dupesToSkip >= countToSatisfy)
                            {
                                return(0);
                            }
                        }
                    }
                }
            }
            return(countToSatisfy - (dupesSoFar - dupesToSkip));
        }
Пример #15
0
        public static bool canUseSidearmType(ThingDefStuffDefPair sidearmType, Pawn pawn, out string errString)
        {
            if (sidearmType != null && sidearmType.thing != null)
            {
                if (ModsConfig.IdeologyActive && pawn.Ideo != null)
                {
                    Precept_Role role = pawn.Ideo.GetRole(pawn);
                    if (role != null)
                    {
                        if (role.def.roleEffects != null && role.def.roleEffects.Any())
                        {
                            //hardcoded cos RoleEffect's CanEquip requires an instance of Thing
                            if (sidearmType.thing.IsMeleeWeapon)
                            {
                                if (role.def.roleEffects.Any(e => e is RoleEffect_NoMeleeWeapons))
                                {
                                    errString = "RoleEffectWontUseMeleeWeapons".Translate();
                                    return(false);
                                }
                            }
                            else if (sidearmType.thing.IsRangedWeapon)
                            {
                                if (role.def.roleEffects.Any(e => e is RoleEffect_NoRangedWeapons))
                                {
                                    errString = "RoleEffectWontUseRangedWeapons".Translate();
                                    return(false);
                                }
                            }
                        }
                    }
                }
            }

            errString = "No issue";
            return(true);
        }
Пример #16
0
 public static bool hasWeaponType(this Pawn pawn, ThingDefStuffDefPair weapon, int dupesToSkip = 0)
 {
     return(pawn.missingCountWeaponsOfType(weapon, 1, dupesToSkip) == 0);
 }
Пример #17
0
 public static string getLabelCap(this ThingDefStuffDefPair pair)
 {
     return(pair.getLabel().CapitalizeFirst());
 }
Пример #18
0
        public static bool isValidSidearm(ThingDefStuffDefPair sidearm, out string errString)
        {
            float sidearmWeight = sidearm.thing.GetStatValueAbstract(StatDefOf.Mass, sidearm.stuff);

            if (!SimpleSidearms.SeparateModes)
            {
                switch (SimpleSidearms.LimitModeSingle.Value)
                {
                case LimitModeSingleSidearm.AbsoluteWeight:
                    if (sidearmWeight >= SimpleSidearms.LimitModeSingle_Absolute.Value)
                    {
                        errString = "SidearmPickupFail_TooHeavyForSidearm".Translate();
                        return(false);
                    }
                    break;

                case LimitModeSingleSidearm.Selection:
                    if (!SimpleSidearms.LimitModeSingle_Selection.Value.InnerList.Contains <ThingDef>(sidearm.thing))
                    {
                        errString = "SidearmPickupFail_NotASidearm".Translate();
                        return(false);
                    }
                    break;

                case LimitModeSingleSidearm.None:
                default:
                    break;
                }
            }
            else
            {
                if (sidearm.thing.IsMeleeWeapon)
                {
                    switch (SimpleSidearms.LimitModeSingleMelee.Value)
                    {
                    case LimitModeSingleSidearm.AbsoluteWeight:
                        if (sidearmWeight >= SimpleSidearms.LimitModeSingleMelee_Absolute.Value)
                        {
                            errString = "SidearmPickupFail_TooHeavyForSidearmMelee".Translate();
                            return(false);
                        }
                        break;

                    case LimitModeSingleSidearm.Selection:
                        if (!SimpleSidearms.LimitModeSingleMelee_Selection.Value.InnerList.Contains <ThingDef>(sidearm.thing))
                        {
                            errString = "SidearmPickupFail_NotASidearmMelee".Translate();
                            return(false);
                        }
                        break;

                    case LimitModeSingleSidearm.None:
                    default:
                        break;
                    }
                }
                else if (sidearm.thing.IsRangedWeapon)
                {
                    switch (SimpleSidearms.LimitModeSingleRanged.Value)
                    {
                    case LimitModeSingleSidearm.AbsoluteWeight:
                        if (sidearmWeight >= SimpleSidearms.LimitModeSingleRanged_Absolute.Value)
                        {
                            errString = "SidearmPickupFail_TooHeavyForSidearmRanged".Translate();
                            return(false);
                        }
                        break;

                    case LimitModeSingleSidearm.Selection:
                        if (!SimpleSidearms.LimitModeSingleRanged_Selection.Value.InnerList.Contains <ThingDef>(sidearm.thing))
                        {
                            errString = "SidearmPickupFail_NotASidearmRanged".Translate();
                            return(false);
                        }
                        break;

                    case LimitModeSingleSidearm.None:
                    default:
                        break;
                    }
                }
            }
            errString = "SidearmPickupPass".Translate();
            return(true);
        }
Пример #19
0
        public static bool canCarrySidearmType(ThingDefStuffDefPair sidearm, Pawn pawn, out string errString)
        {
            float maxCapacity   = MassUtility.Capacity(pawn);
            float freeCapacity  = MassUtility.FreeSpace(pawn);
            float sidearmWeight = sidearm.thing.GetStatValueAbstract(StatDefOf.Mass, sidearm.stuff);

            if (((pawn.CombinedDisabledWorkTags & WorkTags.Violent) != 0) && (!sidearm.isTool()))
            {
                errString = "SidearmPickupFail_NotAToolForPacifist".Translate(pawn.LabelShort);
                return(false);
            }

            //this is duplicated in the switches later but Id rather not risk accidentaly deleting a case that might come up
            if (!isValidSidearm(sidearm, out errString))
            {
                return(false);
            }

            if (sidearmWeight >= freeCapacity)
            {
                errString = "SidearmPickupFail_NoFreeSpace".Translate();
                return(false);
            }

            if (!SimpleSidearms.SeparateModes)
            {
                switch (SimpleSidearms.LimitModeSingle.Value)
                {
                case LimitModeSingleSidearm.None:
                    break;

                case LimitModeSingleSidearm.AbsoluteWeight:
                    if (sidearmWeight >= SimpleSidearms.LimitModeSingle_Absolute.Value)
                    {
                        errString = "SidearmPickupFail_TooHeavyForSidearm".Translate();
                        return(false);
                    }
                    break;

                case LimitModeSingleSidearm.RelativeWeight:
                    if (sidearmWeight >= SimpleSidearms.LimitModeSingle_Relative.Value * maxCapacity)
                    {
                        errString = "SidearmPickupFail_TooHeavyForSidearm".Translate();
                        return(false);
                    }
                    break;

                case LimitModeSingleSidearm.Selection:
                    if (!SimpleSidearms.LimitModeSingle_Selection.Value.InnerList.Contains <ThingDef>(sidearm.thing))
                    {
                        errString = "SidearmPickupFail_NotASidearm".Translate();
                        return(false);
                    }
                    break;
                }
                switch (SimpleSidearms.LimitModeAmount.Value)
                {
                case LimitModeAmountOfSidearms.MaximumCarryWeightOnly:
                    break;

                case LimitModeAmountOfSidearms.AbsoluteWeight:
                    if (sidearmWeight >= (SimpleSidearms.LimitModeAmount_Absolute.Value - weightForLimitType(pawn, WeaponSearchType.Both)))
                    {
                        errString = "SidearmPickupFail_SidearmsTooHeavyInTotal".Translate();
                        return(false);
                    }
                    break;

                case LimitModeAmountOfSidearms.RelativeWeight:
                    if (sidearmWeight >= ((SimpleSidearms.LimitModeAmount_Relative.Value * maxCapacity) - weightForLimitType(pawn, WeaponSearchType.Both)))
                    {
                        errString = "SidearmPickupFail_SidearmsTooHeavyInTotal".Translate();
                        return(false);
                    }
                    break;

                case LimitModeAmountOfSidearms.Slots:
                    if (SimpleSidearms.LimitModeAmount_Slots.Value <= countForLimitType(pawn, WeaponSearchType.Both))
                    {
                        errString = "SidearmPickupFail_AllSlotsFull".Translate();
                        return(false);
                    }
                    break;
                }
            }
            else
            {
                switch (SimpleSidearms.LimitModeAmountTotal.Value)
                {
                case LimitModeAmountOfSidearms.MaximumCarryWeightOnly:
                    break;

                case LimitModeAmountOfSidearms.AbsoluteWeight:
                    if (sidearmWeight >= (SimpleSidearms.LimitModeAmountTotal_Absolute.Value - weightForLimitType(pawn, WeaponSearchType.Both)))
                    {
                        errString = "SidearmPickupFail_SidearmsTooHeavyInTotal".Translate();
                        return(false);
                    }
                    break;

                case LimitModeAmountOfSidearms.RelativeWeight:
                    if (sidearmWeight >= ((SimpleSidearms.LimitModeAmountTotal_Relative.Value * maxCapacity) - weightForLimitType(pawn, WeaponSearchType.Both)))
                    {
                        errString = "SidearmPickupFail_SidearmsTooHeavyInTotal".Translate();
                        return(false);
                    }
                    break;

                case LimitModeAmountOfSidearms.Slots:
                    if (SimpleSidearms.LimitModeAmountTotal_Slots.Value <= countForLimitType(pawn, WeaponSearchType.Both))
                    {
                        errString = "SidearmPickupFail_AllSlotsFull".Translate();
                        return(false);
                    }
                    break;
                }
                if (sidearm.thing.IsMeleeWeapon)
                {
                    switch (SimpleSidearms.LimitModeSingleMelee.Value)
                    {
                    case LimitModeSingleSidearm.None:
                        break;

                    case LimitModeSingleSidearm.AbsoluteWeight:
                        if (sidearmWeight >= SimpleSidearms.LimitModeSingleMelee_Absolute.Value)
                        {
                            errString = "SidearmPickupFail_TooHeavyForSidearmMelee".Translate();
                            return(false);
                        }
                        break;

                    case LimitModeSingleSidearm.RelativeWeight:
                        if (sidearmWeight >= SimpleSidearms.LimitModeSingleMelee_Relative.Value * maxCapacity)
                        {
                            errString = "SidearmPickupFail_TooHeavyForSidearmMelee".Translate();
                            return(false);
                        }
                        break;

                    case LimitModeSingleSidearm.Selection:
                        if (!SimpleSidearms.LimitModeSingleMelee_Selection.Value.InnerList.Contains <ThingDef>(sidearm.thing))
                        {
                            errString = "SidearmPickupFail_NotASidearmMelee".Translate();
                            return(false);
                        }
                        break;
                    }
                    switch (SimpleSidearms.LimitModeAmountMelee.Value)
                    {
                    case LimitModeAmountOfSidearms.MaximumCarryWeightOnly:
                        break;

                    case LimitModeAmountOfSidearms.AbsoluteWeight:
                        if (sidearmWeight >= (SimpleSidearms.LimitModeAmountMelee_Absolute.Value - weightForLimitType(pawn, WeaponSearchType.Melee)))
                        {
                            errString = "SidearmPickupFail_SidearmsTooHeavyMelee".Translate();
                            return(false);
                        }
                        break;

                    case LimitModeAmountOfSidearms.RelativeWeight:
                        if (sidearmWeight >= ((SimpleSidearms.LimitModeAmountMelee_Relative.Value * maxCapacity) - weightForLimitType(pawn, WeaponSearchType.Melee)))
                        {
                            errString = "SidearmPickupFail_SidearmsTooHeavyMelee".Translate();
                            return(false);
                        }
                        break;

                    case LimitModeAmountOfSidearms.Slots:
                        if (SimpleSidearms.LimitModeAmountMelee_Slots.Value <= countForLimitType(pawn, WeaponSearchType.Melee))
                        {
                            errString = "SidearmPickupFail_MeleeSlotsFull".Translate();
                            return(false);
                        }
                        break;
                    }
                }
                else if (sidearm.thing.IsRangedWeapon)
                {
                    switch (SimpleSidearms.LimitModeSingleRanged.Value)
                    {
                    case LimitModeSingleSidearm.None:
                        break;

                    case LimitModeSingleSidearm.AbsoluteWeight:
                        if (sidearmWeight >= SimpleSidearms.LimitModeSingleRanged_Absolute.Value)
                        {
                            errString = "SidearmPickupFail_TooHeavyForSidearmRanged".Translate();
                            return(false);
                        }
                        break;

                    case LimitModeSingleSidearm.RelativeWeight:
                        if (sidearmWeight >= SimpleSidearms.LimitModeSingleRanged_Relative.Value * maxCapacity)
                        {
                            errString = "SidearmPickupFail_TooHeavyForSidearmRanged".Translate();
                            return(false);
                        }
                        break;

                    case LimitModeSingleSidearm.Selection:
                        if (!SimpleSidearms.LimitModeSingleRanged_Selection.Value.InnerList.Contains <ThingDef>(sidearm.thing))
                        {
                            errString = "SidearmPickupFail_NotASidearmRanged".Translate();
                            return(false);
                        }
                        break;
                    }
                    switch (SimpleSidearms.LimitModeAmountRanged.Value)
                    {
                    case LimitModeAmountOfSidearms.MaximumCarryWeightOnly:
                        break;

                    case LimitModeAmountOfSidearms.AbsoluteWeight:
                        if (sidearmWeight >= (SimpleSidearms.LimitModeAmountRanged_Absolute.Value - weightForLimitType(pawn, WeaponSearchType.Ranged)))
                        {
                            errString = "SidearmPickupFail_SidearmsTooHeavyRanged".Translate();
                            return(false);
                        }
                        break;

                    case LimitModeAmountOfSidearms.RelativeWeight:
                        if (sidearmWeight >= ((SimpleSidearms.LimitModeAmountRanged_Relative.Value * maxCapacity) - weightForLimitType(pawn, WeaponSearchType.Ranged)))
                        {
                            errString = "SidearmPickupFail_SidearmsTooHeavyRanged".Translate();
                            return(false);
                        }
                        break;

                    case LimitModeAmountOfSidearms.Slots:
                        if (SimpleSidearms.LimitModeAmountRanged_Slots.Value <= countForLimitType(pawn, WeaponSearchType.Ranged))
                        {
                            errString = "SidearmPickupFail_RangedSlotsFull".Translate();
                            return(false);
                        }
                        break;
                    }
                }
            }
            errString = "SidearmPickupPass".Translate();
            return(true);
        }