Hey Sokomine, I found a pitchfork duplication situation with cottages: try sticking a pitchfork in the ground through, say, a grass node (the regular grass, which spreads). The result would be that you'll have the pitchfork replacing the grass, and yet the pitchfork in your hand will remain. I found that it is because the pointed_thing points to different nodes (1 node height difference) in those cases, and therefore the "find placed pitchfork at pos" test fails with grass (it looks where there is air in that case). So far I resolved the issue with simply looking for a pitchfork in ±1 node area (above and below the initial target, that is):
- Code: Select all
minetest.rotate_and_place(ItemStack("cottages:pitchfork_placed"), placer, pointed_thing)
-- did the placing succeed?
if not minetest.find_nodes_in_area({x=pos.x, y=pos.y-1, z=pos.z},
{x=pos.x, y=pos.y+1, z=pos.z},
{"cottages:pitchfork_placed"})[1] then
return nil
end