Skip to content

Commit

Permalink
Merge pull request #830 from llunak/headgear
Browse files Browse the repository at this point in the history
do not remove headgear if ideology requires it (#829)
  • Loading branch information
OrionFive authored Dec 22, 2024
2 parents 447300d + a0e7774 commit c957bc0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
9 changes: 9 additions & 0 deletions Source/Source/Utilities/InternalDefOf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ namespace Hospitality.Utilities
[RimWorld.DefOf]
public static class InternalDefOf
{
[MayRequireIdeology]
public static PreceptDef Nudity_Male_UncoveredGroinChestOrHairDisapproved;
[MayRequireIdeology]
public static PreceptDef Nudity_Male_UncoveredGroinChestHairOrFaceDisapproved;
[MayRequireIdeology]
public static PreceptDef Nudity_Female_UncoveredGroinChestOrHairDisapproved;
[MayRequireIdeology]
public static PreceptDef Nudity_Female_UncoveredGroinChestHairOrFaceDisapproved;

[MayRequire("CETeam.CombatExtended")]
public static ThingDef CE_Apparel_Backpack;

Expand Down
15 changes: 13 additions & 2 deletions Source/Source/Utilities/ItemUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,19 @@ public static class ItemUtility
public static void PocketHeadgear(this Pawn pawn)
{
if (pawn?.apparel?.WornApparel == null || pawn.inventory?.innerContainer == null) return;
// Don't do it when the pawn wants to stay anonymous
if (ModsConfig.IdeologyActive && pawn.ideo?.Ideo?.HasPrecept(InternalDefOf.VME_Anonymity_Required) == true) return;
if (ModsConfig.IdeologyActive)
{
// Don't do it when ideology requires covered hair or face.
if (pawn.gender == Gender.Male
&& (pawn.ideo?.Ideo?.HasPrecept(InternalDefOf.Nudity_Male_UncoveredGroinChestOrHairDisapproved) == true
|| pawn.ideo?.Ideo?.HasPrecept(InternalDefOf.Nudity_Male_UncoveredGroinChestHairOrFaceDisapproved) == true))
return;
if (pawn.gender == Gender.Female
&& (pawn.ideo?.Ideo?.HasPrecept(InternalDefOf.Nudity_Female_UncoveredGroinChestOrHairDisapproved) == true
|| pawn.ideo?.Ideo?.HasPrecept(InternalDefOf.Nudity_Female_UncoveredGroinChestHairOrFaceDisapproved) == true))
return;
if (pawn.ideo?.Ideo?.HasPrecept(InternalDefOf.VME_Anonymity_Required) == true) return;
}

var headgear = pawn.apparel.WornApparel.Where(CoversHead).ToArray();
foreach (var apparel in headgear)
Expand Down

0 comments on commit c957bc0

Please sign in to comment.