yl_speak_up/register_node_punch.lua
2021-06-05 22:54:48 +02:00

17 lines
635 B
Lua

-- some formspecs need a position; let the player punch the node
minetest.register_on_punchnode(function(pos, node, puncher)
local pname = puncher:get_player_name()
if(pname and pname ~= ""
and yl_speak_up.speak_to[pname]
and yl_speak_up.speak_to[pname].expect_block_punch) then
local fs_name = yl_speak_up.speak_to[pname].expect_block_punch
-- the block was punched successfully
yl_speak_up.speak_to[pname].expect_block_punch = nil
-- store *which* block has been punched
yl_speak_up.speak_to[pname].block_punched = pos
-- show the formspec again
yl_speak_up.show_fs(puncher, fs_name)
end
end)