mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-08-20 12:00:13 +08:00
Resolved: #12 Regions - limit state bandwidth
This commit is contained in:
@@ -32,5 +32,10 @@ EntityController.prototype = {
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
clearRegions: function () {
|
||||
for (var i = 0; i < this.entities.length; i ++) {
|
||||
this.entities[i].setRegion('');
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user