Misc bug/exploit fixes

This commit is contained in:
LoneWolfHT 2020-11-21 08:31:36 -08:00
parent f8800fd043
commit 8f2088b92f
3 changed files with 8 additions and 8 deletions

View file

@ -68,7 +68,7 @@ local dont_heal = {}
minetest.register_on_player_hpchange(function(player, hp_change, reason) minetest.register_on_player_hpchange(function(player, hp_change, reason)
local name = player:get_player_name() local name = player:get_player_name()
if reason.type == "drown" or reason.type == "mode_damage" then if reason.type == "drown" or reason.type == "node_damage" then
dont_heal[name] = true dont_heal[name] = true
elseif dont_heal[name] then elseif dont_heal[name] then
dont_heal[name] = nil dont_heal[name] = nil
@ -95,8 +95,8 @@ minetest.override_item("ctf_bandages:bandage", {
local name = user:get_player_name() local name = user:get_player_name()
if ctf.player(pname).team == ctf.player(name).team then if ctf.player(pname).team == ctf.player(name).team then
local nodename = minetest.get_node(object:get_pos()).name local nodename = minetest.get_node(object:get_pos()).name
if dont_heal[pname] or nodename:find("lava") or nodename:find("water") then if dont_heal[pname] or nodename:find("lava") or nodename:find("water") or nodename:find("spike") then
return -- Can't heal players in lava/water return -- Can't heal players in lava/water/spikes
end end
local hp = object:get_hp() local hp = object:get_hp()

View file

@ -11,6 +11,10 @@ local COMBAT_TIMEOUT_TIME = 20
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
return
end
local pname = player:get_player_name() local pname = player:get_player_name()
local hname = hitter:get_player_name() local hname = hitter:get_player_name()
@ -22,10 +26,6 @@ time_from_last_punch, tool_capabilities, dir, damage)
return return
end end
if ctf_respawn_immunity.is_immune(player) then
return
end
local hp = player:get_hp() - damage local hp = player:get_hp() - damage
if hp <= 0 then if hp <= 0 then
if potential_cowards[pname] then if potential_cowards[pname] then

View file

@ -1,2 +1,2 @@
name = anticoward name = anticoward
depends = ctf, ctf_classes depends = ctf, ctf_classes, ctf_match