diff --git a/apps/arena/lib/arena/game_tracker.ex b/apps/arena/lib/arena/game_tracker.ex index ca98e3b12..7f430709b 100644 --- a/apps/arena/lib/arena/game_tracker.ex +++ b/apps/arena/lib/arena/game_tracker.ex @@ -30,6 +30,7 @@ defmodule Arena.GameTracker do | {:heal, player_id(), non_neg_integer()} | {:kill_by_zone, player_id()} | {:select_bounty, player_id(), bounty_quest_id()} + | {:deathmatch_position, player_id(), pos_integer()} @spec push_event(pid(), event()) :: :ok def push_event(match_pid, event) do @@ -136,6 +137,11 @@ defmodule Arena.GameTracker do |> put_in([:position_on_death], data.position_on_death - 1) end + defp update_data(data, {:deathmatch_position, player_id, position}) do + data + |> put_in([:players, player_id, :position], position) + end + defp update_data(data, {:damage_taken, player_id, amount}) do update_in(data, [:players, player_id, :damage_taken], fn damage_taken -> damage_taken + amount end) end diff --git a/apps/arena/lib/arena/game_updater.ex b/apps/arena/lib/arena/game_updater.ex index ff676c7fa..85fc75736 100644 --- a/apps/arena/lib/arena/game_updater.ex +++ b/apps/arena/lib/arena/game_updater.ex @@ -354,6 +354,7 @@ defmodule Arena.GameUpdater do teams_with_kills |> Enum.reduce(game_state, fn {team, position}, game_state_acc -> Enum.reduce(team.players, game_state_acc, fn player, game_state_acc -> + GameTracker.push_event(self(), {:deathmatch_position, player.id, position}) put_player_position(game_state_acc, player.id, position) end) end)