summaryrefslogtreecommitdiff
path: root/teleport_tube.lua
diff options
context:
space:
mode:
authorhdastwb <hdastwb@hdastwb.heliohost.org>2013-08-06 13:26:05 -0400
committerhdastwb <hdastwb@hdastwb.heliohost.org>2013-08-06 14:58:11 -0400
commitf66336394e327fa7bd53d1769295263a99a1be89 (patch)
treed34352f37b33e47daa1da172aa8fa4905703cb36 /teleport_tube.lua
parent6323a923e0cfa76f2bc958429f790a8f2e35b4c6 (diff)
downloadpipeworks-f66336394e327fa7bd53d1769295263a99a1be89.tar
pipeworks-f66336394e327fa7bd53d1769295263a99a1be89.tar.gz
pipeworks-f66336394e327fa7bd53d1769295263a99a1be89.tar.bz2
pipeworks-f66336394e327fa7bd53d1769295263a99a1be89.tar.xz
pipeworks-f66336394e327fa7bd53d1769295263a99a1be89.zip
added reserved teleport channels
Diffstat (limited to 'teleport_tube.lua')
-rw-r--r--teleport_tube.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/teleport_tube.lua b/teleport_tube.lua
index 6936a82..33bfed4 100644
--- a/teleport_tube.lua
+++ b/teleport_tube.lua
@@ -94,6 +94,25 @@ register_tube("pipeworks:teleport_tube","Teleporter pneumatic tube segment",tele
end,
on_receive_fields = function(pos,formname,fields,sender)
local meta = minetest.get_meta(pos)
+
+ --check for private channels
+ if fields.channel ~= nil then
+ local name, mode = fields.channel:match("^([^:;]+)([:;])")
+ if name and mode and name ~= sender:get_player_name() then
+
+ --channels starting with '[name]:' can only be used by the named player
+ if mode == ":" then
+ minetest.chat_send_player(sender:get_player_name(), "Sorry, channel '"..fields.channel.."' is reserved for exclusive use by "..name)
+ return
+
+ --channels starting with '[name];' can be used by other players, but cannot be received from
+ elseif mode == ";" and (meta:get_int("can_receive") ~= 0) == (fields["bt"] == nil) then
+ minetest.chat_send_player(sender:get_player_name(), "Sorry, receiving from channel '"..fields.channel.."' is reserved for "..name)
+ return
+ end
+ end
+ end
+
if fields.channel==nil then fields.channel=meta:get_string("channel") end
meta:set_string("channel",fields.channel)
remove_tube_in_file(pos)