mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
merges from rubedoll
This commit is contained in:
commit
8e9ce62e19
4 changed files with 23 additions and 101 deletions
|
|
@ -5,10 +5,11 @@ define([
|
|||
"Lib/Utilities/NotificationCenter",
|
||||
"Game/" + GLOBALS.context + "/GameObjects/Doll",
|
||||
"Game/" + GLOBALS.context + "/GameObjects/GameObject",
|
||||
"Lib/Utilities/Assert"
|
||||
"Game/" + GLOBALS.context + "/GameObjects/Item",
|
||||
"Lib/Utilities/Assert",
|
||||
],
|
||||
|
||||
function (PhysicsEngine, TiledLevel, Player, Nc, Doll, GameObject, Assert) {
|
||||
function (PhysicsEngine, TiledLevel, Player, Nc, Doll, GameObject, Item, Assert) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
|
@ -104,6 +105,8 @@ function (PhysicsEngine, TiledLevel, Player, Nc, Doll, GameObject, Assert) {
|
|||
console.warn("User (", userId ,") left who has not joined");
|
||||
return;
|
||||
}
|
||||
|
||||
this.clearItemsOfPlayerFingerPrints(player);
|
||||
|
||||
player.destroy();
|
||||
delete this.players[userId];
|
||||
|
|
@ -115,6 +118,20 @@ function (PhysicsEngine, TiledLevel, Player, Nc, Doll, GameObject, Assert) {
|
|||
return player;
|
||||
};
|
||||
|
||||
GameController.prototype.clearItemsOfPlayerFingerPrints = function(player) {
|
||||
for (var key in this.gameObjects) {
|
||||
for (var i = 0; i < this.gameObjects[key].length; i++) { // to go through animated and fixed.
|
||||
var gameObject = this.gameObjects[key][i];
|
||||
if (gameObject instanceof Item) {
|
||||
|
||||
if (gameObject.getLastMovedBy() && gameObject.getLastMovedBy().player === player) {
|
||||
gameObject.setLastMovedBy(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
GameController.prototype.destroy = function () {
|
||||
var i = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue