aboutsummaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
authorY. Wang <yw05@forksworld.de>2021-11-27 13:31:16 +0100
committerY. Wang <yw05@forksworld.de>2021-11-27 13:31:16 +0100
commit6129ce33cc13b1170f7a7d5886fe0949626e5317 (patch)
tree33dd46cebf8f5ae90b9130e95d4548fd1bf53199 /assets
parent5b74344fe7e3abb2e0f430752384be2b97c90a71 (diff)
downloadadvtrains-6129ce33cc13b1170f7a7d5886fe0949626e5317.tar.gz
advtrains-6129ce33cc13b1170f7a7d5886fe0949626e5317.tar.bz2
advtrains-6129ce33cc13b1170f7a7d5886fe0949626e5317.zip
Remove detailed description in API entry (not enough space)
Diffstat (limited to 'assets')
-rw-r--r--assets/manual2/manual.tex70
1 files changed, 35 insertions, 35 deletions
diff --git a/assets/manual2/manual.tex b/assets/manual2/manual.tex
index 1ed8744..70007e5 100644
--- a/assets/manual2/manual.tex
+++ b/assets/manual2/manual.tex
@@ -48,7 +48,7 @@
\end{center}
}
-\newenvironment{apidoc}[2]{
+\newenvironment{apidoc}[1]{
\begin{list}{}{
\setlength{\labelwidth}{0pt}
\setlength{\labelsep}{0pt}
@@ -62,11 +62,11 @@
\providecommand{\api}[2]{\apient{\texttt{##1}}{##2}}
\providecommand{\apiasp}[1]{\apient{##1}{signal aspect}}
\providecommand{\apicmd}[1]{\api{##1}{command}}
-\providecommand{\apienum}[1]{\apip{##1}{#2 enumeration}}
+\providecommand{\apienum}[1]{\apip{##1}{enumeration}}
\providecommand{\apifield}[1]{\apip{##1}{field}}
\providecommand{\apiitem}[1]{\apient{##1}{item}}
-\providecommand{\apivar}[1]{\apip{##1}{#2 variable}\index{#1!\texttt{##1}}}
-\providecommand{\apifunc}[2]{\apip{##1(##2)}{#2 function}\index{#1!\texttt{##1}}}
+\providecommand{\apivar}[1]{\apip{##1}{variable}\index{#1!\texttt{##1}}}
+\providecommand{\apifunc}[2]{\apip{##1(##2)}{function}\index{#1!\texttt{##1}}}
\providecommand{\apilex}[1]{\apip{##1}{lexical syntax}}
\providecommand{\apipat}[1]{\apip{##1}{pattern}}
\providecommand{\apiterm}[1]{\apient{##1}{term}}
@@ -279,7 +279,7 @@ Exercise: Build a T junction. You will need this later in section \ref{s:iljunct
\advtrains{} also have a few special tracks, some of which are explain in their own sections.
-\begin{apidoc}{Special tracks}{special track}
+\begin{apidoc}{Special tracks}
\item \apiitem{ATC track} Track that sends ATC commands to a train (see section \ref{s:atc} for more information)
\item \apiitem{Loading track} Track that makes a train load as many items as possible from a chest below the track if the train is moving in the direction indicated by the arrow on the track at a speed lower than 2m/s.
\item \apiitem{Unloading track} Track that makes a train unload as many items as possible into a chest below the track if the train is moving in the direction indicated by the arrow on the track at a speed lower than 2m/s.
@@ -305,7 +305,7 @@ Unlike in real life, levers are not moved continuously. Instead, there are a few
\subsection{Train formspec}\label{s:trainformspec}
If you have access to the driver stand of the wagon, right-clicking the train will open up a formspec will a few buttons, depending on the status of the train:
-\begin{apidoc}{Train formspec}{train formspec}
+\begin{apidoc}{Train formspec}
\item \apiui{Passenger area} Move to the passenger area.
\item \apiui{Driver stand} Move to the driver stand.
\item \apiui{Onboard computer} Open the onboard computer.
@@ -316,7 +316,7 @@ If you have access to the driver stand of the wagon, right-clicking the train wi
\subsection{Onboard computer}\label{s:bordcom}
The onboard computer allow setting certain properties of the train. Feel free to explore it yourself. A few fields are explained here in detail:
-\begin{apidoc}{Onboard computer}{onboard computer}
+\begin{apidoc}{Onboard computer}
\item \apiui{Line number} The line name of the train. Despite the label, you can set this to anything. This field is mainly used for interlocking.
\item \apiui{Routing code} The routing code of the train, separated by space characters. This field is mainly used for interlocking.
\item \apiui{Train overview} This section is only shown when the train is not moving. It allows you to couple and decouple wagons from the train.
@@ -453,7 +453,7 @@ ATC is a method of automatically controlling trains. Certain modes can be direct
ATC tracks can be used to send custom ATC commands to the train passing the track. The ATC commands available are listed below:
-\begin{apidoc}{ATC}{ATC}
+\begin{apidoc}{ATC}
\item \apilex{A0} Disables ARS.
\item \apilex{A1} Enables ARS.
\item \apilex{BB} Actives the emergency brake until the train stops.
@@ -475,7 +475,7 @@ For the \texttt{B}, \texttt{D}, and \texttt{S} commands, the argument should be
The following \var{condition}s are available for the ATC \texttt{I} command:
-\begin{apidoc}{ATC conditions}{ATC conditional}
+\begin{apidoc}{ATC conditions}
\item \apilex{+} True when the train is driving in the same direction as the arrows on the ATC rail.
\item \apilex{-} True when the train is driving in the opposite direction of the arrow on the ATC rail.
\item \apilex{<\var{speed}} True when the train is slower than \var{speed}.
@@ -647,7 +647,7 @@ After finishing the route, you are prompted for the name of the route. It is rec
Automatic routesetting (ARS) is a method of choosing a route based on a set of matching patterns. In the previous section, you learned to set up a route, and there is a text input box where you can enter the ARS rules. This area is empty by default, which means that the route is not selected in any case.
ARS rules are delimited by a newline. Each line can be one of the following:
-\begin{apidoc}{ARS rules}{ARS rule}
+\begin{apidoc}{ARS rules}
\item \apipat{\# \var{comment}} Comment
\item \apipat{LN \var{line}} Matches trains with the exact line name \var{line}.
\item \apipat{RC \var{routing code}} Matches trains that contain the routing code \var{routing code}.
@@ -802,7 +802,7 @@ There are a few types of speed restrictions that a signal can give. These speed
The following types of speed restrictions are used by signals in \advtrains{}:
-\begin{apidoc}{speed restriction type}{speed restriction}
+\begin{apidoc}{speed restriction type}
\item \apiterm{Permanent (``main'') speed restriction (\texttt{main})} The default type of speed restriction. This one is most commonly given by signal lights.
\item \apiterm{Temporary speed restriction (\texttt{temp})} Speed restrictions that are temporarily set up, such as near construction sites.
\item \apiterm{Line speed restriction (\texttt{line})} Speed restriction that applies to the entire rail line.
@@ -832,7 +832,7 @@ The signal placement conventions assume right-hand traffic.
Ks signals are combined signals that combines the features of main signals and distant signals. The system was developed by the Deutsche Bahn AG after the Deutsche Bundesbahn in West Germany and the Deutsche Reichsbahn in East Germany merged, and the goal was to replace the other four signaling system in use in Germany, which still exist today.
Ks signals have the following aspects:
-\begin{apidoc}{Signal aspects!Ks signals}{}
+\begin{apidoc}{Signal aspects!Ks signals}
\item \apiasp{Hp 0} Red light: Stop.
\item \apiasp{Ks 1} Green light: Proceed at maximum speed or with the speed limit shown on the Zs 3 indicator on the main signal (if present) and expect to pass the next main signal at maximum speed or, if the green light is flashing, with the speed limit shown on the Zs 3v indicator directly below the main signal.
\item \apiasp{Ks 2} Yellow light: Proceed at maximum speed or with the speed limit shown on the Zs 3 indicator on the main signal (if present) and expect to stop at the next main signal.
@@ -841,7 +841,7 @@ Ks signals have the following aspects:
In addition, Sh 1 (see below) may also appear along with Hp 0, in which case the train proceeds in shunt mode.
\subsubsection{Shunt signals}
-\begin{apidoc}{Signal aspects!Shunt signals}{}
+\begin{apidoc}{Signal aspects!Shunt signals}
\item \apiasp{Sh 0} Two horizontally aligned red lights: Stop.
\item \apiasp{Sh 1/(ex-DR) Ra 12} Two white lights aligned on a slanted line: Shunting allowed.
\end{apidoc}
@@ -849,7 +849,7 @@ In addition, Sh 1 (see below) may also appear along with Hp 0, in which case the
\subsubsection{Signal signs}
\advtrains{} has a few types of signal signs, which can be placed by the corresponding placers. The aspect of the signal sign can be adjusted with the trackworker, but only in the range limited by the placer.
-\begin{apidoc}{Signal aspects!Signal signs}{}
+\begin{apidoc}{Signal aspects!Signal signs}
\item \apiasp{Zs 3} White number on a black background: Proceed with the main speed restriction shown on the sign.
\item \apiasp{Zs 10} An upward-pointing arrow: The speed restriction set by Zs 3 and regular signals is lifted.
\item \apiasp{(ex-DR) Lf 1/2} Black number on an orange background: Proceed with the temporary speed restriction shown on the sign.
@@ -886,7 +886,7 @@ Each active component in LuaATC is assigned to an environment where all relevant
The following chat commands are available. These commands also require the \texttt{atlatc} privilege.
-\begin{apidoc}{LuaATC}{LuaATC environment}
+\begin{apidoc}{LuaATC}
\item \apicmd{/env\_create \var{name}} Create an environment named \var{name}. Please choose the name wisely, as you can't rename environments without deleting and recreating the environment.
\item \apicmd{/env\_setup \var{name}} Edit the initialization code for the environment named \var{name}. You can also delete the environment from the editor or re-run the init code.
\item \apicmd{/env\_subscribe \var{name}} Subscribe to the environment named \var{name}.
@@ -901,7 +901,7 @@ Each environment can contain some \textit{initialization code} (called \textit{i
The init code is typically used to add functions shared among LuaATC components.
\subsection{LuaATC components}
-\begin{apidoc}{LuaATC!Component}{LuaATC}
+\begin{apidoc}{LuaATC!Component}
\item \apiitem{LuaATC track} Tracks that can execute LuaATC code.
\item \apiitem{LuaATC operator panel} Simple node that can execute LuaATC code (similar to Luacontrollers in the mesecons modpack).
\end{apidoc}
@@ -934,45 +934,45 @@ The following standard Lua functions are available:
It is an error to globally override the provided Lua library functions.
\subsection{Environment-specific variables}
-\begin{apidoc}{LuaATC}{LuaATC environment}
+\begin{apidoc}{LuaATC}
\item \apivar{F} Global table shared between all components of the environment. The content of this table is discarded on server shutdown or execution of the init code. Functions are allowed in the table.
\item \apivar{S} Global table persistently shared between all components of the environment. This variable may not contain functions. The existence of certain patterns in this table may violate implementation restrictions.
\end{apidoc}
\subsection{LuaATC helpers}
-\begin{apidoc}{LuaATC}{LuaATC helper}
+\begin{apidoc}{LuaATC}
\item \apifunc{POS}{\var{x},\var{y},\var{z}} Returns a position vector of the form \texttt{\{x=\var{x}, y=\var{y}, z=\var{z}\}}.
\end{apidoc}
\subsection{Passive components}\index{LuaATC!Passive components}
The \var{pos} arguments in this section accept a position vector or the name of a passive component.
-\begin{apidoc}{LuaATC}{LuaATC passive component API}
+\begin{apidoc}{LuaATC}
\item \apifunc{getstate}{\var{pos}} Returns the state of the passive component at \var{pos}.
\item \apifunc{setstate}{\var{pos},\var{state}} Sets the state of the passive component at \var{pos} to \var{state}.
\item \apifunc{is\_passive}{\var{pos}} Returns a boolean indicating whether a passive component exists at \var{pos} and whether \var{pos} is a name of an existing passive component.
\end{apidoc}
The basic light signals provided by \advtrains{} (the ones that can only show red or green) can be accessed with this API. The following \var{state}s are accepted:
-\begin{apidoc}{LuaATC!Passive components!Basic light signals}{basic light signal status}
+\begin{apidoc}{LuaATC!Passive components!Basic light signals}
\item \apienum{green} The signal shows a green light.
\item \apienum{red} The signal shows a red light.
\end{apidoc}
Two-way turnouts with one straight direction accept the following \var{state}s:
-\begin{apidoc}{LuaATC!Passive components!Two-way turnouts}{two-way turnout status}
+\begin{apidoc}{LuaATC!Passive components!Two-way turnouts}
\item \apienum{st} The turnout lets the train continue in the direction that can be reached with a straight track.
\item \apienum{cr} The turnout lets the train continue in the direction that needs to be reached with a curve.
\end{apidoc}
The Y-shaped and three-way turnouts can have a few \var{state}s, looking from the convergence point:
-\begin{apidoc}{LuaATC!Passive components!Y-/three-way turnouts}{Y-/three-way turnout status}
+\begin{apidoc}{LuaATC!Passive components!Y-/three-way turnouts}
\item \apienum{l} The turnout points to the left.
\item \apienum{c} The turnout is straight (three-way turnouts only).
\item \apienum{r} The turnout points to the right.
\end{apidoc}
Unprotected full-node mesecon switches and Andrew's crosses can have one of the following \var{state}s:
-\begin{apidoc}{LuaATC!Passive components!Switches}{switch status}
+\begin{apidoc}{LuaATC!Passive components!Switches}
\item \apienum{off} The item is turned off.
\item \apienum{on} The item is turned on.
\end{apidoc}
@@ -980,7 +980,7 @@ Unprotected full-node mesecon switches and Andrew's crosses can have one of the
Passive components can be named using the passive component naming tool. Passive component names (as strings) can be used as coordinates, provided that the passive component with the name exists. Please note that the ``Signal Name'' field in the signal formspec is unrelated to the passive component name of the signal.
\subsection{Interrupts}
-\begin{apidoc}{LuaATC}{LuaATC interrupt}
+\begin{apidoc}{LuaATC}
\item \apifunc{interrupt}{\var{time},\var{message}} Triggers an \texttt{int} event on this component after \var{time} seconds with \var{message} as the message. \var{Message} can be any Lua data type. This function is not available for the init code.
\item \apifunc{interrupt\_safe}{\var{time},\var{message}} Like \texttt{interrupt}, but does not add an interrupt and when an interrupt of any type is present for this component. The return value is a boolean indicating whether the interrupt was successfully added.
\item \apifunc{interrupt\_pos}{\var{pos},\var{message}} Immediately triggers an \texttt{ext\_int} event on the active component at \var{pos} with \var{message} passed like with \texttt{interrupt}. Please keep in mind that this function can be a source of a fork bomb.
@@ -988,13 +988,13 @@ Passive components can be named using the passive component naming tool. Passive
\end{apidoc}
\subsection{Diglines}
-\begin{apidoc}{LuaATC}{LuaATC digilines API}
+\begin{apidoc}{LuaATC}
\item \apifunc{digiline\_send}{\var{channel},\var{message}} Sends \var{message} to the digiline channel named \var{channel}. This function is only available for active components.
\end{apidoc}
\subsection{Interlocking}
The following are available if \texttt{advtrains\_interlocking} is enabled.
-\begin{apidoc}{LuaATC}{LuaATC interlocking API}
+\begin{apidoc}{LuaATC}
\item \apifunc{can\_set\_route}{\var{pos},\var{name}} Returns a boolean indicating whether the route named \var{name} of the signal at \var{pos} can be set.
\item \apifunc{set\_route}{\var{pos},\var{name}} Sets the route named \var{name} of the signal at \var{pos}.
\item \apifunc{cancel\_route}{\var{pos}} Cancels the route that is set from the signal at \var{pos}.
@@ -1003,14 +1003,14 @@ The following are available if \texttt{advtrains\_interlocking} is enabled.
\subsection{Railway time}
the railway time API described in section \ref{s:tilrwt} is available in the \texttt{rwt} table.
-\begin{apidoc}{LuaATC}{LuaATC railway time API}
+\begin{apidoc}{LuaATC}
\item \apifunc{schedule}{\var{time},\var{message}} Triggers a \texttt{schedule} event at \var{time} with the message \var{message}. Only one event can be scheduled this way.
\item \apifunc{schedule\_in}{\var{time},\var{message}} Like \texttt{schedule}, but \var{time} is given as the time until the event is triggered.
\end{apidoc}
\subsection{Train control}{LuaATC}
These functions and variables described in this section are only available to LuaATC tracks. Exceptions are explicitly stated. These functions, except \texttt{atc\_send\_to\_train}, require that a reference to the train can be made, i.e. when a train is on (or passing) the track or when execution of the code takes place as part of the approach callback.
-\begin{apidoc}{LuaATC}{LuaATC train control}
+\begin{apidoc}{LuaATC}
\item \apivar{atc\_arrow} A boolean indicating whether the train is driving in the direction of the arrow indicated on the ATC track, or \luanil{} when there is no train.
\item \apivar{atc\_id} A string containing the ID of the train, or \luanil{} if there is no train.
\item \apifunc{atc\_reset}{} Resets the ATC command of the train or returns \luafalse{} if there is no train.
@@ -1028,7 +1028,7 @@ These functions and variables described in this section are only available to Lu
\subsubsection{Shunting and freight code}
Freight codes are delimited with exclamation marks (\texttt{!}).
-\begin{apidoc}{LuaATC}{LuaATC freight code API}
+\begin{apidoc}{LuaATC}
\item \apifunc{set\_autocouple}{} Enables autocouple mode for the train.
\item \apifunc{unset\_autocouple}{} Disables autocouple mode for the train.
\item \apifunc{split\_at\_fc}{\var{command},\var{len}} Like \texttt{split\_at\_index}, but the train is split in a way that all wagons in the first part of the train have an empty freight code or the same freight code. \var{Len} specifies the maximum length of the first part of the train. The freight code of the wagons of the first part is returned.
@@ -1041,7 +1041,7 @@ Freight codes are delimited with exclamation marks (\texttt{!}).
The event table is passed as the \texttt{event} global variable when an event is triggered. The \texttt{type} field of the event is a string indicating the type of the event, and the field indexed by the event type string includes the \luatrue{} constant. Additional fields may be provided, depending on the event type.
The following events are available in LuaATC:
-\begin{apidoc}{LuaATC!Event types}{LuaATC event type}
+\begin{apidoc}{LuaATC!Event types}
\item \apienum{approach} Triggered when a train approaches the track. This event can be triggered multiple times for the same train.
\item \apienum{digiline} Like \texttt{int} (see below), but triggered with digiline. The channel and message are included in the \texttt{channel} and \texttt{message} fields, respectively.
\item \apienum{ext\_int} Like \texttt{int} (see below), but triggered when the interrupt is called by a different active component. The message is only included in the \texttt{message} field.
@@ -1053,7 +1053,7 @@ The following events are available in LuaATC:
\subsubsection{Approach callback}
This subsection is relevant to the \texttt{approach} event.
-\begin{apidoc}{LuaATC}{LuaATC approach callback}
+\begin{apidoc}{LuaATC}
\item \apifunc{atc\_set\_lzb\_tsr}{\var{speed}} Set the temporary speed restriction of the train to \var{speed} at the position of the track. This needs to be called every time the \texttt{approach} callback is triggered.
\end{apidoc}
Approach callbacks are executing during the train step. This may be problematic when performing actions with side effects on the environment that the train is in, such as switching turnouts or setting routes. It is encouraged to only run things that are necessary and defer everything else to an interrupt or a schedule.
@@ -1097,7 +1097,7 @@ This part is mostly relevant only to those interested in working on internal mec
\subsection{Railway time}\label{s:tilrwt}
\advtrains{} depends on Minetest's ``dtime'' for most operations, and may slow itself down when necessary (e.g. in a situation with a lot of lag) to prevent unexpected behavior. As a result, the internal time used by \advtrains{} is not synchronized to real-life time due to lag and server restarts. Railway time was therefore introduced as a method of accurately measuring internal time, as well as to provide a scheduling system. It can, however, be set up to keep in sync with real-life time, depending on the real-life time adaptation mode (\texttt{advtrains\_lines\_rwt\_realtime}):
-\begin{apidoc}{Railway time adaptation mode}{RWT adaptation mode}
+\begin{apidoc}{Railway time adaptation mode}
\item \apienum{independent} Do not adapt to real-life time and instead keep in sync with \advtrains{}' internal dtime.
\item \apienum{follow\_real} Independent of real-life time, but counts up in real-life time.
\item \apienum{adapt\_real} Use \texttt{os.time} for RWT.
@@ -1114,7 +1114,7 @@ Railway time can be represented in three formats:
The following entries are present in \texttt{advtrains.interlocking.rwt}. \var{Time}, \var{t}, \var{interval}, and \var{offset} refer to a railway time object represented in one of the methods described above. \var{Interval} and \var{offset} represent the interval and offset of a repetition, respectively. \var{Cycles}, \var{minutes}, and \var{seconds} should be the value of the \texttt{c}, \texttt{m} and \texttt{s} fields of a railway time table.
-\begin{apidoc}{\texttt{advtrains}!\texttt{interlocking.rwt}}{railway time API}
+\begin{apidoc}{\texttt{advtrains}!\texttt{interlocking.rwt}}
\item \apifunc{add}{\vari{t},\varii{t}} Returns the sum of \vari{t} and \varii{t}.
\item \apifunc{copy}{\var{time}} Returns a copy of \var{time}.
\item \apifunc{diff}{\vari{t},\varii{t}} Subtracts \vari{t} from \varii{t} and returns the result in seconds.
@@ -1141,7 +1141,7 @@ Note that the meaning of \luanil{} here differ from the meaning used in signal a
The following entries are present in \texttt{advtrains.speed}:
-\begin{apidoc}{\texttt{advtrains}!\texttt{speed}}{\texttt{speed} library}
+\begin{apidoc}{\texttt{advtrains}!\texttt{speed}}
\item \apifunc{lessp}{\var{a},\var{b}} Returns a boolean indicating whether \var{a} is more strict than \var{b}.
\item \apifunc{greaterp}{\var{a},\var{b}} Returns a boolean indicating whether \var{a} is less strict than \var{b}.
\item \apifunc{equalp}{\var{a},\var{b}} Returns a boolean indicating whether \var{a} is the same speed limit as \var{b}.
@@ -1166,7 +1166,7 @@ This section only documents table structures shared among multiple modules. API-
\subsection{Signal aspect table}\label{s:sigasp}
Signal aspect tables may contain the following members:
-\begin{apidoc}{Signal aspect table}{signal aspect table}
+\begin{apidoc}{Signal aspect table}
\item \apifield{main} The aspect of the main signal.
\item \apifield{type} The type of signal. Please refer to section \ref{s:srtypes} for more information.
\item \apifield{dst} The aspect of the next main signal.