Skip to content

Commit

Permalink
even more hot fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas-Petervary committed Dec 2, 2024
1 parent 49614b0 commit bff1e09
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/networking/ConnectionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export default class ConnectionManager {
console.log(`Connection with "${connection.peer}" closed`);
delete this.connections[connection.peer];
g_Lobby.refreshLobbyUI()
g_Lobby.onLeave(connection.peer);
});
}

Expand Down
5 changes: 5 additions & 0 deletions src/networking/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ export class Server {
g_ConnectionManager.connections[peerId]._conn.close();
}

onLeave(peerId) {
this.players[peerId].remove();
delete this.players[peerId];
}

readyButton() {
this.lobbyReadied = !this.lobbyReadied;

Expand Down
6 changes: 6 additions & 0 deletions src/render/PhysicsMesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ export class PhysicsMesh {
this.mesh.position.copy( _pos(this.body.position) );
this.mesh.quaternion.copy( _quat(this.body.quaternion) );
}

remove() {
g_renderer.scene.remove(this.mesh);
g_world.world.removeBody(this.body);
g_world.objects.splice(g_world.objects.indexOf(this), 1);
}
}

function _pos(pos) {
Expand Down

0 comments on commit bff1e09

Please sign in to comment.