Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update position of attached motes based on real position #473

Merged
merged 1 commit into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Source/Client/Patches/Determinism.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ namespace Multiplayer.Client.Patches
[HarmonyPatch(nameof(PawnTweener.TweenedPos), MethodType.Getter)]
static class DrawPosPatch
{
static bool Prefix() => Multiplayer.Client == null || Multiplayer.InInterface;
public static bool returnTruePosition = false;

static bool Prefix() => Multiplayer.Client == null || Multiplayer.InInterface || returnTruePosition;

// Give the root position during ticking
static void Postfix(PawnTweener __instance, ref Vector3 __result)
{
if (Multiplayer.Client == null || Multiplayer.InInterface) return;
if (Multiplayer.Client == null || Multiplayer.InInterface || returnTruePosition) return;
__result = __instance.TweenedPosRoot();
}
}
Expand Down
9 changes: 9 additions & 0 deletions Source/Client/Patches/Patches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Reflection.Emit;
using System.Text.RegularExpressions;
using System.Xml.Linq;
using Multiplayer.Client.Patches;
using UnityEngine;
using Verse;
using Verse.AI;
Expand Down Expand Up @@ -581,4 +582,12 @@ static void FixStorage(IStoreSettingsParent __instance, StorageSettings ___allow
___allowedNutritionSettings.owner ??= __instance;
}
}

[HarmonyPatch(typeof(MoteAttachLink), nameof(MoteAttachLink.UpdateDrawPos))]
static class MoteAttachLinkUsesTruePosition
{
static void Prefix() => DrawPosPatch.returnTruePosition = true;

static void Finalizer() => DrawPosPatch.returnTruePosition = false;
}
}
Loading