Exemplo n.º 1
0
 public static bool ApparelRequirementTagsMatch(SpecificApparelRequirement req, ThingDef thing)
 {
     if (!req.RequiredTag.NullOrEmpty() && thing.apparel.tags.Contains(req.RequiredTag))
     {
         return(true);
     }
     if (!req.AlternateTagChoices.NullOrEmpty())
     {
         return(req.AlternateTagChoices.Where((SpecificApparelRequirement.TagChance x) => thing.apparel.tags.Contains(x.tag) && Rand.Value < x.chance).Any());
     }
     return(false);
 }
Exemplo n.º 2
0
 public static bool ApparelRequirementHandlesThing(SpecificApparelRequirement req, ThingDef thing)
 {
     if (req.BodyPartGroup != null && !thing.apparel.bodyPartGroups.Contains(req.BodyPartGroup))
     {
         return(false);
     }
     if (req.ApparelLayer != null && !thing.apparel.layers.Contains(req.ApparelLayer))
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 3
0
 private static bool ApparelRequirementCanUseStuff(SpecificApparelRequirement req, ThingStuffPair pair)
 {
     if (req.Stuff == null)
     {
         return(true);
     }
     if (!ApparelRequirementHandlesThing(req, pair.thing))
     {
         return(true);
     }
     if (pair.stuff != null)
     {
         return(req.Stuff == pair.stuff);
     }
     return(false);
 }