This commit is contained in:
parent
db9e4429d7
commit
6135f8a23b
|
@ -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.
|
||||
|
||||
- `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.
|
||||
|
||||
#### Interlocking Route Management Functions
|
||||
If `advtrains_interlocking` is enabled, the following aditional functions can be used:
|
||||
|
||||
|
@ -230,6 +233,9 @@ In addition to the above environment functions, the following functions are avai
|
|||
- `atc_set_text_inside(text)`
|
||||
Set text shown to train passengers. Pass nil to show no text. `text` must be a string.
|
||||
|
||||
- `atc_set_text_inside(text) / atc_set_text_outside(text)`
|
||||
Getters for inside/outside text, return nil when no train is there.
|
||||
|
||||
- `get_line()`
|
||||
Returns the "Line" property of the train (a string).
|
||||
This can be used to distinguish between trains of different lines and route them appropriately.
|
||||
|
|
|
@ -151,6 +151,14 @@ function r.fire_event(pos, evtdata, appr_internal)
|
|||
advtrains.trains[train_id].text_inside=text
|
||||
return true
|
||||
end,
|
||||
atc_get_text_outside = function()
|
||||
if not train_id then return false end
|
||||
return advtrains.trains[train_id].text_outside
|
||||
end,
|
||||
atc_get_text_inside = function(text)
|
||||
if not train_id then return false end
|
||||
return advtrains.trains[train_id].text_inside
|
||||
end,
|
||||
atc_set_lzb_tsr = function(speed)
|
||||
if not appr_internal then
|
||||
error("atc_set_lzb_tsr() can only be used during 'approach' events!")
|
||||
|
|
|
@ -153,6 +153,17 @@ local static_env = {
|
|||
local pos=atlatc.pcnaming.resolve_pos(parpos)
|
||||
atlatc.interrupt.add(0, pos, {type="ext_int", ext_int=true, message=imesg})
|
||||
end,
|
||||
-- sends an atc command to train regardless of where it is in the world
|
||||
atc_send_to_train = function(train_id, command)
|
||||
assertt(command, "string")
|
||||
local train = advtrains.trains[train_id]
|
||||
if train then
|
||||
advtrains.atc.train_set_command(train, command, true)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
-- If interlocking is present, enable route setting functions
|
||||
|
|
Loading…
Reference in New Issue