state command added
This commit is contained in:
parent
2b6fcb5b9b
commit
01c49cadf1
@ -136,6 +136,13 @@ techage.register_node({"techage:ta3_cartdetector_off", "techage:ta3_cartdetector
|
|||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
local dir = minetest.facedir_to_dir(node.param2)
|
local dir = minetest.facedir_to_dir(node.param2)
|
||||||
minecart.punch_cart(pos, nil, 1.5, dir)
|
minecart.punch_cart(pos, nil, 1.5, dir)
|
||||||
|
elseif topic == "state" then
|
||||||
|
local node = techage.get_node_lvm(pos)
|
||||||
|
if node.name == "techage:ta3_cartdetector_on" then
|
||||||
|
return "on"
|
||||||
|
else
|
||||||
|
return "off"
|
||||||
|
end
|
||||||
else
|
else
|
||||||
return "unsupported"
|
return "unsupported"
|
||||||
end
|
end
|
||||||
|
@ -187,6 +187,21 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
techage.register_node({"techage:ta3_nodedetector_off", "techage:ta3_nodedetector_on"}, {
|
techage.register_node({"techage:ta3_nodedetector_off", "techage:ta3_nodedetector_on"}, {
|
||||||
|
on_recv_message = function(pos, src, topic, payload)
|
||||||
|
if topic == "name" then
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
return nvm.player_name or ""
|
||||||
|
elseif topic == "state" then
|
||||||
|
local node = techage.get_node_lvm(pos)
|
||||||
|
if node.name == "techage:ta3_nodedetector_off" then
|
||||||
|
return "on"
|
||||||
|
else
|
||||||
|
return "off"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return "unsupported"
|
||||||
|
end
|
||||||
|
end,
|
||||||
on_node_load = function(pos)
|
on_node_load = function(pos)
|
||||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||||
end,
|
end,
|
||||||
|
@ -311,6 +311,14 @@ techage.register_node({
|
|||||||
if topic == "name" then
|
if topic == "name" then
|
||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
return nvm.player_name or ""
|
return nvm.player_name or ""
|
||||||
|
elseif topic == "state" then
|
||||||
|
local node = techage.get_node_lvm(pos)
|
||||||
|
if node.name == "techage:ta3_playerdetector_on" or
|
||||||
|
node.name == "techage:ta4_playerdetector_on" then
|
||||||
|
return "on"
|
||||||
|
else
|
||||||
|
return "off"
|
||||||
|
end
|
||||||
else
|
else
|
||||||
return "unsupported"
|
return "unsupported"
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user