From d837e7e5e9d2d6de7903e91b3efc36e0dd032b92 Mon Sep 17 00:00:00 2001 From: orwell96 Date: Fri, 24 Aug 2018 22:39:13 +0200 Subject: Add LuaAutomation interface functions for interlocking routesetting and aspect requesting. This allows to incorporate interlocking to automated systems --- advtrains_luaautomation/pcnaming.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'advtrains_luaautomation/pcnaming.lua') diff --git a/advtrains_luaautomation/pcnaming.lua b/advtrains_luaautomation/pcnaming.lua index 4910f1d..8880d53 100644 --- a/advtrains_luaautomation/pcnaming.lua +++ b/advtrains_luaautomation/pcnaming.lua @@ -12,9 +12,14 @@ function atlatc.pcnaming.save() return atlatc.pcnaming.name_map end -function atlatc.pcnaming.resolve_pos(posorname) - if type(posorname)=="table" then return posorname end - return atlatc.pcnaming.name_map[posorname] +function atlatc.pcnaming.resolve_pos(pos, func_name) + if type(pos)=="string" then + local e = atlatc.pcnaming.name_map[pos] + if e then return e end + elseif type(pos)=="table" and pos.x and pos.y and pos.z then + return pos + end + error("Invalid position supplied to " .. (func_name or "???")..": " .. dump(pos)) end minetest.register_craftitem("advtrains_luaautomation:pcnaming",{ -- cgit v1.2.3