slightly optimize placement

This commit is contained in:
cora 2022-07-03 02:28:30 +02:00
parent 0a2e68d136
commit 40d0c1affb

View File

@ -364,18 +364,24 @@ local function Platform(p, radius, node, node2)
if not node2 then if not node2 then
node2 = { name = tsm_railcorridors.nodes.dirt } node2 = { name = tsm_railcorridors.nodes.dirt }
end end
local n1 = {}
local n2 = {}
for zi = p.z-radius, p.z+radius do for zi = p.z-radius, p.z+radius do
for xi = p.x-radius, p.x+radius do for xi = p.x-radius, p.x+radius do
local np, np2 = NeedsPlatform({x=xi,y=p.y,z=zi}) local np, np2 = NeedsPlatform({x=xi,y=p.y,z=zi})
if np then if np then
if np2 then if np2 then
minetest.set_node({x=xi,y=p.y-1,z=zi}, node2) --minetest.set_node({x=xi,y=p.y-1,z=zi}, node2)
table.insert(n1,{x=xi,y=p.y-1,z=zi})
else else
minetest.set_node({x=xi,y=p.y-1,z=zi}, node) --minetest.set_node({x=xi,y=p.y-1,z=zi}, node)
table.insert(n2,{x=xi,y=p.y-1,z=zi})
end end
end end
end end
end end
minetest.bulk_set_node(n1,node)
minetest.bulk_set_node(n2,node2)
end end
-- Chests -- Chests
@ -1097,7 +1103,7 @@ local function create_corridor_system(main_cave_coords)
-- At this point, all corridors were generated and all nodes were set. -- At this point, all corridors were generated and all nodes were set.
-- We spawn the carts now -- We spawn the carts now
--spawn_carts() spawn_carts()
return true return true
end end