diff options
author | orwell <orwell@bleipb.de> | 2024-06-11 22:30:40 +0200 |
---|---|---|
committer | orwell <orwell@bleipb.de> | 2024-06-11 22:30:40 +0200 |
commit | 72cae1327527672afe2bbb47662d42a44f086942 (patch) | |
tree | 7283d5d08a4f5ea46414cad2e76dc7b99b347125 /advtrains_interlocking | |
parent | 44a8cef1d5f2433502f5982f1d57410f49bb3afc (diff) | |
download | advtrains-72cae1327527672afe2bbb47662d42a44f086942.tar.gz advtrains-72cae1327527672afe2bbb47662d42a44f086942.tar.bz2 advtrains-72cae1327527672afe2bbb47662d42a44f086942.zip |
Fix more setstate stuff with new API (compat legacy)
Diffstat (limited to 'advtrains_interlocking')
-rw-r--r-- | advtrains_interlocking/signal_api.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/advtrains_interlocking/signal_api.lua b/advtrains_interlocking/signal_api.lua index a300ab1..b1e8b20 100644 --- a/advtrains_interlocking/signal_api.lua +++ b/advtrains_interlocking/signal_api.lua @@ -211,6 +211,21 @@ function signal.clear_aspect(pos, skip_dst_notify) end end +-- Clear any info about aspects from this signal, without resetting/reapplying the aspect. +-- Supposed to be used for legacy on-off signals when the on-off toggle is used +function signal.unregister_aspect(pos) + local main_pts = advtrains.encode_pos(pos) + local old_tbl = signal.aspects[main_pts] + local old_remote = old_tbl and old_tbl.remote + + -- unregister from old remote + if old_remote then + signal.distant_refs[old_remote][main_pts] = nil + end + + signal.aspects[main_pts] = nil +end + -- Notify distant signals of main_pts of a change in the aspect of this signal -- function signal.notify_distants_of(main_pts, limit) |