mirror of
https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
synced 2024-08-15 00:43:45 +00:00
commit
This commit is contained in:
parent
74a34b6f8d
commit
55ae1c5d10
29 changed files with 1387 additions and 28 deletions
35
Source/Patches/HarmonyPatch_AlienRace.cs
Normal file
35
Source/Patches/HarmonyPatch_AlienRace.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using HarmonyLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace Rimworld_Animations {
|
||||
[StaticConstructorOnStartup]
|
||||
public static class HarmonyPatch_AlienRace {
|
||||
static HarmonyPatch_AlienRace () {
|
||||
try {
|
||||
((Action)(() => {
|
||||
if (LoadedModManager.RunningModsListForReading.Any(x => x.Name == "Humanoid Alien Races 2.0")) {
|
||||
(new Harmony("rjw")).Patch(AccessTools.Method(typeof(PawnGraphicSet), "ResolveApparelGraphics"),
|
||||
prefix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_AlienRace), "Prefix_StopResolveAllGraphicsWhileSex")));
|
||||
}
|
||||
}))();
|
||||
}
|
||||
catch (TypeLoadException ex) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Prefix_StopResolveAllGraphicsWhileSex(ref Pawn ___pawn) {
|
||||
|
||||
if(___pawn.TryGetComp<CompBodyAnimator>() != null && ___pawn.TryGetComp<CompBodyAnimator>().isAnimating) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
44
Source/Patches/HarmonyPatch_FacialAnimation.cs
Normal file
44
Source/Patches/HarmonyPatch_FacialAnimation.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
using HarmonyLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace Rimworld_Animations {
|
||||
[StaticConstructorOnStartup]
|
||||
public static class Patch_FacialAnimation {
|
||||
|
||||
static Patch_FacialAnimation() {
|
||||
try {
|
||||
((Action)(() => {
|
||||
if (LoadedModManager.RunningModsListForReading.Any(x => x.Name == "[NL] Facial Animation - WIP")) {
|
||||
(new Harmony("rjw")).Patch(AccessTools.Method(AccessTools.TypeByName("FacialAnimation.DrawFaceGraphicsComp"), "DrawGraphics"),
|
||||
prefix: new HarmonyMethod(AccessTools.Method(typeof(Patch_FacialAnimation), "Prefix")));
|
||||
}
|
||||
}))();
|
||||
}
|
||||
catch (TypeLoadException ex) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Prefix(ref Pawn ___pawn, ref Rot4 headFacing, ref Vector3 headOrigin, ref Quaternion quaternion, ref bool portrait) {
|
||||
|
||||
CompBodyAnimator bodyAnim = ___pawn.TryGetComp<CompBodyAnimator>();
|
||||
|
||||
if (bodyAnim.isAnimating && !portrait) {
|
||||
|
||||
headFacing = bodyAnim.headFacing;
|
||||
headOrigin = new Vector3(bodyAnim.getPawnHeadPosition().x, headOrigin.y, bodyAnim.getPawnHeadPosition().z);
|
||||
quaternion = Quaternion.AngleAxis(bodyAnim.headAngle, Vector3.up);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
86
Source/Patches/HarmonyPatch_PawnRenderer.cs
Normal file
86
Source/Patches/HarmonyPatch_PawnRenderer.cs
Normal file
|
@ -0,0 +1,86 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using UnityEngine;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace Rimworld_Animations {
|
||||
|
||||
[HarmonyPatch(typeof(PawnRenderer), "RenderPawnInternal", new Type[]
|
||||
{
|
||||
typeof(Vector3),
|
||||
typeof(float),
|
||||
typeof(bool),
|
||||
typeof(Rot4),
|
||||
typeof(Rot4),
|
||||
typeof(RotDrawMode),
|
||||
typeof(bool),
|
||||
typeof(bool),
|
||||
typeof(bool)
|
||||
})]
|
||||
|
||||
public static class HarmonyPatch_PawnRenderer
|
||||
{
|
||||
|
||||
[HarmonyBefore(new string[] { "showhair.kv.rw", "erdelf.HumanoidAlienRaces", "Nals.FacialAnimation" })]
|
||||
public static void Prefix(PawnRenderer __instance, ref Vector3 rootLoc, ref float angle, bool renderBody, ref Rot4 bodyFacing, ref Rot4 headFacing, RotDrawMode bodyDrawType, bool portrait, bool headStump, bool invisible)
|
||||
{
|
||||
PawnGraphicSet graphics = __instance.graphics;
|
||||
Pawn pawn = graphics.pawn;
|
||||
CompBodyAnimator bodyAnim = pawn.TryGetComp<CompBodyAnimator>();
|
||||
|
||||
if (!graphics.AllResolved) {
|
||||
graphics.ResolveAllGraphics();
|
||||
}
|
||||
|
||||
|
||||
if (bodyAnim != null && bodyAnim.isAnimating && !portrait) {
|
||||
bodyAnim.tickGraphics(graphics);
|
||||
pawn.TryGetComp<CompBodyAnimator>().animatePawn(ref rootLoc, ref angle, ref bodyFacing, ref headFacing);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyAfter(new string[] { "showhair.kv.rw", "erdelf.HumanoidAlienRaces", "Nals.FacialAnimation" })]
|
||||
[HarmonyReversePatch(HarmonyReversePatchType.Snapshot)]
|
||||
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) {
|
||||
|
||||
MethodInfo drawMeshNowOrLater = AccessTools.Method(typeof(GenDraw), "DrawMeshNowOrLater");//typeof(GenDraw).GetMethod("DrawMeshNowOrLater", BindingFlags.Static | BindingFlags.Public);
|
||||
FieldInfo headGraphic = AccessTools.Field(typeof(PawnGraphicSet), "headGraphic");
|
||||
|
||||
|
||||
List<CodeInstruction> codes = instructions.ToList();
|
||||
bool forHead = true;
|
||||
for(int i = 0; i < codes.Count(); i++) {
|
||||
|
||||
//Instead of calling drawmeshnoworlater, add pawn to the stack and call my special static method
|
||||
if (codes[i].OperandIs(drawMeshNowOrLater) && forHead) {
|
||||
|
||||
yield return new CodeInstruction(OpCodes.Ldarg_0);
|
||||
yield return new CodeInstruction(OpCodes.Ldfld, AccessTools.DeclaredField(typeof(PawnRenderer), "pawn"));
|
||||
yield return new CodeInstruction(OpCodes.Call, AccessTools.DeclaredMethod(typeof(AnimationUtility), nameof(AnimationUtility.RenderPawnHeadMeshInAnimation)));
|
||||
|
||||
}
|
||||
//checking for if(graphics.headGraphic != null)
|
||||
else if (codes[i].opcode == OpCodes.Ldfld && codes[i].OperandIs(headGraphic)) {
|
||||
forHead = true;
|
||||
yield return codes[i];
|
||||
}
|
||||
//checking for if(renderbody)
|
||||
else if(codes[i].opcode == OpCodes.Ldarg_3) {
|
||||
forHead = false;
|
||||
yield return codes[i];
|
||||
}
|
||||
else {
|
||||
yield return codes[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
25
Source/Patches/HarmonyPatch_Pawn_DrawTracker.cs
Normal file
25
Source/Patches/HarmonyPatch_Pawn_DrawTracker.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using HarmonyLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace Rimworld_Animations {
|
||||
|
||||
[HarmonyPatch(typeof(Pawn_DrawTracker), "DrawPos", MethodType.Getter)]
|
||||
public static class HarmonyPatch_Pawn_DrawTracker {
|
||||
public static bool Prefix(ref Pawn ___pawn, ref Vector3 __result) {
|
||||
|
||||
if(___pawn.TryGetComp<CompBodyAnimator>() != null && ___pawn.TryGetComp<CompBodyAnimator>().isAnimating) {
|
||||
__result = ___pawn.TryGetComp<CompBodyAnimator>().anchor + ___pawn.TryGetComp<CompBodyAnimator>().deltaPos;
|
||||
___pawn.Position = __result.ToIntVec3();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
50
Source/Patches/HarmonyPatch_ShowHairWithHats.cs
Normal file
50
Source/Patches/HarmonyPatch_ShowHairWithHats.cs
Normal file
|
@ -0,0 +1,50 @@
|
|||
using HarmonyLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace Rimworld_Animations {
|
||||
[StaticConstructorOnStartup]
|
||||
public static class Patch_ShowHairWithHats {
|
||||
|
||||
static Patch_ShowHairWithHats() {
|
||||
try {
|
||||
((Action)(() =>
|
||||
{
|
||||
if (LoadedModManager.RunningModsListForReading.Any(x => x.Name == "[KV] Show Hair With Hats or Hide All Hats - 1.1")) {
|
||||
(new Harmony("rjw")).Patch(AccessTools.Method(AccessTools.TypeByName("ShowHair.Patch_PawnRenderer_RenderPawnInternal"), "Postfix"), //typeof(ShowHair.Patch_PawnRenderer_RenderPawnInternal), nameof(ShowHair.Patch_PawnRenderer_RenderPawnInternal.Postfix)),
|
||||
transpiler: new HarmonyMethod(AccessTools.Method(typeof(Patch_ShowHairWithHats), "Transpiler")));
|
||||
}
|
||||
}))();
|
||||
}
|
||||
catch (TypeLoadException ex) { }
|
||||
}
|
||||
|
||||
|
||||
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) {
|
||||
|
||||
MethodInfo drawMeshNowOrLater = AccessTools.Method(typeof(GenDraw), "DrawMeshNowOrLater");
|
||||
|
||||
List<CodeInstruction> codes = instructions.ToList();
|
||||
for (int i = 0; i < codes.Count(); i++) {
|
||||
|
||||
//Instead of calling drawmeshnoworlater, add pawn to the stack and call my special static method
|
||||
if (codes[i].OperandIs(drawMeshNowOrLater)) {
|
||||
|
||||
yield return new CodeInstruction(OpCodes.Ldarg_0);
|
||||
yield return new CodeInstruction(OpCodes.Ldfld, AccessTools.DeclaredField(typeof(PawnRenderer), "pawn"));
|
||||
yield return new CodeInstruction(OpCodes.Call, AccessTools.DeclaredMethod(typeof(AnimationUtility), nameof(AnimationUtility.RenderPawnHeadMeshInAnimation)));
|
||||
|
||||
}
|
||||
else {
|
||||
yield return codes[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
22
Source/Patches/Harmony_PatchAll.cs
Normal file
22
Source/Patches/Harmony_PatchAll.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
using HarmonyLib;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Rimworld_Animations {
|
||||
|
||||
[StaticConstructorOnStartup]
|
||||
public static class Harmony_PatchAll {
|
||||
|
||||
static Harmony_PatchAll() {
|
||||
|
||||
Harmony val = new Harmony("rimworldanim");
|
||||
val.PatchAll(Assembly.GetExecutingAssembly());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using rjw;
|
||||
|
||||
namespace Rimworld_Animations {
|
||||
|
||||
[HarmonyPatch(typeof(JobDriver_SexBaseInitiator), "Start")]
|
||||
static class HarmonyPatch_JobDriver_SexBaseInitiator_Start {
|
||||
public static void Postfix(ref JobDriver_SexBaseInitiator __instance) {
|
||||
|
||||
if(__instance is JobDriver_JoinInBed) {
|
||||
Log.Warning("Tried to start wrong JobDriver with Rimworld-Animations installed. If you see this warning soon after installing this mod, it's fine and animated sex will start soon. If you see this a long time after installing, that's a problem.");
|
||||
return;
|
||||
}
|
||||
|
||||
Pawn Target = __instance.Target;
|
||||
Pawn pawn = __instance.pawn;
|
||||
|
||||
Building_Bed bed = __instance.Bed;
|
||||
|
||||
if (__instance is JobDriver_BestialityForFemale)
|
||||
bed = (__instance as JobDriver_BestialityForFemale).Bed;
|
||||
else if (__instance is JobDriver_WhoreIsServingVisitors) {
|
||||
bed = (__instance as JobDriver_WhoreIsServingVisitors).Bed;
|
||||
}
|
||||
else if(__instance is JobDriver_SexCasualForAnimation) {
|
||||
bed = (__instance as JobDriver_SexCasualForAnimation).Bed;
|
||||
}
|
||||
|
||||
if (__instance.Target.jobs?.curDriver is JobDriver_SexBaseReciever) {
|
||||
|
||||
if (!(Target.jobs.curDriver as JobDriver_SexBaseReciever).parteners.Contains(pawn)) {
|
||||
(Target.jobs.curDriver as JobDriver_SexBaseReciever).parteners.Add(pawn);
|
||||
}
|
||||
|
||||
if (bed != null) {
|
||||
RerollAnimations(Target, __instance.duration, bed as Thing);
|
||||
}
|
||||
else {
|
||||
RerollAnimations(Target, __instance.duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void RerollAnimations(Pawn pawn, int duration, Thing bed = null) {
|
||||
|
||||
if(pawn == null || !(pawn.jobs?.curDriver is JobDriver_SexBaseReciever)) {
|
||||
Log.Message("Error: Tried to reroll animations when pawn isn't sexing");
|
||||
return;
|
||||
}
|
||||
|
||||
List<Pawn> pawnsToAnimate = (pawn.jobs.curDriver as JobDriver_SexBaseReciever).parteners.ToList();
|
||||
|
||||
if (!pawnsToAnimate.Contains(pawn)) {
|
||||
pawnsToAnimate = pawnsToAnimate.Append(pawn).ToList();
|
||||
}
|
||||
|
||||
AnimationDef anim = AnimationUtility.tryFindAnimation(ref pawnsToAnimate);
|
||||
|
||||
if (anim != null) {
|
||||
|
||||
Log.Message("Now playing " + anim.defName);
|
||||
|
||||
bool mirror = GenTicks.TicksGame % 2 == 0;
|
||||
for (int i = 0; i < pawnsToAnimate.Count; i++) {
|
||||
|
||||
if (bed != null)
|
||||
pawnsToAnimate[i].TryGetComp<CompBodyAnimator>().setAnchor(bed);
|
||||
else
|
||||
pawnsToAnimate[i].TryGetComp<CompBodyAnimator>().setAnchor(pawn);
|
||||
|
||||
pawnsToAnimate[i].TryGetComp<CompBodyAnimator>().StartAnimation(anim, i, mirror);
|
||||
(pawnsToAnimate[i].jobs.curDriver as JobDriver_Sex).ticks_left = anim.animationTimeTicks;
|
||||
(pawnsToAnimate[i].jobs.curDriver as JobDriver_Sex).ticksLeftThisToil = anim.animationTimeTicks;
|
||||
(pawnsToAnimate[i].jobs.curDriver as JobDriver_Sex).duration = anim.animationTimeTicks;
|
||||
(pawnsToAnimate[i].jobs.curDriver as JobDriver_Sex).ticks_remaining = anim.animationTimeTicks;
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
Log.Message("Anim not found");
|
||||
//if pawn isn't already animating,
|
||||
if (!pawn.TryGetComp<CompBodyAnimator>().isAnimating) {
|
||||
(pawn.jobs.curDriver as JobDriver_SexBaseReciever).increase_time(duration);
|
||||
//they'll just do the thrusting anim
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(JobDriver_SexBaseInitiator), "End")]
|
||||
static class HarmonyPatch_JobDriver_SexBaseInitiator_End {
|
||||
|
||||
public static void Postfix(ref JobDriver_SexBaseInitiator __instance) {
|
||||
|
||||
if (__instance.Target.jobs?.curDriver is JobDriver_SexBaseReciever) {
|
||||
if (__instance.pawn.TryGetComp<CompBodyAnimator>().isAnimating) {
|
||||
|
||||
List<Pawn> parteners = (__instance.Target.jobs.curDriver as JobDriver_SexBaseReciever).parteners;
|
||||
|
||||
for (int i = 0; i < parteners.Count; i++) {
|
||||
|
||||
//prevents pawns who started a new anim from stopping their new anim
|
||||
if (!((parteners[i].jobs.curDriver as JobDriver_SexBaseInitiator) != null && (parteners[i].jobs.curDriver as JobDriver_SexBaseInitiator).Target != __instance.pawn))
|
||||
parteners[i].TryGetComp<CompBodyAnimator>().isAnimating = false;
|
||||
|
||||
if (xxx.is_human(parteners[i])) {
|
||||
parteners[i].Drawer.renderer.graphics.ResolveApparelGraphics();
|
||||
PortraitsCache.SetDirty(parteners[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
__instance.Target.TryGetComp<CompBodyAnimator>().isAnimating = false;
|
||||
|
||||
if (xxx.is_human(__instance.Target)) {
|
||||
__instance.Target.Drawer.renderer.graphics.ResolveApparelGraphics();
|
||||
PortraitsCache.SetDirty(__instance.Target);
|
||||
}
|
||||
}
|
||||
|
||||
(__instance.Target.jobs.curDriver as JobDriver_SexBaseReciever).parteners.Remove(__instance.pawn);
|
||||
|
||||
}
|
||||
|
||||
if (xxx.is_human(__instance.pawn)) {
|
||||
__instance.pawn.Drawer.renderer.graphics.ResolveApparelGraphics();
|
||||
PortraitsCache.SetDirty(__instance.pawn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
71
Source/Patches/rjwPatches/HarmonyPatch_JoinInBedGiveJob.cs
Normal file
71
Source/Patches/rjwPatches/HarmonyPatch_JoinInBedGiveJob.cs
Normal file
|
@ -0,0 +1,71 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using rjw;
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
using RimWorld;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace Rimworld_Animations {
|
||||
[HarmonyPatch(typeof(JobGiver_JoinInBed), "TryGiveJob")]
|
||||
public static class HarmonyPatch_JoinInBedGiveJob {
|
||||
|
||||
public static bool Prefix(ref Job __result, ref Pawn pawn) {
|
||||
|
||||
__result = null;
|
||||
|
||||
if (!RJWHookupSettings.HookupsEnabled)
|
||||
return false;
|
||||
|
||||
if (pawn.Drafted)
|
||||
return false;
|
||||
|
||||
if (!SexUtility.ReadyForHookup(pawn))
|
||||
return false;
|
||||
|
||||
// We increase the time right away to prevent the fairly expensive check from happening too frequently
|
||||
SexUtility.IncreaseTicksToNextHookup(pawn);
|
||||
|
||||
// If the pawn is a whore, or recently had sex, skip the job unless they're really horny
|
||||
if (!xxx.is_frustrated(pawn) && (xxx.is_whore(pawn) || !SexUtility.ReadyForLovin(pawn)))
|
||||
return false;
|
||||
|
||||
// This check attempts to keep groups leaving the map, like guests or traders, from turning around to hook up
|
||||
if (pawn.mindState?.duty?.def == DutyDefOf.TravelOrLeave) {
|
||||
// TODO: Some guest pawns keep the TravelOrLeave duty the whole time, I think the ones assigned to guard the pack animals.
|
||||
// That's probably ok, though it wasn't the intention.
|
||||
if (RJWSettings.DebugLogJoinInBed) Log.Message($"[RJW] JoinInBed.TryGiveJob:({xxx.get_pawnname(pawn)}): has TravelOrLeave, no time for lovin!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pawn.CurJob == null || pawn.CurJob.def == JobDefOf.LayDown) {
|
||||
//--Log.Message(" checking pawn and abilities");
|
||||
if (xxx.can_fuck(pawn) || xxx.can_be_fucked(pawn)) {
|
||||
//--Log.Message(" finding partner");
|
||||
Pawn partner = JobGiver_JoinInBed.find_pawn_to_fuck(pawn, pawn.Map);
|
||||
|
||||
//--Log.Message(" checking partner");
|
||||
if (partner == null)
|
||||
return false;
|
||||
|
||||
// Can never be null, since find checks for bed.
|
||||
Building_Bed bed = partner.CurrentBed();
|
||||
|
||||
// Interrupt current job.
|
||||
if (pawn.CurJob != null && pawn.jobs.curDriver != null)
|
||||
pawn.jobs.curDriver.EndJobWith(JobCondition.InterruptForced);
|
||||
|
||||
__result = JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("JoinInBedAnimation", true), partner, bed);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
42
Source/Patches/rjwPatches/HarmonyPatch_SexTick.cs
Normal file
42
Source/Patches/rjwPatches/HarmonyPatch_SexTick.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
using rjw;
|
||||
using Verse.Sound;
|
||||
|
||||
namespace Rimworld_Animations {
|
||||
|
||||
[HarmonyPatch(typeof(xxx), "sexTick")]
|
||||
public static class HarmonyPatch_SexTick {
|
||||
|
||||
public static bool Prefix(ref Pawn pawn, ref Pawn partner, ref bool enablerotation, ref bool pawnnude, ref bool partnernude) {
|
||||
|
||||
|
||||
if (enablerotation) {
|
||||
pawn.rotationTracker.Face(((Thing)partner).DrawPos);
|
||||
partner.rotationTracker.Face(((Thing)pawn).DrawPos);
|
||||
}
|
||||
if (RJWSettings.sounds_enabled && !pawn.TryGetComp<CompBodyAnimator>().isAnimating) {
|
||||
SoundDef.Named("Sex").PlayOneShot(new TargetInfo(pawn.Position, pawn.Map));
|
||||
}
|
||||
pawn.Drawer.Notify_MeleeAttackOn((Thing)(object)partner);
|
||||
if (enablerotation) {
|
||||
pawn.rotationTracker.FaceCell(partner.Position);
|
||||
}
|
||||
if (pawnnude && !xxx.has_quirk(pawn, "Endytophile")) {
|
||||
xxx.DrawNude(pawn);
|
||||
}
|
||||
if (partnernude && !xxx.has_quirk(pawn, "Endytophile")) {
|
||||
xxx.DrawNude(partner);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
29
Source/Patches/rjwPatches/HarmonyPatch_WorkGiverSex.cs
Normal file
29
Source/Patches/rjwPatches/HarmonyPatch_WorkGiverSex.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using rjw;
|
||||
using HarmonyLib;
|
||||
using Verse;
|
||||
using RimWorld;
|
||||
using Verse.AI;
|
||||
|
||||
namespace Rimworld_Animations {
|
||||
|
||||
[HarmonyPatch(typeof(WorkGiver_Sex), "JobOnThing")]
|
||||
public static class HarmonyPatch_WorkGiverSex {
|
||||
|
||||
public static bool Prefix(ref Job __result, ref Thing t) {
|
||||
|
||||
Building_Bed bed = RestUtility.CurrentBed(t as Pawn);
|
||||
if (bed == null) {
|
||||
return false;
|
||||
}
|
||||
__result = JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("JoinInBedAnimation", true), t as Pawn, bed);
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue