Reimplement chest spawning

This commit is contained in:
rubenwardy 2017-12-27 15:21:21 +00:00
parent e513a63205
commit d5c2454471
3 changed files with 11 additions and 8 deletions

View file

@ -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

View file

@ -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

View file

@ -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