[Mod] Train remote for advtrains [train_remote]

Post Reply
yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

[Mod] Train remote for advtrains [train_remote]

by yw05 » Post

This is a simple mod that allows players to remotely control trains.

Available controls
  • Lever
  • Door control
  • Display
  • Line and routing code
  • Toggle ARS (requires interlocking)
  • Reverse train (button)
Notes
  • The information in the formspec is not automatically updated. This is partly why certain elements on the train HUD are not yet available in the formspec.
  • Changing the lever switches the train to manual control. It overrides ATC without any warning, but it does not override LZB.
  • This mod is intended for users with at least some knowledge of advtrains.
Download
Last edited by yw05 on Sat Jun 19, 2021 13:11, edited 3 times in total.

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

Re: [Mod] Train remote for advtrains [train_remote]

by orwell » Post

Nice idea and nice work!
I have two ideas:
- Maybe, the RC should be bound to a wagon (e.g. right-click an engine to bind control) and control this wagon's train - will be useful for shunting, in case the engine gets a different ID when decoupling
- Add a button that opens the onboard computer (function is called show_bordcom) so you can do coupling
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Train remote for advtrains [train_remote]

by yw05 » Post

orwell wrote:
Sat Jun 05, 2021 21:29
- Maybe, the RC should be bound to a wagon (e.g. right-click an engine to bind control) and control this wagon's train - will be useful for shunting, in case the engine gets a different ID when decoupling
I still have to figure that part out. The main thing is that I want to separate wagon and train controls, and I still need to test that a bit (possibly by holding the ID of the first or n-th wagon in the formspec name rather than the train ID)
orwell wrote: - Add a button that opens the onboard computer (function is called show_bordcom) so you can do coupling
I would actually design my own formspec. The reasons I don't want to use the bordcom formspecs are:
  • The boardcom formspec handler apparently checks to make sure that the player is in the driver stand of a particular wagon. (Also, I have not yet managed to get it to work with my formspec ...)
  • The coupling control is not displayed properly for long trains
  • I would use tabs to separate controls between individual wagons and the entire train, so I would use something that opens the "wagon properties" formspec instead.
Edit: I think I should actually use separate formspecs for trains and wagons to avoid some potential workarounds for tabs.

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Train remote for advtrains [train_remote]

by yw05 » Post

Image
Revision 8
(Note: While I make sure that the master branch is stable enough, I make releases only when I have made enough changes IMO, and I don't tend to announce maintenance releases.)
  • Add input boxes for display, line, and routing code.
  • Change lever and door control to show levers (implemented with scrollbars)
  • Change ARS to a checkbox
  • Add wagon count in formspec
Attachments
Screenshot_20210619_114429.png
Screenshot_20210619_114429.png (12.63 KiB) Viewed 764 times

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

Re: [Mod] Train remote for advtrains [train_remote]

by Maverick2797 » Post

Perhaps an exit button too? I've found that the formspec keeps opening if I try to close it, forcing a client shutdown to escape.
The number you have called is not available during a solar eclipse. This message will self destruct in ten seconds in protest... [BEEP]

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Train remote for advtrains [train_remote]

by yw05 » Post

Maverick2797 wrote:
Mon Jul 05, 2021 13:50
Perhaps an exit button too? I've found that the formspec keeps opening if I try to close it, forcing a client shutdown to escape.
*Facepalm* I always quit the formspec with the escape key (at least in singleplayer) so I didn't think about adding an exit button (by the way, I think you can also quit a formspec by left-clicking twice in an area outside the FS). I will add it soon.

I haven't worked on it for a while because I was a bit busy with some things, but I will get back now.

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

Re: [Mod] Train remote for advtrains [train_remote]

by Maverick2797 » Post

That's how I also usually exit formspecs (Esc key) but the fs kept reappearing before I could do anything else.
The number you have called is not available during a solar eclipse. This message will self destruct in ten seconds in protest... [BEEP]

yw05
Member
Posts: 366
Joined: Tue May 07, 2019 12:59
GitHub: y5nw
IRC: y5nw
In-game: ywang
Location: Germany

Re: [Mod] Train remote for advtrains [train_remote]

by yw05 » Post

Fixed: (at least it works on my side now)
Image
On an unrelated note, the text input boxes are escaped now to fix the weird behavior with square brackets (hopefully that bug did not hit anyone)

(By the way, thanks @apercy for the tram on the screenshot.)
Attachments
Screenshot_20210706_164055.png
Screenshot_20210706_164055.png (134.4 KiB) Viewed 764 times

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests