mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-07-19 11:19:49 +08:00
Removed set player state from client - should set from server
This commit is contained in:
@@ -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;
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -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();
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
Reference in New Issue
Block a user