diff --git a/1.2/Assemblies/Rimworld-Animations.dll b/1.2/Assemblies/Rimworld-Animations.dll
index 74aa6bf..57d6c2f 100644
Binary files a/1.2/Assemblies/Rimworld-Animations.dll and b/1.2/Assemblies/Rimworld-Animations.dll differ
diff --git a/About/About.xml b/About/About.xml
index 63b1b3c..ffe7733 100644
--- a/About/About.xml
+++ b/About/About.xml
@@ -6,7 +6,7 @@
https://gitgud.io/c0ffeeeeeeee/rimworld-animations
1.1
- 1.2
+ 1.2
c0ffee.rimworld.animations
@@ -31,7 +31,7 @@
UnlimitedHugs.HugsLib
brrainz.harmony
- rim.job.world
+ rim.job.world
Rimworld Animations! Hurray!
diff --git a/About/Manifest.xml b/About/Manifest.xml
index 8950b18..0c08d6f 100644
--- a/About/Manifest.xml
+++ b/About/Manifest.xml
@@ -1,5 +1,5 @@
Rimworld-Animations
- 1.1.2
+ 1.1.3
\ No newline at end of file
diff --git a/Source/Comps/CompBodyAnimator.cs b/Source/Comps/CompBodyAnimator.cs
index a234e38..b5fcfc9 100644
--- a/Source/Comps/CompBodyAnimator.cs
+++ b/Source/Comps/CompBodyAnimator.cs
@@ -15,7 +15,7 @@ namespace Rimworld_Animations {
{
public Pawn pawn => base.parent as Pawn;
public PawnGraphicSet Graphics;
-
+
//public CompProperties_BodyAnimator Props => (CompProperties_BodyAnimator)(object)base.props;
public bool isAnimating {
@@ -25,7 +25,7 @@ namespace Rimworld_Animations {
set {
Animating = value;
- if(value == true) {
+ if (value == true) {
SexUtility.DrawNude(pawn);
} else {
pawn.Drawer.renderer.graphics.ResolveAllGraphics();
@@ -54,7 +54,13 @@ namespace Rimworld_Animations {
public bool controlGenitalAngle = false;
private AnimationDef anim;
- private AnimationStage stage => anim.animationStages[curStage];
+ private AnimationStage stage {
+ get
+ {
+ return anim.animationStages[curStage];
+ }
+
+ }
private PawnAnimationClip clip => (PawnAnimationClip)stage.animationClips[actor];
public bool Mirror {
@@ -144,9 +150,16 @@ namespace Rimworld_Animations {
this.actor = actor;
this.anim = anim;
this.mirror = mirror;
-
- curStage = fastAnimForQuickie ? 1 : 0;
- animTicks = 0;
+ if(fastAnimForQuickie)
+ {
+ curStage = 1;
+ animTicks = anim.animationStages[0].playTimeTicks;
+ } else
+ {
+ curStage = 0;
+ animTicks = 0;
+ }
+
stageTicks = 0;
clipTicks = 0;
@@ -222,6 +235,13 @@ namespace Rimworld_Animations {
public void tickStage()
{
+
+ if(stage == null)
+ {
+ isAnimating = false;
+ return;
+ }
+
stageTicks++;
if(stageTicks >= stage.playTimeTicks) {
@@ -321,9 +341,11 @@ namespace Rimworld_Animations {
deltaPos = new Vector3(clip.BodyOffsetX.Evaluate(clipPercent) * (mirror ? -1 : 1), clip.layer.AltitudeFor(), clip.BodyOffsetZ.Evaluate(clipPercent));
- if (AnimationSettings.offsets != null && AnimationSettings.offsets.ContainsKey(CurrentAnimation.defName + pawn.def.defName + ActorIndex)) {
- deltaPos.x += AnimationSettings.offsets[CurrentAnimation.defName + pawn.def.defName + ActorIndex].x * (mirror ? -1 : 1);
- deltaPos.z += AnimationSettings.offsets[CurrentAnimation.defName + pawn.def.defName + ActorIndex].y;
+ string bodyTypeDef = (pawn.story?.bodyType != null) ? pawn.story.bodyType.ToString() : "";
+
+ if (AnimationSettings.offsets != null && AnimationSettings.offsets.ContainsKey(CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex)) {
+ deltaPos.x += AnimationSettings.offsets[CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex].x * (mirror ? -1 : 1);
+ deltaPos.z += AnimationSettings.offsets[CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex].y;
}
@@ -334,8 +356,8 @@ namespace Rimworld_Animations {
genitalAngle = clip.GenitalAngle.Evaluate(clipPercent) * (mirror ? -1 : 1);
}
- if (AnimationSettings.rotation != null && AnimationSettings.rotation.ContainsKey(CurrentAnimation.defName + pawn.def.defName + ActorIndex)) {
- float offsetRotation = AnimationSettings.rotation[CurrentAnimation.defName + pawn.def.defName + ActorIndex] * (Mirror ? -1 : 1);
+ if (AnimationSettings.rotation != null && AnimationSettings.rotation.ContainsKey(CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex)) {
+ float offsetRotation = AnimationSettings.rotation[CurrentAnimation.defName + pawn.def.defName + bodyTypeDef + ActorIndex] * (Mirror ? -1 : 1);
genitalAngle += offsetRotation;
bodyAngle += offsetRotation;
headAngle += offsetRotation;
diff --git a/Source/MainTabWindows/MainTabWindow_OffsetConfigure.cs b/Source/MainTabWindows/MainTabWindow_OffsetConfigure.cs
index c7f0875..45c645d 100644
--- a/Source/MainTabWindows/MainTabWindow_OffsetConfigure.cs
+++ b/Source/MainTabWindows/MainTabWindow_OffsetConfigure.cs
@@ -35,21 +35,23 @@ namespace Rimworld_Animations {
int ActorIndex = curPawn.TryGetComp().ActorIndex;
float offsetX = 0, offsetZ = 0, rotation = 0;
- if (AnimationSettings.offsets.ContainsKey(def.defName + curPawn.def.defName + ActorIndex)) {
- offsetX = AnimationSettings.offsets[def.defName + curPawn.def.defName + ActorIndex].x;
- offsetZ = AnimationSettings.offsets[def.defName + curPawn.def.defName + ActorIndex].y;
+ string bodyTypeDef = (curPawn.story?.bodyType != null) ? curPawn.story.bodyType.ToString() : "";
+
+ if (AnimationSettings.offsets.ContainsKey(def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex)) {
+ offsetX = AnimationSettings.offsets[def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex].x;
+ offsetZ = AnimationSettings.offsets[def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex].y;
} else {
- AnimationSettings.offsets.Add(def.defName + curPawn.def.defName + ActorIndex, new Vector2(0, 0));
+ AnimationSettings.offsets.Add(def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex, new Vector2(0, 0));
}
- if (AnimationSettings.rotation.ContainsKey(def.defName + curPawn.def.defName + ActorIndex)) {
- rotation = AnimationSettings.rotation[def.defName + curPawn.def.defName + ActorIndex];
+ if (AnimationSettings.rotation.ContainsKey(def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex)) {
+ rotation = AnimationSettings.rotation[def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex];
}
else {
- AnimationSettings.rotation.Add(def.defName + curPawn.def.defName + ActorIndex, 0);
+ AnimationSettings.rotation.Add(def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex, 0);
}
- listingStandard.Label("Name: " + curPawn.Name + " Race: " + curPawn.def.defName + " Actor Index: " + curPawn.TryGetComp().ActorIndex + " Animation: " + def.label + (curPawn.TryGetComp().Mirror ? " mirrored" : ""));
+ listingStandard.Label("Name: " + curPawn.Name + " Race: " + curPawn.def.defName + " Actor Index: " + curPawn.TryGetComp().ActorIndex + " Body Type (if any): " + bodyTypeDef + " Animation: " + def.label + (curPawn.TryGetComp().Mirror ? " mirrored" : ""));
if(curPawn.def.defName == "Human") {
listingStandard.Label("Warning--You generally don't want to change human offsets, only alien offsets");
@@ -96,13 +98,15 @@ namespace Rimworld_Animations {
}
- if (offsetX != AnimationSettings.offsets[def.defName + curPawn.def.defName + ActorIndex].x || offsetZ != AnimationSettings.offsets[def.defName + curPawn.def.defName + ActorIndex].y) {
- AnimationSettings.offsets[def.defName + curPawn.def.defName + ActorIndex] = new Vector2(offsetX, offsetZ);
+
+
+ if (offsetX != AnimationSettings.offsets[def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex].x || offsetZ != AnimationSettings.offsets[def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex].y) {
+ AnimationSettings.offsets[def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex] = new Vector2(offsetX, offsetZ);
}
- if(rotation != AnimationSettings.rotation[def.defName + curPawn.def.defName + ActorIndex]) {
- AnimationSettings.rotation[def.defName + curPawn.def.defName + ActorIndex] = rotation;
+ if(rotation != AnimationSettings.rotation[def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex]) {
+ AnimationSettings.rotation[def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex] = rotation;
}
}
diff --git a/Source/Patches/rjwPatches/HarmonyPatch_JobDriver_SexBaseInitiator.cs b/Source/Patches/rjwPatches/HarmonyPatch_JobDriver_SexBaseInitiator.cs
index 0665e56..8a38ca1 100644
--- a/Source/Patches/rjwPatches/HarmonyPatch_JobDriver_SexBaseInitiator.cs
+++ b/Source/Patches/rjwPatches/HarmonyPatch_JobDriver_SexBaseInitiator.cs
@@ -121,12 +121,13 @@ namespace Rimworld_Animations {
bool shiver = pawnsToAnimate[i].jobs.curDriver is JobDriver_SexBaseRecieverRaped;
pawnsToAnimate[i].TryGetComp().StartAnimation(anim, pawnsToAnimate, i, mirror, shiver, fastAnimForQuickie);
- (pawnsToAnimate[i].jobs.curDriver as JobDriver_Sex).ticks_left = anim.animationTimeTicks;
- (pawnsToAnimate[i].jobs.curDriver as JobDriver_Sex).sex_ticks = anim.animationTimeTicks;
- (pawnsToAnimate[i].jobs.curDriver as JobDriver_Sex).duration = anim.animationTimeTicks;
+ int animTicks = anim.animationTimeTicks - (fastAnimForQuickie ? anim.animationStages[0].playTimeTicks : 0);
+ (pawnsToAnimate[i].jobs.curDriver as JobDriver_Sex).ticks_left = animTicks;
+ (pawnsToAnimate[i].jobs.curDriver as JobDriver_Sex).sex_ticks = animTicks;
+ (pawnsToAnimate[i].jobs.curDriver as JobDriver_Sex).duration = animTicks;
- AnimationTimeTicks = anim.animationTimeTicks;
+ AnimationTimeTicks = animTicks;
if(!AnimationSettings.hearts) {
(pawnsToAnimate[i].jobs.curDriver as JobDriver_Sex).ticks_between_hearts = Int32.MaxValue;