2017-12-23 16:33:05 +00:00
|
|
|
ctf_map = {}
|
|
|
|
|
2019-03-17 03:32:15 +00:00
|
|
|
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
|
|
|
|
|
2019-10-11 10:20:56 +00:00
|
|
|
-- Convenience function to check whether a file (or multiple files) exists in mapdir
|
|
|
|
function ctf_map.file_exists(subdir, target)
|
|
|
|
local list = minetest.get_dir_list(ctf_map.mapdir .. subdir, false)
|
|
|
|
if type(target) == "string" then
|
2020-04-23 18:50:35 +00:00
|
|
|
return table.indexof(list, target) ~= -1
|
2019-10-11 10:20:56 +00:00
|
|
|
elseif type(target) == "table" then
|
|
|
|
for _, filename in pairs(target) do
|
|
|
|
if table.indexof(list, filename) == -1 then
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-03-17 03:32:15 +00:00
|
|
|
-- Overridden by server mods
|
|
|
|
function ctf_map.can_cross(player)
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
2019-11-28 05:21:59 +00:00
|
|
|
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
2019-05-12 13:23:31 +00:00
|
|
|
dofile(modpath .. "/nodes.lua")
|
|
|
|
dofile(modpath .. "/emerge.lua")
|
|
|
|
dofile(modpath .. "/barrier.lua")
|
2017-12-23 16:33:05 +00:00
|
|
|
|
|
|
|
if minetest.get_modpath("ctf") then
|
2019-08-31 07:18:46 +00:00
|
|
|
dofile(modpath .. "/base.lua")
|
2019-05-12 13:23:31 +00:00
|
|
|
dofile(modpath .. "/chest.lua")
|
2019-12-07 09:23:02 +00:00
|
|
|
dofile(modpath .. "/meta_helpers.lua")
|
2019-05-12 13:23:31 +00:00
|
|
|
dofile(modpath .. "/schem_map.lua")
|
|
|
|
dofile(modpath .. "/maps_catalog.lua")
|
2017-12-23 16:33:05 +00:00
|
|
|
|
|
|
|
ctf_match.register_on_build_time_end(ctf_map.remove_middle_barrier)
|
2020-03-13 21:58:42 +00:00
|
|
|
|
|
|
|
give_initial_stuff.register_stuff_provider(function(player)
|
|
|
|
return ctf_map.map and ctf_map.map.initial_stuff or {
|
|
|
|
"default:pick_stone",
|
|
|
|
"default:sword_stone",
|
|
|
|
"default:torch 3",
|
|
|
|
}
|
|
|
|
end)
|
2017-12-23 16:33:05 +00:00
|
|
|
end
|