From e1fd9c21db74b39e2374440d3c194d09e795d034 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Mon, 22 Jan 2018 03:52:51 +0000 Subject: [PATCH] Fix attempt for loading issues --- mods/ctf_map/emerge.lua | 10 ++++++---- mods/ctf_map/schem_map.lua | 22 +++++++++------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/mods/ctf_map/emerge.lua b/mods/ctf_map/emerge.lua index 2d45854..ae6ad3f 100644 --- a/mods/ctf_map/emerge.lua +++ b/mods/ctf_map/emerge.lua @@ -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 diff --git a/mods/ctf_map/schem_map.lua b/mods/ctf_map/schem_map.lua index 9755482..5f4f8c1 100644 --- a/mods/ctf_map/schem_map.lua +++ b/mods/ctf_map/schem_map.lua @@ -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)