mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
fixed crashing player destroy
This commit is contained in:
parent
a4120f6ff5
commit
4bf4eb8b35
3 changed files with 6 additions and 4 deletions
|
|
@ -166,7 +166,6 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, reque
|
||||||
|
|
||||||
var player = this.players[playerId];
|
var player = this.players[playerId];
|
||||||
player.spawn(x, y);
|
player.spawn(x, y);
|
||||||
this.onGameObjectAdd('animated', player);
|
|
||||||
|
|
||||||
if(options.holdingItemUid) {
|
if(options.holdingItemUid) {
|
||||||
this.onHandActionResponse({
|
this.onHandActionResponse({
|
||||||
|
|
|
||||||
|
|
@ -79,9 +79,7 @@ function (PhysicsEngine, TiledLevel, Player, Nc, Doll) {
|
||||||
console.warn("User (", userId ,") left who has not joined");
|
console.warn("User (", userId ,") left who has not joined");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onGameObjectRemove('animated', player);
|
|
||||||
|
|
||||||
player.destroy();
|
player.destroy();
|
||||||
delete this.players[userId];
|
delete this.players[userId];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ function (Doll, Settings, Nc, Exception, SpectatorDoll, RagDoll) {
|
||||||
this.isSpawned = false;
|
this.isSpawned = false;
|
||||||
this.holdingItem = null;
|
this.holdingItem = null;
|
||||||
this.spectatorDoll = new SpectatorDoll(this.physicsEngine, "spectatorDoll-" + this.id, this);
|
this.spectatorDoll = new SpectatorDoll(this.physicsEngine, "spectatorDoll-" + this.id, this);
|
||||||
|
|
||||||
|
Nc.trigger(Nc.ns.core.game.gameObject.add, 'animated', this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Player.prototype.getActiveDoll = function() {
|
Player.prototype.getActiveDoll = function() {
|
||||||
|
|
@ -137,6 +139,9 @@ function (Doll, Settings, Nc, Exception, SpectatorDoll, RagDoll) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Player.prototype.destroy = function () {
|
Player.prototype.destroy = function () {
|
||||||
|
|
||||||
|
Nc.trigger(Nc.ns.core.game.gameObject.remove, 'animated', this);
|
||||||
|
|
||||||
if(this.holdingItem) {
|
if(this.holdingItem) {
|
||||||
this.throw(0, 0, this.holdingItem);
|
this.throw(0, 0, this.holdingItem);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue