From 48f02df34c315c894e2fa618360584ef16706ec6 Mon Sep 17 00:00:00 2001 From: teascade Date: Sat, 8 Aug 2020 04:58:02 +0300 Subject: [PATCH] Move HandleSyncPckt to it's own call --- Assets/Scripts/Networking/Instances/Server.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/Networking/Instances/Server.cs b/Assets/Scripts/Networking/Instances/Server.cs index e1a54df..30a7f00 100644 --- a/Assets/Scripts/Networking/Instances/Server.cs +++ b/Assets/Scripts/Networking/Instances/Server.cs @@ -97,12 +97,7 @@ namespace NeonTea.Quakeball.Networking.Instances { } } else if (packet is PlayerSyncPacket) { PlayerSyncPacket syncPckt = (PlayerSyncPacket)packet; - if (Players[conn.uid].Controlled != null) { - syncPckt.PlayerId = conn.uid; - if (!Players[conn.uid].Controlled.ProcessSyncPacket(syncPckt, false)) { - Players[conn.uid].Unsynced = true; - } - } + HandleSyncPckt(conn.uid, syncPckt); } else if (packet is PlayerActionPckt) { PlayerActionPckt action = (PlayerActionPckt)packet; if (Players[conn.uid].Controlled != null) { @@ -145,6 +140,15 @@ namespace NeonTea.Quakeball.Networking.Instances { PlayerList.Remove(player); } + private void HandleSyncPckt(ulong uid, PlayerSyncPacket pckt) { + if (Players[uid].Controlled != null) { + pckt.PlayerId = uid; + if (!Players[uid].Controlled.ProcessSyncPacket(pckt, false)) { + Players[uid].Unsynced = true; + } + } + } + private void HandleAction(ulong uid, PlayerActionPckt action) { switch (action.Action) { case PlayerAction.Jump: