Make combat log count as death

This commit is contained in:
LoneWolfHT 2021-02-08 16:08:49 -08:00
parent f8cb85be9f
commit eb71f5e385

View file

@ -3,13 +3,14 @@
potential_cowards = {} potential_cowards = {}
local TIMER_UPDATE_INTERVAL = 2 local TIMER_UPDATE_INTERVAL = 2
local COMBAT_TIMEOUT_TIME = 20 local COMBAT_TIMEOUT_TIME = 20
local COMBATLOG_SCORE_PENALTY = 10
-- --
--- Make suicides and combat logs award last puncher with kill --- Make suicides and combat logs award last puncher with kill
-- --
minetest.register_on_punchplayer(function(player, hitter, minetest.register_on_punchplayer(function(player, hitter,
time_from_last_punch, tool_capabilities, dir, damage) time_from_last_punch, tool_capabilities, dir, damage)
if player and hitter then if player and hitter then
if ctf_respawn_immunity.is_immune(player) or ctf_match.is_in_build_time() then if ctf_respawn_immunity.is_immune(player) or ctf_match.is_in_build_time() then
return return
@ -136,6 +137,17 @@ minetest.register_on_leaveplayer(function(player, timeout)
) )
end end
local main, match = ctf_stats.player(pname)
if main and match then
main.deaths = main.deaths + 1
match.deaths = match.deaths + 1
main.score = main.score - COMBATLOG_SCORE_PENALTY
match.score = match.score - COMBATLOG_SCORE_PENALTY
match.kills_since_death = 0
ctf_stats.request_save()
end
potential_cowards[pname] = nil potential_cowards[pname] = nil
end end
end) end)