[Mod] Advanced Trains [advtrains] [2.4.7]
Re: [Mod] Advanced Trains [advtrains] [2.4.5]
An error happens in Advtrains in the following situation: I have a level crossing between a linetrack road line and a train line. As the train arrives at the crossing, a bus is, well, crossing the tracks. Interlocking makes the train slow down, a susual. However, as soon as the bus is out of the crossing, i.e when the light turns green and the train begins to cross the road, the error gets thrown. It does not seem to be crossing-dependent, and never occurs when it is the bus that is blocked. Quite strange. Upon reloading the world, everything is back as usual.
Maybe it is worth mentioning that after the crossing, the track continues on a 50-ish-node-long section (part of the same route as the crossing sections), at the end of which there is a signal, and then another 50-ish-node-long section. The signal at the beginning of this section has a route set in automatic working, which comprises that section.
Error message:
-- Upd. 6 --
Turns out I mistook a function for another; I did not realize I was looking at the wrong function. That might explain my problems with finding where the error is.
Investigations now continue in function on_train_approach() r.fire_event() from the LuaATC rail definition, in file advtrains_luaautomation/atc_rail.lua.
It seems the problem is in the code run by the LuaATC. This code simply... Er... Sets a signal? Investigations now continue in function advtrains.interlocking.route.update_route() (large amount of functions skipped) advtrains.interlocking.signal_on_aspect_changed() aaaaand...
Aha! That last function calls advtrains.invalidate_all_paths_ahead()! Which brings us back to advtrains/trainlogic.lua after our grand tour of many different files... Now, I'm pretty sure advtrains.occ.reverse_lookup_sel() does not modify the lzb data, so I guess the problem is in advtrains.path_invalidate_ahead() (advtrains/path.lua), in which lzb is mentioned by a comment right above a call to advtrains.run_callbacks_invahead() (back to trainlogic.lua) which is another function which registers callbacks! So, yay, prints() again... (other suspect function would be advtrains.occ.clear_specific_item(), which I think can not be the culprit)
-- Upd. 7 --
We then look where advtrains.te_register_on_invalidate_ahead() is called, and find lzb.lua in which is registered a function that calls advtrains.lzb_invalidate_ahead(). Looking for that function, we find at line 228 the following:
As far as I could understand, I think it should be replaced by:
I have tested this change and it seems to work.
P.S: I wonder how many functions and files I had to travel through to find that. I'll say it was a well-spent afternoon. (lil' trip in Advtrains code...)
Maybe it is worth mentioning that after the crossing, the track continues on a 50-ish-node-long section (part of the same route as the crossing sections), at the end of which there is a signal, and then another 50-ish-node-long section. The signal at the beginning of this section has a route set in automatic working, which comprises that section.
Error message:
Code: Select all
AsyncErr: Lua: Runtime error from mod 'advtrains' in callback environment_Step(): ...etest/mods/advtrains/advtrains_interlocking/approach.lua:43: attempt to index local 'lzbdata' (a nil value)
stack traceback:
...etest/mods/advtrains/advtrains_interlocking/approach.lua:43: in function 'f'
...DACTED/.minetest/mods/advtrains/advtrains/trainlogic.lua:832: in function 'run_callbacks_approach_node'
...DACTED/.minetest/mods/advtrains/advtrains/trainlogic.lua:910: in function 'tnc_call_approach_callback'
/home/REDACTED/.minetest/mods/advtrains/advtrains/lzb.lua:116: in function 'lzb_look_ahead'
...DACTED/.minetest/mods/advtrains/advtrains/trainlogic.lua:358: in function 'train_step_b'
...vyroot/.minetest/mods/advtrains/advtrains/trainlogic.lua:109: in function 'mainloop_trainlogic'
/home/REDACTED/.minetest/mods/advtrains/advtrains/init.lua:624: in function </home/REDACTED/.minetest/mods/advtrains/advtrains/init.lua:586>
/usr/share/minetest/builtin/common/register.lua:26: in function </usr/share/minetest/builtin/common/register.lua:12>
Spoiler
-- Upd. --
Having inserted a print() in the Advtrains code, it seems the crash occurs when the function is called for the train; maybe it is due to the track ending some distance away? I am not sure but maybe it is because of this.
-- Upd. 2 --
Nay, it's not that. Still crashes.
-- Upd. 3 --
After some investigations, it seems that the function that makes the game crash receives, at some point, some lzbdata, but at the same call of the function train.lzb.trav_lzbdata is nil (whereas it usually is a table). Then, on the next call to this specific function, the lzbdata it receives is nil. I do not know if any function that is registered with advtrains.tnc_register_on_approach() removes train.lzb.trav_lzbdata, so I will look for that.
EDIT: No, it seems the crashing function is the only one to be called on approach callbacks (unless grep is drunk).
-- Upd. 4 --
With more print()s, it seems that train.lzb.trav_lzbdata is modified (or removed) by advtrains.tnc_call_approach_callback(), but before the crashing function (the only one that is registered, thus called) is called.
-- Upd. 5 --
With even more print()s, the results are:
Having inserted a print() in the Advtrains code, it seems the crash occurs when the function is called for the train; maybe it is due to the track ending some distance away? I am not sure but maybe it is because of this.
-- Upd. 2 --
Nay, it's not that. Still crashes.
-- Upd. 3 --
After some investigations, it seems that the function that makes the game crash receives, at some point, some lzbdata, but at the same call of the function train.lzb.trav_lzbdata is nil (whereas it usually is a table). Then, on the next call to this specific function, the lzbdata it receives is nil. I do not know if any function that is registered with advtrains.tnc_register_on_approach() removes train.lzb.trav_lzbdata, so I will look for that.
EDIT: No, it seems the crashing function is the only one to be called on approach callbacks (unless grep is drunk).
-- Upd. 4 --
With more print()s, it seems that train.lzb.trav_lzbdata is modified (or removed) by advtrains.tnc_call_approach_callback(), but before the crashing function (the only one that is registered, thus called) is called.
-- Upd. 5 --
With even more print()s, the results are:
- In advtrains/lzb.lua, function resolve_latest_lzbdata(): right before calling advtrains.tnc_call_approach_callback(), everything is normal - train.lzb.trav_lzbdata exists.
- In advtrains/trainlogic.lua, function mknodecallback(), in the function it returns (which is then referred to ads advtrains.tnc_call_approach_callback()): immediately after the function is called, train.lzb.trav_lzbdata no longer exists. However, it seems that, in-between, a LuaATC some distance away got called, which is supposed to set a route at a signal on the train line. Investigations in progress...
Turns out I mistook a function for another; I did not realize I was looking at the wrong function. That might explain my problems with finding where the error is.
Investigations now continue in function on_train_approach() r.fire_event() from the LuaATC rail definition, in file advtrains_luaautomation/atc_rail.lua.
It seems the problem is in the code run by the LuaATC. This code simply... Er... Sets a signal? Investigations now continue in function advtrains.interlocking.route.update_route() (large amount of functions skipped) advtrains.interlocking.signal_on_aspect_changed() aaaaand...
Aha! That last function calls advtrains.invalidate_all_paths_ahead()! Which brings us back to advtrains/trainlogic.lua after our grand tour of many different files... Now, I'm pretty sure advtrains.occ.reverse_lookup_sel() does not modify the lzb data, so I guess the problem is in advtrains.path_invalidate_ahead() (advtrains/path.lua), in which lzb is mentioned by a comment right above a call to advtrains.run_callbacks_invahead() (back to trainlogic.lua) which is another function which registers callbacks! So, yay, prints() again... (other suspect function would be advtrains.occ.clear_specific_item(), which I think can not be the culprit)
-- Upd. 7 --
We then look where advtrains.te_register_on_invalidate_ahead() is called, and find lzb.lua in which is registered a function that calls advtrains.lzb_invalidate_ahead(). Looking for that function, we find at line 228 the following:
Code: Select all
train.lzb.trav_lzbdata = nil
Code: Select all
train.lzb.trav_lzbdata = {}
P.S: I wonder how many functions and files I had to travel through to find that. I'll say it was a well-spent afternoon. (lil' trip in Advtrains code...)
Last edited by nazalassa on Thu Sep 19, 2024 06:42, edited 14 times in total.
Life is like a multitasking OS: you know you'll eventually get back to anything, but you don't know when. s/luanti/minetest/gi
Re: [Mod] Advanced Trains [advtrains] [2.4.5]
While I am on the subject of fixing stuff in Advtrains, I would like to suggest (again) making it possible to add fields to the table of train fields to be saved. This way, mods that store train data will not need to worry about saving it: Advtrains will do it for them.
Life is like a multitasking OS: you know you'll eventually get back to anything, but you don't know when. s/luanti/minetest/gi
Re: [Mod] Advanced Trains [advtrains] [2.4.3]
AsyncErr: Lua: Runtime error from mod 'advtrains' in callback environment_Step(): ...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:1121: attempt to index local 'wagon' (a nil value)
stack traceback:
...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:1121: in function 'spawn_wagons'
...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:714: in function 'train_step_c'
...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:114: in function 'mainloop_trainlogic'
...est-5.9.0-win64\bin\..\mods\advtrains\advtrains\init.lua:618: in function <...est-5.9.0-win64\bin\..\mods\advtrains\advtrains\init.lua:580>
...\minetest-5.9.0-win64\bin\..\builtin\common\register.lua:26: in function <...\minetest-5.9.0-win64\bin\..\builtin\common\register.lua:12>
HELP PLEASE!!!
stack traceback:
...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:1121: in function 'spawn_wagons'
...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:714: in function 'train_step_c'
...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:114: in function 'mainloop_trainlogic'
...est-5.9.0-win64\bin\..\mods\advtrains\advtrains\init.lua:618: in function <...est-5.9.0-win64\bin\..\mods\advtrains\advtrains\init.lua:580>
...\minetest-5.9.0-win64\bin\..\builtin\common\register.lua:26: in function <...\minetest-5.9.0-win64\bin\..\builtin\common\register.lua:12>
HELP PLEASE!!!
Re: [Mod] Advanced Trains [advtrains] [2.4.3]
It could help if you could provide information about when the crash happened, i.e what you were doing - I assume you were going somewhere where there was a train, and suddenly the game crashed, but that is only an assumption, and I can not know the rest of the situation. It may also help to know the list of mods you use, especially those you recently upgraded or installed (if any).Dmax_05 wrote: ↑Thu Sep 19, 2024 13:06AsyncErr: Lua: Runtime error from mod 'advtrains' in callback environment_Step(): ...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:1121: attempt to index local 'wagon' (a nil value)
stack traceback:
...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:1121: in function 'spawn_wagons'
...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:714: in function 'train_step_c'
...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:114: in function 'mainloop_trainlogic'
...est-5.9.0-win64\bin\..\mods\advtrains\advtrains\init.lua:618: in function <...est-5.9.0-win64\bin\..\mods\advtrains\advtrains\init.lua:580>
...\minetest-5.9.0-win64\bin\..\builtin\common\register.lua:26: in function <...\minetest-5.9.0-win64\bin\..\builtin\common\register.lua:12>
HELP PLEASE!!!
Life is like a multitasking OS: you know you'll eventually get back to anything, but you don't know when. s/luanti/minetest/gi
Re: [Mod] Advanced Trains [advtrains] [2.4.5]
nazalassa wrote: ↑Sun Sep 15, 2024 13:54An error happens in Advtrains in the following situation: I have a level crossing between a linetrack road line and a train line. As the train arrives at the crossing, a bus is, well, crossing the tracks. Interlocking makes the train slow down, a susual. However, as soon as the bus is out of the crossing, i.e when the light turns green and the train begins to cross the road, the error gets thrown. It does not seem to be crossing-dependent, and never occurs when it is the bus that is blocked. Quite strange. Upon reloading the world, everything is back as usual.
Maybe it is worth mentioning that after the crossing, the track continues on a 50-ish-node-long section (part of the same route as the crossing sections), at the end of which there is a signal, and then another 50-ish-node-long section. The signal at the beginning of this section has a route set in automatic working, which comprises that section.
Error message:Code: Select all
AsyncErr: Lua: Runtime error from mod 'advtrains' in callback environment_Step(): ...etest/mods/advtrains/advtrains_interlocking/approach.lua:43: attempt to index local 'lzbdata' (a nil value) stack traceback: ...etest/mods/advtrains/advtrains_interlocking/approach.lua:43: in function 'f' ...DACTED/.minetest/mods/advtrains/advtrains/trainlogic.lua:832: in function 'run_callbacks_approach_node' ...DACTED/.minetest/mods/advtrains/advtrains/trainlogic.lua:910: in function 'tnc_call_approach_callback' /home/REDACTED/.minetest/mods/advtrains/advtrains/lzb.lua:116: in function 'lzb_look_ahead' ...DACTED/.minetest/mods/advtrains/advtrains/trainlogic.lua:358: in function 'train_step_b' ...vyroot/.minetest/mods/advtrains/advtrains/trainlogic.lua:109: in function 'mainloop_trainlogic' /home/REDACTED/.minetest/mods/advtrains/advtrains/init.lua:624: in function </home/REDACTED/.minetest/mods/advtrains/advtrains/init.lua:586> /usr/share/minetest/builtin/common/register.lua:26: in function </usr/share/minetest/builtin/common/register.lua:12>
In hindsight, grep -rn trav_lzbdata would probably be faster.-- Upd. 7 --
We then look where advtrains.te_register_on_invalidate_ahead() is called, and find lzb.lua in which is registered a function that calls advtrains.lzb_invalidate_ahead(). Looking for that function, we find at line 228 the following:
As far as I could understand, I think it should be replaced by:Code: Select all
train.lzb.trav_lzbdata = nil
I have tested this change and it seems to work.Code: Select all
train.lzb.trav_lzbdata = {}
P.S: I wonder how many functions and files I had to travel through to find that. I'll say it was a well-spent afternoon. (lil' trip in Advtrains code...)
Anyway, I'm not sure whether setting trav_lzbdata to the empty table is a good idea, considering that the point of invalidating lzbdata is to tell the LZB system to generate it based on updated information. IMO it would be better to move the nil check (which currently is only performed once before the while loop) into the while loop so that the check is performed at the beginning of each iteration.
Does this patch help?: https://lists.sr.ht/~gpcf/advtrains-devel/patches/55107Dmax_05 wrote: ↑Sat Sep 14, 2024 18:35AsyncErr: Lua: Runtime error from mod 'advtrains' in callback environment_Step(): ...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:1121: attempt to index local 'wagon' (a nil value)
stack traceback:
...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:1121: in function 'spawn_wagons'
...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:714: in function 'train_step_c'
...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:114: in function 'mainloop_trainlogic'
...est-5.9.0-win64\bin\..\mods\advtrains\advtrains\init.lua:618: in function <...est-5.9.0-win64\bin\..\mods\advtrains\advtrains\init.lua:580>
...\minetest-5.9.0-win64\bin\..\builtin\common\register.lua:26: in function <...\minetest-5.9.0-win64\bin\..\builtin\common\register.lua:12>
Anyone knows how to solve this error?
Last edited by yw05 on Fri Sep 20, 2024 11:26, edited 1 time in total.
Re: [Mod] Advanced Trains [advtrains] [2.4.3]
I was going near the station were there are some trains and the game suddenly crashed. I don't know how to give you the list of mods.nazalassa wrote: ↑Thu Sep 19, 2024 15:58It could help if you could provide information about when the crash happened, i.e what you were doing - I assume you were going somewhere where there was a train, and suddenly the game crashed, but that is only an assumption, and I can not know the rest of the situation. It may also help to know the list of mods you use, especially those you recently upgraded or installed (if any).Dmax_05 wrote: ↑Thu Sep 19, 2024 13:06AsyncErr: Lua: Runtime error from mod 'advtrains' in callback environment_Step(): ...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:1121: attempt to index local 'wagon' (a nil value)
stack traceback:
...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:1121: in function 'spawn_wagons'
...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:714: in function 'train_step_c'
...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:114: in function 'mainloop_trainlogic'
...est-5.9.0-win64\bin\..\mods\advtrains\advtrains\init.lua:618: in function <...est-5.9.0-win64\bin\..\mods\advtrains\advtrains\init.lua:580>
...\minetest-5.9.0-win64\bin\..\builtin\common\register.lua:26: in function <...\minetest-5.9.0-win64\bin\..\builtin\common\register.lua:12>
HELP PLEASE!!!
Re: [Mod] Advanced Trains [advtrains] [2.4.5]
I don't know how to use the patch you provided. Is there a way to download it?yw05 wrote: ↑Thu Sep 19, 2024 18:49nazalassa wrote: ↑Sun Sep 15, 2024 13:54An error happens in Advtrains in the following situation: I have a level crossing between a linetrack road line and a train line. As the train arrives at the crossing, a bus is, well, crossing the tracks. Interlocking makes the train slow down, a susual. However, as soon as the bus is out of the crossing, i.e when the light turns green and the train begins to cross the road, the error gets thrown. It does not seem to be crossing-dependent, and never occurs when it is the bus that is blocked. Quite strange. Upon reloading the world, everything is back as usual.
Maybe it is worth mentioning that after the crossing, the track continues on a 50-ish-node-long section (part of the same route as the crossing sections), at the end of which there is a signal, and then another 50-ish-node-long section. The signal at the beginning of this section has a route set in automatic working, which comprises that section.
Error message:Code: Select all
AsyncErr: Lua: Runtime error from mod 'advtrains' in callback environment_Step(): ...etest/mods/advtrains/advtrains_interlocking/approach.lua:43: attempt to index local 'lzbdata' (a nil value) stack traceback: ...etest/mods/advtrains/advtrains_interlocking/approach.lua:43: in function 'f' ...DACTED/.minetest/mods/advtrains/advtrains/trainlogic.lua:832: in function 'run_callbacks_approach_node' ...DACTED/.minetest/mods/advtrains/advtrains/trainlogic.lua:910: in function 'tnc_call_approach_callback' /home/REDACTED/.minetest/mods/advtrains/advtrains/lzb.lua:116: in function 'lzb_look_ahead' ...DACTED/.minetest/mods/advtrains/advtrains/trainlogic.lua:358: in function 'train_step_b' ...vyroot/.minetest/mods/advtrains/advtrains/trainlogic.lua:109: in function 'mainloop_trainlogic' /home/REDACTED/.minetest/mods/advtrains/advtrains/init.lua:624: in function </home/REDACTED/.minetest/mods/advtrains/advtrains/init.lua:586> /usr/share/minetest/builtin/common/register.lua:26: in function </usr/share/minetest/builtin/common/register.lua:12>
In hindsight, grep -rn trav_lzbdata would probably be faster.-- Upd. 7 --
We then look where advtrains.te_register_on_invalidate_ahead() is called, and find lzb.lua in which is registered a function that calls advtrains.lzb_invalidate_ahead(). Looking for that function, we find at line 228 the following:
As far as I could understand, I think it should be replaced by:Code: Select all
train.lzb.trav_lzbdata = nil
I have tested this change and it seems to work.Code: Select all
train.lzb.trav_lzbdata = {}
P.S: I wonder how many functions and files I had to travel through to find that. I'll say it was a well-spent afternoon. (lil' trip in Advtrains code...)
Anyway, I'm not sure whether setting trav_lzbdata to the empty table is a good idea, considering that the point of invalidating lzbdata is to tell the LZB system to generate it based on updated information. IMO it would be better to move the nil check (which currently is only performed once before the while loop) into the while loop so that it is run at the beginning of each iteration.
Does this patch help?: https://lists.sr.ht/~gpcf/advtrains-devel/patches/55107Dmax_05 wrote: ↑Sat Sep 14, 2024 18:35AsyncErr: Lua: Runtime error from mod 'advtrains' in callback environment_Step(): ...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:1121: attempt to index local 'wagon' (a nil value)
stack traceback:
...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:1121: in function 'spawn_wagons'
...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:714: in function 'train_step_c'
...9.0-win64\bin\..\mods\advtrains\advtrains/trainlogic.lua:114: in function 'mainloop_trainlogic'
...est-5.9.0-win64\bin\..\mods\advtrains\advtrains\init.lua:618: in function <...est-5.9.0-win64\bin\..\mods\advtrains\advtrains\init.lua:580>
...\minetest-5.9.0-win64\bin\..\builtin\common\register.lua:26: in function <...\minetest-5.9.0-win64\bin\..\builtin\common\register.lua:12>
Anyone knows how to solve this error?
Re: [Mod] Advanced Trains [advtrains] [2.4.5]
How about a staticdata field in the train tables?nazalassa wrote: ↑Wed Sep 18, 2024 15:24While I am on the subject of fixing stuff in Advtrains, I would like to suggest (again) making it possible to add fields to the table of train fields to be saved. This way, mods that store train data will not need to worry about saving it: Advtrains will do it for them.
You can download the patch with the "Export patchset (mbox)" button. You should by able to apply it by running git am path/to/mbox or (if you do not use git) apply -p1 path/to/mbox in the Advtrains modpack directory; I would assume that Windows provides the tools for downloading patches.Dmax_05 wrote: ↑Fri Sep 20, 2024 07:14I don't know how to use the patch you provided. Is there a way to download it?yw05 wrote: ↑Thu Sep 19, 2024 18:49Does this patch help?: https://lists.sr.ht/~gpcf/advtrains-devel/patches/55107
-
- Member
- Posts: 21
- Joined: Sat Jul 06, 2024 17:34
- In-game: NicoKaiser
Re: [Mod] Fortgeschrittene [Vorzüge] [2.4.3]
I have to write:
/grantme atlatc
/set-info-display(event.id, "front", "Line 1")
?
/grantme atlatc
/set-info-display(event.id, "front", "Line 1")
?
Re: [Mod] Advanced Trains [advtrains] [2.4.5]
Both commands are not working on windowsyw05 wrote: ↑Fri Sep 20, 2024 11:04How about a staticdata field in the train tables?nazalassa wrote: ↑Wed Sep 18, 2024 15:24While I am on the subject of fixing stuff in Advtrains, I would like to suggest (again) making it possible to add fields to the table of train fields to be saved. This way, mods that store train data will not need to worry about saving it: Advtrains will do it for them.
You can download the patch with the "Export patchset (mbox)" button. You should by able to apply it by running git am path/to/mbox or (if you do not use git) apply -p1 path/to/mbox in the Advtrains modpack directory; I would assume that Windows provides the tools for downloading patches.Dmax_05 wrote: ↑Fri Sep 20, 2024 07:14I don't know how to use the patch you provided. Is there a way to download it?yw05 wrote: ↑Thu Sep 19, 2024 18:49Does this patch help?: https://lists.sr.ht/~gpcf/advtrains-devel/patches/55107
Re: [Mod] Advanced Trains [advtrains] [2.4.5]
Why not... Actually, this seems better than setting random fields in the train table.yw05 wrote: ↑Fri Sep 20, 2024 11:04How about a staticdata field in the train tables?nazalassa wrote: ↑Wed Sep 18, 2024 15:24While I am on the subject of fixing stuff in Advtrains, I would like to suggest (again) making it possible to add fields to the table of train fields to be saved. This way, mods that store train data will not need to worry about saving it: Advtrains will do it for them.
What you have to do is:NicoKaiserHello wrote: ↑Fri Sep 20, 2024 11:19I have to write:
/grantme atlatc
/set-info-display(event.id, "front", "Line 1")
?
- In your minetest world, press the '/' key, which will open the chat at the top of the screen
- Enter the following command: /grantme atlatc
(make sure there is only 1 '/' and not 2 before 'grantme')- You should then see in the chat someting like this: "Privileges of <playername>: ..."
- If you did not create a LuaATC environment yet, you should create one; to do so, repeat the above steps with: /env_create <name> (replace <name> with whatever name you wish, e.g "subway")
- You can then go to your LuaATC rail, and enter code into it. Make sure to assign it to an environment using the drop-down menu in the top-left of the LuaATC rail formspec.
- set_info_display() is a function that can be used in LuaATC code. So, in your LuaATC rail, you should enter the following code:
Code: Select all
if event.train then set_info_display(event.id, "front", "Line 1") end
Life is like a multitasking OS: you know you'll eventually get back to anything, but you don't know when. s/luanti/minetest/gi
Re: [Mod] Advanced Trains [advtrains] [2.4.5]
I guess we'll have to go with a hotfix then. Does line 1121 of advtrains/trainlogic.lua look something like the following on your local copy? (You can ignore the whitespaces)Dmax_05 wrote: ↑Fri Sep 20, 2024 11:34Both commands are not working on windowsyw05 wrote: ↑Fri Sep 20, 2024 11:04You can download the patch with the "Export patchset (mbox)" button. You should by able to apply it by running git am path/to/mbox or (if you do not use git) apply -p1 path/to/mbox in the Advtrains modpack directory; I would assume that Windows provides the tools for downloading patches.
Code: Select all
wagon:set_id(id)
Code: Select all
if wagon then wagon:set_id(id) end
I have finished the patch in the meantime; could you see if it helps?: https://lists.sr.ht/~gpcf/advtrains-devel/patches/55116nazalassa wrote: ↑Fri Sep 20, 2024 13:04Why not... Actually, this seems better than setting random fields in the train table.yw05 wrote: ↑Fri Sep 20, 2024 11:04How about a staticdata field in the train tables?nazalassa wrote: ↑Wed Sep 18, 2024 15:24While I am on the subject of fixing stuff in Advtrains, I would like to suggest (again) making it possible to add fields to the table of train fields to be saved. This way, mods that store train data will not need to worry about saving it: Advtrains will do it for them.
Basically it exposes a staticdata table field in the train table. It is shared with other mods though (but not with Advtrains core), so I would suggest adding at least a prefix to field names.
Note that there are certain limitations imposed by serialize_lib, but that should not be relevant in most cases.
Side note: reformatting advtrains/api_doc.txt (into Markdown perhaps?) would be a good idea as well.
Re: [Mod] Advanced Trains [advtrains] [2.4.5]
Since the patch (obviously) seems to work, I have adapted advtrains_info_displays so that it works with staticdata. Not much to change...yw05 wrote: ↑Fri Sep 20, 2024 13:27I have finished the patch in the meantime; could you see if it helps?: https://lists.sr.ht/~gpcf/advtrains-devel/patches/55116
Basically it exposes a staticdata table field in the train table. It is shared with other mods though (but not with Advtrains core), so I would suggest adding at least a prefix to field names.
Note that there are certain limitations imposed by serialize_lib, but that should not be relevant in most cases.
Side note: reformatting advtrains/api_doc.txt (into Markdown perhaps?) would be a good idea as well.
Life is like a multitasking OS: you know you'll eventually get back to anything, but you don't know when. s/luanti/minetest/gi
Re: [Mod] Advanced Trains [advtrains] [2.4.3]
Where are the selection/collision boxes of the default sloped tracks defined? I couldn't find it, and I'd like to understand why only the default slopes (and not any custom slopes I register from my mods, for example) have selection boxes that correspond to their model.
Also, setmetatable() might be useful in LuaATCs in some occasions, such as storing data for stations, as it may remove the need for code like this:
by having a metatable like
Also, setmetatable() might be useful in LuaATCs in some occasions, such as storing data for stations, as it may remove the need for code like this:
Code: Select all
if not S.stn[name] then
S.stn[name] = {}
end
Code: Select all
{__index = function (t,i)
t[i] = {}
return t[i]
end
}
Life is like a multitasking OS: you know you'll eventually get back to anything, but you don't know when. s/luanti/minetest/gi
- apercy
- Member
- Posts: 667
- Joined: Wed Mar 25, 2020 16:31
- GitHub: APercy
- In-game: APercy
- Location: Pinheiral - RJ - Brazil
Re: [Mod] Advanced Trains [advtrains] [2.4.3]
After I did the update of my server to the version 5.9.1, I got this error:
Code: Select all
2024-10-22 00:50:50: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'advtrains' in callback environment_Step(): ...bin/../mods/advtrains-release-2.4.6/advtrains/nodedb.lua:205: attempt to call field 'get_node_or_nil' (a nil value)
2024-10-22 00:50:50: ERROR[Main]: stack traceback:
2024-10-22 00:50:50: ERROR[Main]: ...bin/../mods/advtrains-release-2.4.6/advtrains/nodedb.lua:205: in function 'get_node_or_nil'
2024-10-22 00:50:50: ERROR[Main]: ...bin/../mods/advtrains-release-2.4.6/advtrains/nodedb.lua:274: in function 'get_rail_info_at'
2024-10-22 00:50:50: ERROR[Main]: ...in/../mods/advtrains-release-2.4.6/advtrains/helpers.lua:320: in function 'get_adjacent_rail'
2024-10-22 00:50:50: ERROR[Main]: ...t/bin/../mods/advtrains-release-2.4.6/advtrains/path.lua:253: in function 'advtrains_path_get'
2024-10-22 00:50:50: ERROR[Main]: ...t/bin/../mods/advtrains-release-2.4.6/advtrains/path.lua:338: in function 'path_get_index_by_offset'
2024-10-22 00:50:50: ERROR[Main]: ...../mods/advtrains-release-2.4.6/advtrains/trainlogic.lua:230: in function 'recalc_end_index'
2024-10-22 00:50:50: ERROR[Main]: ...../mods/advtrains-release-2.4.6/advtrains/trainlogic.lua:333: in function 'train_ensure_init'
2024-10-22 00:50:50: ERROR[Main]: ...../mods/advtrains-release-2.4.6/advtrains/trainlogic.lua:102: in function 'mainloop_trainlogic'
2024-10-22 00:50:50: ERROR[Main]: ...t/bin/../mods/advtrains-release-2.4.6/advtrains/init.lua:618: in function <...t/bin/../mods/advtrains-release-2.4.6/advtrains/init.lua:580>
Re: [Mod] Advanced Trains [advtrains] [2.4.3]
advtrains/tracks.lua seems to define a default selectionbox for tracks in advtrains.register_tracks. The default track set defines its own selectionboxes in advtrains_train_track/init.lua.nazalassa wrote: ↑Sat Sep 21, 2024 10:02Where are the selection/collision boxes of the default sloped tracks defined? I couldn't find it, and I'd like to understand why only the default slopes (and not any custom slopes I register from my mods, for example) have selection boxes that correspond to their model.
Agreed. Be careful though: the metatables for tables inside F and S may need to be updated when the init code is (re)run.Also, setmetatable() might be useful in LuaATCs in some occasions
This is weird. minetest.get_node_or_nil is clearly defined by the engine, so it should not be nil.apercy wrote: ↑Tue Oct 22, 2024 00:53Code: Select all
2024-10-22 00:50:50: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'advtrains' in callback environment_Step(): ...bin/../mods/advtrains-release-2.4.6/advtrains/nodedb.lua:205: attempt to call field 'get_node_or_nil' (a nil value) 2024-10-22 00:50:50: ERROR[Main]: stack traceback: 2024-10-22 00:50:50: ERROR[Main]: ...bin/../mods/advtrains-release-2.4.6/advtrains/nodedb.lua:205: in function 'get_node_or_nil' 2024-10-22 00:50:50: ERROR[Main]: ...bin/../mods/advtrains-release-2.4.6/advtrains/nodedb.lua:274: in function 'get_rail_info_at' 2024-10-22 00:50:50: ERROR[Main]: ...in/../mods/advtrains-release-2.4.6/advtrains/helpers.lua:320: in function 'get_adjacent_rail' 2024-10-22 00:50:50: ERROR[Main]: ...t/bin/../mods/advtrains-release-2.4.6/advtrains/path.lua:253: in function 'advtrains_path_get' 2024-10-22 00:50:50: ERROR[Main]: ...t/bin/../mods/advtrains-release-2.4.6/advtrains/path.lua:338: in function 'path_get_index_by_offset' 2024-10-22 00:50:50: ERROR[Main]: ...../mods/advtrains-release-2.4.6/advtrains/trainlogic.lua:230: in function 'recalc_end_index' 2024-10-22 00:50:50: ERROR[Main]: ...../mods/advtrains-release-2.4.6/advtrains/trainlogic.lua:333: in function 'train_ensure_init' 2024-10-22 00:50:50: ERROR[Main]: ...../mods/advtrains-release-2.4.6/advtrains/trainlogic.lua:102: in function 'mainloop_trainlogic' 2024-10-22 00:50:50: ERROR[Main]: ...t/bin/../mods/advtrains-release-2.4.6/advtrains/init.lua:618: in function <...t/bin/../mods/advtrains-release-2.4.6/advtrains/init.lua:580>
Re: [Mod] Advanced Trains [advtrains] [2.4.3]
Yes, but I could not find any selection/collision boxes related to sloped tracks in advtrains_train_track/init.lua, nor in advtrains/tracks.lua; weirdly enough, copying the 'normal' sloped track definition does not 'copy' the sloped collision boxes.yw05 wrote: ↑Wed Oct 23, 2024 18:43advtrains/tracks.lua seems to define a default selectionbox for tracks in advtrains.register_tracks. The default track set defines its own selectionboxes in advtrains_train_track/init.lua.nazalassa wrote: ↑Sat Sep 21, 2024 10:02Where are the selection/collision boxes of the default sloped tracks defined? I couldn't find it, and I'd like to understand why only the default slopes (and not any custom slopes I register from my mods, for example) have selection boxes that correspond to their model.
Life is like a multitasking OS: you know you'll eventually get back to anything, but you don't know when. s/luanti/minetest/gi
Re: [Mod] Advanced Trains [advtrains] [2.4.3]
It seems like the sloped tracks use the default selection and collision boxes. This also appears to be the case in-game, where it is possible to visually walk into the sloped tracks.
---
WIP: New HUD:
Re: [Mod] Advanced Trains [advtrains] [2.4.3]
Whoops. I guess my eyes bugged then.
Ooh, nice HUD! Is that Unifont on the Cpl, ARS, ATC and LZB indicators?
Life is like a multitasking OS: you know you'll eventually get back to anything, but you don't know when. s/luanti/minetest/gi
Re: [Mod] Advanced Trains [advtrains] [2.4.3]
Yes, it is Unifont.
Also a minor adjustment to the speed bar (the design is still close to the one we currently use):
- Attachments
-
- screenshot_20241029_190428.png (820 Bytes) Viewed 1795 times
- orwell
- Member
- Posts: 964
- Joined: Wed Jun 24, 2015 18:45
- GitHub: orwell96
- IRC: orwell96_mt
- In-game: orwell
- Location: Raxacoricofallapatorius
Re: [Mod] Advanced Trains [advtrains] [2.4.7]
Advtrains 2.4.7
Hello all,
after welcoming my second child (IRL) end of September and having some sleepless nights, I got back to advtrains and found a myriad of patches submitted to the mailing list. Special thanks to 1F616EMO/nazalassa and Maverick for the contributions, to Tanavit for the french translation, and for ywang for keeping an eye out in the forum and on the mailing list.
2.4.7 brings a couple of improvements, fixing some bugs and adding convenience features to the interlocking. My overhaul of the signalling system (branch route_prog_rework) is still not finished though, so no distant signalling yet.
Regards, orwell
Hello all,
after welcoming my second child (IRL) end of September and having some sleepless nights, I got back to advtrains and found a myriad of patches submitted to the mailing list. Special thanks to 1F616EMO/nazalassa and Maverick for the contributions, to Tanavit for the french translation, and for ywang for keeping an eye out in the forum and on the mailing list.
2.4.7 brings a couple of improvements, fixing some bugs and adding convenience features to the interlocking. My overhaul of the signalling system (branch route_prog_rework) is still not finished though, so no distant signalling yet.
Regards, orwell
-
- Member
- Posts: 11
- Joined: Fri Jun 17, 2022 07:36
- GitHub: singularis-mzf
Re: [Mod] Advanced Trains [advtrains] [2.4.7]
Hello,
it seems to me that I found a compatibility issue that causes misbehaviour od advtrains in new versions of Luanti. It is in function advtrains.is_node_loaded(). This function is not working properly on new engine versions (I found it in Minetest 5.8.0), so nodes (especially signals) are sometimes not updated, especially when the mapblock is forceloaded (which means that it is loaded and active, but no player is around). This function should use core.compare_block_status() function when it is available.
it seems to me that I found a compatibility issue that causes misbehaviour od advtrains in new versions of Luanti. It is in function advtrains.is_node_loaded(). This function is not working properly on new engine versions (I found it in Minetest 5.8.0), so nodes (especially signals) are sometimes not updated, especially when the mapblock is forceloaded (which means that it is loaded and active, but no player is around). This function should use core.compare_block_status() function when it is available.
-
- New member
- Posts: 3
- Joined: Mon Nov 25, 2024 08:48
Re: [Mod] Advanced Trains [advtrains] [2.4.7]
Hi,
I have a fairly complex layout of tracks etc. I am trying to modify it, but now I find I cannot delete TCBs, neither can I delete the piece of track connected to the TCB.
What can I do to remove all unused TCBs and sections without starting over?
Thanks, Dave
I have a fairly complex layout of tracks etc. I am trying to modify it, but now I find I cannot delete TCBs, neither can I delete the piece of track connected to the TCB.
What can I do to remove all unused TCBs and sections without starting over?
Thanks, Dave
- Blockhead
- Moderator
- Posts: 2184
- Joined: Wed Jul 17, 2019 10:14
- GitHub: Montandalar
- IRC: Blockhead256
- In-game: Blockhead Blockhead256
- Location: Land Down Under
- Contact:
Re: [Mod] Advanced Trains [advtrains] [2.4.7]
Hi Singularis,Singularis wrote: ↑Sun Nov 24, 2024 13:10Hello,
it seems to me that I found a compatibility issue that causes misbehaviour od advtrains in new versions of Luanti. It is in function advtrains.is_node_loaded(). This function is not working properly on new engine versions (I found it in Minetest 5.8.0), so nodes (especially signals) are sometimes not updated, especially when the mapblock is forceloaded (which means that it is loaded and active, but no player is around). This function should use core.compare_block_status() function when it is available.
Is there an engine regression that you're aware of, or was Advtrains maybe relying on undefined behaviour? If you know if an an engine regression, please report it. If you have a reproducible way to make Advtrains crash with that function, that would also be very helpful. Even better, though not expected, would be if you could send a fix to the mailing list.
Hi porcupiney/Dave,porcupiney wrote: ↑Mon Nov 25, 2024 08:52Hi,
I have a fairly complex layout of tracks etc. I am trying to modify it, but now I find I cannot delete TCBs, neither can I delete the piece of track connected to the TCB.
What can I do to remove all unused TCBs and sections without starting over?
Thanks, Dave
Ordinarily you need to delete both sections to remove the TCB. This is done from the TCB's right click menu by clicking through to each section and removing the TCB, or dissolving the entire section (probably you want the latter if you are taking sections apart). Is this working for you?
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