Yes, pname refers to the player name, and no, it is not used in the function.
But since pname has always been the (documented) second parameter, although never used, I didnt want to break things and just appended the "invname" as the third parameter
Current_player is automatically "found" by minetest

Lua is great!List of my mods
I like singing. I like dancing. I like ... niyummm...

I post this to clean the confusion over terms like "tss branch" and "interlocking system":

About half a year ago, I started reimplementing large parts of some internal logic of advtrains. The version control system (git) allows to create separate branches that do not affect the "stable" main version ("master branch") and can be independently developed. Back then, I created such a branch, named "tss" (short for "track section signalling", see after)
That rewrite was done some months ago, and I started with the original goal of the whole operation, which was implementing an interlocking system (search the internet for what that is, or see http://advtrains.bleipb.de/interlocking) on top of this new "tss branch". But I didn't want to "merge" my rewrite back into the stable "master" branch because it was possible that there were bugs I was unaware of, and wanted it to prove working. On the "master" branch, only important bugfixes were still made.

The interlocking system has progressed pretty far in the last months, and during this time it seems like I've eliminated all critical bugs in the core logic that have shown up. Therefore, I will declare the "tss" stable and make it the new "master" branch somewhen around the new year.

However, you can already do this step now if you don't want to wait. But before "upgrade" advtrains to "tss", I recommend you to make a backup of all worlds you use advtrains in and don't wish to be broken, because:
1. Once you switch to "tss", you cannot go back*
2. It might be possible that some things get lost or even the whole world gets corrupt during the upgrade.
3. I should note that the "add-on" mods that are linked in the main post are probably not compatible to TSS

To do this, follow these steps:
If you've installed using git:
1. back up your world(s)
2. $ git checkout tss
If not:
1. back up your world(s)
2. delete old "advtrains" folder
3. https://git.bananach.space/advtrains.git/log/?h=tss
4. Select top entry in list
5. select one of the download formats
6. save, unpack, as you would install any other modpack.

Small note in between: the difference between "safety" and "security"
Safety means a system is secured against failure caused by itself or some component inside the system (for a railway, this would be the tracks, vehicles and the train driver)
Security means a system is secured against external disturbances, components outside of the system (for our mod, this would be malicious players randomly decoupling wagons or throwing sand onto tracks)

What follows is an incomplete list of the most important changes that happened in "tss":
- Completely rewritten path logic:
-- inofficial internal "API" for path update callbacks
-- reverse lookup of positions to train path indices
-> This simplified a lot of code and probably eliminated some minor bugs that existed before, especially the buggy coupling behavior

- Fix yaw/looking direction behavior
-> Trains now finally appear in the direction they were placed

- Reworked security
-> Things now actually work
-> There are no longer "couple locks" because this only confused players.

- Track sections
-> Trains can occupy certain track sections, which can be used in combination with the latter features

- Signals and "LZB"
-- There are some new signals and a unified API for "signal aspects" (things that a signal tells to a train driver)
-- By setting an "Influence Point", the obeyance of those aspects is enforced automatically using a system similar to ETCS, LZB and the like (but without technical equipment, because the whole mod is a simulation and all parameters are known at any time)

- Train (and shunt) routes
-- Trains can be guided along secured paths to prevent collisions or accidents, where all turnouts are locked and cannot be reversed

- Speed restrictions
-- Both signals and special signs can set up speed restrictions for trains
-> all of them work using the Signal API and the aforementioned "Influence Points"

* There is a possibility to downgrade, but this might still result in data loss or might not work at all:
1. revert back to "master" (don't start world)
2. go into world directory, open the file "advtrains" with a text editor
3. Using the "Find" function (Ctrl-F), locate "version"
4. change value there to 1
5. save file, close, start world.

to download the tss branch, am I supposed to put the address in step 3 of the if not instructions into a browser?
if so I can't find the list described in steps 4 and 5

On startup we get the message
"Undeclared global variable "id" accessed at ..\advtrains\advtrains\trainlogic.lua:111"

Also normal users dont seem to be able to attach wagons. Given train_operator but they dont attach.

Is there a train_admin priv now? Read in documentation but doesnt seem to exist.

Is there away to stop people loosing their stuff when hit by a train? Have the server setup to keep their items but with trains they loose it all.

Running minetest 0.4.17

Thanks

Oh, seems like I overlooked your post
1. What version? Can't find mentioned line
2. The wagons they want to couple must be owned by them or whitelisted (wagon properties)
3. Privilege_guide.txt line 15
4. No, not directly. Tell me which advtrains version you are using, so I can tell you which code to change.

Lua is great!List of my mods
I like singing. I like dancing. I like ... niyummm...

I wanted to test some automation in the new tss branch.
The gui/objects to compose a route are fantastic :)
I added 4 route segments in my test track. Each with a circuit breaker and signal.
For each segment i made a single route (i hope thats correct).
For the station halt and return on the end i added atc-tracks:

Hm...
The message "train x hit route y" appears when a route is set into a section and suddenly a train not supposed for it suddenly occupies the section (either when it is placed into such a section or it enters the section from a "wrong" TCB.
One thing I noticed is that your layout does not obey a design principle of real-world railways that I implicitly assumed: Routes should not involve changes of the driving direction. This means that after each supposed driving direction change, there should be a signal in the opposite direction from which a new route can be set. The route for the movement up to the reversing location needs to be set as usual: from a signal to the next signal in the same direction.
see also https://www.simsig.co.uk/Wiki/Show?page ... erse_train under "Reversing examples"

Also, your layout requires that the train drives on the turnout from the wrong side, which is bad practice.I recommend a layout like this:

Then, the 2 inner signals lock the turnout straight, and the outer 2 signals lock it reverse (curve)
You need the extra TCBs so another train can enter the terminal section once one has cleared the turnout. Note that the routes of the outer signals have to be programmed over 2 track sections then.

Another question: Have you set the influence points for the signals? If not, automatic trains won't stop at red signals by themself.

A way how you can check whether your interlocking setup works is by trying to set conflicting routes manually. When the system allows it and the signal turns green though it should not (because a section is occupied etc.) you've made a mistake.

Lua is great!List of my mods
I like singing. I like dancing. I like ... niyummm...

I guess nothing. Are there any trains missing in your world? Else, you can ignore this.
The message "remove_train failed" should be harmless. However, can you PM me just the file called "advtrains" from the world directory of the pre-update world, so I can check the cause?
Thanks

Lua is great!List of my mods
I like singing. I like dancing. I like ... niyummm...

We have deployed the TSS branch on the LinuxWorks server, which acts as a "public beta" for it. So far, it has proven working and stable. I will officially deprecate the current "master" branch in the next week.

Lua is great!List of my mods
I like singing. I like dancing. I like ... niyummm...

After over a year of development, I finally announce the official release of what was formerly known as the TSS branch. The old master branch has been deprecated and is further available as "master_old"

If you were using Git to install the "master" branch, delete and re-pull your local repository or rename your local "tss" branch to "master". I renamed the tss branch to "master" and the former "master" branch to "master_old". A merge of both branches was not practical, because they had diverged too much and the things on old master were mostly backported bugfixes.

When you install this update, some trains in your world will probably flip their driving direction and/or "mirror" around one end. This is due to an inevitable change in the save data and will only occur a single time. Also, the brake distance of ATC rails has slightly increased.

I suggest that you make a backup of all advtrains-related files in your world directory before updating.

+
Spoiler

- Coupling trains now works
- Interlocking system (with all its implications, see the guide for info)
- Privilege system now works
- To get a train out of ATC mode ("ATC" is written in the lower control bar), you need to press Space once (or whatever key "Jump" is), else it won't accept your controls
- The bug regarding trains reversing behind wronly set switches is gone
- Use "Point speed restriction rails" to utilize the automatic braking function for your ATC setups

I also updated the version in the Content DB and rewrote the main post.

+
Spoiler

PLEASE READ:viewtopic.php?f=11&t=14726&p=337551#p337551
This mod adds good-looking, realistic trains to minetest. It introduces rails that make turns of only 30 degrees instead of 90. The trains can be highly automated.

+
Spoiler

- tracks and switches, based on angles of 30(!) degrees
- wagons that drive on these rails and collide with nodes in the environment(they need 3x3x3 space)
-> a steam engine (with smoke!)
-> a regular green wagon
-> a box wagon
-> a subway train
-> engine and wagon for a passenger train (the 'japanese train')
- coupling /discoupling of wagons/trains
- trains can travel through unloaded map chunks (but I don't recommend you to do so unless you have them automated with ATC, watch the movie 'unstoppable', it is really hard to stop a fast moving train, even with fly/fast)
- head-up display for train speed and nice controls when sitting in locomotive
- signals and bumpers
- switches and signals controllable by mesecons
- wagons have an owner, only this owner (or persons with appropriate privs) can destroy or discouple wagons.
- Automatic train control (ATC) (currently only static commands, but these are powerful enough)
- Automation with LUA code
- API to add custom wagons
- doors on subway train that can be opened
- Sounds: Train horns, driving sounds, level crossing bell
/spoiler]

- Use the 'track' item to place tracks. In most cases it will adjust rails in the direction you need them.
- use the trackworker tool (doctor who sonic screwdriver) to rotate tracks(right-click) and to change normal rails into switches(left-click)
- to overcome heights you need the ramped rails, place them and you will understand.
- right-click switches to change direction
- place locomotives or wagons by picking the item and placing it on a track.
- right-click a wagon or locomotive to sit onto it.
- drive two trains together and they will connect by right-clicking that gray icon that appears (it was green once).
- punch the red couple icon between wagons to discouple themFor the syntax of ATC commands see atc_commands.txt
/spoiler]
Have fun!
Guide to using the interlocking system: http://advtrains.bleipb.de/interlocking

Please note: The github repository of this mod (https://github.com/orwell96/advtrains) is no longer updated. If you are using Git and want to receive further update, you need to change the "origin" repository to the one mentioned above.

We found an issue with ATC conditional orders and train's order queue last night.

Suppose you have two ATC tracks looking in different directions (placed close enough though), having conditional orders, and a train approaching:

==========▭▭▭▭▭⇨==========[<<¹]===[>>²]==========

Each of ATC tracks has some order conditional on the direction of travel, for example "I+ B0W OR D15 OC D1 S16;"

Now in the situation above, the train passes the first ATC track ([>>]), doesn't react, passes to the second, and executes the order. Seemingly everything as it should be. Now imagine the tracks being placed differently (notice the direction of arrows on ATC tracks):

==========▭▭▭▭▭⇨==========[>>¹]===[<<²]==========

In this case, the train will begin executing the order given by the first ATC track it passes over, the orders will queue to be executed, then it will pass over the next track... and the train's ATC order queue will be purged! In my experiments, it will just roll to stop. Presence of braking order doesn't seem to make an difference, an order of opening and closing doors repeatedly is similarly purged by another such order.

Now, when I see an order like "I+ B0W OR D15 OC D1 S16;" I expect it to mean "If moving in the direction of ATC track, execute this sequence, otherwise perform no action". However, what happens in advanced trains as implemented is "If moving in the direction of ATC track, execute this sequence, otherwise make the trainperform no action". So there is an implicit "no operation" passed with such order, as if it was "I+ ... E NOP;"

I don't think this is how it should be. After all, there is a construction with explicit "or else" order set. If a train meets an ATC track with an order which is purely direction-dependent, literally nothing should change for the train.

Linux Forks, the Best Forks: linux-forks.de // Play @ LinuxWorks Next Generation