forceload blocks where stellements are built;

no more broken/cut buildings on mapchunk borders
master
Rochambeau 2018-07-30 20:54:36 +02:00
parent e16b70f6af
commit f2b8d2a2d9
2 changed files with 8 additions and 5 deletions

View File

@ -122,23 +122,26 @@ function settlements.terraform()
fwidth = schematic_data["hdepth"]
fdepth = schematic_data["hwidth"]
end
fheight = schematic_data["hheight"] * 3 -- remove trees and leaves above
--fheight = schematic_data["hheight"] * 3 -- remove trees and leaves above
fheight = schematic_data["hheight"] -- remove trees and leaves above
--
-- now that every info is available -> create platform and clear space above
--
for xi = 0,fwidth-1 do
for zi = 0,fdepth-1 do
for yi = 0,fheight do
for yi = 0,fheight *3 do
if yi == 0 then
local p = {x=pos.x+xi, y=pos.y, z=pos.z+zi}
settlements.ground(p)
else
-- write ground
local node = minetest.get_node_or_nil({x=pos.x+xi, y=pos.y+yi, z=pos.z+zi})
local p = {x=pos.x+xi, y=pos.y+yi, z=pos.z+zi}
minetest.forceload_block(p)
local node = minetest.get_node_or_nil(p)
if node then
if node.name ~= "air"
then
minetest.swap_node({x=pos.x+xi, y=pos.y+yi, z=pos.z+zi},{name="air"})
minetest.swap_node(p,{name="air"})
end
end
end

View File

@ -58,7 +58,7 @@ minetest.register_on_generated(function(minp, maxp)
--
-- randomly try to build settlements
--
if math.random(1,10)<7 then
if math.random(1,10)<6 then
--
-- don't build settlement underground
--