summaryrefslogtreecommitdiff
path: root/dispatcher.lua
diff options
context:
space:
mode:
Diffstat (limited to 'dispatcher.lua')
-rw-r--r--dispatcher.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/dispatcher.lua b/dispatcher.lua
index 6a8a77a..b58c6eb 100644
--- a/dispatcher.lua
+++ b/dispatcher.lua
@@ -89,6 +89,16 @@ local function handlefields(pos,_,fields,sender)
celevator.dispatcher.run(pos,event)
end
+local function candig(_,player)
+ local controls = player:get_player_control()
+ if controls.sneak then
+ return true
+ else
+ minetest.chat_send_player(player:get_player_name(),"Hold the sneak button while digging to remove.")
+ return false
+ end
+end
+
minetest.register_node("celevator:dispatcher",{
description = "Elevator Dispatcher",
groups = {
@@ -121,6 +131,7 @@ minetest.register_node("celevator:dispatcher",{
on_destruct = ondestruct,
on_rotate = onrotate,
on_receive_fields = handlefields,
+ can_dig = candig,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("mem",minetest.serialize({}))
@@ -198,6 +209,7 @@ minetest.register_node("celevator:dispatcher_open",{
on_destruct = ondestruct,
on_rotate = onrotate,
on_receive_fields = handlefields,
+ can_dig = candig,
on_punch = function(pos,node,puncher)
if not puncher:is_player() then
return