Remove broken random spawn logic
This commit is contained in:
parent
34969ec7d2
commit
8469e1ee09
1 changed files with 0 additions and 37 deletions
|
@ -1,40 +1,3 @@
|
||||||
local old = ctf.get_spawn
|
|
||||||
function ctf.get_spawn(tname)
|
|
||||||
local team = ctf.team(tname)
|
|
||||||
if team and #team.flags >= 1 then
|
|
||||||
local flag = team.flags[1]
|
|
||||||
local i = 0
|
|
||||||
local r = 6
|
|
||||||
while i < 6 do
|
|
||||||
i = i + 1
|
|
||||||
local pos = {x=0, z=0}
|
|
||||||
pos.x = flag.x + math.random() * 40 - 20
|
|
||||||
pos.z = math.random() * 30 + 49
|
|
||||||
if pos.x < -99 then
|
|
||||||
pos.x = -99
|
|
||||||
end
|
|
||||||
if pos.x > 99 then
|
|
||||||
pos.x = 99
|
|
||||||
end
|
|
||||||
if team.flags[1].z < 0 then
|
|
||||||
pos.z = -pos.z
|
|
||||||
end
|
|
||||||
local res = minetest.find_nodes_in_area_under_air(
|
|
||||||
{ x = pos.x - r, y = 2, z = pos.z - r},
|
|
||||||
{ x = pos.x + r, y = 17, z = pos.z + r},
|
|
||||||
{"default:dirt_with_grass"})
|
|
||||||
if #res > 0 then
|
|
||||||
res[1].y = res[1].y + 1
|
|
||||||
team.spawn = res[1]
|
|
||||||
return res[1]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return team.spawn or old(tname)
|
|
||||||
else
|
|
||||||
return team.spawn
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function max(a, b)
|
local function max(a, b)
|
||||||
return (a > b) and a or b
|
return (a > b) and a or b
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue