diff --git a/.gitignore b/.gitignore index 2b8784c..1c79e0c 100644 --- a/.gitignore +++ b/.gitignore @@ -348,11 +348,3 @@ healthchecksdb /Source/Patches/OtherModPatches/HarmonyPatch_AlienRace.cs /Source/Patches/ThingAnimationPatches/HarmonyPatch_ThingDrawAt.cs /Defs/AnimationDefs/Animations_SexToys.xml -/1.5/Defs/AnimationDefs/BasicBestiality/HumanRotatedOffset.xml -/1.5/Defs/AnimationDefs/BasicBestiality/BasicBestiality4v1.xml -/1.5/Defs/AnimationDefs/BasicBestiality/BasicBestiality3v1.xml -/1.5/Defs/AnimationDefs/BasicBestiality/BasicBestiality2v1.xml -/1.5/Defs/AnimationDefs/BasicBestiality/BasicBestiality1v1.xml -/1.5/Defs/AnimationDefs/BasicBestiality/!BasicBestiality.xml -/1.5/Defs/TestDoNotPush -/1.5/Textures/AnimationProps/BEV diff --git a/1.5/Assemblies/Rimworld-Animations.dll b/1.5/Assemblies/Rimworld-Animations.dll index dd3d63c..fc2cf06 100644 Binary files a/1.5/Assemblies/Rimworld-Animations.dll and b/1.5/Assemblies/Rimworld-Animations.dll differ diff --git a/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs b/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs index de2d7d8..fb9eb43 100644 --- a/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs +++ b/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs @@ -19,6 +19,11 @@ namespace Rimworld_Animations public bool canAnimationBeUsed(List actors) { + if (RJWAnimationSettings.debugMode) + { + Log.Message("[anims] Checking if " + defName + " is valid animation"); + } + if (!contexts.NullOrEmpty()) { foreach (BaseGroupAnimationContext context in contexts) diff --git a/1.5/Source/Animations/Keyframes/ExtendedKeyframe.cs b/1.5/Source/Animations/Keyframes/ExtendedKeyframe.cs index 45fced9..4d1031e 100644 --- a/1.5/Source/Animations/Keyframes/ExtendedKeyframe.cs +++ b/1.5/Source/Animations/Keyframes/ExtendedKeyframe.cs @@ -14,6 +14,6 @@ namespace Rimworld_Animations public Rot4 rotation = Rot4.North; public SoundDef sound = null; public VoiceTagDef voice = null; - public bool visible = false; + public bool visible = true; } } diff --git a/1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs b/1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs index e30e0b9..3ba2def 100644 --- a/1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs +++ b/1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs @@ -11,45 +11,50 @@ namespace Rimworld_Animations { [HarmonyPatch(typeof(JobDriver_SexBaseInitiator), "Start")] static class HarmonyPatch_JobDriver_SexBaseInitiator_Start { public static void Postfix(ref JobDriver_SexBaseInitiator __instance) { + /* + These particular jobs need special code + don't play anim for now + */ + if(__instance is JobDriver_Masturbate || __instance is JobDriver_ViolateCorpse) { + + return; + + } + + if(!RJWAnimationSettings.PlayAnimForNonsexualActs && NonSexualAct(__instance)) + { + return; + } Pawn pawn = __instance.pawn; Pawn partner = __instance.Target as Pawn; - + Building_Bed bed = __instance.Bed; if (partner?.jobs?.curDriver is JobDriver_SexBaseReciever partnerSexBaseReceiver) { Pawn Target = __instance.Target as Pawn; + int preAnimDuration = __instance.duration; + + List participants = partnerSexBaseReceiver.parteners.Append(partner).ToList(); GroupAnimationDef groupAnimation = AnimationUtility.FindGroupAnimation(participants, out int reorder); - if (groupAnimation != null) { - Thing anchor = (Thing)__instance.Bed ?? partner; + Thing anchor; + if (bed != null) anchor = bed; + else anchor = partner; AnimationUtility.StartGroupAnimation(participants, groupAnimation, reorder, anchor); int animTicks = AnimationUtility.GetAnimationLength(pawn); foreach(Pawn participant in participants) { - if (RJWAnimationSettings.debugMode) - { - Log.Message("Participant: " + participant.Name); - Log.Message("JobDriver: " + participant.CurJobDef.defName); - - } - - //null ref check for pawns that might have lost their jobs or become null for some reason - if (participant?.jobs?.curDriver is JobDriver_Sex participantJobDriver) - { - participantJobDriver.ticks_left = animTicks; - participantJobDriver.sex_ticks = animTicks; - participantJobDriver.orgasmStartTick = animTicks; - participantJobDriver.duration = animTicks; - } - - + (participant.jobs.curDriver as JobDriver_Sex).ticks_left = animTicks; + (participant.jobs.curDriver as JobDriver_Sex).sex_ticks = animTicks; + (participant.jobs.curDriver as JobDriver_Sex).orgasmStartTick = animTicks; + (participant.jobs.curDriver as JobDriver_Sex).duration = animTicks; } } } @@ -87,8 +92,7 @@ namespace Rimworld_Animations { } //stop partner's other partners (threesome pawns) animating - //added null ref checks for instances when pawns get nulled or lose their jobs - if (__instance.Partner?.jobs?.curDriver is JobDriver_SexBaseReciever partnerReceiverJob) + if (__instance.Partner.jobs.curDriver is JobDriver_SexBaseReciever partnerReceiverJob) { foreach(Pawn pawn in partnerReceiverJob.parteners) { diff --git a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNodeWorker.cs b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNodeWorker.cs index e71462d..4e8b0f0 100644 --- a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNodeWorker.cs +++ b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNodeWorker.cs @@ -31,6 +31,13 @@ namespace Rimworld_Animations return true; } + //set graphic variant nodes to invisible when not animating + if (node is PawnRenderNode_GraphicVariants) + { + __result = false; + return false; + } + return true; } diff --git a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeWorker_GraphicVariants.cs b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeWorker_GraphicVariants.cs index 1192bb0..184caff 100644 --- a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeWorker_GraphicVariants.cs +++ b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeWorker_GraphicVariants.cs @@ -18,13 +18,14 @@ namespace Rimworld_Animations if (parms.Portrait) return false; //don't draw if not visible at tick - if (node.AnimationWorker is AnimationWorker_KeyframesExtended extendedAnimator) + if (node.AnimationWorker is AnimationWorker_KeyframesExtended extendedAnimator + && !extendedAnimator.visibleAtTick(node.tree.AnimationTick)) { - return extendedAnimator.visibleAtTick(node.tree.AnimationTick); + return false; } - //don't draw at all if not animating - return false; + + return true; } protected override Material GetMaterial(PawnRenderNode node, PawnDrawParms parms) { diff --git a/1.5/Source/Utilities/AnimationUtility.cs b/1.5/Source/Utilities/AnimationUtility.cs index 1fdc73c..61e3d1f 100644 --- a/1.5/Source/Utilities/AnimationUtility.cs +++ b/1.5/Source/Utilities/AnimationUtility.cs @@ -44,12 +44,6 @@ namespace Rimworld_Animations { //each participant gets their own unique extendedanimatoranchor, important for scribe_deep saving List allAnimationsForPawn = groupAnimationDef.GetAllAnimationsForActor(i, seed, reorder); BaseExtendedAnimatorAnchor animatorAnchor = new ExtendedAnimatorAnchor_Thing(anchor); - - if (RJWAnimationSettings.debugMode) - { - Log.Message("Now playing animation: " + groupAnimationDef.defName); - } - participants[i].TryGetComp().PlayGroupAnimation(allAnimationsForPawn, position, rotation, animatorAnchor); } } diff --git a/Rimworld-Animations.csproj b/Rimworld-Animations.csproj index 294fcea..619c1b1 100644 --- a/Rimworld-Animations.csproj +++ b/Rimworld-Animations.csproj @@ -143,12 +143,6 @@ - - - - - - @@ -184,56 +178,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -