Use an LVM to emerge map, place schematic, and fix lighting
This commit is contained in:
parent
0e1525d282
commit
7732d0c23d
1 changed files with 37 additions and 34 deletions
|
@ -22,8 +22,8 @@ minetest.register_alias("default:grass_5", "air")
|
|||
minetest.register_alias("default:bush_leaves", "air")
|
||||
minetest.register_alias("default:bush_stem", "air")
|
||||
|
||||
|
||||
local max_r = 120
|
||||
local max_h = 150
|
||||
local mapdir = minetest.get_modpath("ctf_map") .. "/maps/"
|
||||
ctf_map.map = nil
|
||||
|
||||
|
@ -49,13 +49,21 @@ end
|
|||
|
||||
|
||||
function ctf_map.place_map(map)
|
||||
ctf_map.emerge_with_callbacks(nil, map.pos1, map.pos2, function()
|
||||
local schempath = mapdir .. map.schematic
|
||||
local res = minetest.place_schematic(map.pos1, schempath,
|
||||
|
||||
--------------------------------------------------
|
||||
-- LVM
|
||||
|
||||
local vm = minetest.get_voxel_manip(map.pos1, map.pos2)
|
||||
local res = minetest.place_schematic_on_vmanip(vm, map.pos1, schempath,
|
||||
map.rotation == "z" and "0" or "90")
|
||||
|
||||
assert(res)
|
||||
|
||||
vm:write_to_map()
|
||||
|
||||
--------------------------------------------------
|
||||
|
||||
for _, value in pairs(ctf_map.map.teams) do
|
||||
ctf_team_base.place(value.color, value.pos)
|
||||
end
|
||||
|
@ -78,11 +86,6 @@ function ctf_map.place_map(map)
|
|||
irc:say("Map: " .. map.name)
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.after(10, function()
|
||||
minetest.fix_light(ctf_map.map.pos1, ctf_map.map.pos2)
|
||||
end)
|
||||
end, nil)
|
||||
end
|
||||
|
||||
function ctf_match.load_map_meta(idx, name)
|
||||
|
@ -105,7 +108,7 @@ function ctf_match.load_map_meta(idx, name)
|
|||
chests = {},
|
||||
}
|
||||
|
||||
assert(map.r <= max_r)
|
||||
assert(map.r <= max_r and map.h <= max_h)
|
||||
|
||||
map.pos1 = vector.add(offset, { x = -map.r, y = -map.h / 2, z = -map.r })
|
||||
map.pos2 = vector.add(offset, { x = map.r, y = map.h / 2, z = map.r })
|
||||
|
|
Loading…
Reference in a new issue