Change fall damage to use combat system

This commit is contained in:
LoneWolfHT 2020-10-13 08:51:53 -07:00
parent 9666b03ea3
commit 90d73f0587
2 changed files with 2 additions and 11 deletions

View file

@ -136,7 +136,7 @@ ctf.register_on_killedplayer(function(victim, killer, stack, tool_caps)
if tool_caps.damage_groups.combat_log then if tool_caps.damage_groups.combat_log then
victim = victim .. " (Combat Log)" victim = victim .. " (Combat Log)"
elseif tool_caps.damage_groups.suicide then elseif tool_caps.damage_groups.suicide then
victim = victim .. " (Suicide)" victim = victim .. " (Suicide?)"
end end
ctf_events.post("kill_" .. type, killer, victim) ctf_events.post("kill_" .. type, killer, victim)

View file

@ -4,15 +4,6 @@ local potential_cowards = {}
local TIMER_UPDATE_INTERVAL = 2 local TIMER_UPDATE_INTERVAL = 2
local COMBAT_TIMEOUT_TIME = 20 local COMBAT_TIMEOUT_TIME = 20
-- Prevent fall damage from killing players
minetest.register_on_player_hpchange(function(player, hp_change, reason)
if reason.type == "fall" and player:get_hp() + hp_change <= 0 then
return (-player:get_hp()) + 1
end
return hp_change
end, true)
-- --
--- Make suicides and combat logs award last puncher with kill --- Make suicides and combat logs award last puncher with kill
-- --
@ -76,7 +67,7 @@ end)
minetest.register_on_dieplayer(function(player, reason) minetest.register_on_dieplayer(function(player, reason)
local pname = player:get_player_name() local pname = player:get_player_name()
if reason.type == "node_damage" or reason.type == "drown" then if reason.type == "node_damage" or reason.type == "drown" or reason.type == "fall" then
if potential_cowards[pname] then if potential_cowards[pname] then
local hname = potential_cowards[pname].puncher local hname = potential_cowards[pname].puncher
local last_attacker = minetest.get_player_by_name(hname) local last_attacker = minetest.get_player_by_name(hname)