settlements/foundation.lua

37 lines
975 B
Lua
Raw Normal View History

2018-06-26 11:08:14 -07:00
--
-- Function to fill empty space below baseplate when building on a hill
--
function settlements.ground(pos) -- Wendelsteinkircherl, Brannenburg
local p2 = pos
local cnt = 0
local mat = "dirt"
p2.y = p2.y-1
2018-06-26 11:23:11 -07:00
while true do
2018-06-26 11:08:14 -07:00
cnt = cnt+1
2018-06-29 05:52:56 -07:00
if cnt > 100 then break end
2018-06-26 11:08:14 -07:00
if cnt>math.random(2,4) then mat = "stone"end
minetest.set_node(p2, {name="default:"..mat})
p2.y = p2.y-1
end
end
--
2018-06-29 05:52:56 -07:00
-- Function to fill empty space below baseplate when building on a hill
2018-06-26 11:08:14 -07:00
--
function settlements.foundation(pos, width, depth, height)
local p5 = settlements.shallowCopy(pos)
local height = height * 3 -- remove trees and leaves above
for yi = 0,height do
2018-06-26 11:23:11 -07:00
for xi = 0,width-1 do
for zi = 0,depth-1 do
2018-06-26 11:08:14 -07:00
if yi == 0 then
local p = {x=p5.x+xi, y=p5.y, z=p5.z+zi}
minetest.after(1,settlements.ground,p)--(p)
else
minetest.remove_node({x=p5.x+xi, y=p5.y+yi, z=p5.z+zi})
end
end
end
end
end