diff --git a/1.5/Assemblies/0MultiplayerAPI.dll b/1.5/Assemblies/0MultiplayerAPI.dll
deleted file mode 100644
index 9648606..0000000
Binary files a/1.5/Assemblies/0MultiplayerAPI.dll and /dev/null differ
diff --git a/1.5/Assemblies/Rimworld-Animations.dll b/1.5/Assemblies/Rimworld-Animations.dll
index a394dd9..1297fac 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 81923af..06bdbd0 100644
--- a/1.5/Defs/AnimationDefs/TestAnimation2.xml
+++ b/1.5/Defs/AnimationDefs/TestAnimation2.xml
@@ -2,7 +2,7 @@
TestAnimation2
- 200
+ 50
False
False
@@ -13,27 +13,27 @@
Rimworld_Animations.AnimationWorker_KeyframesExtended
- (0, -1, 0)
+ (1, -1, 0)
0
- 23
+ 0
North
(0, -1, 0)
- 6
- -5
+ 20
+ 0
+ North
+
+
+ (-1, -1, 0)
+ 30
+ 0
North
(0, -1, 0)
- 12
- 4
- North
-
-
- (0, -1, 0)
- 188
- -1
+ 40
+ 0
North
@@ -51,16 +51,16 @@
6
- -5
+ 0
North
12
- 4
+ 0
North
- 128
+ 18
0
North
diff --git a/1.5/Defs/GroupAnimationDefs/TestGroupAnimation1.xml b/1.5/Defs/GroupAnimationDefs/TestGroupAnimation1.xml
index 701c56d..58c6dd2 100644
--- a/1.5/Defs/GroupAnimationDefs/TestGroupAnimation1.xml
+++ b/1.5/Defs/GroupAnimationDefs/TestGroupAnimation1.xml
@@ -4,13 +4,6 @@
TestGroupAnimation1
2
-
- 200
-
- TestAnimation1
- TestAnimation2
-
-
10
@@ -72,7 +65,7 @@
-->
-
+
@@ -89,6 +82,12 @@
+
diff --git a/1.5/Defs/OffsetDefs/OffsetDef_GroinToAppropriateHeight.xml b/1.5/Defs/OffsetDefs/OffsetDef_GroinToAppropriateHeight.xml
new file mode 100644
index 0000000..3fe9c46
--- /dev/null
+++ b/1.5/Defs/OffsetDefs/OffsetDef_GroinToAppropriateHeight.xml
@@ -0,0 +1,37 @@
+
+
+
+ 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)
+
+
+
+
diff --git a/1.5/Source/AnimationWorkers/AnimationWorker_KeyframesExtended.cs b/1.5/Source/AnimationWorkers/AnimationWorker_KeyframesExtended.cs
index 50af003..7546b67 100644
--- a/1.5/Source/AnimationWorkers/AnimationWorker_KeyframesExtended.cs
+++ b/1.5/Source/AnimationWorkers/AnimationWorker_KeyframesExtended.cs
@@ -15,6 +15,12 @@ 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
diff --git a/1.5/Source/Comps/CompExtendedAnimator.cs b/1.5/Source/Comps/CompExtendedAnimator.cs
index 17231e2..e1cb8cf 100644
--- a/1.5/Source/Comps/CompExtendedAnimator.cs
+++ b/1.5/Source/Comps/CompExtendedAnimator.cs
@@ -11,7 +11,121 @@ using Verse.Sound;
namespace Rimworld_Animations {
public class CompExtendedAnimator : ThingComp
{
- List> animationQueue;
+
+ // CompExtendedAnimator
+ // Helps manage AnimationQueue, AbsolutePosition
+
+ 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();
+ }
+
+ //ticks of current animation
+ private int animationTicks;
+
+ 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;
+ animationQueue = groupAnimation;
+ PlayNextAnimation();
+ }
+
+ public override void PostExposeData()
+ {
+ base.PostExposeData();
+ Scribe_Values.Look(ref this.isAnimating, "animations_isAnimating", false);
+
+ Scribe_Collections.Look(ref animationQueue, "animations_queue");
+ Scribe_Deep.Look(ref this.anchor, "animations_anchor");
+
+ }
+
+ private Pawn pawn => base.parent as Pawn;
}
diff --git a/1.5/Source/Comps/CompProperties_ExtendedAnimator.cs b/1.5/Source/Comps/CompProperties_ExtendedAnimator.cs
index c74848a..47fc1a5 100644
--- a/1.5/Source/Comps/CompProperties_ExtendedAnimator.cs
+++ b/1.5/Source/Comps/CompProperties_ExtendedAnimator.cs
@@ -12,6 +12,7 @@ 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
new file mode 100644
index 0000000..6116a8c
--- /dev/null
+++ b/1.5/Source/Comps/ExtendedAnimatorAnchor/BaseExtendedAnimatorAnchor.cs
@@ -0,0 +1,23 @@
+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
new file mode 100644
index 0000000..8b61405
--- /dev/null
+++ b/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Thing.cs
@@ -0,0 +1,34 @@
+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
new file mode 100644
index 0000000..ffb84ab
--- /dev/null
+++ b/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Vector3.cs
@@ -0,0 +1,33 @@
+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 f5ee3dc..d62b348 100644
--- a/1.5/Source/GroupAnimations/GroupAnimationContexts/BaseGroupAnimationContext.cs
+++ b/1.5/Source/GroupAnimations/GroupAnimationContexts/BaseGroupAnimationContext.cs
@@ -11,6 +11,7 @@ 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 7c2033e..a0bb3be 100644
--- a/1.5/Source/GroupAnimations/GroupAnimationContexts/GroupAnimationContext_RJWSex.cs
+++ b/1.5/Source/GroupAnimations/GroupAnimationContexts/GroupAnimationContext_RJWSex.cs
@@ -17,7 +17,6 @@ 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;
@@ -25,5 +24,11 @@ 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 36eb64a..c54984f 100644
--- a/1.5/Source/GroupAnimations/GroupAnimationDef.cs
+++ b/1.5/Source/GroupAnimations/GroupAnimationDef.cs
@@ -16,6 +16,11 @@ 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)
{
@@ -28,5 +33,20 @@ 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 58e86ab..b212183 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 actor, int seed);
+ public abstract List GetAnimations(int actorNumber, int seed);
}
}
diff --git a/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_Branch.cs b/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_Branch.cs
index 889b06e..a187270 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 actor, int seed)
+ public override List GetAnimations(int actorNumber, int seed)
{
- return paths[(seed * 59) % paths.Count].GetAnimations(actor, seed);
+ return paths[(seed * 59) % paths.Count].GetAnimations(actorNumber, seed);
}
}
}
diff --git a/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_LoopRandomSelectChance.cs b/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_LoopRandomSelectChance.cs
index a6fa374..09cbc9c 100644
--- a/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_LoopRandomSelectChance.cs
+++ b/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_LoopRandomSelectChance.cs
@@ -12,48 +12,50 @@ namespace Rimworld_Animations
public int loops;
public List loopOptions;
- public override List> GetAnimations(int actor, int seed)
+ public override List GetAnimations(int actorNumber, 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, out int longestAnimLength);
- Tuple animation = Tuple.Create(longestAnimLength, option.animationDefs[actor]);
- animations.Append(animation);
+ AnimationLoopOption option = getAnimationLoopOptionByWeight(seed + i);
+ animations.Add(option.animationDefs[actorNumber]);
}
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
- public AnimationLoopOption getAnimationLoopOptionByWeight(int seed, out int longestAnimLength)
+ private AnimationLoopOption getAnimationLoopOptionByWeight(int seed)
{
int totalWeight = loopOptions.Sum(x => x.probability);
- int randomNumber = (seed * 56) % totalWeight;
+ int randomNumber = ((seed * 59) % totalWeight) + 1;
int cumulativeWeight = 0;
- foreach(AnimationLoopOption option in loopOptions) {
- cumulativeWeight += option.probability;
+ 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
+
if (randomNumber <= cumulativeWeight)
{
- longestAnimLength = option.animationDefs.Max(x => x.durationTicks);
- return option;
+ return loopOptions[i];
}
}
- longestAnimLength = loopOptions[0].animationDefs.Max(x => x.durationTicks);
- return loopOptions[0];
+ //default
+ return loopOptions.Last();
}
+ }
-
+ 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 e502596..cd63ecf 100644
--- a/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_TicksDuration.cs
+++ b/1.5/Source/GroupAnimations/GroupAnimationStages/AnimationStage_TicksDuration.cs
@@ -7,14 +7,17 @@ using Verse;
namespace Rimworld_Animations
{
+ /* don't use? just use looprandomselect once
public class AnimationStage_TicksDuration : AnimationStage
{
- int ticks;
- List animationDefs;
+ public int ticks;
+ public 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 830ac41..8980cec 100644
--- a/1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs
+++ b/1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs
@@ -42,10 +42,9 @@ 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);
+ AnimationUtility.StartGroupAnimation(participants, groupAnimation, reorder, partner);
}
diff --git a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNode.cs b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNode.cs
index c7cff4f..d482853 100644
--- a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNode.cs
+++ b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderNode.cs
@@ -18,26 +18,28 @@ namespace Rimworld_Animations
{
if (__instance.AnimationWorker is AnimationWorker_KeyframesExtended extendedAnimWorker)
{
- //INVIS IF ANIM CALLS FOR IT
- //replace maybe?
- if (!extendedAnimWorker.visibleAtTick(__instance.tree.AnimationTick))
- {
- __instance.requestRecache = true;
- return false;
- }
-
- // HEAD ROTATION ADJUST FACING get rotated textures
+ // ADJUST FACING get rotated textures
+ // compare the previous tick to the current tick; if the current tick rotation is different, recache
Rot4 animFacing = extendedAnimWorker.facingAtTick(__instance.tree.AnimationTick);
- if (parms.facing != animFacing)
+ if (extendedAnimWorker.facingAtTick(__instance.tree.AnimationTick - 1) != extendedAnimWorker.facingAtTick(__instance.tree.AnimationTick))
{
- //requestRecache or else it won't update properly
__instance.requestRecache = true;
parms.facing = animFacing;
}
+ //INVIS IF ANIM CALLS FOR IT
+ //replace maybe?
+
+ //cheaper call now comparing prev tick to cur tick
+ if (extendedAnimWorker.visibleAtTick(__instance.tree.AnimationTick - 1) != extendedAnimWorker.visibleAtTick(__instance.tree.AnimationTick))
+ {
+ __instance.requestRecache = true;
+ return extendedAnimWorker.visibleAtTick(__instance.tree.AnimationTick);
+ }
+
}
return true;
diff --git a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderTree.cs b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderTree.cs
index edc16af..6acbe35 100644
--- a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderTree.cs
+++ b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderTree.cs
@@ -28,6 +28,7 @@ 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);
}
}
diff --git a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTracker.cs b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTracker.cs
index 65b34e9..8b467e1 100644
--- a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTracker.cs
+++ b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTracker.cs
@@ -9,23 +9,18 @@ namespace Rimworld_Animations {
public static class HarmonyPatch_Pawn_DrawTracker {
public static bool Prefix(ref Pawn ___pawn, ref Vector3 __result) {
- // If animating and is sexbaseinitiator jobdriver,
- if (___pawn?.Drawer?.renderer?.renderTree?.rootNode?.AnimationWorker is AnimationWorker_KeyframesExtended
- && ___pawn.jobs?.curDriver is JobDriver_SexBaseInitiator sexdriver)
+
+ CompExtendedAnimator animator = ___pawn.TryGetComp();
+
+ //align pos on top of partner, position, etc., based on animatoranchor
+ if (animator != null && animator.IsAnchored)
{
-
- //align pos on top of partner
- if (sexdriver?.Partner?.Drawer?.DrawPos != null)
- __result = sexdriver.Partner.Drawer.DrawPos;
-
-
+ __result = animator.getAnchor();
return false;
-
}
return true;
-
}
}
}
diff --git a/1.5/Source/Settings/AnimationSettings.cs b/1.5/Source/Settings/AnimationSettings.cs
index 0a96621..f320fa2 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-sheartsOnLovin");
+ Scribe_Values.Look(ref hearts, "RJWAnimation-heartsOnLovin");
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 d06d203..71c785a 100644
--- a/1.5/Source/Utilities/AnimationUtility.cs
+++ b/1.5/Source/Utilities/AnimationUtility.cs
@@ -21,15 +21,42 @@ 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)
{
- for(int i = 0; i < participants.Count; i++)
+ int seed = GenTicks.TicksGame;
+
+ for (int i = 0; i < participants.Count; i++)
{
- //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);
+ List allAnimationsForPawn = groupAnimationDef.GetAllAnimationsForActor(i, seed, reorder);
+ participants[i].TryGetComp().PlayGroupAnimation(allAnimationsForPawn);
}
}
@@ -38,13 +65,13 @@ namespace Rimworld_Animations {
{
foreach(Pawn pawn in participants)
{
- pawn.Drawer.renderer.SetAnimation(null);
+ pawn.TryGetComp()?.StopAnimating();
}
}
public static void StopGroupAnimation(Pawn participant)
{
- participant?.Drawer?.renderer?.SetAnimation(null);
+ participant.TryGetComp()?.StopAnimating();
}
public static GroupAnimationDef FindGroupAnimation(List participants, out int reorder)
@@ -55,8 +82,6 @@ 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 e213401..abfae70 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 cd6b26a..2317000 100644
--- a/Rimworld-Animations.csproj
+++ b/Rimworld-Animations.csproj
@@ -77,6 +77,9 @@
+
+
+
@@ -114,6 +117,7 @@
+