2020-04-09 00:43:01 +00:00
|
|
|
|
using HarmonyLib;
|
2020-04-22 22:52:11 +00:00
|
|
|
|
using RimWorld;
|
2020-04-09 00:43:01 +00:00
|
|
|
|
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")));
|
2020-04-22 22:52:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(new Harmony("rjw")).Patch(AccessTools.Method(AccessTools.TypeByName("FacialAnimation.FaceAnimationDef"), "IsSame", new Type[] { typeof(JobDef) }),
|
|
|
|
|
prefix: new HarmonyMethod(AccessTools.Method(typeof(Patch_FacialAnimation), "Prefix_IsSameA")));
|
|
|
|
|
|
|
|
|
|
(new Harmony("rjw")).Patch(AccessTools.Method(AccessTools.TypeByName("FacialAnimation.FaceAnimationDef"), "IsSame", new Type[] { typeof(string) }),
|
|
|
|
|
prefix: new HarmonyMethod(AccessTools.Method(typeof(Patch_FacialAnimation), "Prefix_IsSameB")));
|
2020-04-09 00:43:01 +00:00
|
|
|
|
}
|
|
|
|
|
}))();
|
|
|
|
|
}
|
|
|
|
|
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>();
|
|
|
|
|
|
2020-04-10 00:03:56 +00:00
|
|
|
|
if (bodyAnim != null && bodyAnim.isAnimating && !portrait) {
|
2020-04-09 00:43:01 +00:00
|
|
|
|
|
|
|
|
|
headFacing = bodyAnim.headFacing;
|
|
|
|
|
headOrigin = new Vector3(bodyAnim.getPawnHeadPosition().x, headOrigin.y, bodyAnim.getPawnHeadPosition().z);
|
|
|
|
|
quaternion = Quaternion.AngleAxis(bodyAnim.headAngle, Vector3.up);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2020-04-22 22:52:11 +00:00
|
|
|
|
|
|
|
|
|
public static List<string> rjwLovinDefNames = new List<string>{
|
2020-04-23 01:57:46 +00:00
|
|
|
|
"Lovin",
|
2020-04-22 22:52:11 +00:00
|
|
|
|
"JoinInBed",
|
2020-04-23 01:57:46 +00:00
|
|
|
|
"JoinInBedAnimation",
|
|
|
|
|
"GettinLovedAnimation",
|
2020-04-22 22:52:11 +00:00
|
|
|
|
"GettinLoved",
|
|
|
|
|
"GettinLicked",
|
|
|
|
|
"GettinSucked",
|
|
|
|
|
"GettinRaped",
|
|
|
|
|
"ViolateCorpse",
|
|
|
|
|
"Masturbate_Bed",
|
|
|
|
|
"Masturbate_Quick",
|
|
|
|
|
"GettinBred",
|
|
|
|
|
"Bestiality",
|
|
|
|
|
"BestialityForFemale",
|
|
|
|
|
"StruggleInBondageGear",
|
|
|
|
|
"WhoreIsServingVisitors",
|
|
|
|
|
"UseFM"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static bool Prefix_IsSameA(JobDef job, string ___jobDef, ref bool __result) {
|
|
|
|
|
|
2020-04-23 00:52:59 +00:00
|
|
|
|
if(___jobDef != null && ___jobDef == "Lovin" && job?.defName != null && rjwLovinDefNames.Contains(job?.defName)) {
|
2020-04-22 22:52:11 +00:00
|
|
|
|
__result = true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool Prefix_IsSameB(string jobName, string ___jobDef, ref bool __result) {
|
|
|
|
|
|
2020-04-23 00:52:59 +00:00
|
|
|
|
if (___jobDef != null && ___jobDef == "Lovin" && jobName != null && rjwLovinDefNames.Contains(jobName)) {
|
2020-04-22 22:52:11 +00:00
|
|
|
|
__result = true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2020-04-09 00:43:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|