diff --git a/Assets/Scripts/Net/Instances/Client.cs b/Assets/Scripts/Net/Instances/Client.cs index a9d1d1a..bb62163 100644 --- a/Assets/Scripts/Net/Instances/Client.cs +++ b/Assets/Scripts/Net/Instances/Client.cs @@ -51,6 +51,7 @@ namespace NeonTea.Quakeball.Net.Instances { SelfIdentPckt ident = (SelfIdentPckt)packet; LocalPlayer.Id = ident.PlayerId; Players.Add(LocalPlayer.Id, LocalPlayer); + Debug.Log($"I got self-identified as {LocalPlayer.Id}"); SpawnPckt spawn = new SpawnPckt(); spawn.Location = LocalPlayer.Controlled.transform.position; diff --git a/Assets/Scripts/Net/Instances/Server.cs b/Assets/Scripts/Net/Instances/Server.cs index efa742c..10a1c69 100644 --- a/Assets/Scripts/Net/Instances/Server.cs +++ b/Assets/Scripts/Net/Instances/Server.cs @@ -40,12 +40,13 @@ namespace NeonTea.Quakeball.Net.Instances { SpawnPckt spawn = new SpawnPckt(); spawn.PlayerId = p.Id; spawn.Location = p.Controlled.transform.position; - Peer.SendReliable(conn.uid, spawn); + Peer.SendReliableLater(conn.uid, spawn); } NetPlayer RemotePlayer = new NetPlayer(PlayerIdCounter++); Players.Add(RemotePlayer.Id, RemotePlayer); SelfIdentPckt ident = new SelfIdentPckt(); ident.PlayerId = RemotePlayer.Id; + Debug.Log("Send self-ident!"); Peer.SendReliable(conn.uid, ident); } @@ -54,6 +55,7 @@ namespace NeonTea.Quakeball.Net.Instances { public override void Handle(Connection conn, Packet packet) { if (packet is SpawnPckt) { + Debug.Log("Do i ever get it"); SpawnPckt spawn = (SpawnPckt)packet; if (Players[conn.uid].Controlled == null) { GameObject obj = Net.SpawnPlayer(spawn.Location); diff --git a/Assets/Scripts/Net/NetChaperone.cs b/Assets/Scripts/Net/NetChaperone.cs index eb5dd35..079a915 100644 --- a/Assets/Scripts/Net/NetChaperone.cs +++ b/Assets/Scripts/Net/NetChaperone.cs @@ -29,7 +29,9 @@ namespace NeonTea.Quakeball.Net { } private void Update() { - Net.Singleton.Instance.Peer.Update(); + if (Net.Singleton.Instance != null) { + Net.Singleton.Instance.Peer.Update(); + } if (Terminal != null && Terminal.isActiveAndEnabled) { while (MessageQueue.Count > 0) { Terminal.Println(MessageQueue.Dequeue()); diff --git a/Assets/Scripts/TeaNet/Peers/ConnectionManager.cs b/Assets/Scripts/TeaNet/Peers/ConnectionManager.cs index d7777a2..40afecc 100644 --- a/Assets/Scripts/TeaNet/Peers/ConnectionManager.cs +++ b/Assets/Scripts/TeaNet/Peers/ConnectionManager.cs @@ -209,8 +209,6 @@ namespace NeonTea.Quakeball.TeaNet.Peers { if (oldStatus == ConnectionStatus.Establishing) { // Update connection status conn.Status = ConnectionStatus.Ready; ProtocolActionQueues[protocol.Identifier].Enqueue(new ConnectionChangedAction(oldStatus, conn.Status, conn)); - } else { - break; // They're cheating! No cheating! } conn.Internal.LatestOutwardReliable = buffer.ReadInt();