[Mod] Advanced Trains [advtrains] [2.9.0]

cyberonkel
Member
Posts: 12
Joined: Sat Mar 29, 2025 09:13
In-game: mavori

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by cyberonkel » Post

Hi
Just updated to luanti 5.15. Did not change the world. I have now this error:

ServerError: AsyncErr: Lua: Runtime error from mod 'advtrains' in callback environment_Step(): ...orlds/world/worldmods/advtrains/serialize_lib/atomic.lua:112: Loading data from file '.../world/advtrains_core.ls' fail
2026-02-05 14:00:10: ERROR[Main]: ed:
2026-02-05 14:00:10: ERROR[Main]: ...ds/world/worldmods/advtrains/serialize_lib/serialize.lua:130: Unable to parse line: 'Spos_in_tr'!
2026-02-05 14:00:10: ERROR[Main]: Disable Strict Loading to ignore.

I have a lot of entries like
Spos_in_train:N3
Spos_in_trainparts:N1
in advtrains_core.ls

Same for advtrains 2.7 and advtrains 2.8

Any ideas?

Best M

User avatar
Blockhead
Moderator
Posts: 2990
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.8.0]

by Blockhead » Post

cyberonkel wrote:
Thu Feb 05, 2026 14:10
Hi
Just updated to luanti 5.15. Did not change the world. I have now this error:

ServerError: AsyncErr: Lua: Runtime error from mod 'advtrains' in callback environment_Step(): ...orlds/world/worldmods/advtrains/serialize_lib/atomic.lua:112: Loading data from file '.../world/advtrains_core.ls' fail
2026-02-05 14:00:10: ERROR[Main]: ed:
2026-02-05 14:00:10: ERROR[Main]: ...ds/world/worldmods/advtrains/serialize_lib/serialize.lua:130: Unable to parse line: 'Spos_in_tr'!
2026-02-05 14:00:10: ERROR[Main]: Disable Strict Loading to ignore.

I have a lot of entries like
Spos_in_train:N3
Spos_in_trainparts:N1
in advtrains_core.ls

Same for advtrains 2.7 and advtrains 2.8

Any ideas?

Best M
This looks like file corruption. Does your file advtrains_core.ls have a line that is cut short? How large is the file?
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

cyberonkel
Member
Posts: 12
Joined: Sat Mar 29, 2025 09:13
In-game: mavori

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by cyberonkel » Post

error msg from server is abbreviated.
typical entry looks as

S931186:T
S_reversed_cache:B0
Sowner:Smavori
Spos_in_train:N3
Spos_in_trainparts:N1
Swagon_flipped:B0
Sid:S931186
Sseatp:T

User avatar
orwell
Member
Posts: 1011
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by orwell » Post

cyberonkel wrote:
Thu Feb 05, 2026 16:00
error msg from server is abbreviated.
typical entry looks as

S931186:T
S_reversed_cache:B0
Sowner:Smavori
Spos_in_train:N3
Spos_in_trainparts:N1
Swagon_flipped:B0
Sid:S931186
Sseatp:T
Yes, I also think it’s file corruption. I think writing the file stopped in the middle. Can you check, what are the last 5 lines in advtrains_core.ls? I strongly suspect that Spos_in_tr is the last line.

If you want to restore it quickly, make a backup copy of your world and then delete advtrains_core.ls. Then disable the option „serialize_lib_strict_loading“ in the settings. You will lose all trains currently in your world, but if this is ok for you then this solves it quickly.

Still leaves the question how it became corrupted in the first place… which operating system do you have?
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

cyberonkel
Member
Posts: 12
Joined: Sat Mar 29, 2025 09:13
In-game: mavori

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by cyberonkel » Post

Thanks for the hint. As you said, file was corrupted. Server is running on a VPS. I upgraded 2 days ago to more RAM/disk space and provider made a backup. I assume, that they had not stopped the server but doing this backup while minetest service was running. I am running minetest on a yunohost environment and – unfortunately – updating minetest overwrites the world data and I used the backup made by the provider to restore the world.
But fortunately, I had a backup from a few days earlier and have just overwritten all .ls files in world with this backup. It's running again.
I am running this on VoxeLibre, will check, if there are any problems ...
Thanks again!

User avatar
Slightly
Member
Posts: 174
Joined: Sun May 15, 2022 22:29
In-game: Slightly

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by Slightly » Post

Been modifying the ATC track. New distinctive texture that shows it's bidirectional (that confused me as a beginner since I expected tracks to be effective in the direction of the arrow). UI that provides some interesting samples to get started (like the Horntrack UI I did).
ATCUISamples.png
ATCUISamples.png (649.22 KiB) Viewed 9840 times


Anyone have easy-to-read ATC commands you'd like to contribute that show off possibilities?
I have these on the UI right now:

Code: Select all

"Train Max Speed", cmd = "SM"
"Brake to Stop", cmd = "BB"
"Speed 2 Only in + Direction", cmd = "I+S2;"
"Stop 3s Slow Start to Max Speed", cmd = "B0D3S2SM"
"Stop Open Doors Left", cmd = "B0D2OLKD2OCD2S2"
"Speed 3 Couple Brake Reverse", cmd = "S3CplB0WD2RS3"
"If + Direction Max Else Stop", cmd = "I+SMEB0"

Maverick2797
Member
Posts: 154
Joined: Sun Aug 05, 2018 12:37
In-game: Maverick2797
Location: Poking about here and there...

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by Maverick2797 » Post

Slightly wrote:
Thu Feb 12, 2026 19:26
Looks great, here's my notes (nothing bad I swear):

Code: Select all

"Train Max Speed", cmd = "SM"
"Brake to Stop", cmd = "B0"
"Emergency Braking", cmd = "BB"
"Speed 2 Only In + Direction", cmd = "I+S2;"
"Stop, Wait 3s, Slow Start to Max Speed", cmd = "B0WD3S2WD2SM"
"Stop, Open Doors Left, Evict Passengers, Close Doors and Continue at Speed 2", cmd = "B0WD2OLKD2OCD2S2"
"Speed 3, Couple, Confirm Stopped, Reverse", cmd = "S3CplS0WD2RS3"
"If + Direction Speed Max Else Stop", cmd = "I+SMEB0;"
I've adjusted the snippet above slightly. B0 is an instantaneous command, so you have to pause the ATC with W until the speed is actually 0 before continuing otherwise the train may keep rolling (while braking) as the doors open after D2 if the initial speed is too high.

Also noted the passenger eviction due to K, missing ; on the last if command, and just a bit of comma-action to help identify the stages of the commands :) Also, ATC doesn't care about whitespaces between commands, so feel free to space them out a little for readability, especially with the longer strings
--> am signature, much wow :P <--

User avatar
Slightly
Member
Posts: 174
Joined: Sun May 15, 2022 22:29
In-game: Slightly

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by Slightly » Post

Maverick2797 wrote:
Fri Feb 13, 2026 03:50

I've adjusted the snippet above slightly. B0 is an instantaneous command, so you have to pause the ATC with W until the speed is actually 0 before continuing otherwise the train may keep rolling (while braking) as the doors open after D2 if the initial speed is too high.

Also noted the passenger eviction due to K, missing ; on the last if command, and just a bit of comma-action to help identify the stages of the commands :) Also, ATC doesn't care about whitespaces between commands, so feel free to space them out a little for readability, especially with the longer strings
I'll look into these, thanks. I had commas but they broke things, probably I need to sanitize that or something.

EDIT
All fixed. Thanks a lot. Do you have any other codes for the drop down you think would work well for beginners?

Code: Select all

    {name = "Train Max Speed", cmd = "SM"},
    {name = "Brake to Stop", cmd = "BB"},
    {name = "Speed 2 Only in + Direction", cmd = "I+ S2;"},
    {name = "Stop 3s, Slow Start to Max Speed", cmd = "B0 W D3 S2 SM"},
    {name = "Stop, Open Doors Left", cmd = "B0 D2 OL K D2 OC D2 S2"},
    {name = "Speed 3, Couple, Reverse, Speed 3", cmd = "S3 Cpl B0 W D2 R S3"},
    {name = "If + Direction, Max Speed, Else Stop", cmd = "I+ SM E B0;"},

yw05
Member
Posts: 469
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by yw05 » Post

Slightly wrote:
Fri Feb 13, 2026 17:01

Code: Select all

    {name = "Brake to Stop", cmd = "BB"},
Note that BB effectively applies the "emergency break" (unlike B0, which performs regular braking).

Code: Select all

    {name = "Stop 3s, Slow Start to Max Speed", cmd = "B0 W D3 S2 SM"},
Afaik S2 SM is effectively the same as SM as the same (constant) acceleration is applied.

---

How about using hypertext instead of dropdowns? Then you can format the entries to look something like this:

Code: Select all

B0 W OL K D2 OC D2 S2
* Stop
* Open doors on the left side
* Kick all passengers
* Wait for 2s
* Close doors
* Wait for 2s
* Accelerate to 2
(Also, I wonder whether it is better to parse ATC commands into an AST and generate the description from that. Having ASTs would also make it possible to create a form closer to visual programmer.)

User avatar
Slightly
Member
Posts: 174
Joined: Sun May 15, 2022 22:29
In-game: Slightly

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by Slightly » Post

yw05 wrote:
Fri Feb 13, 2026 20:29
Note that BB effectively applies the "emergency break" (unlike B0, which performs regular braking).
I probably don't see the difference given my slow toy trains, but I'll change the label to reflect this.
yw05 wrote:
Fri Feb 13, 2026 20:29
Afaik S2 SM is effectively the same as SM as the same (constant) acceleration is applied.
Ok, I'll test that.

yw05 wrote:
Fri Feb 13, 2026 20:29
How about using hypertext instead of dropdowns?
...
(Also, I wonder whether it is better to parse ATC commands into an AST and generate the description from that. Having ASTs would also make it possible to create a form closer to visual programmer.)
I don't understand this part. I'm not looking to change the tracks' functions, just to make the simpler ones more user-friendly. Ideally, using mine would make it easier for someone to go on to using the less friendly advanced parts of advtrains. Does hypertext work in that context?


Thanks for the feedback. Do you have any other command strings you see beginners wanting to use?

yw05
Member
Posts: 469
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by yw05 » Post

Slightly wrote:
Fri Feb 13, 2026 20:47
yw05 wrote:
Fri Feb 13, 2026 20:29
How about using hypertext instead of dropdowns?
...
(Also, I wonder whether it is better to parse ATC commands into an AST and generate the description from that. Having ASTs would also make it possible to create a form closer to visual programmer.)
I don't understand this part.
I wrote multiple ideas in that post.

The first is about using hypertexts instead of using dropdowns (as seen in download/file.php?id=31334). The idea is that hypertext (along with increasing the height of the formspec) allows writing longer descriptions (potentially with multiple lines) for each example.
I'm not looking to change the tracks' functions, just to make the simpler ones more user-friendly. Ideally, using mine would make it easier for someone to go on to using the less friendly advanced parts of advtrains. Does hypertext work in that context?
Do I understand correctly that in this case you want to improve the ATC form by adding examples that users can choose to use in their ATC form? In this case yes (see explanation above).

The other (although more ambitious than simply changing the UI) idea was based on the having long/multiline descriptions for each example:
yw05 wrote:
Fri Feb 13, 2026 20:29
I wonder whether it is better to parse ATC commands into an AST and generate the description from that. Having ASTs would also make it possible to create a form closer to visual programmer.)
The (as said, not trivial) idea here is to refactor ATC internals so that there is a parser that parses ATC strings into abstract syntax trees (i.e. more structured data). It could then be possible to add an API that "describes" (or simply lists out the instructions in) an ATC string by working off the AST and generating a description for each ATC command. Such an API would allow describing arbitrary sequences of ATC commands beyond just examples). (This would also speak for the use of hypertext, as a description API could be designed by highlighting the parameters for each command in a manner similar to syntax highlighting.).

Side note: About five years ago I proposed a patch for "compiling" ATC commands. Part of the implementation was not too different from how I would write an ATC parser today, although the technical detail of producing Lua strings was bad in hindsight.

The follow-up of having ASTs would be to introduce a UI for visual programming. That would hopefully lower the bar for using ATC, but would (to an extent) be a small project of its own.
Slightly wrote:
Fri Feb 13, 2026 17:01

Code: Select all

    {name = "Stop, Open Doors Left", cmd = "B0 D2 OL K D2 OC D2 S2"},
Another note here: I would suggest using B0 W OL ... here. That would avoid hardcoding the braking time based on the presumed speed of the train.
Thanks for the feedback. Do you have any other command strings you see beginners wanting to use?
Not that I can think of at the moment.

User avatar
Slightly
Member
Posts: 174
Joined: Sun May 15, 2022 22:29
In-game: Slightly

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by Slightly » Post

yw05 wrote:
Fri Feb 13, 2026 23:51
Another note here: I would suggest using B0 W OL ... here. That would avoid hardcoding the braking time based on the presumed speed of the train.
Ok, I'll fix this and give the other ideas some thought.
Last edited by Blockhead on Sun Feb 15, 2026 07:36, edited 1 time in total.
Reason: Fixed end of quote tag

User avatar
Blockhead
Moderator
Posts: 2990
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.8.0]

by Blockhead » Post

yw05 wrote:
Fri Feb 13, 2026 23:51
The (as said, not trivial) idea here is to refactor ATC internals so that there is a parser that parses ATC strings into abstract syntax trees (i.e. more structured data).
My understanding is that ARS rules are already parsed into tables, so it stands to reason a parser can put a data structure together for ATC too.

...
yw05 wrote:
Fri Feb 13, 2026 23:51
The follow-up of having ASTs would be to introduce a UI for visual programming. That would hopefully lower the bar for using ATC, but would (to an extent) be a small project of its own.
Yes, a good idea, but a not insignificant project. Fairly beginner-friendly. Then the code code be presented like LWScratch, Google Code Blocks etc.. I'd present it as another tab on the ATC track GUI, or the raw string at the top or bottom and the visualisation underneath/above. It would need to embed blocks like the ATC conditional operator, not just a stream of sequential operations.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

User avatar
Slightly
Member
Posts: 174
Joined: Sun May 15, 2022 22:29
In-game: Slightly

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by Slightly » Post

New UI for LuaATC track. I can now create environments and delete unused ones in the UI. It no longer saves without me clicking SAVE or assigns environments I haven't assigned, either. I think it's more intuitive that way. The Env in Use button is dynamic, so changes to Delete Unused, or disappears if there are none. If anyone wants to try the UI, remember I only mod and test for singleplayer so please backup and test before trying anything I make on servers.
screenshot.png
screenshot.png (666.36 KiB) Viewed 9626 times
originalincaseyouforgot.png
originalincaseyouforgot.png (55.28 KiB) Viewed 9626 times
yw05 wrote:
Fri Feb 13, 2026 23:51

Do I understand correctly that in this case you want to improve the ATC form by adding examples that users can choose to use in their ATC form? In this case yes (see explanation above).

