Resolved: #12 Regions - limit state bandwidth

This commit is contained in:
Jeremiah Billmann
2013-08-23 13:30:13 -04:00
parent e805c2d991
commit 790c69305a
8 changed files with 132 additions and 30 deletions
+5
View File
@@ -32,5 +32,10 @@ EntityController.prototype = {
return;
}
}
},
clearRegions: function () {
for (var i = 0; i < this.entities.length; i ++) {
this.entities[i].setRegion('');
}
}
};
+4 -4
View File
@@ -9,11 +9,11 @@ function PlayerController (maxHistorySecondBuffer) {
PlayerController.prototype = Object.create(entityController.prototype);
PlayerController.prototype.add = function (client) {
PlayerController.prototype.add = function (socket) {
var newPlayer, playerFound = false;
this.entities.some(function (player) {
if (player.client.id === client.id) {
if (player.id === socket.id) {
newPlayer = player;
playerFound = true;
return true;
@@ -21,7 +21,7 @@ PlayerController.prototype.add = function (client) {
});
if (!playerFound) {
newPlayer = new player(client, this.maxHistorySecondBuffer);
newPlayer = new player(socket, this.maxHistorySecondBuffer);
this.entities.push(newPlayer);
}
return newPlayer;
@@ -29,7 +29,7 @@ PlayerController.prototype.add = function (client) {
PlayerController.prototype.addInput = function (id, input, sequence, time) {
this.entities.some(function (player) {
if (player.client.id === id) {
if (player.id === id) {
player.inputs.push({ input: input, seq: sequence, time: time });
return true;
}