This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
usage:nodes:atc_rail [2019-11-07 08:58] orwell extend doc(part 1) |
usage:nodes:atc_rail [2019-11-07 09:20] orwell never do this |
||
---|---|---|---|
Line 142: | Line 142: | ||
The time counter and queue handling these interrupts is synchronized to minetest' | The time counter and queue handling these interrupts is synchronized to minetest' | ||
- | + | < | |
- | -- an example for an " | + | -- an example for an " |
- | if event.int then | + | -- NEVER DO THIS! |
- | interrupt(1," | + | if event.int then |
- | interrupt(1," | + | interrupt(1," |
- | -- run 1: {A,B} | + | interrupt(1," |
- | -- run 2: {A,B,A,B} | + | -- run 1: {A,B} |
- | -- run 3: {A, | + | -- run 2: {A,B,A,B} |
+ | -- run 3: {A, | ||
+ | </ | ||
== interrupt(time, | == interrupt(time, | ||
Line 158: | Line 159: | ||
Triggers immediately an '' | Triggers immediately an '' | ||
+ | |||
+ | === Railway Time === | ||
+ | |||
+ | When '' | ||
+ | |||
+ | For the available functions, see [[dev: | ||
+ | |||
+ | < | ||
+ | --Example: print the time of the next full minute | ||
+ | local now = rwt.now() | ||
+ | local next_minute = rwt.next_rpt(now, | ||
+ | </ | ||
=== Railway Time Scheduler === | === Railway Time Scheduler === | ||
Line 165: | Line 178: | ||
There are two important considerations to this: | There are two important considerations to this: | ||
- | 1. While the interrupt system is always synchronized to minetest step time, the RWT scheduler follows the RWT time flow. In particular, this means that you must be able to handle "time jumps" that occur when RWT is set up to adapt to real time. | + | - While the interrupt system is always synchronized to minetest step time, the RWT scheduler follows the RWT time flow. In particular, this means that you must be able to handle "time jumps" that occur when RWT is set up to adapt to real time. |
- | 2. The RWT scheduler has a built-in protection against " | + | |
+ | |||
+ | Clicking " | ||
== schedule(rwtime, | == schedule(rwtime, | ||
Line 177: | Line 192: | ||
Like schedule(), but the passed time is relative. | Like schedule(), but the passed time is relative. | ||
+ | < | ||
-- Example: schedule a " | -- Example: schedule a " | ||
schedule_in(" | schedule_in(" | ||
+ | </ | ||
=== Digiline === | === Digiline === | ||
Line 189: | Line 204: | ||
This function is not available in init code. | This function is not available in init code. | ||
- | ==== Interlocking functions | + | === Interlocking functions === |
Interlocking functions are available when the '' | Interlocking functions are available when the '' | ||
- | === can_set_route(pos, | + | == can_set_route(pos, |
Checks whether it is possible to set the route designated by '' | Checks whether it is possible to set the route designated by '' | ||
Line 211: | Line 226: | ||
> 2019-01-01 15:00:00: WARNING[Server]: | > 2019-01-01 15:00:00: WARNING[Server]: | ||
- | === set_route(pos, | + | == set_route(pos, |
Requests the route designated by '' | Requests the route designated by '' | ||
Line 219: | Line 234: | ||
If the route can't be set, the signal remains red and waits for conflicting problems to be solved. Execution continues **immediately**. | If the route can't be set, the signal remains red and waits for conflicting problems to be solved. Execution continues **immediately**. | ||
- | === cancel_route(pos, | + | == cancel_route(pos, |
Cancels the route designated by '' | Cancels the route designated by '' | ||
Line 227: | Line 242: | ||
If the route has already been canceled, nothing happens. | If the route has already been canceled, nothing happens. | ||
- | === get_aspect(pos) | + | == get_aspect(pos) == |
Gets the aspect of the signal at '' | Gets the aspect of the signal at '' | ||
Line 243: | Line 258: | ||
} | } | ||
</ | </ | ||
- | |||
- | |||
===== Trivia ===== | ===== Trivia ===== | ||
The LuaAutomation ATC rail has the same texture as the [[usage: | The LuaAutomation ATC rail has the same texture as the [[usage: |