Example #1
0
 public static bool CheckWeapon(ThingDef pawn, ThingDef weapon)
 {
     if (pawn is RaceAddonThingDef thingDef)
     {
         var set = thingDef.raceAddonSettings.weaponRestrictionSetting;
         if (WeaponRestrictions.Contains(weapon))
         {
             return(set.raceSpecifics.Contains(weapon));
         }
         else
         {
             if (set.allAllow)
             {
                 return(!set.allAllow_Exceptions.Contains(weapon));
             }
             else
             {
                 return(set.allAllow_Exceptions.Contains(weapon));
             }
         }
     }
     else
     {
         return(!WeaponRestrictions.Contains(weapon));
     }
 }
 public static bool CheckWeapon(Pawn pawn, ThingDef weapon)
 {
     if (pawn.def is RaceAddonThingDef thingDef)
     {
         if (thingDef.raceAddonSettings.graphicSetting.drawSize[pawn.GetComp <RaceAddonComp>().drawSize].allowedWeapons is var list && list != null)
         {
             if (list.Contains(weapon))
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         var set = thingDef.raceAddonSettings.weaponRestrictionSetting;
         if (!WeaponRestrictions.Contains(weapon))
         {
             if (set.allAllow)
             {
                 if (!set.allAllow_Exceptions.Contains(weapon))
                 {
                     return(true);
                 }
             }
             else
             {
                 if (set.allAllow_Exceptions.Contains(weapon))
                 {
                     return(true);
                 }
             }
         }
         else if (set.raceSpecifics.Contains(weapon))
         {
             return(true);
         }
     }
     else
     {
         if (!WeaponRestrictions.Contains(weapon))
         {
             return(true);
         }
     }
     return(false);
 }