Don't play painting place sound if place failed
This commit is contained in:
parent
27e623d5cf
commit
aa1bf87abe
@ -624,16 +624,20 @@ xdecor.register("painting_1", {
|
|||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
local num = math.random(4)
|
local num = math.random(4)
|
||||||
local leftover = minetest.item_place_node(
|
local leftover, place_pos = minetest.item_place_node(
|
||||||
ItemStack("xdecor:painting_" .. num), placer, pointed_thing)
|
ItemStack("xdecor:painting_" .. num), placer, pointed_thing)
|
||||||
|
|
||||||
|
if not place_pos then
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
if leftover:get_count() == 0 and
|
if leftover:get_count() == 0 and
|
||||||
not minetest.setting_getbool("creative_mode") then
|
not minetest.setting_getbool("creative_mode") then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Play 'place' sound manually
|
-- Play 'place' sound manually
|
||||||
minetest.sound_play(default.node_sound_wood_defaults().place, {pos=pointed_thing.above}, true)
|
minetest.sound_play(default.node_sound_wood_defaults().place, {pos=place_pos}, true)
|
||||||
|
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
|
Loading…
Reference in New Issue
Block a user