The follow-up of having ASTs would be to introduce a UI for visual programming. That would hopefully lower the bar for using ATC, but would (to an extent) be a small project of its own.
I thought about this a bit more. The first part... not necessarily, not for the LuaATC. I did consider it, but I think I'll just include better beginner examples in my documentation. In thinking about examples, I realized this wasn't the same as the horntrack or ATC. Editing would be required for the player's setup which, by the time the player is using the LuaATC, they would be able to do. I see the LuaATC Track as the end of the beginner phase for users. If they've gotten this far, they can use the mod and move on to more advanced parts of it if they care to, or they can have a small complete system without doing that.

This brings me to the second part. IMO, the problem with using ATC is the same as with using most of advtrains. It's not that casual players don't know code necessarily, it's that they don't know advtrains, and if they don't know realistic trains either, they don't have that help in figuring out the more cryptic parts of advtrains so they give up. My goal is just to remove barriers to entry and, obviously, make my trains more accessible to the kind of players who like them while making it more fun for me to use.

yw05
Member
Posts: 469
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by yw05 » Post

Slightly wrote:
Sun Feb 15, 2026 20:17
yw05 wrote:
Fri Feb 13, 2026 23:51

Do I understand correctly that in this case you want to improve the ATC form by adding examples that users can choose to use in their ATC form? In this case yes (see explanation above).
I thought about this a bit more. The first part... not necessarily, not for the LuaATC. I did consider it, but I think I'll just include better beginner examples in my documentation. In thinking about examples, I realized this wasn't the same as the horntrack or ATC.
I thought this was brought up in the context of regular ATC though (not LuaATC)?
Editing would be required for the player's setup which, by the time the player is using the LuaATC, they would be able to do. I see the LuaATC Track as the end of the beginner phase for users. If they've gotten this far, they can use the mod and move on to more advanced parts of it if they care to, or they can have a small complete system without doing that.
Agreed. That said, I do recall a discussion some years ago about an idea of adding "templated" tracks, where players can define a string/function call template for the tracks and subsequently insert the relevant values for each instance of the track without having to repeat the same code. IIRC The idea was less about unexperienced players and more about indirectly giving (heavily limited) LuaATC access to more players in multiplayer environments.
The follow-up of having ASTs would be to introduce a UI for visual programming. That would hopefully lower the bar for using ATC, but would (to an extent) be a small project of its own.
This brings me to the second part. IMO, the problem with using ATC is the same as with using most of advtrains. It's not that casual players don't know code necessarily, it's that they don't know advtrains, and if they don't know realistic trains either, they don't have that help in figuring out the more cryptic parts of advtrains so they give up. My goal is just to remove barriers to entry and, obviously, make my trains more accessible to the kind of players who like them while making it more fun for me to use.
I would personally prefer having a combination of both (if it is possible in terms of UI). Examples provide a starting/introduction point for ATC, while descriptions/visual programming provides (for some players) an intuitive interface for using ATC. (Of course, the current interfacing of entering ATC commands directly should still stay as an alternative to a potential visual programming interface, as there is no technical reason for removing direct ATC input.)

User avatar
Slightly
Member
Posts: 174
Joined: Sun May 15, 2022 22:29
In-game: Slightly

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by Slightly » Post

yw05 wrote:
Sun Feb 15, 2026 21:37
I thought this was brought up in the context of regular ATC though (not LuaATC)?
Since I redid both UIs, I may have just lost the context of our discussion. I did make dropdown examples for the regular ATC and the horntrack, but decided against it for the LuaATC track. I'll definitely include examples in the docs though.
yw05 wrote:
Sun Feb 15, 2026 21:37
Agreed. That said, I do recall a discussion some years ago about an idea of adding "templated" tracks, where players can define a string/function call template for the tracks and subsequently insert the relevant values for each instance of the track without having to repeat the same code. IIRC The idea was less about unexperienced players and more about indirectly giving (heavily limited) LuaATC access to more players in multiplayer environments.
I am kicking around the idea of just making a couple more tracks like the stop rail (which I also reworked) and the horntrack and loading... maybe a coupling track. That would work for this.

