diff --git a/client/garageserver.io.js b/client/garageserver.io.js index 38481f8..113ca73 100644 --- a/client/garageserver.io.js +++ b/client/garageserver.io.js @@ -38,16 +38,10 @@ window.GarageServerIO = (function (window, socketio) { any: function () { return this.inputs.length > 0; }, - getSequence: function () { - return this.sequenceNumber; - }, addInput: function (input) { this.sequenceNumber += 1; this.inputs.push({ input: input, seq: this.sequenceNumber }); }, - getInputs: function () { - return this.inputs; - }, removeUpToSequence: function (seq) { for (var i = 0; i < this.inputs.length; i ++) { if (this.inputs[i].seq == seq) { @@ -215,7 +209,7 @@ window.GarageServerIO = (function (window, socketio) { if (_options.clientSidePrediction && _options.onUpdatePlayerPhysics) { _stateController.state = _options.onUpdatePlayerPhysics(_stateController.state, [{ input: clientInput }]); } - _socket.emit('input', { input: clientInput, seq: _inputController.getSequence() }); + _socket.emit('input', { input: clientInput, seq: _inputController.sequenceNumber }); }, updateState = function (data) { @@ -241,7 +235,7 @@ window.GarageServerIO = (function (window, socketio) { _inputController.removeUpToSequence(playerState.seq); if (_options.clientSidePrediction && _inputController.any()) { - _stateController.state = _options.onUpdatePlayerPhysics(_stateController.state, _inputController.getInputs()); + _stateController.state = _options.onUpdatePlayerPhysics(_stateController.state, _inputController.inputs); } } else { _playerController.forEach(function (player) {