From a0e7774a4db3d36994672720f3b129fb2c770b78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Sat, 21 Dec 2024 12:37:22 +0100 Subject: [PATCH] do not remove headgear if ideology requires it (#829) Ironically Vanilla Expanded was already supported but actual vanilla was not. --- Source/Source/Utilities/InternalDefOf.cs | 9 +++++++++ Source/Source/Utilities/ItemUtility.cs | 15 +++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Source/Source/Utilities/InternalDefOf.cs b/Source/Source/Utilities/InternalDefOf.cs index 100f89f..870027e 100644 --- a/Source/Source/Utilities/InternalDefOf.cs +++ b/Source/Source/Utilities/InternalDefOf.cs @@ -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; diff --git a/Source/Source/Utilities/ItemUtility.cs b/Source/Source/Utilities/ItemUtility.cs index 3d26e64..edf42b4 100644 --- a/Source/Source/Utilities/ItemUtility.cs +++ b/Source/Source/Utilities/ItemUtility.cs @@ -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)