Use swap_node instead of set_node in more places

This commit is contained in:
Elias Åström 2024-09-23 20:43:47 +02:00 committed by cora
parent 6eca814955
commit d73c6159b2
3 changed files with 7 additions and 5 deletions

View File

@ -531,7 +531,7 @@ minetest.register_abm({
action = function(pos, node)
if minetest.get_item_group(minetest.get_node(vector.offset(pos, 0, 1, 0)).name, "solid") > 0 then
node.name = "mcl_nether:netherrack"
minetest.set_node(pos, node)
minetest.swap_node(pos, node)
end
end
})

View File

@ -65,7 +65,7 @@ function mcl_lush_caves.makelake(pos, _, pr)
if not nn[1] then return end
--local dripleaves = {}
for i=1,pr:next(1,#nn) do
minetest.set_node(nn[i],{name="mcl_core:water_source"})
minetest.swap_node(nn[i],{name="mcl_core:water_source"})
--[[
if pr:next(1,20) == 1 then
table.insert(dripleaves,nn[i])
@ -78,9 +78,9 @@ function mcl_lush_caves.makelake(pos, _, pr)
local pp = vector.add(v,vv)
local an = minetest.get_node(pp)
if an.name ~= "mcl_core:water_source" then
minetest.set_node(pp,{name="mcl_core:clay"})
minetest.swap_node(pp,{name="mcl_core:clay"})
if pr:next(1,20) == 1 then
minetest.set_node(vector.offset(pp,0,1,0),{name="mcl_lush_caves:moss_carpet"})
minetest.swap_node(vector.offset(pp,0,1,0),{name="mcl_lush_caves:moss_carpet"})
end
end
end

View File

@ -297,7 +297,9 @@ mcl_mapgen_core.register_generator("structures",nil, function(minp, maxp, blocks
if struct.deco_id then
local has = false
for _, pos in pairs(gennotify["decoration#"..struct.deco_id] or {}) do
local pr = PcgRandom(minetest.hash_node_position(pos) + 42)
local realpos = vector.offset(pos,0,1,0)
minetest.swap_node(realpos, {name = "air"})
minetest.fix_light(vector.offset(pos,-1,-1,-1),vector.offset(pos,1,3,1))
if struct.chunk_probability == nil or (not has and pr:next(1,struct.chunk_probability) == 1 ) then
mcl_structures.place_structure(vector.offset(pos,0,1,0), struct, pr, blockseed)
has=true