merges from rubedoll

This commit is contained in:
logsol 2015-06-22 00:22:00 +02:00
commit 8e9ce62e19
4 changed files with 23 additions and 101 deletions

View file

@ -14,6 +14,9 @@ function (Parent) {
Item.prototype = Object.create(Parent.prototype);
Item.prototype.getLastMovedBy = function() {
return this.lastMoved;
}
Item.prototype.setLastMovedBy = function(player) {

View file

@ -91,7 +91,7 @@ function () {
CHANNEL_DEFAULT_MAX_USERS: 40,
CHANNEL_DEFAULT_SCORE_LIMIT: 10,
CHANNEL_DEFAULT_LEVELS: ["debug"],
CHANNEL_RECORD_SESSION: true,
CHANNEL_RECORD_SESSION: false,
// ME STATE
ME_STATE_MAX_DIFFERENCE_METERS: 1,

View file

@ -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;