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
if ctx.current_blocks == ctx.total_blocks then
minetest.chat_send_player(ctx.name,
string.format("Finished emerging %d blocks in %.2fms.",
ctx.total_blocks, (os.clock() - ctx.start_time) * 1000))
if ctx.name then
minetest.chat_send_player(ctx.name,
string.format("Finished emerging %d blocks in %.2fms.",
ctx.total_blocks, (os.clock() - ctx.start_time) * 1000))
end
ctx:callback()
else
elseif ctx.progress then
ctx:progress()
end
end

View file

@ -29,15 +29,13 @@ end
function ctf_map.place_map(map)
local r = map.r
local h = map.h
minetest.emerge_area(map.pos1, map.pos2)
ctf_map.emerge_with_callbacks(nil, map.pos1, map.pos2, function()
local schempath = mapdir .. map.schematic
local res = minetest.place_schematic(map.pos1, schempath,
map.rotation == "z" and "0" or "90")
local schempath = mapdir .. map.schematic
local res = minetest.place_schematic(map.pos1, schempath,
map.rotation == "z" and "0" or "90")
assert(res)
if res ~= nil then
local seed = minetest.get_mapgen_setting("seed")
for _, value in pairs(ctf_map.map.teams) do
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)
end
end
minetest.after(5, function()
minetest.chat_send_all("Map: " .. map.name .. " by " .. map.author)
end)
return res ~= nil
minetest.after(2, function()
minetest.chat_send_all("Map: " .. map.name .. " by " .. map.author)
end)
end, nil)
end
function ctf_match.load_map_meta(idx, name)