As for the visual coding being more intuitive, not my experience, but for some people, probably. I've not done it. But really I didn't think the coding was the complex part of using ATC and LuaATC. It was the missing or confusing instructions and the lack of simple examples along with the lack of train knowledge to figure out what the complicated examples intended. Once I got past that, the coding for what I wanted was not difficult.

yw05
Member
Posts: 469
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
Location: Germany

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by yw05 » Post

Slightly wrote:
Sun Feb 15, 2026 21:49
Since I redid both UIs, I may have just lost the context of our discussion. I did make dropdown examples for the regular ATC and the horntrack, but decided against it for the LuaATC track.
The original context was this (referring to ATC tracks):
yw05 wrote:
Fri Feb 13, 2026 23:51
The first is about using hypertexts instead of using dropdowns (as seen in download/file.php?id=31334). The idea is that hypertext (along with increasing the height of the formspec) allows writing longer descriptions (potentially with multiple lines) for each example.
I made a quick UI mockup to describe this idea, although without long descriptions due to the way each entry is formatted:
2026-02-16-20-58-13.png
2026-02-16-20-58-13.png (30.73 KiB) Viewed 9577 times
I'll definitely include examples in the docs though.
That would be nice. Another thing to potentially consider is to put documentation in-game using the doc mod. (I considered doing the latter in my advtrains_doc_integration mod, but dropped the idea because IMO the lack of access to the information from Advtrains' own UI would limit the utility of such documentation.)

User avatar
Slightly
Member
Posts: 174
Joined: Sun May 15, 2022 22:29
In-game: Slightly

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by Slightly » Post

yw05 wrote:
Mon Feb 16, 2026 20:22
I made a quick UI mockup to describe this idea, although without long descriptions
Thanks, I see now. I'm giving the docs more thought.

engineghostbacking.png
engineghostbacking.png (346.12 KiB) Viewed 9567 times
What is causing this? Sometimes, when the train stops at the platform (stoprail) and wagon is stopped (the doors are opening to board in this case) the engine will do this ghostly backing or running off without the waiting wagon and then snap back to where it really belongs to continue on as normal. I'm wondering if it might be related to the little bump and resettle movement it does when it stops... or... if there's a mismatch because these are smaller than many common wagons or... what? What is it?

User avatar
orwell
Member
Posts: 1011
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by orwell » Post

Slightly wrote:
Mon Feb 16, 2026 22:37
yw05 wrote:
Mon Feb 16, 2026 20:22
I made a quick UI mockup to describe this idea, although without long descriptions
Thanks, I see now. I'm giving the docs more thought.


engineghostbacking.png

What is causing this? Sometimes, when the train stops at the platform (stoprail) and wagon is stopped (the doors are opening to board in this case) the engine will do this ghostly backing or running off without the waiting wagon and then snap back to where it really belongs to continue on as normal. I'm wondering if it might be related to the little bump and resettle movement it does when it stops... or... if there's a mismatch because these are smaller than many common wagons or... what? What is it?
This bug is very old (I think it traces to the very beginning). I have never investigated since it didn’t bother me so much, but it is one of two causes:

1. when the wagon stops, its acceleration is not set to 0 until next time the 2-second force update timer elapses (bug in advtrains wagons.lua)
2. the code sets the acceleration to 0 correctly, but a bug in the Luanti engine causes it to not take effect.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
Slightly
Member
Posts: 174
Joined: Sun May 15, 2022 22:29
In-game: Slightly

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by Slightly » Post

orwell wrote:
Mon Feb 16, 2026 22:43

This bug is very old (I think it traces to the very beginning). I have never investigated since it didn’t bother me so much, but it is one of two causes:

1. when the wagon stops, its acceleration is not set to 0 until next time the 2-second force update timer elapses (bug in advtrains wagons.lua)
2. the code sets the acceleration to 0 correctly, but a bug in the Luanti engine causes it to not take effect.
I tested a bunch of stuff with ATC and acceleration and waiting ticks that didn't seem to get me anywhere, but since the train always gave this little bounce and drift when stopping at a stoprail, I looked at braking. My theory now is that it's because after braking, when ATC sends a delay, velocity is not really 0, so the train bounces and sometimes creeps in the opposite direction.

I added a full stop to the end of 4a in train_step_b and it seems better. It was intermittent so still watching to see if it happens again, but it stops without that bounce and drift now so fingers crossed it works for good and I didn't break something else. I'll move it into my sc_advtrains_patches mod and keep testing.

Code: Select all

	--- 4a. if accelerating, modify the velocity AFTER the movement
	if accelerating then
		...
	end

-- sc full stop to prevent bouncing and ghostly reversing during delays 

if (train.tarvelocity and train.tarvelocity == 0) 
or (train.atc_delay and train.atc_delay > 0) 
or train.atc_wait_finish or train.atc_wait_autocouple 
or train.atc_wait_signal then 
train.velocity = 0 
train.acceleration = 0 
end
end


cyberonkel
Member
Posts: 12
Joined: Sat Mar 29, 2025 09:13
In-game: mavori

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by cyberonkel » Post

I upgraded on my VoxeLibre server to 2.8.0, running nicely most of the time. I have never defined any line, as this has provoked crashes before (I assumed due to be running on VL). With 2.8, I see now a line editor, but many texts in the form are in Czek, not in German or English. Hard to decipher.
If I try to establish a new line adding a start station and a terminus station, I have an "Error in line setup: Line setup must contain at least 1 terminus stop!".

Is there any documentation about the format of advtrains.lines, so I could add lines manually. As I added mapserver now to my world, I see there the trains running – but no other info as e.g. train lines, would be nice to have this info.

cyberonkel
Member
Posts: 12
Joined: Sat Mar 29, 2025 09:13
In-game: mavori

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by cyberonkel » Post

Edit: Figured out, "Dep" must be ordered, I added just integers 1, 2, 3 ... and line is saved.

User avatar
NicoKaiserHello
Member
Posts: 81
Joined: Sat Jul 06, 2024 17:34
GitHub: Nico K
In-game: NicoKaiser
Location: Germany/Bavaria
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by NicoKaiserHello » Post

Hello. I have a ask. I updated the advtrains mod and I tried to use the new LUA rail with the commands, but it is the old by me. Do i need the new version (5.15)? Or is 5.9 working too?
I like building and programming!

User avatar
Slightly
Member
Posts: 174
Joined: Sun May 15, 2022 22:29
In-game: Slightly

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by Slightly » Post

NicoKaiserHello wrote:
Wed Feb 18, 2026 20:35
Hello. I have a ask. I updated the advtrains mod and I tried to use the new LUA rail with the commands, but it is the old by me. Do i need the new version (5.15)? Or is 5.9 working too?
Are you looking for an ATC or LuaATC track like the one we've been discussing? Those are in a patch mod, not in the regular advtrains mod. Or you looking for something else?

User avatar
NicoKaiserHello
Member
Posts: 81
Joined: Sat Jul 06, 2024 17:34
GitHub: Nico K
In-game: NicoKaiser
Location: Germany/Bavaria
Contact:

Re: [Mod] Advanced Trains [advtrains] [2.8.0]

by NicoKaiserHello » Post

Slightly wrote:
Thu Feb 19, 2026 02:26
NicoKaiserHello wrote:
Wed Feb 18, 2026 20:35
Hello. I have a ask. I updated the advtrains mod and I tried to use the new LUA rail with the commands, but it is the old by me. Do i need the new version (5.15)? Or is 5.9 working too?
Are you looking for an ATC or LuaATC track like the one we've been discussing? Those are in a patch mod, not in the regular advtrains mod. Or you looking for something else?
Yes. I mean the + - command rail.
download/file.php?id=31334

which plugin is it?
I like building and programming!

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests