I have made models for Y-shaped and 3-way turnouts. These are some very
useful shapes!
I added native support for the three-way turnouts by giving them 5 entries
in the conns table, the last entry being unused but useful to distinguish
from crossings without refactoring the rest of the code. It was also
necessary to update the setstate function to not assume two-state switches
but instead set the state that was specifically passed - as used in
interlocking.
See the code at https://github.com/Montandalar/advtrains/pull/5
Nice work on the turnouts!
I noticed something weird when setting a route from a headshunt when
testing though, see:
https://github.com/Montandalar/advtrains/issues/6
I have pushed a new commit to address this issue,
https://github.com/Montandalar/advtrains/commit/61009bf00dc705077ca42d003e4c164d162f83ab
It is the new tip of the moreturnouts branch
just updated to 1a743c2
crashes when assigning tcb near 3way turnout
from console:
2020-09-15 06:16:26: ERROR[Main]: ServerError: AsyncErr:
ServerThread::run Lua: Runtime error from mod '' in callback
node_on_punch():
/home/corey/.minetest/mods/advtrains/advtrains/helpers.lua:44:
advtrains: in helpers.lua/dir_to_vector() given dir=nil
2020-09-15 06:16:26: ERROR[Main]: stack traceback:
2020-09-15 06:16:26: ERROR[Main]: [C]: in function 'error'
2020-09-15 06:16:26: ERROR[Main]:
/home/mt/.minetest/mods/advtrains/advtrains/helpers.lua:44: in function
'dirToCoord'
2020-09-15 06:16:26: ERROR[Main]:
/home/mt/.minetest/mods/advtrains/advtrains/helpers.lua:34: in function
'dirCoordSet'
2020-09-15 06:16:26: ERROR[Main]:
/home/mt/.minetest/mods/advtrains/advtrains/helpers.lua:313: in function
'get_adjacent_rail'
2020-09-15 06:16:26: ERROR[Main]:
...etest/mods/advtrains/advtrains_interlocking/database.lua:271: in
function 'traverser'
2020-09-15 06:16:26: ERROR[Main]:
...etest/mods/advtrains/advtrains_interlocking/database.lua:295: in
function 'traverser'
2020-09-15 06:16:26: ERROR[Main]:
...etest/mods/advtrains/advtrains_interlocking/database.lua:295: in
function 'traverser'
2020-09-15 06:16:26: ERROR[Main]:
...etest/mods/advtrains/advtrains_interlocking/database.lua:295: in
function 'traverser'
2020-09-15 06:16:26: ERROR[Main]:
...etest/mods/advtrains/advtrains_interlocking/database.lua:344: in
function 'sync_tcb_neighbors'
2020-09-15 06:16:26: ERROR[Main]:
...test/mods/advtrains/advtrains_interlocking/tcb_ts_ui.lua:125: in
function 'callback'
2020-09-15 06:16:26: ERROR[Main]:
/usr/share/minetest/builtin/game/item.lua:505: in function
</usr/share/minetest/builtin/game/item.lua:498>
see https://github.com/Montandalar/advtrains/issues/7 for more info and
image
The above issue resulted from using ["3"] as the key in the conns table for
3-way turnouts. I have pushed another commit to fix. Thank you for doing
the important job of testing this! Makes me think we should have automated
tests too though.
https://github.com/Montandalar/advtrains/pull/8
A reminder that the commit 521f93d which addresses this last issue with
3-way turnouts and the traverser still has not been merged into master,
meaning anyone using the latest master will still have an unstable version
where they can't use interlocking on the 3-ways without a crash. Hope to
see it merged soon, thanks!