added register_node_punch.lua
This commit is contained in:
parent
79a7184a7e
commit
841581d4fd
2
init.lua
2
init.lua
@ -35,6 +35,8 @@ dofile(modpath .. "trade_simple.lua")
|
||||
dofile(modpath .. "trade_list.lua")
|
||||
-- the main functionality of the mod
|
||||
dofile(modpath .. "functions.lua")
|
||||
-- a way of determining a node position
|
||||
dofile(modpath .. "register_node_punch.lua")
|
||||
-- the staffs (requires npc_master priv)
|
||||
dofile(modpath .. "tools.lua")
|
||||
-- the actual mobs, using mobs_redo
|
||||
|
16
register_node_punch.lua
Normal file
16
register_node_punch.lua
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
-- 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)
|
Loading…
Reference in New Issue
Block a user