aboutsummaryrefslogtreecommitdiff
path: root/advtrains_luaautomation/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains_luaautomation/README.md')
-rw-r--r--advtrains_luaautomation/README.md24
1 files changed, 14 insertions, 10 deletions
diff --git a/advtrains_luaautomation/README.md b/advtrains_luaautomation/README.md
index a885075..275653c 100644
--- a/advtrains_luaautomation/README.md
+++ b/advtrains_luaautomation/README.md
@@ -93,6 +93,9 @@ Removes any pending interrupts of this node.
Make this active component send a digiline message on the specified channel.
Not available in init code.
+ - `trainparts(train_id)`
+ returns a table with the ids of the cars the train is composed of, or false if `train_id` is invalid. `train_id` can be replaced with `atc_id` when used in LuaATC Rails.
+
- `atc_send_to_train(<train_id>, <atc_command>)`
Sends the specified ATC command to the train specified by its train id. This happens regardless of where the train is in the world, and can be used to remote-control trains. Returns true on success. If the train ID does not exist, returns false and does nothing. See [atc_command.txt](../atc_command.txt) for the ATC command syntax.
@@ -142,22 +145,16 @@ asp = {
-- the character of call_on and dead_end is purely informative
call_on = <boolean>, -- Call-on route, expect train in track ahead (not implemented yet)
dead_end = <boolean>, -- Route ends on a dead end (e.g. bumper) (not implemented yet)
-
- w_speed = <integer>,
- -- "Warning speed restriction". Supposed for short-term speed
- -- restrictions which always override any other restrictions
- -- imposed by "speed" fields, until lifted by a value of -1
- -- (Example: german Langsamfahrstellen-Signale)
}
```
-As of January 2020, the 'dst', 'call_on' and 'dead_end' fields are not used.
+As of September 2024, the 'dst', 'call_on' and 'dead_end' fields are not used.
#### Lines
The advtrains_line_automation component adds a few contraptions that should make creating timeable systems easier.
Part of its functionality is also available in LuaATC:
-- `rwt.*` - all Railway Time functions are included as documented in [the wiki](https://advtrains.de/wiki/doku.php?id=dev:lines:rwt)
+- `rwt.*` - all Railway Time functions are included as documented in [the wiki](https://advtrains.de/wiki/doku.php?id=dev:api:railway_time_api)
- `schedule(rw_time, msg)`, `schedule_in(rw_dtime, msg)`
Schedules an event of type {type="schedule", schedule=true, msg=msg} at (resp. after) the specified railway time (which can be in any format). You can only schedule one event this way. (uses the new lines-internal scheduler)
@@ -273,10 +270,17 @@ Each wagon has a current FC, indicating its next destination.
Returns a table with the entire FC list for each wagon in the train.
Command: `get_fc()`
Result: `{"", "foo!bar", "testing", "fc_1!fc_2!fc_3!?", "hello_world"}`
+
+ - `get_fc_index()`
+ Returns a table with the current FC index for each wagon in the train. Use in conjunction with the result from `get_fc()` to find a the current FC for a wagon.
+ Command: `get_fc_index()`
+ Result: `{1, 1, 1, 2, 1}`
- - `set_fc(fc_list)`
+ - `set_fc(fc_list, reset_index)`
Overwrites the FC list according to a table `fc_list`. A false or nil entry will leave the wagon unaffected, however all others will be overwritten.
- Useful for mass-programming freight trains that use FC-shunting instead of walking to each wagon individually.
+ Useful for mass-programming freight trains that use FC-shunting instead of walking to each wagon individually. If the new FC entry for a wagon is shorter than the old entry, the index will clip to the last FC in the new entry.
+ If `reset_index` is true, all Current FC values will reset to the first entry in the list, instead of remaining at the current index.
+
Example: train has FC lists: `"", "foo!bar", "testing", "fc_1!fc_2!fc_3!?", "hello_world"`
Command: `set_fc({"", "foo!turtle", nil, "4tehlulz", false})`
Result: `""` `"foo!turtle"` `"testing"` `"4tehlulz"` `"hello_world"`