From 25900cbc2f3b66bf67bb3d9cdb26a8813b133112 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Wed, 2 Aug 2023 14:02:00 -0700 Subject: [PATCH] better QSBPatch.Remote --- QSB/Patches/QSBPatch.cs | 2 +- QSB/Player/TransformSync/PlayerTransformSync.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/QSB/Patches/QSBPatch.cs b/QSB/Patches/QSBPatch.cs index 618ba1eb..90dba5ca 100644 --- a/QSB/Patches/QSBPatch.cs +++ b/QSB/Patches/QSBPatch.cs @@ -11,7 +11,7 @@ public abstract class QSBPatch public void DoPatches(Harmony instance) => instance.PatchAll(GetType()); /// - /// this is true when a message is received remotely (OnReceiveRemote) or a player leaves (OnRemovePlayer) + /// this is true when a message is received remotely (OnReceiveRemote) or a remote player joins/leaves (OnAddPlayer/OnRemovePlayer) /// public static bool Remote; } diff --git a/QSB/Player/TransformSync/PlayerTransformSync.cs b/QSB/Player/TransformSync/PlayerTransformSync.cs index 4cadce5b..2611fef9 100644 --- a/QSB/Player/TransformSync/PlayerTransformSync.cs +++ b/QSB/Player/TransformSync/PlayerTransformSync.cs @@ -36,7 +36,9 @@ public class PlayerTransformSync : SectoredTransformSync var player = new PlayerInfo(this); QSBPlayerManager.PlayerList.SafeAdd(player); base.OnStartClient(); + QSBPatch.Remote = !isLocalPlayer; QSBPlayerManager.OnAddPlayer?.SafeInvoke(Player); + QSBPatch.Remote = false; DebugLog.DebugWrite($"Create Player : {Player}", MessageType.Info); JoinLeaveSingularity.Create(Player, true); @@ -49,7 +51,7 @@ public class PlayerTransformSync : SectoredTransformSync JoinLeaveSingularity.Create(Player, false); // TODO : Maybe move this to a leave event...? Would ensure everything could finish up before removing the player - QSBPatch.Remote = true; + QSBPatch.Remote = !isLocalPlayer; QSBPlayerManager.OnRemovePlayer?.SafeInvoke(Player); QSBPatch.Remote = false; base.OnStopClient();