Fix igloo hidden trapdoor with minetest.after(), https://git.minetest.land/MineClone2/MineClone2/issues/1797

This commit is contained in:
kay27 2021-06-22 16:53:55 +04:00
parent c6b662ce7a
commit 7ff476b9b9

View file

@ -187,8 +187,6 @@ function mcl_structures.generate_igloo(pos, rotation, pr)
if real_depth <= 6 then if real_depth <= 6 then
return success return success
end end
-- Place hidden trapdoor
minetest.set_node(tpos, {name="mcl_doors:trapdoor", param2=20+minetest.dir_to_facedir(dir)}) -- TODO: more reliable param2
-- Generate ladder to basement -- Generate ladder to basement
for y=1, real_depth-1 do for y=1, real_depth-1 do
set_brick({x=tpos.x-1,y=tpos.y-y,z=tpos.z }) set_brick({x=tpos.x-1,y=tpos.y-y,z=tpos.z })
@ -199,6 +197,10 @@ function mcl_structures.generate_igloo(pos, rotation, pr)
end end
-- Place basement -- Place basement
mcl_structures.generate_igloo_basement(bpos, rotation, pr) mcl_structures.generate_igloo_basement(bpos, rotation, pr)
-- Place hidden trapdoor
minetest.after(5, function(tpos, dir)
minetest.set_node(tpos, {name="mcl_doors:trapdoor", param2=20+minetest.dir_to_facedir(dir)}) -- TODO: more reliable param2
end, tpos, dir)
end end
return success return success
end end