diff options
author | 1F616EMO <root@1f616emo.xyz> | 2024-06-30 06:20:42 +0800 |
---|---|---|
committer | orwell <orwell@bleipb.de> | 2024-08-01 21:59:41 +0200 |
commit | ae394a43b8a715570ee3b94b19e70b8d66f597e4 (patch) | |
tree | 0af2372c4d7119339f47a6cdd1f68286ad434fb0 /advtrains_interlocking/tcb_ts_ui.lua | |
parent | 0a51d5713839cf346b1dcdf97725d525d7fa086b (diff) | |
download | advtrains-ae394a43b8a715570ee3b94b19e70b8d66f597e4.tar.gz advtrains-ae394a43b8a715570ee3b94b19e70b8d66f597e4.tar.bz2 advtrains-ae394a43b8a715570ee3b94b19e70b8d66f597e4.zip |
Remove TCB marker on TCB removal
This patch fixes the following problem:
* TCB marker is not removed on TCB removal
* TCB marker is recreated on removal
Diffstat (limited to 'advtrains_interlocking/tcb_ts_ui.lua')
-rwxr-xr-x | advtrains_interlocking/tcb_ts_ui.lua | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/advtrains_interlocking/tcb_ts_ui.lua b/advtrains_interlocking/tcb_ts_ui.lua index 0cc10da..96edadb 100755 --- a/advtrains_interlocking/tcb_ts_ui.lua +++ b/advtrains_interlocking/tcb_ts_ui.lua @@ -550,6 +550,13 @@ minetest.register_entity("advtrains_interlocking:tcbmarker", { static_save = false, }) +function advtrains.interlocking.remove_tcb_marker_pts(pts) + if markerent[pts] then + markerent[pts]:remove() + markerent[pts] = nil + end +end + function advtrains.interlocking.show_tcb_marker(pos) --atdebug("showing tcb marker",pos) local tcb = ildb.get_tcb(pos) @@ -573,9 +580,7 @@ function advtrains.interlocking.show_tcb_marker(pos) end local pts = advtrains.roundfloorpts(pos) - if markerent[pts] then - markerent[pts]:remove() - end + advtrains.interlocking.remove_tcb_marker_pts(pts) local obj = minetest.add_entity(pos, "advtrains_interlocking:tcbmarker") if not obj then return end |