mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-07-05 17:30:44 +08:00
Reduced size of internal JSON property names.
This commit is contained in:
@@ -346,15 +346,15 @@ var GarageServerIO = (function (socketio) {
|
||||
},
|
||||
|
||||
update = function (data) {
|
||||
_stateController.setTime(data.time);
|
||||
_stateController.setTime(data.t);
|
||||
|
||||
updatePlayers(data);
|
||||
updateEntities(data);
|
||||
},
|
||||
|
||||
updatePlayers = function (data) {
|
||||
data.playerStates.forEach(function (playerState) {
|
||||
updateEntity(_playerController, playerState, data.time);
|
||||
data.ps.forEach(function (playerState) {
|
||||
updateEntity(_playerController, playerState, data.t);
|
||||
|
||||
if (_options.onPlayerUpdate) {
|
||||
_options.onPlayerUpdate(playerState[1]);
|
||||
@@ -363,8 +363,8 @@ var GarageServerIO = (function (socketio) {
|
||||
},
|
||||
|
||||
updateEntities = function (data) {
|
||||
data.entityStates.forEach(function (entityState) {
|
||||
updateEntity(_entityController, entityState, data.time);
|
||||
data.es.forEach(function (entityState) {
|
||||
updateEntity(_entityController, entityState, data.t);
|
||||
|
||||
if (_options.onEntityUpdate) {
|
||||
_options.onEntityUpdate(entityState[1]);
|
||||
|
||||
@@ -27,17 +27,17 @@ GarageServerGame.prototype.stop = function () {
|
||||
|
||||
GarageServerGame.prototype.broadcastState = function () {
|
||||
var i = 0, currentTime = new Date().getTime() - this.startTime,
|
||||
state = { time: currentTime, playerStates: [], entityStates: [] };
|
||||
state = { t: currentTime, ps: [], es: [] };
|
||||
|
||||
if (this.regions.length > 0) {
|
||||
for (i = 0; i < this.regions.length; i ++) {
|
||||
state.playerStates = this.getStateByRegion(this.playerController, this.regions[i]);
|
||||
state.entityStates = this.getStateByRegion(this.entityController, this.regions[i]);
|
||||
state.ps = this.getStateByRegion(this.playerController, this.regions[i]);
|
||||
state.es = this.getStateByRegion(this.entityController, this.regions[i]);
|
||||
this.broadcastCallback(state, this.regions[i]);
|
||||
}
|
||||
} else {
|
||||
state.playerStates = this.getState(this.playerController);
|
||||
state.entityStates = this.getState(this.entityController);
|
||||
state.ps = this.getState(this.playerController);
|
||||
state.es = this.getState(this.entityController);
|
||||
this.broadcastCallback(state);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user