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); }
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); }
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); }