Fix attempt for loading issues

This commit is contained in:
rubenwardy 2018-01-22 03:52:51 +00:00
parent ae01714049
commit e1fd9c21db
2 changed files with 15 additions and 17 deletions

View file

@ -7,12 +7,14 @@ local function emergeblocks_callback(pos, action, num_calls_remaining, ctx)
ctx.current_blocks = ctx.current_blocks + 1 ctx.current_blocks = ctx.current_blocks + 1
if ctx.current_blocks == ctx.total_blocks then if ctx.current_blocks == ctx.total_blocks then
minetest.chat_send_player(ctx.name, if ctx.name then
string.format("Finished emerging %d blocks in %.2fms.", minetest.chat_send_player(ctx.name,
ctx.total_blocks, (os.clock() - ctx.start_time) * 1000)) string.format("Finished emerging %d blocks in %.2fms.",
ctx.total_blocks, (os.clock() - ctx.start_time) * 1000))
end
ctx:callback() ctx:callback()
else elseif ctx.progress then
ctx:progress() ctx:progress()
end end
end end

View file

@ -29,15 +29,13 @@ end
function ctf_map.place_map(map) function ctf_map.place_map(map)
local r = map.r ctf_map.emerge_with_callbacks(nil, map.pos1, map.pos2, function()
local h = map.h local schempath = mapdir .. map.schematic
minetest.emerge_area(map.pos1, map.pos2) local res = minetest.place_schematic(map.pos1, schempath,
map.rotation == "z" and "0" or "90")
local schempath = mapdir .. map.schematic assert(res)
local res = minetest.place_schematic(map.pos1, schempath,
map.rotation == "z" and "0" or "90")
if res ~= nil then
local seed = minetest.get_mapgen_setting("seed") local seed = minetest.get_mapgen_setting("seed")
for _, value in pairs(ctf_map.map.teams) do for _, value in pairs(ctf_map.map.teams) do
place_chests(value.chests.from, value.chests.to, seed, value.chests.n) place_chests(value.chests.from, value.chests.to, seed, value.chests.n)
@ -47,13 +45,11 @@ function ctf_map.place_map(map)
ctf_team_base.place(value.color, value.pos) ctf_team_base.place(value.color, value.pos)
end end
end
minetest.after(5, function() minetest.after(2, function()
minetest.chat_send_all("Map: " .. map.name .. " by " .. map.author) minetest.chat_send_all("Map: " .. map.name .. " by " .. map.author)
end) end)
end, nil)
return res ~= nil
end end
function ctf_match.load_map_meta(idx, name) function ctf_match.load_map_meta(idx, name)