mirror of
https://github.com/minetest/minetest_game.git
synced 2024-12-22 23:10:17 +01:00
Fix dry shrubs being placed in cacti and fix incorrect comments
This commit is contained in:
parent
165da9348a
commit
c455ba9b68
@ -257,11 +257,11 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
local z0 = minp.z + math.floor((divz+0)*divlen)
|
local z0 = minp.z + math.floor((divz+0)*divlen)
|
||||||
local x1 = minp.x + math.floor((divx+1)*divlen)
|
local x1 = minp.x + math.floor((divx+1)*divlen)
|
||||||
local z1 = minp.z + math.floor((divz+1)*divlen)
|
local z1 = minp.z + math.floor((divz+1)*divlen)
|
||||||
-- Determine cactus amount from perlin noise
|
-- Determine dry shrubs amount from perlin noise
|
||||||
local cactus_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 5 + 0)
|
local shrub_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 5 + 0)
|
||||||
-- Find random positions for cactus based on this random
|
-- Find random positions for dry shrubs based on this random
|
||||||
local pr = PseudoRandom(seed+1)
|
local pr = PseudoRandom(seed+1)
|
||||||
for i=0,cactus_amount do
|
for i=0,shrub_amount do
|
||||||
local x = pr:next(x0, x1)
|
local x = pr:next(x0, x1)
|
||||||
local z = pr:next(z0, z1)
|
local z = pr:next(z0, z1)
|
||||||
-- Find ground level (0...15)
|
-- Find ground level (0...15)
|
||||||
@ -272,9 +272,14 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- If desert sand, make cactus
|
-- If desert sand, make dry shrub
|
||||||
if ground_y and minetest.env:get_node({x=x,y=ground_y,z=z}).name == "default:desert_sand" then
|
if ground_y and minetest.env:get_node({x=x,y=ground_y,z=z}).name == "default:desert_sand" then
|
||||||
minetest.env:set_node({x=x,y=ground_y+1,z=z}, {name="default:dry_shrub"})
|
local p = {x=x,y=ground_y+1,z=z}
|
||||||
|
local nn = minetest.env:get_node(p).name
|
||||||
|
if minetest.registered_nodes[nn] and
|
||||||
|
minetest.registered_nodes[nn].buildable_to then
|
||||||
|
minetest.env:set_node(p, {name="default:dry_shrub"})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user