Readd team base

This commit is contained in:
rubenwardy 2018-01-21 23:09:07 +00:00
parent db49f82790
commit 6a53c23f95
4 changed files with 43 additions and 48 deletions

View file

@ -1,4 +1,5 @@
default
ctf_team_base?
ctf?
ctf_match?
worldedit?

View file

@ -38,6 +38,8 @@ function ctf_map.place_map(map)
minetest.log("error", "Placing " .. value.chests.n .. " chests from " ..
minetest.pos_to_string(value.chests.from) .. " to "..
minetest.pos_to_string(value.chests.to))
ctf_team_base.place(value.color, value.pos)
end
end

View file

@ -1,5 +1,4 @@
ctf
ctf_flag
ctf_match
ctf_barrier
ctf_stats

View file

@ -181,26 +181,22 @@ minetest.register_abm({
end
})
minetest.register_on_generated(function(minp, maxp, seed)
for tname, team in pairs(ctf.teams) do
for _, flag in pairs(team.flags) do
if minp.x <= flag.x and maxp.x >= flag.x and
minp.y <= flag.y and maxp.y >= flag.y and
minp.z <= flag.z and maxp.z >= flag.z then
ctf_team_base = {}
function ctf_team_base.place(color, pos)
-- Spawn ind base
for x = flag.x - 2, flag.x + 2 do
for z = flag.z - 2, flag.z + 2 do
minetest.set_node({ x = x, y = flag.y - 1, z = z},
for x = pos.x - 2, pos.x + 2 do
for z = pos.z - 2, pos.z + 2 do
minetest.set_node({ x = x, y = pos.y - 1, z = z},
{name = "default:cobble"})
end
end
minetest.set_node({ x = flag.x, y = flag.y - 1, z = flag.z},
minetest.set_node({ x = pos.x, y = pos.y - 1, z = pos.z},
{name = "ctf_barrier:ind_stone"})
-- Check for trees
for y = flag.y, flag.y + 3 do
for x = flag.x - 3, flag.x + 3 do
for z = flag.z - 3, flag.z + 3 do
for y = pos.y, pos.y + 3 do
for x = pos.x - 3, pos.x + 3 do
for z = pos.z - 3, pos.z + 3 do
local pos = {x=x, y=y, z=z}
if minetest.get_node(pos).name == "default:tree" then
minetest.set_node(pos, {name="air"})
@ -210,16 +206,16 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
-- Spawn chest
local chest = {name = "ctf_team_base:chest_" .. team.data.color}
local chest = {name = "ctf_team_base:chest_" .. color}
local dz = 2
if flag.z < 0 then
if pos.z < 0 then
dz = -2
chest.param2 = minetest.dir_to_facedir({x=0,y=0,z=-1})
end
local pos = {
x = flag.x,
y = flag.y,
z = flag.z + dz
x = pos.x,
y = pos.y,
z = pos.z + dz
}
minetest.set_node(pos, chest)
local inv = minetest.get_meta(pos):get_inventory()
@ -230,6 +226,3 @@ minetest.register_on_generated(function(minp, maxp, seed)
inv:add_item("main", ItemStack("default:glass 5"))
inv:add_item("main", ItemStack("default:torch 10"))
end
end
end
end)