aboutsummaryrefslogtreecommitdiff
path: root/advtrains_luaautomation/passive.lua
diff options
context:
space:
mode:
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