mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 18:41:09 +01:00
Rarely spawn desert wells in deserts
This commit is contained in:
parent
52616d86c0
commit
b433107f67
2 changed files with 32 additions and 9 deletions
|
@ -889,6 +889,8 @@ local perlin
|
||||||
-- Generate clay and structures
|
-- Generate clay and structures
|
||||||
-- TODO: Try to use more efficient structure generating code
|
-- TODO: Try to use more efficient structure generating code
|
||||||
minetest.register_on_generated(function(minp, maxp, seed)
|
minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
|
local chunk_has_desert_well = false
|
||||||
|
local chunk_has_desert_temple = false
|
||||||
if maxp.y >= 2 and minp.y <= 0 then
|
if maxp.y >= 2 and minp.y <= 0 then
|
||||||
-- Generate clay
|
-- Generate clay
|
||||||
-- Assume X and Z lengths are equal
|
-- Assume X and Z lengths are equal
|
||||||
|
@ -961,10 +963,30 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
if minetest.registered_nodes[nn] and
|
if minetest.registered_nodes[nn] and
|
||||||
minetest.registered_nodes[nn].buildable_to then
|
minetest.registered_nodes[nn].buildable_to then
|
||||||
nn = minetest.get_node({x=x,y=ground_y,z=z}).name
|
nn = minetest.get_node({x=x,y=ground_y,z=z}).name
|
||||||
if nn == "mcl_core:sand" or nn == "mcl_core:sandstone" then
|
local struct = false
|
||||||
if math.random(0,12000) == 1 then
|
-- Desert temples and desert wells
|
||||||
|
if nn == "mcl_core:sand" or (nn == "mcl_core:sandstone") then
|
||||||
|
if not chunk_has_desert_temple and not chunk_has_desert_well then
|
||||||
-- Spawn desert temple
|
-- Spawn desert temple
|
||||||
mcl_structures.call_struct(p,2)
|
-- TODO: Check surface
|
||||||
|
if math.random(1,12000) == 1 then
|
||||||
|
mcl_structures.call_struct(p, "desert_temple")
|
||||||
|
chunk_has_desert_temple = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not chunk_has_desert_temple and not chunk_has_desert_well then
|
||||||
|
-- Minecraft probability: 1/1000 per Minecraft chunk (16×16).
|
||||||
|
-- We adjust the probability to Minetest's MapBlock size.
|
||||||
|
local desert_well_prob = 1000 * (((maxp.x-minp.x+1)*(maxp.z-minp.z+1)) / 256)
|
||||||
|
-- Spawn desert well
|
||||||
|
if math.random(1, desert_well_prob) == 1 then
|
||||||
|
-- Check surface
|
||||||
|
local surface = minetest.find_nodes_in_area({x=p.x,y=p.y-1,z=p.z}, {x=p.x+5, y=p.y-1, z=p.z+5}, "mcl_core:sand")
|
||||||
|
if #surface >= 25 then
|
||||||
|
mcl_structures.call_struct(p, "desert_well")
|
||||||
|
chunk_has_desert_well = true
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -141,11 +141,12 @@ end
|
||||||
|
|
||||||
-- The call of Struct
|
-- The call of Struct
|
||||||
mcl_structures.call_struct= function(pos, struct_style)
|
mcl_structures.call_struct= function(pos, struct_style)
|
||||||
-- 1: Village , 2: Desert temple
|
if struct_style == "village" then
|
||||||
if struct_style == 1 then
|
|
||||||
mcl_structures.geerate_village(pos)
|
mcl_structures.geerate_village(pos)
|
||||||
elseif struct_style == 2 then
|
elseif struct_style == "desert_temple" then
|
||||||
mcl_structures.generate_desert_temple(pos)
|
mcl_structures.generate_desert_temple(pos)
|
||||||
|
elseif struct_style == "desert_well" then
|
||||||
|
mcl_structures.generate_desert_well(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue