diff --git a/1.3/Assemblies/Rimworld-Animations.dll b/1.3/Assemblies/Rimworld-Animations.dll index cf307d7..7f376ba 100644 Binary files a/1.3/Assemblies/Rimworld-Animations.dll and b/1.3/Assemblies/Rimworld-Animations.dll differ diff --git a/1.3/Source/Actors/Actor.cs b/1.3/Source/Actors/Actor.cs index 34766e0..3b382dd 100644 --- a/1.3/Source/Actors/Actor.cs +++ b/1.3/Source/Actors/Actor.cs @@ -21,6 +21,6 @@ namespace Rimworld_Animations { public BodyTypeOffset bodyTypeOffset = new BodyTypeOffset(); public Vector3 offset = new Vector2(0, 0); public List requiredGender; - + public List tags = new List(); } } diff --git a/1.3/Source/Animations/AnimationStage.cs b/1.3/Source/Animations/AnimationStage.cs index 475c079..7a1304e 100644 --- a/1.3/Source/Animations/AnimationStage.cs +++ b/1.3/Source/Animations/AnimationStage.cs @@ -10,9 +10,10 @@ namespace Rimworld_Animations { public string stageName; public int stageIndex; public int playTimeTicks = 0; + public int playTimeTicksQuick = -1; public bool isLooping; public List animationClips; - + public List tags = new List(); public void initialize() { foreach (BaseAnimationClip clip in animationClips) { diff --git a/1.3/Source/Animations/Clips/BaseAnimationClip.cs b/1.3/Source/Animations/Clips/BaseAnimationClip.cs index 9963cd5..aa35b31 100644 --- a/1.3/Source/Animations/Clips/BaseAnimationClip.cs +++ b/1.3/Source/Animations/Clips/BaseAnimationClip.cs @@ -15,6 +15,6 @@ namespace Rimworld_Animations { public abstract void buildSimpleCurves(); public string soundDef = null; //for playing sounds public int actor; - + public List tags = new List(); } } diff --git a/1.3/Source/Animations/Keyframes/Keyframe.cs b/1.3/Source/Animations/Keyframes/Keyframe.cs index b34eb44..8cd859d 100644 --- a/1.3/Source/Animations/Keyframes/Keyframe.cs +++ b/1.3/Source/Animations/Keyframes/Keyframe.cs @@ -10,5 +10,6 @@ namespace Rimworld_Animations { public int tickDuration = 1; public float? atTick; public string soundEffect; + public List tags = new List(); } } diff --git a/1.3/Source/Comps/CompBodyAnimator.cs b/1.3/Source/Comps/CompBodyAnimator.cs index e0ac52a..7910f7d 100644 --- a/1.3/Source/Comps/CompBodyAnimator.cs +++ b/1.3/Source/Comps/CompBodyAnimator.cs @@ -52,6 +52,7 @@ namespace Rimworld_Animations { public List actorsInCurrentAnimation; public bool controlGenitalAngle = false; + public bool fastAnimForQuickie = false; private AnimationDef anim; private AnimationStage stage { @@ -155,7 +156,9 @@ namespace Rimworld_Animations { this.actor = actor; this.anim = anim; this.mirror = mirror; - if(fastAnimForQuickie) + this.fastAnimForQuickie = fastAnimForQuickie; + + if (fastAnimForQuickie && anim.animationStages.Any(x => x.playTimeTicksQuick >= 0) == false) { curStage = 1; animTicks = anim.animationStages[0].playTimeTicks; @@ -259,7 +262,7 @@ namespace Rimworld_Animations { stageTicks++; - if(stageTicks >= stage.playTimeTicks) { + if(stageTicks >= stage.playTimeTicks || (fastAnimForQuickie && stage.playTimeTicksQuick >= 0 && stageTicks >= stage.playTimeTicksQuick)) { curStage++; diff --git a/1.3/Source/Comps/CompProperties_BodyAnimator.cs b/1.3/Source/Comps/CompProperties_BodyAnimator.cs index bfcde83..09df7ce 100644 --- a/1.3/Source/Comps/CompProperties_BodyAnimator.cs +++ b/1.3/Source/Comps/CompProperties_BodyAnimator.cs @@ -1,4 +1,4 @@ - using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -11,7 +11,6 @@ namespace Rimworld_Animations { { public CompProperties_BodyAnimator() { - base.compClass = typeof(CompBodyAnimator); } } diff --git a/1.3/Source/Defs/AnimationDef.cs b/1.3/Source/Defs/AnimationDef.cs index d0d9d61..395ff83 100644 --- a/1.3/Source/Defs/AnimationDef.cs +++ b/1.3/Source/Defs/AnimationDef.cs @@ -15,6 +15,7 @@ namespace Rimworld_Animations { public bool sounds = false; public List sexTypes = null; public List interactionDefTypes = null; + public List tags = new List(); public override void PostLoad() { base.PostLoad(); diff --git a/1.3/Source/Extensions/PawnWoundDrawerExtension.cs b/1.3/Source/Extensions/PawnWoundDrawerExtension.cs new file mode 100644 index 0000000..4901de2 --- /dev/null +++ b/1.3/Source/Extensions/PawnWoundDrawerExtension.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using RimWorld; +using UnityEngine; +using Verse; +using Rimworld_Animations; + +namespace Rimworld_Animations +{ + [StaticConstructorOnStartup] + public static class PawnWoundDrawerExtension + { + public static void RenderOverBody(this PawnWoundDrawer pawnWoundDrawer, Vector3 drawLoc, Mesh bodyMesh, Quaternion quat, bool drawNow, BodyTypeDef.WoundLayer layer, Rot4 pawnRot, bool? overApparel = null, Pawn pawn = null, PawnRenderFlags flags = new PawnRenderFlags()) + { + if (pawn == null) + { return; } + + if (!flags.FlagSet(PawnRenderFlags.Portrait) && layer == BodyTypeDef.WoundLayer.Head) + { + CompBodyAnimator pawnAnimator = pawn.TryGetComp(); + if (pawnAnimator != null && pawnAnimator.isAnimating && pawn.Drawer.renderer.graphics.headGraphic != null) + { + pawnRot = pawnAnimator.headFacing; + quat = Quaternion.AngleAxis(angle: pawnAnimator.headAngle, axis: Vector3.up); + float y = drawLoc.y; + drawLoc = pawnAnimator.getPawnHeadPosition() - Quaternion.AngleAxis(pawnAnimator.headAngle, Vector3.up) * pawn.Drawer.renderer.BaseHeadOffsetAt(pawnAnimator.headFacing); + drawLoc.y = y; + } + } + + pawnWoundDrawer.RenderOverBody(drawLoc, bodyMesh, quat, drawNow, layer, pawnRot, overApparel); + } + } +} diff --git a/1.3/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderer.cs b/1.3/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderer.cs index 7514963..218e45b 100644 --- a/1.3/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderer.cs +++ b/1.3/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderer.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using HarmonyLib; using RimWorld; using Verse; @@ -66,18 +64,21 @@ namespace Rimworld_Animations { //headFacing equals true } + // Fixes the offsets for eye implants and wounds on the head during animations + else if (ins[i].opcode == OpCodes.Callvirt && ins[i].operand != null && ins[i].OperandIs(AccessTools.DeclaredMethod(typeof(PawnWoundDrawer), "RenderOverBody"))) + { + // Pass some additional info to a new overload of RenderOverBody + yield return new CodeInstruction(OpCodes.Ldarg_0); + yield return new CodeInstruction(OpCodes.Ldfld, AccessTools.DeclaredField(typeof(PawnRenderer), "pawn")); + yield return new CodeInstruction(OpCodes.Ldarg_S, (object)6); // renderer flags + yield return new CodeInstruction(OpCodes.Call, AccessTools.DeclaredMethod(typeof(PawnWoundDrawerExtension), "RenderOverBody")); + } + else { yield return ins[i]; - } - - + } } - } - } - - - } diff --git a/1.3/Source/Patches/RimworldPatches/HarmonyPatch_SetPawnAnimatable.cs b/1.3/Source/Patches/RimworldPatches/HarmonyPatch_SetPawnAnimatable.cs index fbaf045..b8c66b8 100644 --- a/1.3/Source/Patches/RimworldPatches/HarmonyPatch_SetPawnAnimatable.cs +++ b/1.3/Source/Patches/RimworldPatches/HarmonyPatch_SetPawnAnimatable.cs @@ -27,7 +27,6 @@ namespace Rimworld_Animations { if (i.OperandIs(AccessTools.Method(typeof(PawnUtility), "IsInvisible"))) { - yield return new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(PawnRenderer_RenderPawnAt_Patch), "ClearCache")); } else diff --git a/About/Manifest.xml b/About/Manifest.xml index 61aa6f0..07f5279 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,5 +1,5 @@ Rimworld-Animations - 1.2.7 + 1.2.8 diff --git a/Patch_SexToysMasturbation/Patch_SexToysMasturbation.csproj b/Patch_SexToysMasturbation/Patch_SexToysMasturbation.csproj index fc6cbf9..b25b5c2 100644 --- a/Patch_SexToysMasturbation/Patch_SexToysMasturbation.csproj +++ b/Patch_SexToysMasturbation/Patch_SexToysMasturbation.csproj @@ -46,11 +46,11 @@ False - ..\..\rjw\1.3\Assemblies\RJW.dll + ..\..\rjw-master\1.3\Assemblies\RJW.dll False - ..\..\rjw-toys-and-masturbation\Assemblies\RJW-ToysAndMasturbation.dll + ..\..\rjw-toys-and-masturbation-master\Assemblies\RJW-ToysAndMasturbation.dll False diff --git a/Rimworld-Animations.csproj b/Rimworld-Animations.csproj index 1c066ce..674eb10 100644 --- a/Rimworld-Animations.csproj +++ b/Rimworld-Animations.csproj @@ -44,7 +44,11 @@ False - ..\rjw\1.3\Assemblies\RJW.dll + ..\rjw-master\1.3\Assemblies\RJW.dll + False + + + ..\rjw-toys-and-masturbation-master\Assemblies\RJW-ToysAndMasturbation.dll False @@ -65,6 +69,7 @@ +