Add ctf_map.get_team_relative_z() and ctf_map.can_cross()
This commit is contained in:
parent
d9f8042640
commit
e3a8f95f59
2 changed files with 15 additions and 10 deletions
|
@ -246,18 +246,12 @@ if minetest.get_modpath("ctf") then
|
|||
end
|
||||
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
if ctf_map.get_team_relative_z(player) < 0 and not ctf_map.can_cross(player) then
|
||||
local name = player:get_player_name()
|
||||
local tname = ctf.player(name).team
|
||||
local pos = player:get_pos()
|
||||
local privs = minetest.get_player_privs(name)
|
||||
if tname and not privs.fly and privs.interact then
|
||||
if (tname == "blue" and pos.z >= 0) or
|
||||
(tname == "red" and pos.z <= 0) then
|
||||
minetest.chat_send_player(name, "Match hasn't started yet!")
|
||||
ctf.move_to_spawn(name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if ctf_match.build_timer > 0.2 then
|
||||
minetest.after(0.2, pos_check)
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
ctf_map = {}
|
||||
|
||||
function ctf_map.get_team_relative_z(player)
|
||||
local name = player:get_player_name()
|
||||
local tname = ctf.player(name).team
|
||||
return (tname == "red" and 1 or -1) * player:get_pos().z
|
||||
end
|
||||
|
||||
-- Overridden by server mods
|
||||
function ctf_map.can_cross(player)
|
||||
return false
|
||||
end
|
||||
|
||||
dofile(minetest.get_modpath("ctf_map") .. "/nodes.lua")
|
||||
dofile(minetest.get_modpath("ctf_map") .. "/emerge.lua")
|
||||
dofile(minetest.get_modpath("ctf_map") .. "/barrier.lua")
|
||||
|
|
Loading…
Reference in a new issue