mirror of
https://github.com/minetest-mods/nether.git
synced 2024-12-27 19:30:28 +01:00
Call old on_place
when not clicking on portal material (#74)
This is needed to work with telemosaic since telemosaic depends on `on_rightclick` being called on beacon node when wielding a mese crystal fragment.
This commit is contained in:
parent
ea677c5a1b
commit
d16b530685
@ -2166,22 +2166,20 @@ function nether.unregister_portal(name)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function nether.register_portal_ignition_item(item_name, ignition_failure_sound)
|
function nether.register_portal_ignition_item(item_name, ignition_failure_sound)
|
||||||
|
local old_on_place = minetest.registered_items[item_name].on_place or minetest.item_place
|
||||||
minetest.override_item(item_name, {
|
minetest.override_item(item_name, {
|
||||||
on_place = function(stack, placer, pt)
|
on_place = function(stack, placer, pt, ...)
|
||||||
local done = false
|
|
||||||
if pt.under and nether.is_frame_node[minetest.get_node(pt.under).name] then
|
if pt.under and nether.is_frame_node[minetest.get_node(pt.under).name] then
|
||||||
done = ignite_portal(pt.under, placer:get_player_name())
|
local done = ignite_portal(pt.under, placer:get_player_name())
|
||||||
if done and not minetest.settings:get_bool("creative_mode") then
|
if done and not minetest.settings:get_bool("creative_mode") then
|
||||||
stack:take_item()
|
stack:take_item()
|
||||||
end
|
end
|
||||||
|
if not done and ignition_failure_sound ~= nil then
|
||||||
|
minetest.sound_play(ignition_failure_sound, {pos = pt.under, max_hear_distance = 10})
|
||||||
|
end
|
||||||
|
return stack
|
||||||
end
|
end
|
||||||
if not done and ignition_failure_sound ~= nil then
|
return old_on_place(stack, placer, pt, ...)
|
||||||
minetest.sound_play(ignition_failure_sound, {pos = pt.under, max_hear_distance = 10})
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
return stack
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user