From 5f456a504a4728b6a81aab7db280746e92ba0c1f Mon Sep 17 00:00:00 2001 From: savilli <78875209+savilli@users.noreply.github.com> Date: Thu, 11 Feb 2021 08:18:09 +0300 Subject: [PATCH] Make ctf_stats award kills again (#788) * Restore register_on_killedplayer callback in ctf_stats * Remove unused args Co-authored-by: savilli Co-authored-by: LoneWolfHT --- mods/ctf/ctf_stats/init.lua | 14 ++++++++++++++ mods/pvp/kill_assist/init.lua | 3 --- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/mods/ctf/ctf_stats/init.lua b/mods/ctf/ctf_stats/init.lua index e3ec456..4c10bd2 100644 --- a/mods/ctf/ctf_stats/init.lua +++ b/mods/ctf/ctf_stats/init.lua @@ -417,6 +417,20 @@ function ctf_stats.calculateKillReward(victim, killer, toolcaps) return reward end +ctf.register_on_killedplayer(function(victim, killer) + -- Suicide is not encouraged here at CTF + if victim == killer then + return + end + local main, match = ctf_stats.player(killer) + if main and match then + main.kills = main.kills + 1 + match.kills = match.kills + 1 + match.kills_since_death = match.kills_since_death + 1 + _needs_save = true + end +end) + minetest.register_on_dieplayer(function(player) local main, match = ctf_stats.player(player:get_player_name()) diff --git a/mods/pvp/kill_assist/init.lua b/mods/pvp/kill_assist/init.lua index 09d4ce4..25d5e38 100644 --- a/mods/pvp/kill_assist/init.lua +++ b/mods/pvp/kill_assist/init.lua @@ -55,9 +55,6 @@ function kill_assist.reward_assists(victim, killer, reward) if name == killer then color = "0x00FF00" - main.kills = main.kills + 1 - match.kills = match.kills + 1 - match.kills_since_death = match.kills_since_death + 1 end hud_score.new(name, {