Don't destroy non-ground content
parent
26dfe0f7ed
commit
6294dc3dd8
9
init.lua
9
init.lua
|
@ -69,13 +69,20 @@ local function nextrandom(min, max)
|
||||||
return pr:next() / 32767 * (max - min) + min
|
return pr:next() / 32767 * (max - min) + min
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Checks if the mapgen is allowed to carve through this structure
|
||||||
|
local function CanBuild(pos)
|
||||||
|
return minetest.registered_nodes[minetest.get_node(pos).name].is_ground_content
|
||||||
|
end
|
||||||
|
|
||||||
-- Würfel…
|
-- Würfel…
|
||||||
-- Cube…
|
-- Cube…
|
||||||
local function Cube(p, radius, node)
|
local function Cube(p, radius, node)
|
||||||
for zi = p.z-radius, p.z+radius do
|
for zi = p.z-radius, p.z+radius do
|
||||||
for yi = p.y-radius, p.y+radius do
|
for yi = p.y-radius, p.y+radius do
|
||||||
for xi = p.x-radius, p.x+radius do
|
for xi = p.x-radius, p.x+radius do
|
||||||
minetest.set_node({x=xi,y=yi,z=zi}, node)
|
if CanBuild({x=xi,y=yi,z=zi}) then
|
||||||
|
minetest.set_node({x=xi,y=yi,z=zi}, node)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue