Option to disable friendly fire

master
rubenwardy 2015-09-01 18:27:43 +01:00
parent cd3bd99f3b
commit 665030b5d5
2 changed files with 13 additions and 1 deletions

View File

@ -145,7 +145,8 @@ function ctf.init()
ctf._set("default_diplo_state", "war")
ctf._set("hud", true)
ctf._set("remove_player_on_leave", false)
ctf._set("autoalloc_on_joinplayer", true)
ctf._set("autoalloc_on_joinplayer", true)
ctf._set("friendly_fire", true)
for i = 1, #ctf.registered_on_init do

View File

@ -420,3 +420,14 @@ minetest.register_on_leaveplayer(function(player)
ctf.remove_player(player:get_player_name())
end
end)
-- Disable friendly fire.
minetest.register_on_punchplayer(function(player, hitter)
local to = ctf.player(player:get_player_name())
local from = ctf.player(hitter:get_player_name())
if not ctf.setting("friendly_fire") and to.team == from.team and
to.team ~= "" and to.team ~= nil then
return true
end
end)