capturetheflag/mods/ctf/ctf_map/init.lua
ANAND 5e3578ae00
ctf_map: Dofile base.lua only when ctf exists
This prevents a crash when running in map-maker mode, as base.lua (which is unnecessarily dofile'd) contains code which re-defines `ctf.get_spawn`
2019-08-31 12:48:46 +05:30

29 lines
769 B
Lua

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
local modpath = minetest.get_modpath("ctf_map")
dofile(modpath .. "/nodes.lua")
dofile(modpath .. "/emerge.lua")
dofile(modpath .. "/barrier.lua")
if minetest.get_modpath("ctf") then
dofile(modpath .. "/base.lua")
dofile(modpath .. "/chest.lua")
dofile(modpath .. "/give_initial_stuff.lua")
dofile(modpath .. "/schem_map.lua")
dofile(modpath .. "/maps_catalog.lua")
ctf_match.register_on_build_time_end(ctf_map.remove_middle_barrier)
else
dofile(modpath .. "/map_maker.lua")
end