-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Place schematic (on vmanip): Enable use of 'place center' flags #7072
Conversation
I've tested your changes with a quickly written test mod that generates one pine tree per mapgen chunk. local vmanip = true
local schem = minetest.get_modpath("default") .. "/schematics/pine_tree.mts"
local flags = "place_center_x,place_center_z"
minetest.register_on_generated(function(minp, maxp, seed)
local pos = {x=math.floor((minp.x+maxp.x)/2), y=math.floor((minp.y+maxp.y)/2), z=math.floor((minp.z+maxp.z)/2)}
if vmanip then
local vm = minetest.get_mapgen_object("voxelmanip")
minetest.place_schematic_on_vmanip(vm, pos, schem, "random", nil, false, flags)
vm:write_to_map()
else
minetest.place_schematic(pos, schem, "random", nil, false, flags)
end
minetest.set_node(pos, {name="default:stone"})
end) I expected the tree to be placed at (7,7,7), on the stone block, but it's placed at (6,7,6). As far as I know the pine tree schem doesn't have extra air rows that makes the trunk not being at the center, so it's misplaced. |
I just found the cause of the issue and fixed it in my branch. |
Correct, see https://github.com/minetest/minetest/blob/master/src/mapgen/mg_decoration.cpp#L363
I will do this for 'place schematic' too. |
Updated. |
All of this works. Both functions work as expected, and there is no bug when |
Thanks. |
For 'place schematic' and 'place schematic on vmanip' APIs. Fix 'place center' code to properly centre schematics. Fix some comments.
Place schematic (on vmanip): Enable use of 'place center' flags
For 'place schematic' and 'place schematic on vmanip' APIs.
Fix 'place center' code to properly centre schematics.
Fix some comments.
///////////////
For #7066
@Gael-de-Sailly please could you test this?