Make ctf_stats award kills again (#788)

* Restore register_on_killedplayer callback in ctf_stats

* Remove unused args

Co-authored-by: savilli <savilli>
Co-authored-by: LoneWolfHT <lonewolf04361@gmail.com>
This commit is contained in:
savilli 2021-02-11 08:18:09 +03:00 committed by GitHub
parent 6a12dcc12a
commit 5f456a504a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View file

@ -417,6 +417,20 @@ function ctf_stats.calculateKillReward(victim, killer, toolcaps)
return reward return reward
end 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) minetest.register_on_dieplayer(function(player)
local main, match = ctf_stats.player(player:get_player_name()) local main, match = ctf_stats.player(player:get_player_name())

View file

@ -55,9 +55,6 @@ function kill_assist.reward_assists(victim, killer, reward)
if name == killer then if name == killer then
color = "0x00FF00" color = "0x00FF00"
main.kills = main.kills + 1
match.kills = match.kills + 1
match.kills_since_death = match.kills_since_death + 1
end end
hud_score.new(name, { hud_score.new(name, {