diff --git a/.gitignore b/.gitignore index 1c79e0c..2b8784c 100644 --- a/.gitignore +++ b/.gitignore @@ -348,3 +348,11 @@ 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 fc2cf06..dd3d63c 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 fb9eb43..de2d7d8 100644 --- a/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs +++ b/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs @@ -19,11 +19,6 @@ 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 4d1031e..45fced9 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 = true; + public bool visible = false; } } 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 3ba2def..e30e0b9 100644 --- a/1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs +++ b/1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs @@ -11,50 +11,45 @@ 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; - if (bed != null) anchor = bed; - else anchor = partner; + Thing anchor = (Thing)__instance.Bed ?? partner; AnimationUtility.StartGroupAnimation(participants, groupAnimation, reorder, anchor); int animTicks = AnimationUtility.GetAnimationLength(pawn); foreach(Pawn participant in participants) { - (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; + 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; + } + + } } } @@ -92,7 +87,8 @@ namespace Rimworld_Animations { } //stop partner's other partners (threesome pawns) animating - if (__instance.Partner.jobs.curDriver is JobDriver_SexBaseReciever partnerReceiverJob) + //added null ref checks for instances when pawns get nulled or lose their jobs + 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 4e8b0f0..e71462d 100644 --- a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNodeWorker.cs +++ b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNodeWorker.cs @@ -31,13 +31,6 @@ 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 184caff..1192bb0 100644 --- a/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeWorker_GraphicVariants.cs +++ b/1.5/Source/PawnRenderNode/GraphicVariants/PawnRenderNodeWorker_GraphicVariants.cs @@ -18,14 +18,13 @@ namespace Rimworld_Animations if (parms.Portrait) return false; //don't draw if not visible at tick - if (node.AnimationWorker is AnimationWorker_KeyframesExtended extendedAnimator - && !extendedAnimator.visibleAtTick(node.tree.AnimationTick)) + if (node.AnimationWorker is AnimationWorker_KeyframesExtended extendedAnimator) { - return false; + return extendedAnimator.visibleAtTick(node.tree.AnimationTick); } - - return true; + //don't draw at all if not animating + return false; } 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 61e3d1f..1fdc73c 100644 --- a/1.5/Source/Utilities/AnimationUtility.cs +++ b/1.5/Source/Utilities/AnimationUtility.cs @@ -44,6 +44,12 @@ 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 619c1b1..294fcea 100644 --- a/Rimworld-Animations.csproj +++ b/Rimworld-Animations.csproj @@ -143,6 +143,12 @@ + + + + + + @@ -178,6 +184,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +