chuck.js/lib/Chuck/ServerGame.js
2012-07-14 00:04:41 +02:00

33 lines
No EOL
933 B
JavaScript

define(["Chuck/Processors/ServerProcessor"], function(ServerProcessor) {
function ServerGame(channel) {
this.channel = channel;
this.serverProcessor = new ServerProcessor(this);
}
ServerGame.prototype.loadLevel = function(path) {
this.serverProcessor.loadLevel(path);
}
ServerGame.prototype.progressGameCommandFromUser = function(command, options, user) {
this.serverProcessor.progressGameCommandFromId(command, options, user.id);
}
ServerGame.prototype.destruct = function() {
this.serverProcessor.destruct();
}
ServerGame.prototype.createPlayerForUser = function(user) {
this.serverProcessor.createPlayerWithId(user.id);
}
ServerGame.prototype.userIdLeft = function(userId) {
this.serverProcessor.userIdLeft(userId);
};
ServerGame.prototype.updateClientsWorld = function(update_world) {
this.channel.sendCommandToAllUsers('gameCommand', {worldUpdate: update_world});
}
return ServerGame;
});