new system for synchronizing game objects. fixes #74

This commit is contained in:
logsol 2015-06-22 00:14:17 +02:00
parent 3ef3a6abf9
commit 07dad646cf
19 changed files with 194 additions and 162 deletions

View file

@ -27,8 +27,6 @@ function (Doll, Settings, Nc, Exception, ColorConverter, SpectatorDoll, RubeDoll
this.spawned = false;
this.holdingItem = null;
this.spectatorDoll = new SpectatorDoll(this.physicsEngine, "spectatorDoll-" + this.id, this);
Nc.trigger(Nc.ns.core.game.gameObject.add, 'animated', this);
}
Player.prototype.getNickname = function() {
@ -161,7 +159,7 @@ function (Doll, Settings, Nc, Exception, ColorConverter, SpectatorDoll, RubeDoll
Player.prototype.destroy = function () {
Nc.trigger(Nc.ns.core.game.gameObject.remove, 'animated', this);
// FIXME add destroy nc hook
if(this.holdingItem) {
var options = {
@ -174,8 +172,10 @@ function (Doll, Settings, Nc, Exception, ColorConverter, SpectatorDoll, RubeDoll
this.spectatorDoll.destroy();
// doll destoys itself at the end cause its a gameobject
// but on userLeft, the player has to destroy it.
if(this.doll) {
this.doll.destroy();
this.doll.destroy();
}
if(this.playerController) {