aboutsummaryrefslogtreecommitdiff
path: root/advtrains/advtrains_luaautomation/passive.lua
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2017-02-28 14:38:59 +0100
committerorwell96 <mono96.mml@gmail.com>2017-02-28 14:38:59 +0100
commitd51a00c8232e2500783f1a04ec7ad1bf01cadd8b (patch)
treee7b5e6a4964fa6f87f987ef77d09ac903ba338e3 /advtrains/advtrains_luaautomation/passive.lua
parentaa2ec0fc0337de5facb7ebf9adb3dca4f9fefdaf (diff)
downloadadvtrains-d51a00c8232e2500783f1a04ec7ad1bf01cadd8b.tar.gz
advtrains-d51a00c8232e2500783f1a04ec7ad1bf01cadd8b.tar.bz2
advtrains-d51a00c8232e2500783f1a04ec7ad1bf01cadd8b.zip
Add passive component naming
Diffstat (limited to 'advtrains/advtrains_luaautomation/passive.lua')
-rw-r--r--advtrains/advtrains_luaautomation/passive.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/advtrains/advtrains_luaautomation/passive.lua b/advtrains/advtrains_luaautomation/passive.lua
index e32bee9..774df8a 100644
--- a/advtrains/advtrains_luaautomation/passive.lua
+++ b/advtrains/advtrains_luaautomation/passive.lua
@@ -1,8 +1,9 @@
-- passive.lua
-- API to passive components, as described in passive_api.txt
-local function getstate(pos)
- if not type(pos)=="table" or not pos.x or not pos.y or not pos.z then
+local function getstate(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
debug.sethook()
error("Invalid position supplied to getstate")
end
@@ -19,8 +20,9 @@ local function getstate(pos)
return nil
end
-local function setstate(pos, newstate)
- if not type(pos)=="table" or not pos.x or not pos.y or not pos.z then
+local function setstate(parpos, newstate)
+ local pos=atlatc.pcnaming.resolve_pos(parpos)
+ if type(pos)~="table" or (not pos.x or not pos.y or not pos.z) then
debug.sethook()
error("Invalid position supplied to setstate")
end