Move HandleSyncPckt to it's own call

This commit is contained in:
Sofia 2020-08-08 04:58:02 +03:00
parent 97a6b74417
commit 48f02df34c
1 changed files with 10 additions and 6 deletions

View File

@ -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: