Remove handing of Singular Update pckts from Client

This commit is contained in:
Sofia 2020-08-08 01:37:03 +03:00
parent 0fcaa19506
commit c1d620bc9c
2 changed files with 13 additions and 8 deletions

View File

@ -68,22 +68,19 @@ namespace NeonTea.Quakeball.Networking.Instances {
Player obj = Net.SpawnPlayer(spawn.Location).GetComponent<Player>();
NetPlayer player = new NetPlayer(spawn.PlayerId, obj);
Players.Add(spawn.PlayerId, player);
} else if (packet is PlayerUpdatePckt) {
PlayerUpdatePckt updatePckt = (PlayerUpdatePckt)packet;
HandleUpdatePlayer(updatePckt);
} else if (packet is MultiplePlayerUpdatesPckt) {
MultiplePlayerUpdatesPckt multiple = (MultiplePlayerUpdatesPckt)packet;
foreach (PlayerUpdatePckt pckt in multiple.Updates) {
HandleUpdatePlayer(pckt);
}
} else if (packet is MultipleSyncsPckt) {
MultipleSyncsPckt multiple = (MultipleSyncsPckt)packet;
foreach (PlayerSyncPacket pckt in multiple.Syncs) {
HandleSyncPckt(pckt);
}
} else if (packet is PlayerJumpPckt) {
PlayerJumpPckt jump = (PlayerJumpPckt)packet;
Players[jump.PlayerId].Controlled.Jump();
} else if (packet is PlayerSyncPacket) {
PlayerSyncPacket syncPckt = (PlayerSyncPacket)packet;
if (syncPckt.Unsynced || syncPckt.PlayerId != LocalPlayer.Id) {
Players[syncPckt.PlayerId].Controlled.ProcessSyncPacket(syncPckt);
}
}
}
@ -94,6 +91,12 @@ namespace NeonTea.Quakeball.Networking.Instances {
Players[pckt.PlayerId].Controlled.ProcessUpdatePacket(pckt);
}
private void HandleSyncPckt(PlayerSyncPacket syncPckt) {
if (syncPckt.Unsynced || syncPckt.PlayerId != LocalPlayer.Id) {
Players[syncPckt.PlayerId].Controlled.ProcessSyncPacket(syncPckt);
}
}
public override void UpdateLocalPlayer() {
if (SelfIdentified && Server != null) {
PlayerUpdatePckt pckt = LocalPlayer.Controlled.CreateUpdatePacket();

View File

@ -1,5 +1,6 @@
using UnityEngine;
using NeonTea.Quakeball.Networking.Packets;
using NeonTea.Quakeball.Interface;
namespace NeonTea.Quakeball.Players {
/// <summary>The central glue class for players (both local and remote).</summary>
@ -90,6 +91,7 @@ namespace NeonTea.Quakeball.Players {
transform.position = syncPckt.Location;
GroundVelocity = syncPckt.GroundVelocity;
}
Terminal.Singleton.Println($"Processing sync: {syncPckt.Unsynced}");
return ShouldApply;
}