mirror of
https://gitgud.io/AbstractConcept/overt-underwear.git
synced 2024-08-15 03:19:13 +00:00
v1.0.0
This commit is contained in:
commit
545cb16d50
30 changed files with 491 additions and 0 deletions
21
Source/Scripts/Patches/HarmonyPatch_PatchAll.cs
Normal file
21
Source/Scripts/Patches/HarmonyPatch_PatchAll.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
using HarmonyLib;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Overt_Underwear
|
||||
{
|
||||
[StaticConstructorOnStartup]
|
||||
public static class Harmony_PatchAll
|
||||
{
|
||||
static Harmony_PatchAll()
|
||||
{
|
||||
Harmony harmony = new Harmony("Overt_Underwear");
|
||||
harmony.PatchAll(Assembly.GetExecutingAssembly());
|
||||
}
|
||||
}
|
||||
}
|
101
Source/Scripts/Patches/HarmonyPatch_ThoughtWorkers.cs
Normal file
101
Source/Scripts/Patches/HarmonyPatch_ThoughtWorkers.cs
Normal file
|
@ -0,0 +1,101 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace Overt_Underwear
|
||||
{
|
||||
[HarmonyPatch(typeof(ThoughtWorker_Precept_GroinChestHairOrFaceUncovered), "HasUncoveredGroinChestHairOrFace")]
|
||||
public static class HarmonyPatch_ThoughtWorker_Precept_GroinChestHairOrFaceUncovered
|
||||
{
|
||||
public static void Postfix(ref bool __result, Pawn p)
|
||||
{
|
||||
if (__result == false) return;
|
||||
|
||||
Pawn pawn = p;
|
||||
|
||||
if (pawn?.apparel == null)
|
||||
{ __result = false; return; }
|
||||
|
||||
if (pawn.apparel.WornApparel.NullOrEmpty())
|
||||
{ __result = true; return; }
|
||||
|
||||
bool fullHeadCovered = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.FullHead));
|
||||
bool groinCovered = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs) || x.def.apparel.bodyPartGroups.Contains(ModBodyPartGroupDefOf.GenitalsBPG));
|
||||
bool chestCovered = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) || x.def.apparel.bodyPartGroups.Contains(ModBodyPartGroupDefOf.ChestBPG));
|
||||
bool faceCovered = fullHeadCovered || pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Eyes));
|
||||
bool hairCovered = fullHeadCovered || pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.UpperHead));
|
||||
|
||||
__result = !(groinCovered && chestCovered && faceCovered && hairCovered);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(ThoughtWorker_Precept_GroinChestOrHairUncovered), "HasUncoveredGroinChestOrHair")]
|
||||
public static class HarmonyPatch_ThoughtWorker_Precept_GroinChestOrHairUncovered
|
||||
{
|
||||
public static void Postfix(ref bool __result, Pawn p)
|
||||
{
|
||||
if (__result == false) return;
|
||||
|
||||
Pawn pawn = p;
|
||||
|
||||
if (pawn?.apparel == null)
|
||||
{ __result = false; return; }
|
||||
|
||||
if (pawn.apparel.WornApparel.NullOrEmpty())
|
||||
{ __result = true; return; }
|
||||
|
||||
bool fullHeadCovered = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.FullHead));
|
||||
bool groinCovered = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs) || x.def.apparel.bodyPartGroups.Contains(ModBodyPartGroupDefOf.GenitalsBPG));
|
||||
bool chestCovered = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) || x.def.apparel.bodyPartGroups.Contains(ModBodyPartGroupDefOf.ChestBPG));
|
||||
bool hairCovered = fullHeadCovered || pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.UpperHead));
|
||||
|
||||
__result = !(groinCovered && chestCovered && hairCovered);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(ThoughtWorker_Precept_GroinOrChestUncovered), "HasUncoveredGroinOrChest")]
|
||||
public static class HarmonyPatch_ThoughtWorker_Precept_HasUncoveredGroinOrChest
|
||||
{
|
||||
public static void Postfix(ref bool __result, Pawn p)
|
||||
{
|
||||
if (__result == false) return;
|
||||
|
||||
Pawn pawn = p;
|
||||
|
||||
if (pawn?.apparel == null)
|
||||
{ __result = false; return; }
|
||||
|
||||
if (pawn.apparel.WornApparel.NullOrEmpty())
|
||||
{ __result = true; return; }
|
||||
|
||||
bool groinCovered = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs) || x.def.apparel.bodyPartGroups.Contains(ModBodyPartGroupDefOf.GenitalsBPG));
|
||||
bool chestCovered = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) || x.def.apparel.bodyPartGroups.Contains(ModBodyPartGroupDefOf.ChestBPG));
|
||||
|
||||
__result = !(groinCovered && chestCovered);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(ThoughtWorker_Precept_GroinUncovered), "HasUncoveredGroin")]
|
||||
public static class HarmonyPatch_ThoughtWorker_Precept_GroinUncovered
|
||||
{
|
||||
public static void Postfix(ref bool __result, Pawn p)
|
||||
{
|
||||
if (__result == false) return;
|
||||
|
||||
Pawn pawn = p;
|
||||
|
||||
if (pawn?.apparel == null)
|
||||
{ __result = false; return; }
|
||||
|
||||
if (pawn.apparel.WornApparel.NullOrEmpty())
|
||||
{ __result = true; return; }
|
||||
|
||||
bool groinCovered = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs) || x.def.apparel.bodyPartGroups.Contains(ModBodyPartGroupDefOf.GenitalsBPG));
|
||||
|
||||
__result = !groinCovered;
|
||||
}
|
||||
}
|
||||
}
|
32
Source/Scripts/ThoughtWorkers/ThoughtWorker_Underwear.cs
Normal file
32
Source/Scripts/ThoughtWorkers/ThoughtWorker_Underwear.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using rjw;
|
||||
|
||||
namespace Overt_Underwear
|
||||
{
|
||||
public class ThoughtWorker_Underwear : ThoughtWorker
|
||||
{
|
||||
public static ThoughtState CurrentThoughtState(Pawn pawn)
|
||||
{
|
||||
if (xxx.has_quirk(pawn, "Exhibitionist") || pawn?.ideo?.Ideo.HasPrecept(ModPreceptDefOf.Exhibitionism_Approved) == true) return ThoughtState.ActiveAtStage(3); // Joy
|
||||
if (pawn?.ideo?.Ideo.HasPrecept(ModPreceptDefOf.Underwear_CanBeVisible) == true) return ThoughtState.ActiveAtStage(2); // Indifference
|
||||
|
||||
return ThoughtState.ActiveAtStage(1); // Shame
|
||||
}
|
||||
|
||||
protected override ThoughtState CurrentStateInternal(Pawn pawn)
|
||||
{
|
||||
if (pawn?.apparel?.WornApparel == null || pawn.apparel.WornApparel.NullOrEmpty()) return false;
|
||||
|
||||
bool wearingUnderwear = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(ModBodyPartGroupDefOf.GenitalsBPG) && x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs) == false);
|
||||
bool wearingUnderwearTop = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(ModBodyPartGroupDefOf.ChestBPG) && x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) == false);
|
||||
|
||||
if (pawn?.ideo?.Ideo.HasPrecept(ModPreceptDefOf.Underwear_Disapproved) == true && (wearingUnderwear || wearingUnderwearTop)) return ThoughtState.ActiveAtStage(0);
|
||||
if (wearingUnderwear && pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs)) == false) return CurrentThoughtState(pawn);
|
||||
if (wearingUnderwearTop && pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso)) == false) return CurrentThoughtState(pawn);
|
||||
|
||||
return ThoughtState.Inactive;
|
||||
}
|
||||
}
|
||||
}
|
22
Source/Scripts/Utilities/ModDefOf.cs
Normal file
22
Source/Scripts/Utilities/ModDefOf.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using Verse;
|
||||
using RimWorld;
|
||||
|
||||
namespace Overt_Underwear
|
||||
{
|
||||
[DefOf]
|
||||
public static class ModBodyPartGroupDefOf
|
||||
{
|
||||
public static BodyPartGroupDef GenitalsBPG;
|
||||
public static BodyPartGroupDef AnusBPG;
|
||||
public static BodyPartGroupDef ChestBPG;
|
||||
}
|
||||
|
||||
[DefOf]
|
||||
public static class ModPreceptDefOf
|
||||
{
|
||||
public static PreceptDef Exhibitionism_Approved;
|
||||
public static PreceptDef Underwear_Disapproved;
|
||||
public static PreceptDef Underwear_MustBeConcealed;
|
||||
public static PreceptDef Underwear_CanBeVisible;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue