Skip to content
This repository has been archived by the owner on Aug 29, 2019. It is now read-only.

Commit

Permalink
Option to disable friendly fire
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Sep 1, 2015
1 parent cd3bd99 commit 665030b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ctf/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions ctf/teams.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 665030b

Please sign in to comment.