<commit_before>	//events recevied by RPC

// SEE http://stackoverflow.com/questions/9626059/window-onbeforeunload-in-chrome-what-is-the-most-recent-fix
//detect when a client leaves and send something to server
$(window).on('beforeunload', function() {
	var x = leaveThisJoint();
	return x;
});
function leaveThisJoint() {
	$game.$player.exitAndSave();
}

//new player joining to keep track of
ss.event.on('ss-addPlayer', function(num, player) {
	$game.numPlayers = num;
	$game.$others.add(player);
	console.log("total active players: " + $game.numPlayers);
	$('.activePlayers').text(num + ' active players!');
});
ss.event.on('ss-removePlayer', function(num, playerId) {
	$game.numPlayers = num;
	$game.$others.remove(playerId);
	console.log("total active players: " + $game.numPlayers);
});

ss.event.on('ss-playerMoved', function(moves, id) {
		//check if that quad is relevant to the current player
		//this will also have the player info so as to id the appropriate one
		
		if(id != $game.$player.id) {
			$game.$others.sendMoveInfo(moves, id);
		}
		

});
//all this breakdown will be on the server side, not client side,
//but we will pass the tiles info
ss.event.on('ss-seedDropped', function(bombed) {
	$game.$map.newBomb(bombed);
});


//new message from chat
ss.event.on('ss-newMessage', function(message, id) {
	
	if(id === $game.$player.id) {
		$game.$player.message(message);
	}
	else {
		$game.$others.message(message, id);
	}

});




$('.seedButton').bind("click", (function () {
	//$game.$player.seedMode = $game.$player.seedMode ? false : true;
	if(!$game.inTransit && !$game.$player.isMoving) {
		$game.$player.seedMode = !$game.$player.seedMode;
	}
	
}));
$(window).bind("keypress", (function (key) {
	//$game.$player.seedMode = $game.$player.seedMode ? false : true;
	if(!$game.inTransit && !$game.$player.isMoving && key.which === 115 && $game.ready) {
			//$game.$player.dropSeed({mouse:false});
	}
}));
//change cursor on mouse move
$('.gameboard').mousemove(function(m) {
	if( !$game.inTransit && !$game.$player.isMoving && !$game.$resources.isShowing && $game.ready){
	
		var mInfo = {
			x: m.pageX,
			y: m.pageY,
			offX: this.offsetLeft,
			offY: this.offsetTop,
			debug: false
		};
		$game.$mouse.updateMouse(mInfo, false);
	}
});

//figure out if we shoupdatuld transition (or do other stuff later)
$('.gameboard').click(function(m) {

	if(!$game.inTransit && !$game.$player.isMoving && !$game.$resources.isShowing && !$game.$player.inventoryShowing && $game.running){
			var mInfo = {
			x: m.pageX,
			y: m.pageY,
			offX: this.offsetLeft,
			offY: this.offsetTop,<commit_msg>cleaned up click events<commit_after>	//events recevied by RPC

// SEE http://stackoverflow.com/questions/9626059/window-onbeforeunload-in-chrome-what-is-the-most-recent-fix
//detect when a client leaves and send something to server
$(window).on('beforeunload', function() {
	var x = leaveThisJoint();
	return x;
});
function leaveThisJoint() {
	$game.$player.exitAndSave();
}

//new player joining to keep track of
ss.event.on('ss-addPlayer', function(num, player) {
	$game.numPlayers = num;
	$game.$others.add(player);
	$('.activePlayers').text(num + ' active players!');
});


ss.event.on('ss-removePlayer', function(num, playerId) {
	$game.numPlayers = num;
	$game.$others.remove(playerId);
	$('.activePlayers').text(num + ' active players!');
});

ss.event.on('ss-playerMoved', function(moves, id) {
		//check if that quad is relevant to the current player
		//this will also have the player info so as to id the appropriate one
		
		if(id != $game.$player.id) {
			$game.$others.sendMoveInfo(moves, id);
		}
		

});
//all this breakdown will be on the server side, not client side,
//but we will pass the tiles info
ss.event.on('ss-seedDropped', function(bombed) {
	$game.$map.newBomb(bombed);
});


//new message from chat
ss.event.on('ss-newMessage', function(message, id) {
	
	if(id === $game.$player.id) {
		$game.$player.message(message);
	}
	else {
		$game.$others.message(message, id);
	}

});




$('.seedButton').bind("click", (function () {
	//$game.$player.seedMode = $game.$player.seedMode ? false : true;
	if(!$game.inTransit && !$game.$player.isMoving) {
		$game.$player.seedMode = !$game.$player.seedMode;
	}
	
}));
$(window).bind("keypress", (function (key) {
	//$game.$player.seedMode = $game.$player.seedMode ? false : true;
	if(!$game.inTransit && !$game.$player.isMoving && key.which === 115 && $game.ready) {
			//$game.$player.dropSeed({mouse:false});
	}
}));
//change cursor on mouse move
$('.gameboard').mousemove(function(m) {
	if( !$game.inTransit && !$game.$player.isMoving && !$game.$resources.isShowing && $game.ready){
	
		var mInfo = {
			x: m.pageX,
			y: m.pageY,
			offX: this.offsetLeft,
			offY: this.offsetTop,
			debug: false
		};
		$game.$mouse.updateMouse(mInfo, false);
	}
});

//figure out if we shoupdatuld transition (or do other stuff later)
$('.gameboard').click(function(m) {

	if(!$game.inTransit && !$game.$player.isMoving && !$game.$resources.isShowing && !$game.$player.inventoryShowing && $game.running && !$game.$gnome.isChat){
			var mInfo = {
			x: m.pageX,
			y: m.pageY,
			offX: this.offsetLeft,
			offY: this.offsetTop,
{'fraction_non_alphanumeric': 0.19145660958245142, 'fraction_numerical': 0.0038483740619588225, 'mean_word_length': 4.106090373280943, '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': '6687747', 'n_tokens_mistral': 1984, 'n_tokens_neox': 1846, 'n_words': 394}