<commit_before>module.exports = function (host, sync) {

  return {
    move: function( socket, packet ) {
      var room = host.sockets[socket.id].room;
      var shipName = host.sockets[socket.id].name;
      var playerState = host.rooms[room].gamestate[shipName];
      // copy over the packet data into the canonical state
      for(var i in packet) {
        playerState[i] = packet[i];
      }
      // emit the canonical state to everyone else
      socket.broadcast.to(room).emit('move', playerState);
    },

    fire: function( socket, packet ) {
      var room = host.sockets[socket.id].room;
      socket.get('name', function (err, name) {
          socket.broadcast.to(room).emit('fire', {
              name: packet.name,
              position: packet.position,
              rotation: packet.rotation,
              initialVelocity: packet.initialVelocity
          });
      });
    },

    hit: function( socket, packet ) {
      var room = host.sockets[socket.id].room;
      var response = {
        zappedName: packet.otherPlayerName,
        killerName: packet.yourName
      };
      console.log('hit!!!');
      socket.broadcast.to(room).emit('hit', response);
      socket.emit('hit', response);
    },

  };
};

  // socket.on('move', function(message) {
  //     socket.get('name', function (err, name) {
  //         if (players[name]) {
  //             var player = players[name];

  //             // Update position
  //             player.pos = message.pos;
  //             player.rot = message.rot;
  //             player.aVeloc = message.aVeloc;
  //             player.lVeloc = message.lVeloc;
  //             player.lastMove = message.time;

  //             // Notify players
  //             socket.broadcast.emit('move', {
  //                 name: name,<commit_msg>hit log removed<commit_after>module.exports = function (host, sync) {

  return {
    move: function( socket, packet ) {
      var room = host.sockets[socket.id].room;
      var shipName = host.sockets[socket.id].name;
      var playerState = host.rooms[room].gamestate[shipName];
      // copy over the packet data into the canonical state
      for(var i in packet) {
        playerState[i] = packet[i];
      }
      // emit the canonical state to everyone else
      socket.broadcast.to(room).emit('move', playerState);
    },

    fire: function( socket, packet ) {
      var room = host.sockets[socket.id].room;
      socket.get('name', function (err, name) {
          socket.broadcast.to(room).emit('fire', {
              name: packet.name,
              position: packet.position,
              rotation: packet.rotation,
              initialVelocity: packet.initialVelocity
          });
      });
    },

    hit: function( socket, packet ) {
      var room = host.sockets[socket.id].room;
      var response = {
        zappedName: packet.otherPlayerName,
        killerName: packet.yourName
      };
      socket.broadcast.to(room).emit('hit', response);
      socket.emit('hit', response);
    },

  };
};

  // socket.on('move', function(message) {
  //     socket.get('name', function (err, name) {
  //         if (players[name]) {
  //             var player = players[name];

  //             // Update position
  //             player.pos = message.pos;
  //             player.rot = message.rot;
  //             player.aVeloc = message.aVeloc;
  //             player.lVeloc = message.lVeloc;
  //             player.lastMove = message.time;

  //             // Notify players
  //             socket.broadcast.emit('move', {
  //                 name: name,
{'fraction_non_alphanumeric': 0.13832451989980518, 'fraction_numerical': 0.0, 'mean_word_length': 1.8056206088992974, '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': '4297624', 'n_tokens_mistral': 1044, 'n_tokens_neox': 1031, 'n_words': 216}