Fix mods comp. using callback on_rightclick with mese fragment

This commit is contained in:
Sys Quatre 2020-07-15 01:46:52 +02:00
parent 3577fd1f5e
commit c0481ea4ca
1 changed files with 9 additions and 4 deletions

View File

@ -2153,19 +2153,24 @@ end
function nether.register_portal_ignition_item(item_name, ignition_failure_sound)
minetest.override_item(item_name, {
on_place = function(stack, _, pt)
on_place = function(stack, placer, pt)
local node = minetest.get_node(pt.under)
local def = minetest.registered_nodes[node.name]
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[node.name] then
done = ignite_portal(pt.under)
if done and not minetest.settings:get_bool("creative_mode") then
stack:take_item()
end
elseif def and def.on_rightclick then
def.on_rightclick(pt.under, node, placer, stack, pt)
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,
})
@ -2301,4 +2306,4 @@ function nether.find_nearest_working_portal(portal_name, anchorPos, distance_lim
end
end
return nil
end
end