<commit_before>var garageServerGame = require('./garageservergame');

function GarageServer (socketio, options) {
    this.io = socketio;
    this.registerSocketEvents(options);
    this.game = new garageServerGame.createGame(options);
}

GarageServer.prototype.registerSocketEvents = function (options) {
    var self = this;
    
    self.io.of('/garageserver.io').on('connection', function (socket) {
        console.log('garageserver.io:: socket ' + socket.id + ' connection');
        self.onPlayerConnect(socket, options);
        
        socket.on('disconnect', function () {
            console.log('garageserver.io:: socket ' + socket.id + ' disconnect');
            self.onPlayerDisconnect(socket, options);
        });
        
        socket.on('input', function (input) {
            self.onPlayerInput(socket, options);
        });
        
        socket.on('ping', function () {
            self.onPlayerInput(socket, options);
        });
        
    });
};

GarageServer.prototype.onPlayerConnect = function (socket, callback) {
    this.game.addPlayer(socket);
    if(callback.onPlayerConnect) {
        callback(socket);
    }
};

GarageServer.prototype.onPlayerDisconnect = function (socket, callback) {
    this.game.removePlayer(socket);
    if(callback.onPlayerDisconnect) {
        callback(socket);
    }
};

GarageServer.prototype.onPlayerInput = function (socket, input, callback) {
    
};

GarageServer.prototype.onPing = function(socket, callback) {

};

exports.createGarageServer = function (io, options){<commit_msg>Minor cleanup...<commit_after>var garageServerGame = require('./garageservergame');

function GarageServer (socketio, options) {
    this.io = socketio;
    this.registerSocketEvents(options);
    this.game = new garageServerGame.createGame(options);
}

GarageServer.prototype.registerSocketEvents = function (options) {
    var self = this;
    
    self.io.of('/garageserver.io').on('connection', function (socket) {
        console.log('garageserver.io:: socket ' + socket.id + ' connection');
        self.onPlayerConnect(socket, options);
        
        socket.on('disconnect', function () {
            console.log('garageserver.io:: socket ' + socket.id + ' disconnect');
            self.onPlayerDisconnect(socket, options);
        });
        
        socket.on('input', function (input) {
            console.log('garageserver.io:: socket input');
            self.onPlayerInput(socket, input, options);
        });
        
        socket.on('ping', function () {
            console.log('garageserver.io:: socket ping');
            self.onPlayerInput(socket, options);
        });
        
    });
};

GarageServer.prototype.onPlayerConnect = function (socket, options) {
    this.game.addPlayer(socket);
    if(options.onPlayerConnect) {
        options(socket);
    }
};

GarageServer.prototype.onPlayerDisconnect = function (socket, options) {
    this.game.removePlayer(socket);
    if(options.onPlayerDisconnect) {
        options(socket);
    }
};

GarageServer.prototype.onPlayerInput = function (socket, input, options) {
    
};

GarageServer.prototype.onPing = function(socket, options) {

};

exports.createGarageServer = function (io, options){
{'fraction_non_alphanumeric': 0.13581395348837208, 'fraction_numerical': 0.0, 'mean_word_length': 2.982716049382716, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7531513', 'n_tokens_mistral': 937, 'n_tokens_neox': 911, 'n_words': 149}