diff --git a/1.5/Assemblies/0MultiplayerAPI.dll b/1.5/Assemblies/0MultiplayerAPI.dll new file mode 100644 index 0000000..9648606 Binary files /dev/null and b/1.5/Assemblies/0MultiplayerAPI.dll differ diff --git a/1.5/Assemblies/Rimworld-Animations.dll b/1.5/Assemblies/Rimworld-Animations.dll index 45220c0..a394dd9 100644 Binary files a/1.5/Assemblies/Rimworld-Animations.dll and b/1.5/Assemblies/Rimworld-Animations.dll differ diff --git a/1.5/Defs/AnimationDefs/TestAnimation2.xml b/1.5/Defs/AnimationDefs/TestAnimation2.xml index 06bdbd0..81923af 100644 --- a/1.5/Defs/AnimationDefs/TestAnimation2.xml +++ b/1.5/Defs/AnimationDefs/TestAnimation2.xml @@ -2,7 +2,7 @@ TestAnimation2 - 50 + 200 False False @@ -13,27 +13,27 @@ Rimworld_Animations.AnimationWorker_KeyframesExtended
  • - (1, -1, 0) + (0, -1, 0) 0 - 0 + 23 North
  • (0, -1, 0) - 20 - 0 - North -
  • -
  • - (-1, -1, 0) - 30 - 0 + 6 + -5 North
  • (0, -1, 0) - 40 - 0 + 12 + 4 + North +
  • +
  • + (0, -1, 0) + 188 + -1 North
  • @@ -51,16 +51,16 @@
  • 6 - 0 + -5 North
  • 12 - 0 + 4 North
  • - 18 + 128 0 North
  • diff --git a/1.5/Defs/GroupAnimationDefs/TestGroupAnimation1.xml b/1.5/Defs/GroupAnimationDefs/TestGroupAnimation1.xml index 7fb19e6..701c56d 100644 --- a/1.5/Defs/GroupAnimationDefs/TestGroupAnimation1.xml +++ b/1.5/Defs/GroupAnimationDefs/TestGroupAnimation1.xml @@ -4,6 +4,13 @@ TestGroupAnimation1 2 +
  • + 200 + +
  • TestAnimation1
  • +
  • TestAnimation2
  • + +
  • 10 @@ -24,53 +31,48 @@
  • +
    - +
  • @@ -87,12 +89,6 @@
  • -
    diff --git a/1.5/Defs/OffsetDefs/OffsetDef_GroinToAppropriateHeight.xml b/1.5/Defs/OffsetDefs/OffsetDef_GroinToAppropriateHeight.xml deleted file mode 100644 index 4503f96..0000000 --- a/1.5/Defs/OffsetDefs/OffsetDef_GroinToAppropriateHeight.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - GroinToAppropriateHeight - -
  • - Male - (0, 0, 0.5) -
  • -
    - -
  • - MinecraftCreeper - - - (0, 0, 0.5) - (0, 0, 0.3) - - - (0, 0, 0.5) - (0, 0, 0.3) - - -
  • -
  • - MinecraftPig - Male - (0, 0, -0.5) -
  • -
  • - MinecraftPig - Female - (0, 0, -0.5) -
  • -
    -
    -
    - \ No newline at end of file diff --git a/1.5/Source/AnimationWorkers/AnimationWorker_KeyframesExtended.cs b/1.5/Source/AnimationWorkers/AnimationWorker_KeyframesExtended.cs index acc531f..50af003 100644 --- a/1.5/Source/AnimationWorkers/AnimationWorker_KeyframesExtended.cs +++ b/1.5/Source/AnimationWorkers/AnimationWorker_KeyframesExtended.cs @@ -15,18 +15,11 @@ namespace Rimworld_Animations { } - public override Vector3 OffsetAtTick(int tick, PawnDrawParms parms) - { - //Todo: Use this for bodyoffsets - return base.OffsetAtTick(tick, parms); - } - //use extendedkeyframes to determine addon facing public Rot4 facingAtTick(int tick) { - //if ticks are < first keyframe tick, just be stuck to first keyframe rot if (tick <= this.part.keyframes[0].tick) { @@ -65,6 +58,8 @@ namespace Rimworld_Animations return (keyframe as ExtendedKeyframe).rotation; } + + public bool visibleAtTick(int tick) { //if ticks are < first keyframe tick, just be stuck to first keyframe rot @@ -109,15 +104,5 @@ namespace Rimworld_Animations } - - public bool shouldRecache(int tick) - { - if (facingAtTick(tick) != facingAtTick(tick - 1) || visibleAtTick(tick) != visibleAtTick(tick - 1)) - { - return true; - } - - return true; - } } } diff --git a/1.5/Source/Comps/CompExtendedAnimator.cs b/1.5/Source/Comps/CompExtendedAnimator.cs index bd15457..17231e2 100644 --- a/1.5/Source/Comps/CompExtendedAnimator.cs +++ b/1.5/Source/Comps/CompExtendedAnimator.cs @@ -11,125 +11,7 @@ using Verse.Sound; namespace Rimworld_Animations { public class CompExtendedAnimator : ThingComp { - - // CompExtendedAnimator - // Helps manage AnimationQueue, AbsolutePosition - //ticks of current animation - private int animationTicks; - - private List animationQueue; - private BaseExtendedAnimatorAnchor anchor; - private bool isAnimating = false; - - - public bool IsAnimating - { - get - { - return isAnimating; - } - } - - public bool IsAnchored - { - get - { - return anchor != null; - } - } - - public Vector3 getAnchor() - { - return anchor.getDrawPos(); - } - - - public override void CompTick() - { - if (isAnimating) - { - animationTicks++; - - //if animationticks is equal to cur. anim duration, - if (animationTicks >= animationQueue[0].durationTicks) - { - //dequeue; returns false if more animations - if (!PopAnimationQueue()) - { - //play next if more anims still - PlayNextAnimation(); - } - else - { - StopAnimating(); - } - } - } - - - - base.CompTick(); - } - - //returns false if still more animations - public bool PopAnimationQueue() - { - - if (!animationQueue.Empty()) - { - //pop queue - animationQueue.RemoveAt(0); - } - - return animationQueue.Empty(); - } - - public void PlayNextAnimation() - { - if (!animationQueue.Empty()) - { - isAnimating = true; - animationTicks = 0; - pawn.Drawer.renderer.SetAnimation(animationQueue[0]); - } - } - - public void StopAnimating() - { - isAnimating = false; - animationQueue = null; - anchor = null; - pawn.Drawer.renderer.SetAnimation(null); - } - - public void PlayGroupAnimation(List groupAnimation) - { - animationQueue = groupAnimation; - PlayNextAnimation(); - } - - public void PlayGroupAnimation(List groupAnimation, BaseExtendedAnimatorAnchor anchor) - { - this.anchor = anchor; - PlayGroupAnimation(groupAnimation); - } - - public override void PostExposeData() - { - base.PostExposeData(); - Scribe_Values.Look(ref this.isAnimating, "animations_isAnimating", false); - Scribe_Values.Look(ref this.animationTicks, "animations_ticks", 0); - Scribe_Collections.Look(ref animationQueue, "animations_queue"); - Scribe_Deep.Look(ref this.anchor, "animations_anchor"); - - } - - public static void CheckRecacheNecessary(int anim) - { - - } - - private Pawn pawn => base.parent as Pawn; + List> animationQueue; } diff --git a/1.5/Source/Comps/CompProperties_ExtendedAnimator.cs b/1.5/Source/Comps/CompProperties_ExtendedAnimator.cs index 47fc1a5..c74848a 100644 --- a/1.5/Source/Comps/CompProperties_ExtendedAnimator.cs +++ b/1.5/Source/Comps/CompProperties_ExtendedAnimator.cs @@ -12,7 +12,6 @@ namespace Rimworld_Animations { public CompProperties_ExtendedAnimator() { base.compClass = typeof(CompExtendedAnimator); - } } } diff --git a/1.5/Source/Comps/ExtendedAnimatorAnchor/BaseExtendedAnimatorAnchor.cs b/1.5/Source/Comps/ExtendedAnimatorAnchor/BaseExtendedAnimatorAnchor.cs deleted file mode 100644 index 6116a8c..0000000 --- a/1.5/Source/Comps/ExtendedAnimatorAnchor/BaseExtendedAnimatorAnchor.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Verse; - -namespace Rimworld_Animations -{ - public abstract class BaseExtendedAnimatorAnchor : IExposable - { - public BaseExtendedAnimatorAnchor() { } - - public virtual void ExposeData() { } - public abstract Vector3 getDrawPos(); - - public string GetUniqueLoadID() - { - throw new NotImplementedException(); - } - } -} diff --git a/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Thing.cs b/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Thing.cs deleted file mode 100644 index 8b61405..0000000 --- a/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Thing.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Verse; - -namespace Rimworld_Animations -{ - public class ExtendedAnimatorAnchor_Thing : BaseExtendedAnimatorAnchor - { - - private Thing thing; - - public ExtendedAnimatorAnchor_Thing() : base() { } - - public ExtendedAnimatorAnchor_Thing(Thing thing) : base() - { - this.thing = thing; - } - - public override Vector3 getDrawPos() - { - return thing.DrawPos; - } - - public override void ExposeData() - { - base.ExposeData(); - Scribe_References.Look(ref this.thing, "animations_anchor_thing", false); - } - } -} diff --git a/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Vector3.cs b/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Vector3.cs deleted file mode 100644 index ffb84ab..0000000 --- a/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Vector3.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Verse; - -namespace Rimworld_Animations -{ - public class ExtendedAnimatorAnchor_Vector3 : BaseExtendedAnimatorAnchor - { - - public ExtendedAnimatorAnchor_Vector3() : base() { } - - private Vector3 position; - public ExtendedAnimatorAnchor_Vector3(Vector3 position) : base() - { - this.position = position; - } - - public override Vector3 getDrawPos() - { - return position; - } - - public override void ExposeData() - { - base.ExposeData(); - Scribe_Values.Look(ref position, "animations_anchor_position", Vector3.zero); - } - } -} diff --git a/1.5/Source/GroupAnimations/GroupAnimationContexts/BaseGroupAnimationContext.cs b/1.5/Source/GroupAnimations/GroupAnimationContexts/BaseGroupAnimationContext.cs index d62b348..f5ee3dc 100644 --- a/1.5/Source/GroupAnimations/GroupAnimationContexts/BaseGroupAnimationContext.cs +++ b/1.5/Source/GroupAnimations/GroupAnimationContexts/BaseGroupAnimationContext.cs @@ -11,7 +11,6 @@ namespace Rimworld_Animations { public int actorShift = 0; public abstract bool CanAnimationBeUsed(List actors, out int reorder); - public abstract string DebugMessage(); //cool class for designating contexts for animations // configure CanAnimationBeUsed to test whether it can be used diff --git a/1.5/Source/GroupAnimations/GroupAnimationContexts/GroupAnimationContext_RJWSex.cs b/1.5/Source/GroupAnimations/GroupAnimationContexts/GroupAnimationContext_RJWSex.cs index a0bb3be..7c2033e 100644 --- a/1.5/Source/GroupAnimations/GroupAnimationContexts/GroupAnimationContext_RJWSex.cs +++ b/1.5/Source/GroupAnimations/GroupAnimationContexts/GroupAnimationContext_RJWSex.cs @@ -17,6 +17,7 @@ namespace Rimworld_Animations public override bool CanAnimationBeUsed(List actors, out int reorder) { + Log.Message("Testing this animation"); JobDriver_SexBaseInitiator latestSexBaseInitiator = (actors.FindLast(x => x.jobs?.curDriver is JobDriver_SexBaseInitiator).jobs.curDriver as JobDriver_SexBaseInitiator); reorder = base.actorShift; @@ -24,11 +25,5 @@ namespace Rimworld_Animations return interactionDefs.Contains(latestSexBaseInitiator.Sexprops.dictionaryKey); } - - public override string DebugMessage() - { - return "Checking for RJWSex AnimationContext\n" - + "InteractionDefs: " + interactionDefs; - } } } diff --git a/1.5/Source/GroupAnimations/GroupAnimationDef.cs b/1.5/Source/GroupAnimations/GroupAnimationDef.cs index c54984f..36eb64a 100644 --- a/1.5/Source/GroupAnimations/GroupAnimationDef.cs +++ b/1.5/Source/GroupAnimations/GroupAnimationDef.cs @@ -16,11 +16,6 @@ namespace Rimworld_Animations public bool canAnimationBeUsed(List actors, out int reorder) { - if (AnimationSettings.debugMode) - { - Log.Message("[anims] Checking if " + defName + " is valid animation"); - } - foreach (BaseGroupAnimationContext context in contexts) { @@ -33,20 +28,5 @@ namespace Rimworld_Animations reorder = 0; return false; } - - public List GetAllAnimationsForActor(int actor, int seed, int reorder = 0) - { - List animations = new List(); - int actorNumber = (actor + reorder) % numActors; - - - foreach (AnimationStage stage in animationStages) - { - //add all new animations to list of animations - animations.AddRange(stage.GetAnimations(actorNumber, seed)); - } - - return animations; - } } } diff --git a/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage.cs b/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage.cs index b212183..58e86ab 100644 --- a/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage.cs +++ b/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage.cs @@ -11,7 +11,7 @@ namespace Rimworld_Animations { //Return a list containing a tuple; int for how long the animation should play for - public abstract List GetAnimations(int actorNumber, int seed); + public abstract List> GetAnimations(int actor, int seed); } } diff --git a/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_Branch.cs b/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_Branch.cs index a187270..889b06e 100644 --- a/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_Branch.cs +++ b/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_Branch.cs @@ -10,9 +10,9 @@ namespace Rimworld_Animations public class AnimationStage_Branch : AnimationStage { public List paths; - public override List GetAnimations(int actorNumber, int seed) + public override List> GetAnimations(int actor, int seed) { - return paths[(seed * 59) % paths.Count].GetAnimations(actorNumber, seed); + return paths[(seed * 59) % paths.Count].GetAnimations(actor, seed); } } } diff --git a/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_LoopRandomSelectChance.cs b/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_LoopRandomSelectChance.cs index 09cbc9c..a6fa374 100644 --- a/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_LoopRandomSelectChance.cs +++ b/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_LoopRandomSelectChance.cs @@ -12,50 +12,48 @@ namespace Rimworld_Animations public int loops; public List loopOptions; - public override List GetAnimations(int actorNumber, int seed) + public override List> GetAnimations(int actor, int seed) { int numberOfActors = loopOptions[0].animationDefs.Count; - List animations = new List(); + List> animations = new List>(); for (int i = 0; i < loops; i++) { - AnimationLoopOption option = getAnimationLoopOptionByWeight(seed + i); - animations.Add(option.animationDefs[actorNumber]); + + AnimationLoopOption option = getAnimationLoopOptionByWeight(seed + i, out int longestAnimLength); + Tuple animation = Tuple.Create(longestAnimLength, option.animationDefs[actor]); + animations.Append(animation); } return animations; } - + public class AnimationLoopOption + { + public int probability; + public List animationDefs; + } //select random element from loop options by weight; also calculate the longest anim length - private AnimationLoopOption getAnimationLoopOptionByWeight(int seed) + public AnimationLoopOption getAnimationLoopOptionByWeight(int seed, out int longestAnimLength) { int totalWeight = loopOptions.Sum(x => x.probability); - int randomNumber = ((seed * 59) % totalWeight) + 1; + int randomNumber = (seed * 56) % totalWeight; int cumulativeWeight = 0; - for (int i = 0; i < loopOptions.Count; i++) { - - - cumulativeWeight += loopOptions[i].probability; - - //random number is same for all pawns because they all have the same seed - + foreach(AnimationLoopOption option in loopOptions) { + cumulativeWeight += option.probability; if (randomNumber <= cumulativeWeight) { - return loopOptions[i]; + longestAnimLength = option.animationDefs.Max(x => x.durationTicks); + return option; } } - //default - return loopOptions.Last(); + longestAnimLength = loopOptions[0].animationDefs.Max(x => x.durationTicks); + return loopOptions[0]; } - } - public class AnimationLoopOption - { - public int probability; - public List animationDefs; + } } diff --git a/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_TicksDuration.cs b/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_TicksDuration.cs index cd63ecf..e502596 100644 --- a/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_TicksDuration.cs +++ b/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_TicksDuration.cs @@ -7,17 +7,14 @@ using Verse; namespace Rimworld_Animations { - /* don't use? just use looprandomselect once public class AnimationStage_TicksDuration : AnimationStage { - public int ticks; - public List animationDefs; + int ticks; + List animationDefs; public override List> GetAnimations(int actor, int seed) { return new List>() { Tuple.Create(ticks, animationDefs[actor]) }; } } - - */ } 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 8980cec..830ac41 100644 --- a/1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs +++ b/1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs @@ -42,9 +42,10 @@ namespace Rimworld_Animations { List participants = partnerSexBaseReceiver.parteners.Append(partner).ToList(); GroupAnimationDef groupAnimation = AnimationUtility.FindGroupAnimation(participants, out int reorder); + if (groupAnimation != null) { - AnimationUtility.StartGroupAnimation(participants, groupAnimation, reorder, partner); + AnimationUtility.StartGroupAnimation(participants, groupAnimation, reorder); } diff --git a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNode.cs b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNode.cs index cf45a65..c7cff4f 100644 --- a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNode.cs +++ b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNode.cs @@ -18,17 +18,25 @@ namespace Rimworld_Animations { if (__instance.AnimationWorker is AnimationWorker_KeyframesExtended extendedAnimWorker) { - - // ADJUST FACING get rotated textures - // compare the previous tick to the current tick; if the current tick rotation is different, recache - parms.facing = extendedAnimWorker.facingAtTick(__instance.tree.AnimationTick); - - //INVIS IF ANIM CALLS FOR IT //replace maybe? + if (!extendedAnimWorker.visibleAtTick(__instance.tree.AnimationTick)) + { + __instance.requestRecache = true; + return false; + } - //cheaper call now comparing prev tick to cur tick - return extendedAnimWorker.visibleAtTick(__instance.tree.AnimationTick); + + // HEAD ROTATION ADJUST FACING get rotated textures + + Rot4 animFacing = extendedAnimWorker.facingAtTick(__instance.tree.AnimationTick); + + if (parms.facing != animFacing) + { + //requestRecache or else it won't update properly + __instance.requestRecache = true; + parms.facing = animFacing; + } } diff --git a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderTree.cs b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderTree.cs index b932135..edc16af 100644 --- a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderTree.cs +++ b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderTree.cs @@ -28,43 +28,8 @@ namespace Rimworld_Animations && node.tree.rootNode.AnimationWorker is AnimationWorker_KeyframesExtended rootNodeAnimationWorker) { - // this is only for the Vector3 position to work right parms.facing = rootNodeAnimationWorker.facingAtTick(node.tree.AnimationTick); } } } - - - [HarmonyPatch(typeof(PawnRenderTree), "AdjustParms")] - public class HarmonyPatch_PawnRenderTree2 - { - public static void Prefix(PawnRenderTree __instance, ref PawnDrawParms parms) - { - - int animationTick = __instance.AnimationTick; - - if (__instance.rootNode.AnimationWorker is AnimationWorker_KeyframesExtended rootAnimWorkerExtended) - { - //recache during facing turn - if (rootAnimWorkerExtended.shouldRecache(animationTick)) - { - __instance.rootNode.requestRecache = true; - return; - } - } - - foreach (PawnRenderNode node in __instance.rootNode.children) - { - if (node.AnimationWorker is AnimationWorker_KeyframesExtended animWorkerExtended) - { - //recache during facing turn - if (animWorkerExtended.shouldRecache(animationTick)) - { - node.requestRecache = true; - return; - } - } - } - } - } } diff --git a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTracker.cs b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTracker.cs index 8b467e1..65b34e9 100644 --- a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTracker.cs +++ b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTracker.cs @@ -9,18 +9,23 @@ namespace Rimworld_Animations { public static class HarmonyPatch_Pawn_DrawTracker { public static bool Prefix(ref Pawn ___pawn, ref Vector3 __result) { - - CompExtendedAnimator animator = ___pawn.TryGetComp(); - - //align pos on top of partner, position, etc., based on animatoranchor - if (animator != null && animator.IsAnchored) + // If animating and is sexbaseinitiator jobdriver, + if (___pawn?.Drawer?.renderer?.renderTree?.rootNode?.AnimationWorker is AnimationWorker_KeyframesExtended + && ___pawn.jobs?.curDriver is JobDriver_SexBaseInitiator sexdriver) { - __result = animator.getAnchor(); + + //align pos on top of partner + if (sexdriver?.Partner?.Drawer?.DrawPos != null) + __result = sexdriver.Partner.Drawer.DrawPos; + + return false; + } return true; + } } } diff --git a/1.5/Source/Settings/AnimationSettings.cs b/1.5/Source/Settings/AnimationSettings.cs index f320fa2..0a96621 100644 --- a/1.5/Source/Settings/AnimationSettings.cs +++ b/1.5/Source/Settings/AnimationSettings.cs @@ -29,7 +29,7 @@ namespace Rimworld_Animations { Scribe_Values.Look(ref orgasmQuiver, "RJWAnimations-orgasmQuiver"); Scribe_Values.Look(ref fastAnimForQuickie, "RJWAnimations-fastAnimForQuickie"); Scribe_Values.Look(ref rapeShiver, "RJWAnimations-rapeShiver"); - Scribe_Values.Look(ref hearts, "RJWAnimation-heartsOnLovin"); + Scribe_Values.Look(ref hearts, "RJWAnimation-sheartsOnLovin"); Scribe_Values.Look(ref PlayAnimForNonsexualActs, "RJWAnims-PlayAnimForNonsexualActs"); Scribe_Values.Look(ref applySemenOnAnimationOrgasm, "RJWAnimations-applySemenOnOrgasm", false); Scribe_Values.Look(ref soundOverride, "RJWAnimations-rjwAnimSoundOverride", true); diff --git a/1.5/Source/Utilities/AnimationUtility.cs b/1.5/Source/Utilities/AnimationUtility.cs index 71c785a..d06d203 100644 --- a/1.5/Source/Utilities/AnimationUtility.cs +++ b/1.5/Source/Utilities/AnimationUtility.cs @@ -21,42 +21,15 @@ namespace Rimworld_Animations { participants[1].Drawer.renderer.SetAnimation(AnimationDefOf.TestAnimation2); } - //startgroupanimator with anchor - //don't anchor to self if anchor is self - public static void StartGroupAnimation(List participants, GroupAnimationDef groupAnimationDef, int reorder, Thing anchor) - { - int seed = GenTicks.TicksGame; - - for (int i = 0; i < participants.Count; i++) - { - if (anchor is Pawn pawn && pawn == participants[i]) - { - - List allAnimationsForPawn = groupAnimationDef.GetAllAnimationsForActor(i, seed, reorder); - participants[i].TryGetComp().PlayGroupAnimation(allAnimationsForPawn); - } - else - { - //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); - - participants[i].TryGetComp().PlayGroupAnimation(allAnimationsForPawn, animatorAnchor); - } - } - } - - //startgroupanimation without anchor; just play where standing public static void StartGroupAnimation(List participants, GroupAnimationDef groupAnimationDef, int reorder) { - int seed = GenTicks.TicksGame; - - for (int i = 0; i < participants.Count; i++) + for(int i = 0; i < participants.Count; i++) { - List allAnimationsForPawn = groupAnimationDef.GetAllAnimationsForActor(i, seed, reorder); - participants[i].TryGetComp().PlayGroupAnimation(allAnimationsForPawn); + //todo: pass all animationstages to ExtendedAnimator, and queue animations + participants[i].Drawer.renderer.SetAnimation( + groupAnimationDef.animationStages[0] + .GetAnimations((i + reorder) % participants.Count, GenTicks.TicksGame)[0].Item2); } } @@ -65,13 +38,13 @@ namespace Rimworld_Animations { { foreach(Pawn pawn in participants) { - pawn.TryGetComp()?.StopAnimating(); + pawn.Drawer.renderer.SetAnimation(null); } } public static void StopGroupAnimation(Pawn participant) { - participant.TryGetComp()?.StopAnimating(); + participant?.Drawer?.renderer?.SetAnimation(null); } public static GroupAnimationDef FindGroupAnimation(List participants, out int reorder) @@ -82,6 +55,8 @@ namespace Rimworld_Animations { int reorder2 = 0; + Log.Message(DefDatabase.AllDefsListForReading[0].defName); + DefDatabase.AllDefsListForReading.TryRandomElement((GroupAnimationDef x) => x.canAnimationBeUsed(participants, out reorder2), out GroupAnimationDef result); diff --git a/Patch_SexToysMasturbation/1.5/Assemblies/Patch_SexToysMasturbation.dll b/Patch_SexToysMasturbation/1.5/Assemblies/Patch_SexToysMasturbation.dll index abfae70..e213401 100644 Binary files a/Patch_SexToysMasturbation/1.5/Assemblies/Patch_SexToysMasturbation.dll and b/Patch_SexToysMasturbation/1.5/Assemblies/Patch_SexToysMasturbation.dll differ diff --git a/Rimworld-Animations.csproj b/Rimworld-Animations.csproj index 2317000..cd6b26a 100644 --- a/Rimworld-Animations.csproj +++ b/Rimworld-Animations.csproj @@ -77,9 +77,6 @@ - - - @@ -117,7 +114,6 @@ -