aboutsummaryrefslogtreecommitdiff
path: root/advtrains_luaautomation/passive.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2018-04-25 17:14:03 +0200
committerorwell96 <orwell@bleipb.de>2018-04-25 17:14:03 +0200
commit1feae7a1ea35fd8f4f3495d1bf65f8180bb0f720 (patch)
treec4119c0cee9d2aaa0d6daf462391ea519e8345d1 /advtrains_luaautomation/passive.lua
parent8b576357ef1d2346e9af112e115ac92a5f4d222d (diff)
downloadadvtrains-1feae7a1ea35fd8f4f3495d1bf65f8180bb0f720.tar.gz
advtrains-1feae7a1ea35fd8f4f3495d1bf65f8180bb0f720.tar.bz2
advtrains-1feae7a1ea35fd8f4f3495d1bf65f8180bb0f720.zip
Add digiline interface and is_passive function to LuaATC
Diffstat (limited to 'advtrains_luaautomation/passive.lua')
-rw-r--r--advtrains_luaautomation/passive.lua15
1 files changed, 14 insertions, 1 deletions
diff --git a/advtrains_luaautomation/passive.lua b/advtrains_luaautomation/passive.lua
index 774df8a..e0902f5 100644
--- a/advtrains_luaautomation/passive.lua
+++ b/advtrains_luaautomation/passive.lua
@@ -34,6 +34,19 @@ local function setstate(parpos, newstate)
end
end
+local function is_passive(parpos)
+ local pos=atlatc.pcnaming.resolve_pos(parpos)
+ if type(pos)~="table" or (not pos.x or not pos.y or not pos.z) then
+ return false
+ end
+ local node=advtrains.ndb.get_node(pos)
+ local ndef=minetest.registered_nodes[node.name]
+ if ndef and ndef.luaautomation and ndef.luaautomation.getstate then
+ return true
+ end
+ return false
+end
+
-- gets called from environment.lua
-- return the values here to keep them local
-return getstate, setstate
+return getstate, setstate, is_passive