diff --git a/1.1/Assemblies/Rimworld-Animations.dll b/1.1/Assemblies/Rimworld-Animations.dll
index 3a0ccba..a907d23 100644
Binary files a/1.1/Assemblies/Rimworld-Animations.dll and b/1.1/Assemblies/Rimworld-Animations.dll differ
diff --git a/Defs/MainTabDefs/MainButtonDef.xml b/Defs/MainTabDefs/MainButtonDef.xml
new file mode 100644
index 0000000..1d3ac05
--- /dev/null
+++ b/Defs/MainTabDefs/MainButtonDef.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ OffsetManager
+
+ Control pawn offsets
+ Rimworld_Animations.MainTabWindow_OffsetConfigure
+ 54
+ false
+
+
+
\ No newline at end of file
diff --git a/Rimworld-Animations.csproj b/Rimworld-Animations.csproj
index 507dad5..49f1644 100644
--- a/Rimworld-Animations.csproj
+++ b/Rimworld-Animations.csproj
@@ -84,7 +84,8 @@
-
+
+
@@ -102,6 +103,15 @@
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/Actors/Actor.cs b/Source/Actors/Actor.cs
index b3ff494..d836d24 100644
--- a/Source/Actors/Actor.cs
+++ b/Source/Actors/Actor.cs
@@ -4,9 +4,10 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
+using Verse;
namespace Rimworld_Animations {
- public class Actor {
+ public class Actor : IExposable {
public List defNames;
public List requiredGenitals;
public List raceOffsets;
@@ -18,5 +19,11 @@ namespace Rimworld_Animations {
public bool controlGenitalAngle = false;
public BodyTypeOffset bodyTypeOffset = new BodyTypeOffset();
public Vector3 offset = new Vector2(0, 0);
+
+ public Dictionary offsetsByDefName = new Dictionary();
+
+ public void ExposeData() {
+ Scribe_Collections.Look(ref offsetsByDefName, "OffsetsSetInOptions", LookMode.Value, LookMode.Value);
+ }
}
}
diff --git a/Source/AnimationUtility.cs b/Source/AnimationUtility.cs
index 0072650..417a76d 100644
--- a/Source/AnimationUtility.cs
+++ b/Source/AnimationUtility.cs
@@ -146,7 +146,7 @@ namespace Rimworld_Animations {
public static void RenderPawnHeadMeshInAnimation(Mesh mesh, Vector3 loc, Quaternion quaternion, Material material, bool portrait, Pawn pawn) {
- if(pawn == null) {
+ if(pawn == null || pawn.Map != Find.CurrentMap) {
GenDraw.DrawMeshNowOrLater(mesh, loc, quaternion, material, portrait);
return;
}
diff --git a/Source/Comps/CompBodyAnimator.cs b/Source/Comps/CompBodyAnimator.cs
index 77195eb..aff1dbe 100644
--- a/Source/Comps/CompBodyAnimator.cs
+++ b/Source/Comps/CompBodyAnimator.cs
@@ -34,7 +34,7 @@ namespace Rimworld_Animations {
PortraitsCache.SetDirty(pawn);
}
}
- private bool Animating;
+ private bool Animating = false;
private bool mirror = false, quiver = false, shiver = false;
private int actor;
@@ -284,8 +284,28 @@ namespace Rimworld_Animations {
public Vector3 getPawnHeadPosition() {
- return anchor + deltaPos + Quaternion.AngleAxis(bodyAngle, Vector3.up) * (pawn.Drawer.renderer.BaseHeadOffsetAt(headFacing) + headBob);
+ Vector3 headPos = anchor + deltaPos + Quaternion.AngleAxis(bodyAngle, Vector3.up) * (pawn.Drawer.renderer.BaseHeadOffsetAt(headFacing) + headBob);
+ if (CurrentAnimation?.actors[ActorIndex]?.offsetsByDefName != null && CurrentAnimation.actors[ActorIndex].offsetsByDefName.ContainsKey(pawn.def.defName)) {
+ headPos.x += CurrentAnimation.actors[ActorIndex].offsetsByDefName[pawn.def.defName].x;
+ headPos.z += CurrentAnimation.actors[ActorIndex].offsetsByDefName[pawn.def.defName].y;
+ }
+
+ return headPos;
+
+ }
+
+
+ public AnimationDef CurrentAnimation {
+ get {
+ return anim;
+ }
+ }
+
+ public int ActorIndex {
+ get {
+ return actor;
+ }
}
public override void PostExposeData() {
diff --git a/Source/MainTabWindows/MainTabWindow_OffsetConfigure.cs b/Source/MainTabWindows/MainTabWindow_OffsetConfigure.cs
new file mode 100644
index 0000000..f90e66e
--- /dev/null
+++ b/Source/MainTabWindows/MainTabWindow_OffsetConfigure.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Verse;
+using RimWorld;
+using UnityEngine;
+
+namespace Rimworld_Animations {
+ class MainTabWindow_OffsetConfigure : MainTabWindow
+ {
+
+ public override Vector2 RequestedTabSize => new Vector2(505, 300);
+ public override void DoWindowContents(Rect inRect) {
+
+ Rect position = new Rect(inRect.x, inRect.y, inRect.width, inRect.height);
+
+
+ Listing_Standard listingStandard = new Listing_Standard();
+ listingStandard.Begin(position);
+
+ listingStandard.Label("Offset Controller");
+
+ if (Find.Selector.SingleSelectedThing is Pawn) {
+
+ Pawn curPawn = Find.Selector.SingleSelectedThing as Pawn;
+
+ if (curPawn.TryGetComp().isAnimating) {
+
+ Actor curActor = curPawn.TryGetComp().CurrentAnimation.actors[curPawn.TryGetComp().ActorIndex];
+
+ float offsetX = 0, offsetZ = 0;
+
+ if (curActor.offsetsByDefName.ContainsKey(curPawn.def.defName)) {
+ offsetX = curActor.offsetsByDefName[curPawn.def.defName].x;
+ offsetZ = curActor.offsetsByDefName[curPawn.def.defName].y;
+ } else {
+ curActor.offsetsByDefName.Add(curPawn.def.defName, new Vector2(0, 0));
+ }
+
+ listingStandard.GapLine();
+
+ listingStandard.Label("Offset for race " + curPawn.def.defName + " in actor position " + curPawn.TryGetComp().ActorIndex);
+
+ if(curPawn.def.defName == "Human") {
+ listingStandard.Label("Warning--You generally don't want to change human offsets, only alien offsets");
+ }
+
+
+ listingStandard.Label("X Offset: " + offsetX);
+ offsetX = listingStandard.Slider(offsetX, -10, 10);
+
+ listingStandard.Label("Z Offset: " + offsetZ);
+ offsetZ = listingStandard.Slider(offsetZ, -10, 10);
+
+ if (offsetX != curActor.offsetsByDefName[curPawn.def.defName].x || offsetZ != curActor.offsetsByDefName[curPawn.def.defName].y) {
+ curActor.offsetsByDefName[curPawn.def.defName] = new Vector2(offsetX, offsetZ);
+ }
+ }
+
+
+ }
+
+ listingStandard.End();
+
+ base.DoWindowContents(inRect);
+
+ }
+ }
+}
diff --git a/Source/MainTabWindows/MainTabWindow_SexAnimator.cs b/Source/MainTabWindows/MainTabWindow_SexAnimator.cs
deleted file mode 100644
index 5889510..0000000
--- a/Source/MainTabWindows/MainTabWindow_SexAnimator.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Verse;
-using RimWorld;
-
-namespace Rimworld_Animations {
- class MainTabWindow_SexAnimator : MainTabWindow
- {
- //todo: add animation maker window
- }
-}
diff --git a/Source/MainTabWindows/OffsetMainButtonDefOf.cs b/Source/MainTabWindows/OffsetMainButtonDefOf.cs
new file mode 100644
index 0000000..657a4c5
--- /dev/null
+++ b/Source/MainTabWindows/OffsetMainButtonDefOf.cs
@@ -0,0 +1,23 @@
+using RimWorld;
+using Verse;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Rimworld_Animations {
+
+ [DefOf]
+ public static class OffsetMainButtonDefOf {
+
+ public static MainButtonDef OffsetManager;
+
+
+ static OffsetMainButtonDefOf() {
+ DefOfHelper.EnsureInitializedInCtor(typeof(OffsetMainButtonDefOf));
+ //OffsetManager.buttonVisible = false;
+ }
+
+ }
+}
diff --git a/Source/Patches/HarmonyPatch_PawnRenderer.cs b/Source/Patches/HarmonyPatch_PawnRenderer.cs
index a58b1e9..a6865bc 100644
--- a/Source/Patches/HarmonyPatch_PawnRenderer.cs
+++ b/Source/Patches/HarmonyPatch_PawnRenderer.cs
@@ -40,9 +40,14 @@ namespace Rimworld_Animations {
}
- if (bodyAnim != null && bodyAnim.isAnimating && !portrait) {
+ if (bodyAnim != null && bodyAnim.isAnimating && !portrait && pawn.Map == Find.CurrentMap) {
bodyAnim.tickGraphics(graphics);
- pawn.TryGetComp().animatePawn(ref rootLoc, ref angle, ref bodyFacing, ref headFacing);
+ bodyAnim.animatePawn(ref rootLoc, ref angle, ref bodyFacing, ref headFacing);
+
+ if(bodyAnim.CurrentAnimation?.actors[bodyAnim.ActorIndex]?.offsetsByDefName != null && bodyAnim.CurrentAnimation.actors[bodyAnim.ActorIndex].offsetsByDefName.ContainsKey(pawn.def.defName)) {
+ rootLoc.x += bodyAnim.CurrentAnimation.actors[bodyAnim.ActorIndex].offsetsByDefName[pawn.def.defName].x;
+ rootLoc.z += bodyAnim.CurrentAnimation.actors[bodyAnim.ActorIndex].offsetsByDefName[pawn.def.defName].y;
+ }
}
}
diff --git a/Source/Settings/AnimationSettings.cs b/Source/Settings/AnimationSettings.cs
index f385c10..ff6cd6e 100644
--- a/Source/Settings/AnimationSettings.cs
+++ b/Source/Settings/AnimationSettings.cs
@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Verse;
using UnityEngine;
+using RimWorld;
namespace Rimworld_Animations {
public class AnimationSettings : ModSettings {
@@ -12,6 +13,8 @@ namespace Rimworld_Animations {
public static bool orgasmQuiver, rapeShiver, soundOverride = true, hearts = true, controlGenitalRotation = false, applySemenOnAnimationOrgasm = false, fastAnimForQuickie = false;
public static float shiverIntensity = 2f;
+ public static Dictionary offsetsByDefName;
+
public override void ExposeData() {
base.ExposeData();
@@ -25,6 +28,7 @@ namespace Rimworld_Animations {
Scribe_Values.Look(ref soundOverride, "rjwAnimSoundOverride", true);
Scribe_Values.Look(ref shiverIntensity, "shiverIntensity", 2f);
+ //todo: save offsetsByDefName
}
@@ -54,9 +58,12 @@ namespace Rimworld_Animations {
listingStandard.CheckboxLabeled("Enable Rape Shiver", ref AnimationSettings.rapeShiver);
listingStandard.CheckboxLabeled("Enable hearts during lovin'", ref AnimationSettings.hearts);
+ listingStandard.CheckboxLabeled("Enable Offset Tab", ref OffsetMainButtonDefOf.OffsetManager.buttonVisible);
+
listingStandard.Label("Shiver/Quiver Intensity (default 2): " + AnimationSettings.shiverIntensity);
AnimationSettings.shiverIntensity = listingStandard.Slider(AnimationSettings.shiverIntensity, 0.0f, 12f);
+
listingStandard.End();
base.DoSettingsWindowContents(inRect);
}