diff --git a/1.5/Assemblies/RJW.dll b/1.5/Assemblies/RJW.dll
deleted file mode 100644
index c1b1980..0000000
Binary files a/1.5/Assemblies/RJW.dll and /dev/null differ
diff --git a/1.5/Assemblies/Rimworld-Animations.dll b/1.5/Assemblies/Rimworld-Animations.dll
index 9f4b569..292a905 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 04fb662..8125f0c 100644
--- a/1.5/Defs/AnimationDefs/TestAnimation2.xml
+++ b/1.5/Defs/AnimationDefs/TestAnimation2.xml
@@ -13,25 +13,25 @@
Rimworld_Animations.AnimationWorker_KeyframesExtended
- (1, -1, 0)
+ (1, 0, 0)
0
0
North
- (0, -1, 0)
+ (0, 0, 0)
30
15
North
- (-1, -1, 0)
+ (-1, 0, 0)
60
0
North
- (0, -1, 0)
+ (0, 0, 0)
90
-15
North
diff --git a/1.5/Defs/GroupAnimationDefs/TestGroupAnimation1.xml b/1.5/Defs/GroupAnimationDefs/TestGroupAnimation1.xml
index 1f68f3d..6be826f 100644
--- a/1.5/Defs/GroupAnimationDefs/TestGroupAnimation1.xml
+++ b/1.5/Defs/GroupAnimationDefs/TestGroupAnimation1.xml
@@ -3,7 +3,6 @@
TestGroupAnimation1
2
- True
10
diff --git a/1.5/Defs/OffsetDefs/OffsetDef_GroinToAppropriateHeight.xml b/1.5/Defs/OffsetDefs/OffsetDef_GroinToAppropriateHeight.xml
index 6566375..544eb4d 100644
--- a/1.5/Defs/OffsetDefs/OffsetDef_GroinToAppropriateHeight.xml
+++ b/1.5/Defs/OffsetDefs/OffsetDef_GroinToAppropriateHeight.xml
@@ -3,11 +3,12 @@
GroinToAppropriateHeight
-
+
Alien_Orassan
(0, 0, 5)
+ 90
@@ -15,7 +16,7 @@
Human
- Hulk(0, 0, 0.5)
+ Hulk(0, 0, 0.5)90
Thin(0, 0, 0.3)
Female(0, 0, 0.4)
diff --git a/1.5/Source/Animations/AnimationOffsets/AnimationOffsetDef.cs b/1.5/Source/Animations/AnimationOffsets/AnimationOffsetDef.cs
index a939d66..03cdc8d 100644
--- a/1.5/Source/Animations/AnimationOffsets/AnimationOffsetDef.cs
+++ b/1.5/Source/Animations/AnimationOffsets/AnimationOffsetDef.cs
@@ -13,21 +13,20 @@ namespace Rimworld_Animations
public List offsets;
- public Vector3 FindOffset(Pawn pawn)
+ public bool FindOffset(Pawn pawn, out BaseAnimationOffset offset)
{
foreach (BaseAnimationOffset animOffset in offsets)
{
if (animOffset.appliesToPawn(pawn)) {
- Vector3? offset = animOffset.getOffset(pawn);
- return (offset == null ? Vector3.zero : (Vector3)offset);
+ offset = animOffset;
+ return true;
}
}
- return Vector3.zero;
+ offset = null;
+ return false;
}
-
-
}
}
diff --git a/1.5/Source/Animations/AnimationOffsets/Offsets/AnimationOffset_BodyType.cs b/1.5/Source/Animations/AnimationOffsets/Offsets/AnimationOffset_BodyType.cs
index 3ea9f74..3777af7 100644
--- a/1.5/Source/Animations/AnimationOffsets/Offsets/AnimationOffset_BodyType.cs
+++ b/1.5/Source/Animations/AnimationOffsets/Offsets/AnimationOffset_BodyType.cs
@@ -18,6 +18,11 @@ namespace Rimworld_Animations
{
return offsets.Find(x => x.bodyType == pawn.story.bodyType)?.offset;
}
+
+ public override int? getRotation(Pawn pawn)
+ {
+ return offsets.Find(x => x.bodyType == pawn.story.bodyType)?.rotation;
+ }
}
}
diff --git a/1.5/Source/Animations/AnimationOffsets/Offsets/AnimationOffset_BodyTypeGendered.cs b/1.5/Source/Animations/AnimationOffsets/Offsets/AnimationOffset_BodyTypeGendered.cs
index 3809af2..f6d44a3 100644
--- a/1.5/Source/Animations/AnimationOffsets/Offsets/AnimationOffset_BodyTypeGendered.cs
+++ b/1.5/Source/Animations/AnimationOffsets/Offsets/AnimationOffset_BodyTypeGendered.cs
@@ -26,5 +26,19 @@ namespace Rimworld_Animations
}
}
+
+ public override int? getRotation(Pawn pawn)
+ {
+
+ if (pawn.gender == Gender.Female)
+ {
+ return offsetsFemale.Find(x => x.bodyType == pawn.story.bodyType)?.rotation;
+ }
+ else
+ {
+ return offsetsMale.Find(x => x.bodyType == pawn.story.bodyType)?.rotation;
+ }
+
+ }
}
}
diff --git a/1.5/Source/Animations/AnimationOffsets/Offsets/AnimationOffset_Single.cs b/1.5/Source/Animations/AnimationOffsets/Offsets/AnimationOffset_Single.cs
index 7ea3135..2744039 100644
--- a/1.5/Source/Animations/AnimationOffsets/Offsets/AnimationOffset_Single.cs
+++ b/1.5/Source/Animations/AnimationOffsets/Offsets/AnimationOffset_Single.cs
@@ -12,10 +12,16 @@ namespace Rimworld_Animations
{
public Vector3 offset;
+ public int? rotation;
public override Vector3? getOffset(Pawn pawn)
{
return offset;
}
+
+ public override int? getRotation(Pawn pawn)
+ {
+ return rotation;
+ }
}
}
diff --git a/1.5/Source/Animations/AnimationOffsets/Offsets/BaseAnimationOffset.cs b/1.5/Source/Animations/AnimationOffsets/Offsets/BaseAnimationOffset.cs
index d0ccd19..57bab15 100644
--- a/1.5/Source/Animations/AnimationOffsets/Offsets/BaseAnimationOffset.cs
+++ b/1.5/Source/Animations/AnimationOffsets/Offsets/BaseAnimationOffset.cs
@@ -15,6 +15,8 @@ namespace Rimworld_Animations
public abstract Vector3? getOffset(Pawn pawn);
+ public abstract int? getRotation(Pawn pawn);
+
public bool appliesToPawn(Pawn pawn)
{
return races.Contains(pawn.def);
diff --git a/1.5/Source/Animations/AnimationOffsets/Offsets/BodyTypeOffset.cs b/1.5/Source/Animations/AnimationOffsets/Offsets/BodyTypeOffset.cs
index 92e7b71..df35501 100644
--- a/1.5/Source/Animations/AnimationOffsets/Offsets/BodyTypeOffset.cs
+++ b/1.5/Source/Animations/AnimationOffsets/Offsets/BodyTypeOffset.cs
@@ -12,6 +12,7 @@ namespace Rimworld_Animations
public class BodyTypeOffset
{
public BodyTypeDef bodyType;
+ public int rotation = 0;
public Vector3 offset;
}
}
diff --git a/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs b/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs
index c9cc5e0..da77e49 100644
--- a/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs
+++ b/1.5/Source/Animations/GroupAnimations/GroupAnimationDef.cs
@@ -18,7 +18,7 @@ namespace Rimworld_Animations
public bool canAnimationBeUsed(List actors, out int reorder)
{
- if (AnimationSettings.debugMode)
+ if (RJWAnimationSettings.debugMode)
{
Log.Message("[anims] Checking if " + defName + " is valid animation");
}
@@ -51,12 +51,23 @@ namespace Rimworld_Animations
return animations;
}
- public Vector3? GetOffset(int actor, Pawn pawn, int reorder = 0)
+ public bool GetOffset(int actor, Pawn pawn, out Vector3? position, out int? rotation, int reorder = 0)
{
+
+ position = null;
+ rotation = null;
+
//element at or default to stop errors
- if (offsetDefs == null) return null;
- if ((actor + reorder) % numActors >= offsetDefs.Count) return null;
- return offsetDefs[(actor + reorder) % numActors].FindOffset(pawn);
+ if (offsetDefs == null) return false;
+ if ((actor + reorder) % numActors >= offsetDefs.Count) return false;
+ if (offsetDefs[(actor + reorder) % numActors].FindOffset(pawn, out BaseAnimationOffset animationOffset))
+ {
+ position = animationOffset.getOffset(pawn);
+ rotation = animationOffset.getRotation(pawn);
+ return true;
+ }
+
+ return false;
}
}
}
diff --git a/1.5/Source/Comps/CompExtendedAnimator.cs b/1.5/Source/Comps/CompExtendedAnimator.cs
index 442a0fb..a7c6973 100644
--- a/1.5/Source/Comps/CompExtendedAnimator.cs
+++ b/1.5/Source/Comps/CompExtendedAnimator.cs
@@ -19,6 +19,7 @@ namespace Rimworld_Animations {
private List animationQueue;
private BaseExtendedAnimatorAnchor anchor;
+ private int? rotation;
private Vector3? offset;
private bool isAnimating = false;
@@ -51,6 +52,18 @@ namespace Rimworld_Animations {
}
}
+ public int? Rotation
+ {
+ get
+ {
+ return rotation;
+ }
+ set
+ {
+ this.rotation = value;
+ }
+ }
+
public int AnimationLength
{
get
@@ -68,6 +81,15 @@ namespace Rimworld_Animations {
}
}
+ public AnimationDef CurrentAnimation {
+
+ get
+ {
+ return IsAnimating ? animationQueue[0] : null;
+ }
+
+ }
+
public Vector3 getAnchor()
{
return anchor.getDrawPos();
@@ -135,17 +157,18 @@ namespace Rimworld_Animations {
pawn.Drawer.renderer.SetAnimation(null);
}
- public void PlayGroupAnimation(List groupAnimation, Vector3? offset)
+ public void PlayGroupAnimation(List groupAnimation, Vector3? positionOffset, int? rotationOffset)
{
- this.Offset = offset;
+ this.Offset = positionOffset;
+ this.Rotation = rotationOffset;
animationQueue = groupAnimation;
PlayNextAnimation();
}
- public void PlayGroupAnimation(List groupAnimation, Vector3? offset, BaseExtendedAnimatorAnchor anchor)
+ public void PlayGroupAnimation(List groupAnimation, Vector3? positionOffset, int? rotationOffset, BaseExtendedAnimatorAnchor anchor)
{
this.anchor = anchor;
- PlayGroupAnimation(groupAnimation, offset);
+ PlayGroupAnimation(groupAnimation, positionOffset, rotationOffset);
}
public override void PostExposeData()
diff --git a/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Thing.cs b/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Thing.cs
index 8b61405..4331046 100644
--- a/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Thing.cs
+++ b/1.5/Source/Comps/ExtendedAnimatorAnchor/ExtendedAnimatorAnchor_Thing.cs
@@ -22,6 +22,7 @@ namespace Rimworld_Animations
public override Vector3 getDrawPos()
{
+ //vector3.up means stand above the thing
return thing.DrawPos;
}
diff --git a/1.5/Source/MainTabWindows/MainTabWindow_OffsetConfigure.cs b/1.5/Source/MainTabWindows/MainTabWindow_OffsetConfigure.cs
index 45784d0..18ba6d6 100644
--- a/1.5/Source/MainTabWindows/MainTabWindow_OffsetConfigure.cs
+++ b/1.5/Source/MainTabWindows/MainTabWindow_OffsetConfigure.cs
@@ -2,12 +2,13 @@
using Verse;
using RimWorld;
using UnityEngine;
+using System.Windows;
namespace Rimworld_Animations {
class MainTabWindow_OffsetConfigure : MainTabWindow
{
- public override Vector2 RequestedTabSize => new Vector2(505, 380);
+ public override Vector2 RequestedTabSize => new Vector2(505, 500);
public override void DoWindowContents(Rect inRect) {
Rect position = new Rect(inRect.x, inRect.y, inRect.width, inRect.height);
@@ -16,121 +17,167 @@ namespace Rimworld_Animations {
Listing_Standard listingStandard = new Listing_Standard();
listingStandard.Begin(position);
- listingStandard.Label("Animation Manager");
+ listingStandard.Label("RimAnims_AnimManager".Translate());
listingStandard.GapLine();
- /*
- if (Find.Selector.SingleSelectedThing is Pawn curPawn) {
- if (CompBodyAnimator.IsAnimating(curPawn)) {
+ if (Find.Selector.SingleSelectedThing is Pawn curPawn
+ && curPawn.TryGetComp(out CompExtendedAnimator extendedAnimator)
+ && extendedAnimator.IsAnimating)
+ {
+ //Pawn info about their body, race
+ Vector3 offsetPosition = extendedAnimator.Offset != null ? (Vector3)extendedAnimator.Offset : Vector3.zero;
+ int offsetRotation = extendedAnimator.Rotation != null ? (int)extendedAnimator.Rotation : 0;
- CompBodyAnimator compBodyAnimator = curPawn.TryGetComp();
- AnimationDef def = compBodyAnimator.CurrentAnimation;
- int ActorIndex = compBodyAnimator.ActorIndex;
- float offsetX = 0, offsetZ = 0, rotation = 0;
+ string pawnDef = curPawn.def.defName;
+ string bodyTypeDef = (curPawn.story?.bodyType != null) ? curPawn.story.bodyType.ToString() : "None";
+ string genderDef = curPawn.gender.ToString();
+ string currentAnimation = extendedAnimator.CurrentAnimation != null ? extendedAnimator.CurrentAnimation.defName : "None";
- string bodyTypeDef = (curPawn.story?.bodyType != null) ? curPawn.story.bodyType.ToString() : "";
+ listingStandard.Label(curPawn.Name + ": " + curPawn.def.defName + ", " + bodyTypeDef + ", " + genderDef + ", Animation: " + currentAnimation);
- 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 + bodyTypeDef + ActorIndex, new Vector2(0, 0));
- }
+ if (curPawn.def.defName == "Human")
+ {
+ listingStandard.Label("RimAnims_Warning".Translate());
+ }
- 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 + bodyTypeDef + ActorIndex, 0);
- }
+ float posX = offsetPosition.x, posY = offsetPosition.y, posZ = offsetPosition.z;
+ int rot = offsetRotation;
- 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" : ""));
+ float.TryParse(listingStandard.TextEntryLabeled("X: ", posX.ToString()), out posX);
+ posX = listingStandard.Slider(posX, -2, 2);
- if(curPawn.def.defName == "Human") {
- listingStandard.Label("Warning--You generally don't want to change human offsets, only alien offsets");
- }
+ float.TryParse(listingStandard.TextEntryLabeled("Y: ", offsetPosition.y.ToString()), out posY);
+ posY = listingStandard.Slider(posY, -2, 2);
- float.TryParse(listingStandard.TextEntryLabeled("X Offset: ", offsetX.ToString()), out offsetX);
- offsetX = listingStandard.Slider(offsetX, -2, 2);
+ float.TryParse(listingStandard.TextEntryLabeled("Z: ", posZ.ToString()), out posZ);
+ posZ = listingStandard.Slider(posZ, -2, 2);
- float.TryParse(listingStandard.TextEntryLabeled("Z Offset: ", offsetZ.ToString()), out offsetZ);
- offsetZ = listingStandard.Slider(offsetZ, -2, 2);
+ int.TryParse(listingStandard.TextEntryLabeled("Rotation: ", rot.ToString()), out rot);
+ rot = (int)listingStandard.Slider(rot, -180, 180);
- float.TryParse(listingStandard.TextEntryLabeled("Rotation: ", rotation.ToString()), out rotation);
- rotation = listingStandard.Slider(rotation, -180, 180);
+ listingStandard.GapLine();
+ Vector3 newOffsetVector = new Vector3(posX, posY, posZ);
- if(listingStandard.ButtonText("Reset All")) {
- offsetX = 0;
- offsetZ = 0;
- rotation = 0;
- }
+ string offset = "";
+ offset += bodyTypeDef != "None" ? "" + bodyTypeDef + "" : "";
+ offset += newOffsetVector != Vector3.zero ? "(" + posX + ", " + posY + ", " + posZ + ")" : "";
+ offset += rot != 0 ? "" + rot + "" : "";
+ offset += "";
- listingStandard.GapLine();
+ listingStandard.Label("Appropriate Offset value for " + currentAnimation + ", " + pawnDef + ", " + bodyTypeDef + ", " + genderDef + ": ");
+ listingStandard.Label(offset);
- if(listingStandard.ButtonText("Shift Actors")) {
-
- if(AnimationSettings.debugMode) {
- Log.Message("Shifting actors in animation...");
- }
+ if (listingStandard.ButtonText("RimAnims_CopyToClipboard".Translate()))
+ {
- for(int i = 0; i < curPawn.TryGetComp().actorsInCurrentAnimation.Count; i++) {
-
- Pawn actor = curPawn.TryGetComp().actorsInCurrentAnimation[i];
-
- actor.TryGetComp()?.shiftActorPositionAndRestartAnimation();
-
- //reset the clock time of every pawn in animation
- if(actor.jobs.curDriver is rjw.JobDriver_Sex) {
- (actor.jobs.curDriver as rjw.JobDriver_Sex).ticks_left = def.animationTimeTicks;
- (actor.jobs.curDriver as rjw.JobDriver_Sex).ticksLeftThisToil = def.animationTimeTicks;
- (actor.jobs.curDriver as rjw.JobDriver_Sex).duration = def.animationTimeTicks;
- }
-
- }
-
- }
-
- 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 + bodyTypeDef + ActorIndex]) {
- AnimationSettings.rotation[def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex] = rotation;
- }
+ GUIUtility.systemCopyBuffer = offset;
}
+ listingStandard.Label("RimAnims_ShareSettings".Translate());
+
+ extendedAnimator.Offset = newOffsetVector;
+ extendedAnimator.Rotation = rot;
+
}
- else {
+
+ else
+ {
listingStandard.Label("Select a pawn currently in an animation to change their offsets");
}
- */
+
listingStandard.End();
}
-
- public override void PreOpen() {
- base.PreOpen();
- if(AnimationSettings.offsets == null) {
- if (AnimationSettings.debugMode)
- Log.Message("New offsets");
- AnimationSettings.offsets = new Dictionary();
- }
-
- if(AnimationSettings.rotation == null) {
- if (AnimationSettings.debugMode)
- Log.Message("New rotation");
- AnimationSettings.rotation = new Dictionary();
- }
- }
-
- public override void PostClose() {
- base.PostClose();
-
- LoadedModManager.GetMod().WriteSettings();
- }
}
}
+
+/**
+ if (curPawn.TryGetComp animator) {
+
+
+
+ /*
+ CompBodyAnimator compBodyAnimator = curPawn.TryGetComp();
+ AnimationDef def = compBodyAnimator.CurrentAnimation;
+ int ActorIndex = compBodyAnimator.ActorIndex;
+ float offsetX = 0, offsetZ = 0, rotation = 0;
+
+ 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 + bodyTypeDef + ActorIndex, new Vector2(0, 0));
+ }
+
+ 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 + bodyTypeDef + ActorIndex, 0);
+ }
+
+ 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");
+ }
+
+ float.TryParse(listingStandard.TextEntryLabeled("X Offset: ", offsetX.ToString()), out offsetX);
+ offsetX = listingStandard.Slider(offsetX, -2, 2);
+
+ float.TryParse(listingStandard.TextEntryLabeled("Z Offset: ", offsetZ.ToString()), out offsetZ);
+ offsetZ = listingStandard.Slider(offsetZ, -2, 2);
+
+ float.TryParse(listingStandard.TextEntryLabeled("Rotation: ", rotation.ToString()), out rotation);
+ rotation = listingStandard.Slider(rotation, -180, 180);
+
+ if(listingStandard.ButtonText("Reset All")) {
+ offsetX = 0;
+ offsetZ = 0;
+ rotation = 0;
+ }
+
+ listingStandard.GapLine();
+
+ if(listingStandard.ButtonText("Shift Actors")) {
+
+ if(AnimationSettings.debugMode) {
+ Log.Message("Shifting actors in animation...");
+ }
+
+ for(int i = 0; i < curPawn.TryGetComp().actorsInCurrentAnimation.Count; i++) {
+
+ Pawn actor = curPawn.TryGetComp().actorsInCurrentAnimation[i];
+
+ actor.TryGetComp()?.shiftActorPositionAndRestartAnimation();
+
+ //reset the clock time of every pawn in animation
+ if(actor.jobs.curDriver is rjw.JobDriver_Sex) {
+ (actor.jobs.curDriver as rjw.JobDriver_Sex).ticks_left = def.animationTimeTicks;
+ (actor.jobs.curDriver as rjw.JobDriver_Sex).ticksLeftThisToil = def.animationTimeTicks;
+ (actor.jobs.curDriver as rjw.JobDriver_Sex).duration = def.animationTimeTicks;
+ }
+
+ }
+
+ }
+
+ 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 + bodyTypeDef + ActorIndex]) {
+ AnimationSettings.rotation[def.defName + curPawn.def.defName + bodyTypeDef + ActorIndex] = rotation;
+ }
+
+ }
+
+}
+ */
+
diff --git a/1.5/Source/MainTabWindows/WorldComponent_UpdateMainTab.cs b/1.5/Source/MainTabWindows/WorldComponent_UpdateMainTab.cs
index 2694419..ff89d7e 100644
--- a/1.5/Source/MainTabWindows/WorldComponent_UpdateMainTab.cs
+++ b/1.5/Source/MainTabWindows/WorldComponent_UpdateMainTab.cs
@@ -16,7 +16,7 @@ namespace Rimworld_Animations {
public override void FinalizeInit() {
base.FinalizeInit();
- OffsetMainButtonDefOf.OffsetManager.buttonVisible = AnimationSettings.offsetTab;
+ OffsetMainButtonDefOf.OffsetManager.buttonVisible = RJWAnimationSettings.offsetTab;
}
diff --git a/1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_Sex.cs b/1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_Sex.cs
index f18dbcf..c025bec 100644
--- a/1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_Sex.cs
+++ b/1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_Sex.cs
@@ -5,20 +5,23 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using UnityEngine;
using Verse;
namespace Rimworld_Animations
{
- /*
- [HarmonyPatch(typeof(JobDriver_Sex), "SexTick")]
+
+ [HarmonyPatch(typeof(JobDriver_Sex), "setup_ticks")]
public class HarmonyPatch_JobDriver_Sex
{
- public static void Prefix(JobDriver_Sex __instance)
+ public static void Postfix(JobDriver_Sex __instance)
{
- Pawn partner = __instance.Partner;
+ if (!RJWAnimationSettings.hearts)
+ {
+ __instance.ticks_between_hearts = int.MaxValue;
+ }
}
}
- */
}
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 07f286f..e464028 100644
--- a/1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs
+++ b/1.5/Source/Patches/RJWPatches/JobDrivers/HarmonyPatch_JobDriver_SexBaseInitiator.cs
@@ -21,7 +21,7 @@ namespace Rimworld_Animations {
}
- if(!AnimationSettings.PlayAnimForNonsexualActs && NonSexualAct(__instance))
+ if(!RJWAnimationSettings.PlayAnimForNonsexualActs && NonSexualAct(__instance))
{
return;
}
@@ -34,8 +34,6 @@ namespace Rimworld_Animations {
Pawn Target = __instance.Target as Pawn;
- bool quickie = (__instance is JobDriver_SexQuick) && AnimationSettings.fastAnimForQuickie;
-
int preAnimDuration = __instance.duration;
@@ -44,7 +42,11 @@ namespace Rimworld_Animations {
GroupAnimationDef groupAnimation = AnimationUtility.FindGroupAnimation(participants, out int reorder);
if (groupAnimation != null)
{
- AnimationUtility.StartGroupAnimation(participants, groupAnimation, reorder, 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)
diff --git a/1.5/Source/Patches/RJWPatches/RJWAnimationSettings.cs b/1.5/Source/Patches/RJWPatches/RJWAnimationSettings.cs
new file mode 100644
index 0000000..6cb30d2
--- /dev/null
+++ b/1.5/Source/Patches/RJWPatches/RJWAnimationSettings.cs
@@ -0,0 +1,78 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Verse;
+using UnityEngine;
+using RimWorld;
+
+namespace Rimworld_Animations {
+
+ public class RJWAnimationSettings : ModSettings {
+
+ public static bool orgasmQuiver, rapeShiver, soundOverride = true, hearts = true, controlGenitalRotation = false,
+ PlayAnimForNonsexualActs = true;
+
+ public static bool offsetTab = false, debugMode = false;
+ public static float shiverIntensity = 2f;
+
+ public override void ExposeData() {
+
+ base.ExposeData();
+
+ Scribe_Values.Look(ref debugMode, "RJWAnimations-AnimsDebugMode", false);
+ Scribe_Values.Look(ref offsetTab, "RJWAnimations-EnableOffsetTab", false);
+ Scribe_Values.Look(ref controlGenitalRotation, "RJWAnimations-controlGenitalRotation", false);
+ Scribe_Values.Look(ref orgasmQuiver, "RJWAnimations-orgasmQuiver");
+ Scribe_Values.Look(ref rapeShiver, "RJWAnimations-rapeShiver");
+ Scribe_Values.Look(ref hearts, "RJWAnimation-heartsOnLovin");
+ Scribe_Values.Look(ref PlayAnimForNonsexualActs, "RJWAnims-PlayAnimForNonsexualActs");
+ Scribe_Values.Look(ref soundOverride, "RJWAnimations-rjwAnimSoundOverride", true);
+ Scribe_Values.Look(ref shiverIntensity, "RJWAnimations-shiverIntensity", 2f);
+ //todo: save offsetsByDefName
+
+ }
+
+ }
+
+ public class RJW_Animations : Mod {
+
+ public RJW_Animations(ModContentPack content) : base(content) {
+ GetSettings();
+
+ }
+
+ public override void DoSettingsWindowContents(Rect inRect) {
+
+ Listing_Standard listingStandard = new Listing_Standard();
+ listingStandard.Begin(inRect);
+
+ listingStandard.CheckboxLabeled("RimAnim_SoundOverride".Translate(), ref RJWAnimationSettings.soundOverride);
+ listingStandard.CheckboxLabeled("RimAnim_GenitalRotation".Translate(), ref RJWAnimationSettings.controlGenitalRotation);
+ listingStandard.CheckboxLabeled("RimAnim_OrgasmQuiver".Translate(), ref RJWAnimationSettings.orgasmQuiver);
+ listingStandard.CheckboxLabeled("RimAnim_RapeShiver".Translate(), ref RJWAnimationSettings.rapeShiver);
+ listingStandard.CheckboxLabeled("RimAnim_HeartsDuringLovin".Translate(), ref RJWAnimationSettings.hearts);
+ listingStandard.CheckboxLabeled("RimAnim_PlayNonsexual".Translate(), ref RJWAnimationSettings.PlayAnimForNonsexualActs);
+ listingStandard.CheckboxLabeled("RimAnim_AnimManagerTab".Translate(), ref RJWAnimationSettings.offsetTab);
+ listingStandard.Label("RimAnim_ShiverIntensity".Translate() + RJWAnimationSettings.shiverIntensity);
+ RJWAnimationSettings.shiverIntensity = listingStandard.Slider(RJWAnimationSettings.shiverIntensity, 0.0f, 12f);
+
+ listingStandard.CheckboxLabeled("RimAnim_DebugMode".Translate(), ref RJWAnimationSettings.debugMode);
+
+
+ listingStandard.End();
+ base.DoSettingsWindowContents(inRect);
+ }
+
+ public override void WriteSettings() {
+ base.WriteSettings();
+ OffsetMainButtonDefOf.OffsetManager.buttonVisible = RJWAnimationSettings.offsetTab;
+
+ }
+
+ public override string SettingsCategory() {
+ return "RimAnim_ModSettings".Translate();
+ }
+ }
+}
diff --git a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTracker.cs b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTracker.cs
index 8b467e1..31c4692 100644
--- a/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTracker.cs
+++ b/1.5/Source/Patches/RimworldPatches/HarmonyPatch_Pawn_DrawTracker.cs
@@ -7,20 +7,20 @@ namespace Rimworld_Animations {
[HarmonyPatch(typeof(Pawn_DrawTracker), "DrawPos", MethodType.Getter)]
public static class HarmonyPatch_Pawn_DrawTracker {
- public static bool Prefix(ref Pawn ___pawn, ref Vector3 __result) {
-
- CompExtendedAnimator animator = ___pawn.TryGetComp();
+ //switch to postfix to get pawn original height first
+ public static void Postfix(ref Pawn ___pawn, ref Vector3 __result) {
//align pos on top of partner, position, etc., based on animatoranchor
- if (animator != null && animator.IsAnchored)
+ if (___pawn.TryGetComp() is CompExtendedAnimator animator
+ && animator.IsAnchored)
{
- __result = animator.getAnchor();
- return false;
+ Vector3 anchor = animator.getAnchor();
+ //ignore y so that pawns don't clip through stuff
+ __result.x = anchor.x;
+ __result.z = anchor.z;
}
- return true;
-
}
}
}
diff --git a/1.5/Source/RenderSubWorkers/PawnRenderSubWorker_ChangeOffset.cs b/1.5/Source/RenderSubWorkers/PawnRenderSubWorker_ChangeOffset.cs
index 2ce182e..117e459 100644
--- a/1.5/Source/RenderSubWorkers/PawnRenderSubWorker_ChangeOffset.cs
+++ b/1.5/Source/RenderSubWorkers/PawnRenderSubWorker_ChangeOffset.cs
@@ -26,5 +26,25 @@ namespace Rimworld_Animations
}
}
+
+ public override void TransformRotation(PawnRenderNode node, PawnDrawParms parms, ref Quaternion rotation)
+ {
+
+ if (node.AnimationWorker is AnimationWorker_KeyframesExtended
+ && node.tree.pawn.TryGetComp(out CompExtendedAnimator extendedAnimator)
+ && extendedAnimator.IsAnimating)
+ {
+ int? pawnRotation = extendedAnimator.Rotation;
+ if (pawnRotation != null)
+ {
+ Quaternion additionalRotation = Quaternion.AngleAxis((int)pawnRotation, Vector3.up);
+ rotation *= additionalRotation;
+ }
+
+ }
+
+ base.TransformRotation(node, parms, ref rotation);
+ }
+
}
}
diff --git a/1.5/Source/Settings/AnimationSettings.cs b/1.5/Source/Settings/AnimationSettings.cs
deleted file mode 100644
index f320fa2..0000000
--- a/1.5/Source/Settings/AnimationSettings.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Verse;
-using UnityEngine;
-using RimWorld;
-
-namespace Rimworld_Animations {
-
- public class AnimationSettings : ModSettings {
-
- public static bool orgasmQuiver, rapeShiver, soundOverride = true, hearts = true, controlGenitalRotation = false, applySemenOnAnimationOrgasm = false, fastAnimForQuickie = false,
- PlayAnimForNonsexualActs = true;
- public static bool offsetTab = false, debugMode = false;
- public static float shiverIntensity = 2f;
-
- public static Dictionary offsets = new Dictionary();
- public static Dictionary rotation = new Dictionary();
-
- public override void ExposeData() {
-
- base.ExposeData();
-
- Scribe_Values.Look(ref debugMode, "RJWAnimations-AnimsDebugMode", false);
- Scribe_Values.Look(ref offsetTab, "RJWAnimations-EnableOffsetTab", false);
- Scribe_Values.Look(ref controlGenitalRotation, "RJWAnimations-controlGenitalRotation", false);
- 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 PlayAnimForNonsexualActs, "RJWAnims-PlayAnimForNonsexualActs");
- Scribe_Values.Look(ref applySemenOnAnimationOrgasm, "RJWAnimations-applySemenOnOrgasm", false);
- Scribe_Values.Look(ref soundOverride, "RJWAnimations-rjwAnimSoundOverride", true);
- Scribe_Values.Look(ref shiverIntensity, "RJWAnimations-shiverIntensity", 2f);
- //todo: save offsetsByDefName
-
- Scribe_Collections.Look(ref offsets, "RJWAnimations-animationOffsets");
- Scribe_Collections.Look(ref rotation, "RJWAnimations-rotationOffsets");
-
-
-
- //needs to be rewritten
- //probably somewhere in options?
-
- }
-
- }
-
- public class RJW_Animations : Mod {
-
- public RJW_Animations(ModContentPack content) : base(content) {
- GetSettings();
-
- }
-
- public override void DoSettingsWindowContents(Rect inRect) {
-
- Listing_Standard listingStandard = new Listing_Standard();
- listingStandard.Begin(inRect);
-
- listingStandard.CheckboxLabeled("Enable Sound Override", ref AnimationSettings.soundOverride);
- listingStandard.CheckboxLabeled("Control Genital Rotation", ref AnimationSettings.controlGenitalRotation);
- listingStandard.CheckboxLabeled("Play Fast Animation for Quickie", ref AnimationSettings.fastAnimForQuickie);
- listingStandard.CheckboxLabeled("Apply Semen on Animation Orgasm", ref AnimationSettings.applySemenOnAnimationOrgasm);
-
- if(AnimationSettings.applySemenOnAnimationOrgasm) {
- listingStandard.Label("Recommended--turn down \"Cum on body percent\" in RJW settings to about 33%");
- }
-
- listingStandard.CheckboxLabeled("Enable Orgasm Quiver", ref AnimationSettings.orgasmQuiver);
- listingStandard.CheckboxLabeled("Enable Rape Shiver", ref AnimationSettings.rapeShiver);
- listingStandard.CheckboxLabeled("Enable hearts during lovin'", ref AnimationSettings.hearts);
- listingStandard.CheckboxLabeled("Play animation for nonsexual acts (handholding, makeout)", ref AnimationSettings.PlayAnimForNonsexualActs);
- listingStandard.CheckboxLabeled("Enable Animation Manager Tab", ref AnimationSettings.offsetTab);
-
- listingStandard.Label("Shiver/Quiver Intensity (default 2): " + AnimationSettings.shiverIntensity);
- AnimationSettings.shiverIntensity = listingStandard.Slider(AnimationSettings.shiverIntensity, 0.0f, 12f);
-
- listingStandard.CheckboxLabeled("Debug Mode", ref AnimationSettings.debugMode);
-
-
- listingStandard.End();
- base.DoSettingsWindowContents(inRect);
- }
-
- public override void WriteSettings() {
- base.WriteSettings();
- OffsetMainButtonDefOf.OffsetManager.buttonVisible = AnimationSettings.offsetTab;
-
- }
-
- public override string SettingsCategory() {
- return "RJW Animation Settings";
- }
- }
-}
diff --git a/1.5/Source/Utilities/AnimationUtility.cs b/1.5/Source/Utilities/AnimationUtility.cs
index e57a096..04950f4 100644
--- a/1.5/Source/Utilities/AnimationUtility.cs
+++ b/1.5/Source/Utilities/AnimationUtility.cs
@@ -30,21 +30,21 @@ namespace Rimworld_Animations {
for (int i = 0; i < participants.Count; i++)
{
-
- Vector3? offset = groupAnimationDef.GetOffset(i, participants[i], reorder);
+
+ groupAnimationDef.GetOffset(i, participants[i], out Vector3? position, out int? rotation, reorder);
if (anchor is Pawn pawn && pawn == participants[i])
{
List allAnimationsForPawn = groupAnimationDef.GetAllAnimationsForActor(i, seed, reorder);
- participants[i].TryGetComp().PlayGroupAnimation(allAnimationsForPawn, offset);
+ participants[i].TryGetComp().PlayGroupAnimation(allAnimationsForPawn, position, rotation);
}
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, offset, animatorAnchor);
+ participants[i].TryGetComp().PlayGroupAnimation(allAnimationsForPawn, position, rotation, animatorAnchor);
}
}
}
@@ -57,8 +57,8 @@ namespace Rimworld_Animations {
for (int i = 0; i < participants.Count; i++)
{
List allAnimationsForPawn = groupAnimationDef.GetAllAnimationsForActor(i, seed, reorder);
- Vector3? offset = groupAnimationDef.GetOffset(i, participants[i], reorder);
- participants[i].TryGetComp().PlayGroupAnimation(allAnimationsForPawn, offset);
+ groupAnimationDef.GetOffset(i, participants[i], out Vector3? position, out int? rotation, reorder);
+ participants[i].TryGetComp().PlayGroupAnimation(allAnimationsForPawn, position, rotation);
}
}
diff --git a/Languages/English/Keyed/RJWAnimations-LanguageData.xml b/Languages/English/Keyed/RJWAnimations-LanguageData.xml
new file mode 100644
index 0000000..95ecca6
--- /dev/null
+++ b/Languages/English/Keyed/RJWAnimations-LanguageData.xml
@@ -0,0 +1,22 @@
+
+
+
+
+ RJW Animation Settings
+ Enable Sound Override
+ Control Genital Rotation
+ Enable Orgasm Quiver
+ Enable Rape Shiver
+ Enable hearts during lovin'
+ Play animation for nonsexual acts (handholding, makeout)
+ Enable Animation Manager Tab
+ Shiver/Quiver Intensity (default 2):
+ Debug Mode
+
+
+ Animation Manager
+ Warning--You generally don't want to change human offsets, only alien offsets or animals
+ Copy Offset to Clipboard
+ Paste offset values in OffsetDef, or share in Discord
+
+
\ No newline at end of file
diff --git a/Rimworld-Animations.csproj b/Rimworld-Animations.csproj
index bdf8615..a57ed97 100644
--- a/Rimworld-Animations.csproj
+++ b/Rimworld-Animations.csproj
@@ -68,6 +68,10 @@
..\..\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll
False
+
+ ..\..\RimWorldWin64_Data\Managed\UnityEngine.IMGUIModule.dll
+ False
+
@@ -122,7 +126,7 @@
-
+
@@ -187,6 +191,7 @@
+
@@ -197,6 +202,7 @@
+
\ No newline at end of file