aboutsummaryrefslogtreecommitdiff
path: root/advtrains_luaautomation/passive.lua
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2018-06-10 17:30:50 +0200
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2018-06-10 17:30:50 +0200
commit38d10acca24e5a34671a1a71f12923002d06253d (patch)
treea72aa02902af4dd37bbfa753bdb1ef651e72be88 /advtrains_luaautomation/passive.lua
parent3e29cba6af2e19909b6d143cecaec877aaf3a7bd (diff)
parent8d8e8c1553bc631b8f357005b506bc651de9a138 (diff)
downloadadvtrains-38d10acca24e5a34671a1a71f12923002d06253d.tar.gz
advtrains-38d10acca24e5a34671a1a71f12923002d06253d.tar.bz2
advtrains-38d10acca24e5a34671a1a71f12923002d06253d.zip
Merge branch 'master' of https://github.com/orwell96/advtrains
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