mirror of
https://github.com/mt-mods/pipeworks.git
synced 2025-05-10 20:50:22 +02:00
allow setting can_receive flag by digilines
basically also allows sending tables to change both or either the tp-channel and receive toggle
This commit is contained in:
parent
bd5a42356b
commit
43bb8dc803
@ -259,14 +259,32 @@ local function repair_tube(pos, node)
|
|||||||
update_meta(meta)
|
update_meta(meta)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function digiline_action(pos, _, channel, msg)
|
local function digiline_action(pos, _, digiline_channel, msg)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
if channel ~= meta:get_string("digiline_channel") or type(msg) ~= "string" then
|
if digiline_channel ~= meta:get_string("digiline_channel") then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local name = meta:get_string("owner")
|
local channel = meta:get_string("channel")
|
||||||
local cr = meta:get_int("can_receive")
|
local can_receive = meta:get_int("can_receive")
|
||||||
update_tube(pos, msg, cr, name)
|
local t_msg = type(msg)
|
||||||
|
if t_msg == "string" then
|
||||||
|
channel = msg
|
||||||
|
elseif t_msg == "table" then
|
||||||
|
if type(msg.channel) == "string" then
|
||||||
|
channel = msg.channel
|
||||||
|
end
|
||||||
|
if nil ~= msg.can_receive then
|
||||||
|
if msg.can_receive == 1 or msg.can_receive == true then
|
||||||
|
can_receive = 1
|
||||||
|
else
|
||||||
|
can_receive = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local player_name = meta:get_string("owner")
|
||||||
|
update_tube(pos, channel, can_receive, player_name)
|
||||||
update_meta(meta)
|
update_meta(meta)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user