mirror of
https://gitgud.io/AbstractConcept/rimworld-animations-patch.git
synced 2024-08-15 00:43:27 +00:00
49 lines
1.2 KiB
C#
49 lines
1.2 KiB
C#
|
using HarmonyLib;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Reflection;
|
|||
|
using System.Reflection.Emit;
|
|||
|
using UnityEngine;
|
|||
|
using RimWorld;
|
|||
|
using Verse;
|
|||
|
using AlienRace;
|
|||
|
|
|||
|
namespace Rimworld_Animations_Patch
|
|||
|
{
|
|||
|
[StaticConstructorOnStartup]
|
|||
|
[HarmonyPatch(typeof(Building_Bed), "DrawGUIOverlay")]
|
|||
|
public static class HarmonyPatch_Building_Bed_DrawGUIOverlay
|
|||
|
{
|
|||
|
// Patches beds so sleeping spot names are hidden when the owner is having sex on it
|
|||
|
public static bool Prefix(Building_Bed __instance)
|
|||
|
{
|
|||
|
foreach (Pawn pawn in __instance.OwnersForReading)
|
|||
|
{
|
|||
|
if (pawn.GetAnimationData() != null && pawn.IsInBed(out Building bed) && bed == __instance)
|
|||
|
{ return false; }
|
|||
|
}
|
|||
|
|
|||
|
return true;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
[StaticConstructorOnStartup]
|
|||
|
[HarmonyPatch(typeof(PawnUIOverlay), "DrawPawnGUIOverlay")]
|
|||
|
public static class HarmonyPatch_PawnUIOverlay_DrawPawnGUIOverlay
|
|||
|
{
|
|||
|
// Patches pawns so their name is hidden when having sex
|
|||
|
public static bool Prefix(PawnUIOverlay __instance)
|
|||
|
{
|
|||
|
if (BasicSettings.hideNamesForSex)
|
|||
|
{
|
|||
|
Pawn pawn = (Pawn)AccessTools.Field(typeof(PawnUIOverlay), "pawn").GetValue(__instance);
|
|||
|
|
|||
|
if (pawn.GetAnimationData() != null)
|
|||
|
{ return false; }
|
|||
|
}
|
|||
|
|
|||
|
return true;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|