Fix shit
This commit is contained in:
parent
1d8e027558
commit
276c1b265e
@ -51,6 +51,7 @@ namespace NeonTea.Quakeball.Net.Instances {
|
|||||||
SelfIdentPckt ident = (SelfIdentPckt)packet;
|
SelfIdentPckt ident = (SelfIdentPckt)packet;
|
||||||
LocalPlayer.Id = ident.PlayerId;
|
LocalPlayer.Id = ident.PlayerId;
|
||||||
Players.Add(LocalPlayer.Id, LocalPlayer);
|
Players.Add(LocalPlayer.Id, LocalPlayer);
|
||||||
|
Debug.Log($"I got self-identified as {LocalPlayer.Id}");
|
||||||
|
|
||||||
SpawnPckt spawn = new SpawnPckt();
|
SpawnPckt spawn = new SpawnPckt();
|
||||||
spawn.Location = LocalPlayer.Controlled.transform.position;
|
spawn.Location = LocalPlayer.Controlled.transform.position;
|
||||||
|
@ -40,12 +40,13 @@ namespace NeonTea.Quakeball.Net.Instances {
|
|||||||
SpawnPckt spawn = new SpawnPckt();
|
SpawnPckt spawn = new SpawnPckt();
|
||||||
spawn.PlayerId = p.Id;
|
spawn.PlayerId = p.Id;
|
||||||
spawn.Location = p.Controlled.transform.position;
|
spawn.Location = p.Controlled.transform.position;
|
||||||
Peer.SendReliable(conn.uid, spawn);
|
Peer.SendReliableLater(conn.uid, spawn);
|
||||||
}
|
}
|
||||||
NetPlayer RemotePlayer = new NetPlayer(PlayerIdCounter++);
|
NetPlayer RemotePlayer = new NetPlayer(PlayerIdCounter++);
|
||||||
Players.Add(RemotePlayer.Id, RemotePlayer);
|
Players.Add(RemotePlayer.Id, RemotePlayer);
|
||||||
SelfIdentPckt ident = new SelfIdentPckt();
|
SelfIdentPckt ident = new SelfIdentPckt();
|
||||||
ident.PlayerId = RemotePlayer.Id;
|
ident.PlayerId = RemotePlayer.Id;
|
||||||
|
Debug.Log("Send self-ident!");
|
||||||
Peer.SendReliable(conn.uid, ident);
|
Peer.SendReliable(conn.uid, ident);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,6 +55,7 @@ namespace NeonTea.Quakeball.Net.Instances {
|
|||||||
|
|
||||||
public override void Handle(Connection conn, Packet packet) {
|
public override void Handle(Connection conn, Packet packet) {
|
||||||
if (packet is SpawnPckt) {
|
if (packet is SpawnPckt) {
|
||||||
|
Debug.Log("Do i ever get it");
|
||||||
SpawnPckt spawn = (SpawnPckt)packet;
|
SpawnPckt spawn = (SpawnPckt)packet;
|
||||||
if (Players[conn.uid].Controlled == null) {
|
if (Players[conn.uid].Controlled == null) {
|
||||||
GameObject obj = Net.SpawnPlayer(spawn.Location);
|
GameObject obj = Net.SpawnPlayer(spawn.Location);
|
||||||
|
@ -29,7 +29,9 @@ namespace NeonTea.Quakeball.Net {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void Update() {
|
private void Update() {
|
||||||
Net.Singleton.Instance.Peer.Update();
|
if (Net.Singleton.Instance != null) {
|
||||||
|
Net.Singleton.Instance.Peer.Update();
|
||||||
|
}
|
||||||
if (Terminal != null && Terminal.isActiveAndEnabled) {
|
if (Terminal != null && Terminal.isActiveAndEnabled) {
|
||||||
while (MessageQueue.Count > 0) {
|
while (MessageQueue.Count > 0) {
|
||||||
Terminal.Println(MessageQueue.Dequeue());
|
Terminal.Println(MessageQueue.Dequeue());
|
||||||
|
@ -209,8 +209,6 @@ namespace NeonTea.Quakeball.TeaNet.Peers {
|
|||||||
if (oldStatus == ConnectionStatus.Establishing) { // Update connection status
|
if (oldStatus == ConnectionStatus.Establishing) { // Update connection status
|
||||||
conn.Status = ConnectionStatus.Ready;
|
conn.Status = ConnectionStatus.Ready;
|
||||||
ProtocolActionQueues[protocol.Identifier].Enqueue(new ConnectionChangedAction(oldStatus, conn.Status, conn));
|
ProtocolActionQueues[protocol.Identifier].Enqueue(new ConnectionChangedAction(oldStatus, conn.Status, conn));
|
||||||
} else {
|
|
||||||
break; // They're cheating! No cheating!
|
|
||||||
}
|
}
|
||||||
conn.Internal.LatestOutwardReliable = buffer.ReadInt();
|
conn.Internal.LatestOutwardReliable = buffer.ReadInt();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user