Remove ctf.area namespace
This commit is contained in:
parent
f44e0903c4
commit
9db50cfd3d
@ -162,8 +162,7 @@ function ctf.save()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
ctf.area = {}
|
function ctf.get_territory_owner(pos)
|
||||||
function ctf.area.get_territory_owner(pos)
|
|
||||||
local largest = nil
|
local largest = nil
|
||||||
local largest_weight = 0
|
local largest_weight = 0
|
||||||
for i = 1, #ctf.registered_on_territory_query do
|
for i = 1, #ctf.registered_on_territory_query do
|
||||||
|
@ -271,7 +271,7 @@ minetest.register_on_newplayer(function(player)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
-- updates the spawn position for a team
|
-- updates the spawn position for a team
|
||||||
function ctf.area.get_spawn(team)
|
function ctf.get_spawn(team)
|
||||||
ctf_flag.asset_flags(team)
|
ctf_flag.asset_flags(team)
|
||||||
|
|
||||||
if not ctf.team(team) then
|
if not ctf.team(team) then
|
||||||
@ -304,7 +304,7 @@ minetest.register_on_respawnplayer(function(player)
|
|||||||
if player and ctf.player(player:get_player_name()) then
|
if player and ctf.player(player:get_player_name()) then
|
||||||
local team = ctf.player(player:get_player_name()).team
|
local team = ctf.player(player:get_player_name()).team
|
||||||
if ctf.team(team) then
|
if ctf.team(team) then
|
||||||
local spawn = ctf.area.get_spawn(team)
|
local spawn = ctf.get_spawn(team)
|
||||||
player:moveto(spawn, false)
|
player:moveto(spawn, false)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -193,7 +193,7 @@ ctf_flag = {
|
|||||||
ctf.team(team).spawn = pos
|
ctf.team(team).spawn = pos
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
ctf.area.get_spawn(team)
|
ctf.get_spawn(team)
|
||||||
end
|
end
|
||||||
|
|
||||||
ctf.save()
|
ctf.save()
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
local old_is_protected = minetest.is_protected
|
local old_is_protected = minetest.is_protected
|
||||||
|
|
||||||
function minetest.is_protected(pos, name)
|
function minetest.is_protected(pos, name)
|
||||||
local team = ctf.area.get_territory_owner(pos)
|
local team = ctf.get_territory_owner(pos)
|
||||||
|
|
||||||
if not team or not ctf.team(team) then
|
if not team or not ctf.team(team) then
|
||||||
return old_is_protected(pos, name)
|
return old_is_protected(pos, name)
|
||||||
|
@ -60,7 +60,7 @@ if ctf.setting("turrets") then
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local app = ctf.area.get_territory_owner(pos)
|
local app = ctf.get_territory_owner(pos)
|
||||||
if app and app~=team then
|
if app and app~=team then
|
||||||
team = app
|
team = app
|
||||||
meta:set_string("team",team)
|
meta:set_string("team",team)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user