From 3216cf75ab9ecaa91b9f60fb4fc90e219421303f Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Thu, 28 Dec 2017 12:49:17 +0000 Subject: [PATCH] Attempt to fix map bugs --- mods/ctf_map/schem_map.lua | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/mods/ctf_map/schem_map.lua b/mods/ctf_map/schem_map.lua index 8fb80fd..3f9334c 100644 --- a/mods/ctf_map/schem_map.lua +++ b/mods/ctf_map/schem_map.lua @@ -2,18 +2,22 @@ assert(minetest.get_mapgen_setting("mg_name") == "singlenode", "singlenode mapge minetest.register_alias("mapgen_singlenode", "ctf_map:ignore") +local max_r = 120 function ctf_map.place_map(map) local r = map.r local h = map.h - minetest.emerge_area({ x = -r, y = -h / 2, z = -r }, { x = r, y = h / 2, z = r }) + minetest.delete_area({ x = -max_r, y = -max_r, z = -max_r }, { x = max_r, y = max_r, z = max_r }) + minetest.emerge_area(map.pos1, map.pos2) local res = minetest.place_schematic({ x = -r, y = -h / 2, z = -r }, minetest.get_modpath("ctf_map") .. "/maps/" .. map.schematic, map.rotation == "z" and "0" or "90") if res ~= nil then local seed = minetest.get_mapgen_setting("seed") - place_chests({ x = -r, y = -h / 2, z = -r }, { x = r, y = h / 2, z = 0 }, seed) - place_chests({ x = -r, y = -h / 2, z = 0 }, { x = r, y = h / 2, z = r }, seed) + local pos1_middle = { x = -r, y = -h / 2, z = 0 } + local pos2_middle = { x = r, y = h / 2, z = 0 } + place_chests(map.pos1, pos2_middle, seed) + place_chests(pos1_middle, map.pos2, seed) end return res ~= nil @@ -49,6 +53,9 @@ function ctf_match.load_map_meta(name) teams = {} } + map.pos1 = { x = -map.r, y = -map.h / 2, z = -map.r } + map.pos2 = { x = map.r, y = map.h / 2, z = map.r } + local i = 1 while meta:get("team." .. i) do local tname = meta:get("team." .. i) @@ -71,10 +78,12 @@ ctf_match.register_on_new_match(function() ctf_map.map = ctf_match.load_map_meta(name) ctf_map.place_map(ctf_map.map) - minetest.after(0.1, function() + minetest.after(1, function() for _, player in pairs(minetest.get_connected_players()) do ctf.move_to_spawn(player:get_player_name()) end + + minetest.fix_light(ctf_map.map.pos1, ctf_map.map.pos2) end) end)