From d5c245447176aa648b5955534fee64262aedeb29 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Wed, 27 Dec 2017 15:21:21 +0000 Subject: [PATCH] Reimplement chest spawning --- minetest.conf | 5 +---- mods/ctf_map/schem_map.lua | 6 ++++++ mods/tsm_chests/init.lua | 8 ++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/minetest.conf b/minetest.conf index 0f40c34..4dbbd8e 100644 --- a/minetest.conf +++ b/minetest.conf @@ -1,15 +1,12 @@ give_initial_stuff = true enable_pvp = true -fixed_map_seed = 13389864206935783704 -mg_name = v7 -mg_flags = nocaves,nodungeons,light,decorations +mg_name = singlenode map_generation_limit = 160 vote.kick_vote = false barrier = 106 regen_interval = 6 regen_amount = 1 random_messages_interval = 60 -water_level = 38 # # CTF_PVP_ENGINE diff --git a/mods/ctf_map/schem_map.lua b/mods/ctf_map/schem_map.lua index b8cee92..be42539 100644 --- a/mods/ctf_map/schem_map.lua +++ b/mods/ctf_map/schem_map.lua @@ -10,6 +10,12 @@ function ctf_map.place_map(map) local res = minetest.place_schematic({ x = -r - 5, y = -h / 2, z = -r - 5 }, 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) + end + return res ~= nil end diff --git a/mods/tsm_chests/init.lua b/mods/tsm_chests/init.lua index 015cf45..0882bd0 100755 --- a/mods/tsm_chests/init.lua +++ b/mods/tsm_chests/init.lua @@ -79,8 +79,8 @@ minetest.register_node("tsm_chests:chest", { --[[ here are some configuration variables ]] local chests_per_chunk = 13 -- number of chests per chunk. 15 is a bit high, an actual mod might have a lower number -local h_min = -1 -- minimum chest spawning height, relative to water_level -local h_max = 64-43 -- maximum chest spawning height, relative to water_level +local h_min = -65 -- minimum chest spawning height, relative to water_level +local h_max = 40 -- maximum chest spawning height, relative to water_level local t_min = 3 -- minimum amount of treasures found in a chest local t_max = 6 -- maximum amount of treasures found in a chest @@ -173,7 +173,7 @@ end --[[ here comes the generation code the interesting part which involes treasurer comes way below ]] -minetest.register_on_generated(function(minp, maxp, seed) +function place_chests(minp, maxp, seed) minp = {x=minp.x, y=minp.y, z=minp.z} maxp = {x=maxp.x, y=maxp.y, z=maxp.z} @@ -229,4 +229,4 @@ minetest.register_on_generated(function(minp, maxp, seed) end print("Spawned " .. chests_placed .. " chests after " .. attempts .. " attempts!") -end) +end