Trigger node callbacks when pumpkin is sheared

The code for shearing a pumpkin used minetest.swap_node() to replace a
faceless pumpkin with a carved pumpkin. This did not trigger the node
callbacks of the carved pumpkin, which meant that shearing a pumpkin
would not check for the snow golem or iron golem spawn conditions.

This patch replaces minetest.swap_node() in the code for shearing a
pumpkin with minetest.set_node(), which does trigger the callbacks;
therefore snow and iron golems can now spawn as a pumpkin is carved.
This commit is contained in:
Nils Dagsson Moskopp 2022-04-14 18:52:31 +02:00
parent fdd3c5db86
commit 7d2ef66175
No known key found for this signature in database
GPG Key ID: A3BC671C35191080
1 changed files with 1 additions and 1 deletions

View File

@ -235,7 +235,7 @@ if minetest.get_modpath("mcl_farming") then
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = pointed_thing.above}, true)
local dir = vector.subtract(pointed_thing.under, pointed_thing.above)
local param2 = minetest.dir_to_facedir(dir)
minetest.swap_node(pointed_thing.under, {name="mcl_farming:pumpkin_face", param2 = param2})
minetest.set_node(pointed_thing.under, {name="mcl_farming:pumpkin_face", param2 = param2})
minetest.add_item(pointed_thing.above, "mcl_farming:pumpkin_seeds 4")
end
return itemstack