From 1feae7a1ea35fd8f4f3495d1bf65f8180bb0f720 Mon Sep 17 00:00:00 2001 From: orwell96 Date: Wed, 25 Apr 2018 17:14:03 +0200 Subject: Add digiline interface and is_passive function to LuaATC --- advtrains_luaautomation/passive.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'advtrains_luaautomation/passive.lua') 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 -- cgit v1.2.3