Removed set player state from client - should set from server

This commit is contained in:
Jeremiah Billmann
2013-07-14 12:02:24 -04:00
parent 4911079981
commit 5a778589ea
7 changed files with 3 additions and 46 deletions
@@ -31,13 +31,5 @@ EntityController.prototype = {
return;
}
}
},
setState: function (id, state) {
this.entities.some(function (entity) {
if (entity.client.id === id) {
entity.state = state;
return true;
}
});
}
};
@@ -34,14 +34,4 @@ PlayerController.prototype.addInput = function (id, input, sequence, time) {
return true;
}
});
};
PlayerController.prototype.setState = function (id, state) {
this.entities.some(function (player) {
if (player.client.id === id) {
player.state = state;
player.inputs = [];
return true;
}
});
};
+1 -16
View File
@@ -13,8 +13,7 @@ options = {
onPlayerConnect: function (socket),
onPlayerInput: function (socket, input),
onPlayerDisconnect: function (socket),
onPing: function (socket, data),
onPlayerState: function (socket, data),
onPing: function (socket, data)
}
*/
@@ -62,13 +61,6 @@ GarageServer.prototype.registerSocketEvents = function (options) {
}
self.onPing(socket, data, options);
});
socket.on('playerState', function (data) {
if (options.logging) {
console.log('garageserver.io:: socket playerState ' + data);
}
self.onPlayerState(socket, data, options);
});
});
};
@@ -101,13 +93,6 @@ GarageServer.prototype.onPing = function (socket, data, options) {
}
};
GarageServer.prototype.onPlayerState = function (socket, data, options) {
this.game.setPlayerState(socket.id, data);
if (options.onPlayerState) {
options.onPlayerState(socket, data);
}
};
GarageServer.prototype.start = function () {
this.game.start();
};
-4
View File
@@ -100,10 +100,6 @@ GarageServerGame.prototype.removeEntity = function (id) {
this.entityController.remove(id);
};
GarageServerGame.prototype.setPlayerState = function (id, state) {
this.playerController.setState(id, state);
};
GarageServerGame.prototype.addPlayerInput = function (id, input, sequence, time) {
this.playerController.addInput(id, input, sequence, time);
};