From d51a00c8232e2500783f1a04ec7ad1bf01cadd8b Mon Sep 17 00:00:00 2001 From: orwell96 Date: Tue, 28 Feb 2017 14:38:59 +0100 Subject: Add passive component naming --- advtrains/advtrains_luaautomation/passive.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'advtrains/advtrains_luaautomation/passive.lua') 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 -- cgit v1.2.3