better offset tweaks for position

This commit is contained in:
c0ffee 2024-04-23 14:21:47 -07:00
parent 7f5e2e1a63
commit 1ba5e0e117
6 changed files with 18 additions and 14 deletions

View File

@ -13,25 +13,25 @@
<workerClass>Rimworld_Animations.AnimationWorker_KeyframesExtended</workerClass>
<keyframes>
<li Class="Rimworld_Animations.ExtendedKeyframe">
<offset>(1, -1, 0)</offset>
<offset>(1, 0, 0)</offset>
<tick>0</tick>
<angle>0</angle>
<rotation>North</rotation>
</li>
<li Class="Rimworld_Animations.ExtendedKeyframe">
<offset>(0, -1, 0)</offset>
<offset>(0, 0, 0)</offset>
<tick>30</tick>
<angle>15</angle>
<rotation>North</rotation>
</li>
<li Class="Rimworld_Animations.ExtendedKeyframe">
<offset>(-1, -1, 0)</offset>
<offset>(-1, 0, 0)</offset>
<tick>60</tick>
<angle>0</angle>
<rotation>North</rotation>
</li>
<li Class="Rimworld_Animations.ExtendedKeyframe">
<offset>(0, -1, 0)</offset>
<offset>(0, 0, 0)</offset>
<tick>90</tick>
<angle>-15</angle>
<rotation>North</rotation>

View File

@ -22,6 +22,7 @@ namespace Rimworld_Animations
public override Vector3 getDrawPos()
{
//vector3.up means stand above the thing
return thing.DrawPos;
}

View File

@ -8,7 +8,7 @@ namespace Rimworld_Animations {
class MainTabWindow_OffsetConfigure : MainTabWindow
{
public override Vector2 RequestedTabSize => new Vector2(505, 450);
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);
@ -76,6 +76,8 @@ namespace Rimworld_Animations {
}
listingStandard.Label("RimAnims_ShareSettings".Translate());
extendedAnimator.Offset = newOffsetVector;
extendedAnimator.Rotation = rot;

View File

@ -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<CompExtendedAnimator>();
//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<CompExtendedAnimator>() 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;
}
}
}

View File

@ -14,8 +14,9 @@
<RimAnim_DebugMode>Debug Mode</RimAnim_DebugMode>
<!-- Main Tab Window -->
<RimAnims_AnimManager>Animation Manager</RimAnims_AnimManager>
<RimAnims_Warning>Warning--You generally don't want to change human offsets, only alien offsets or animals</RimAnims_Warning>
<RimAnims_CopyToClipboard>Copy Offset to Clipboard</RimAnims_CopyToClipboard>
<RimAnims_AnimManager>Animation Manager</RimAnims_AnimManager>
<RimAnims_ShareSettings>Paste offset values in OffsetDef, or share in Discord</RimAnims_ShareSettings>
</LanguageData>