minetest.register_tool('lobby:shank', {
   description = 'Traitor\'s Shank',
   inventory_image = 'lobby_shank.png',
   range = 5,
   groups = {not_in_creative_inventory=1},
   on_use = function(itemstack, player, pointed_thing)
      local physics_table = player:get_physics_override()
      if physics_table.speed ~= 0 then
         local traitor = player:get_player_name()
         local obj = pointed_thing.ref
         if obj and pointed_thing.type == "object" then
            local player_name = obj:get_player_name()
            if player_name ~= '' then
               local map_name = lobby.game[traitor]
               local victim = minetest.get_player_by_name(player_name)
               local player_inv = player:get_inventory()
               victim:set_hp(0)
               local death_pos = player:get_pos()
               minetest.sound_play('lobby_kill', {pos = death_pos, gain = 1, max_hear_distance = 16})
               local count = lobby.map[map_name]-- or 0
               if count > 0 then
                  minetest.chat_send_player(traitor, 'Weapon Cooldown.')
                  minetest.after(10, function()
                     local map_id = lobby.game[traitor]
                     if map_id ~= 'lobby' then
                        player_inv:add_item('main', 'lobby:shank')
                     end
                  end)
               elseif count == 0 then
                  lobby.traitor_win(traitor, map_name)
               end
               itemstack:take_item()
               return itemstack
            end
         end
      end
   end,
   on_drop = lobby.no_drop
})
