better QSBPatch.Remote

This commit is contained in:
JohnCorby 2023-08-02 14:02:00 -07:00
parent 934e761386
commit 25900cbc2f
2 changed files with 4 additions and 2 deletions

View File

@ -11,7 +11,7 @@ public abstract class QSBPatch
public void DoPatches(Harmony instance) => instance.PatchAll(GetType());
/// <summary>
/// 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)
/// </summary>
public static bool Remote;
}

View File

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