~gpcf/advtrains-devel

[LuaATC] Add get_supported_aspects(), fix set_aspect() v1 PROPOSED

Maverick2797: 2
 [LuaATC] Add get_supported_aspects(), fix set_aspect()
 [LuaATC] Fix set_aspect()

 2 files changed, 6 insertions(+), 2 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~gpcf/advtrains-devel/patches/51633/mbox | git am -3
Learn more about email & git

[PATCH] [LuaATC] Add get_supported_aspects(), fix set_aspect() Export this patch

Allow LuaATC to request supported signal aspects

Actually send aspect to advtrains.interlocking.signal_set_aspect() from LuaATC set_aspect()
---
 advtrains_luaautomation/environment.lua | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/advtrains_luaautomation/environment.lua b/advtrains_luaautomation/environment.lua
index 6df5248..8e90dc4 100644
--- a/advtrains_luaautomation/environment.lua
+++ b/advtrains_luaautomation/environment.lua
@@ -218,13 +218,17 @@ if advtrains.interlocking then
		local pos, sigd, tcbs, routeid, route = gen_checks(signal, "", true)
		return advtrains.interlocking.route.update_route(sigd, tcbs, nil, true)
	end
	static_env.get_supported_aspects = function(signal)
		local pos = atlatc.pcnaming.resolve_pos(signal)
		return advtrains.interlocking.signal_get_supported_aspects(pos)
	end
	static_env.get_aspect = function(signal)
		local pos = atlatc.pcnaming.resolve_pos(signal)
		return advtrains.interlocking.signal_get_aspect(pos)
	end
	static_env.set_aspect = function(signal, asp)
		local pos = atlatc.pcnaming.resolve_pos(signal)
		return advtrains.interlocking.signal_set_aspect(pos)
		return advtrains.interlocking.signal_set_aspect(pos,asp)
	end
	
	--section_occupancy()
-- 
2.43.0

[PATCH v2] [LuaATC] Fix set_aspect() Export this patch

Actually send aspect to advtrains.interlocking.signal_set_aspect() from LuaATC set_aspect()
---
As noted by Ywang, the signal aspect system is/will be overhalled with the merging of
feature branch(es) new-ks(-orwell). I've dropped the get_supported_aspect() function until
the system has stabilised. For now if you're working with aspects, consult the API and docs

 advtrains_luaautomation/environment.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/advtrains_luaautomation/environment.lua b/advtrains_luaautomation/environment.lua
index 6df5248..b3b32b0 100644
--- a/advtrains_luaautomation/environment.lua
+++ b/advtrains_luaautomation/environment.lua
@@ -224,7 +224,7 @@ if advtrains.interlocking then
	end
	static_env.set_aspect = function(signal, asp)
		local pos = atlatc.pcnaming.resolve_pos(signal)
		return advtrains.interlocking.signal_set_aspect(pos)
		return advtrains.interlocking.signal_set_aspect(pos,asp)
	end
	
	--section_occupancy()
-- 
2.43.0