From 8b8093b7713479b519c03768ef914cb8f1c99bc9 Mon Sep 17 00:00:00 2001 From: logsol Date: Sat, 1 Oct 2016 16:08:01 +0200 Subject: [PATCH] Stops sending gameCommands between beginRound and clientReady Listen for beginRound control command to set client to be unready again so it can load its new level without getting any gameCommands like worldUpdate --- app/Game/Channel/User.js | 10 ++++++++++ app/Game/Client/Networker.js | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Game/Channel/User.js b/app/Game/Channel/User.js index 1bc4b60..d8fcd78 100755 --- a/app/Game/Channel/User.js +++ b/app/Game/Channel/User.js @@ -61,6 +61,16 @@ function(Parent, Nc, ProtocolHelper, ProtocolParser) { var recipient = this.id; var data = ProtocolHelper.encodeCommand(command, options); + /** + * Listen for beginRound control command + * to set client to be unready again + * so it can load its new level without getting + * any gameCommands like worldUpdate + */ + if(command == "beginRound") { + this.isReady = false; + } + Nc.trigger(Nc.ns.channel.to.server.controlCommand.send, recipient, data); }; diff --git a/app/Game/Client/Networker.js b/app/Game/Client/Networker.js index 9d35cba..fabdc3b 100755 --- a/app/Game/Client/Networker.js +++ b/app/Game/Client/Networker.js @@ -191,7 +191,6 @@ function (ProtocolHelper, GameController, User, Nc, Settings, DomController) { if(this.gameController) { this.gameController.destroy(); - delete this.gameController; } this.gameController = new GameController(options);