Class InterlockingTower
m (Add standard API hierarchy) |
|||
(2 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
The InterlockingTower class is the script representation of an in game Interlocking Tower (aka Signal Tower). Interlocking Towers are used to define track "paths" that trains can travel down. | The InterlockingTower class is the script representation of an in game Interlocking Tower (aka Signal Tower). Interlocking Towers are used to define track "paths" that trains can travel down. | ||
− | *[[TrainzScript | + | *[[TrainzScript Library Reference|API Hierarchy]] |
**[[Class GSObject|GSObject]] * | **[[Class GSObject|GSObject]] * | ||
***[[Class GameObject|GameObject]] | ***[[Class GameObject|GameObject]] | ||
****[[Class TrainzGameObject|TrainzGameObject]] | ****[[Class TrainzGameObject|TrainzGameObject]] | ||
− | |||
*****[[Class MeshObject|MeshObject]] | *****[[Class MeshObject|MeshObject]] | ||
+ | *****[[Class PropertyObject|PropertyObject]] * | ||
******[[Class MapObject|MapObject]] | ******[[Class MapObject|MapObject]] | ||
*******InterlockingTower | *******InterlockingTower | ||
− | |||
− | |||
==Related Classes== | ==Related Classes== | ||
Line 42: | Line 40: | ||
*pathName - The name (or localised name) of the path to find. | *pathName - The name (or localised name) of the path to find. | ||
;Returns | ;Returns | ||
− | *InterlockingTowerPath - The found [[InterlockingTowerPath]], or null if no match was found | + | *InterlockingTowerPath - The found [[InterlockingTowerPath]], or null if no match was found. |
<br>{{MethodHeader|public InterlockingTowerPath[] GetConflictingPaths(InterlockingTowerPath path)}} | <br>{{MethodHeader|public InterlockingTowerPath[] GetConflictingPaths(InterlockingTowerPath path)}} | ||
;Description | ;Description | ||
+ | Builds an array of tower paths which have conflicts with the path passed. This will include any other path which shares an object in its path definition or external requirements. | ||
;Parameters | ;Parameters | ||
+ | *path - The [[InterlockingTowerPath]] to examine and find conflicts for. | ||
;Returns | ;Returns | ||
+ | *InterlockingTowerPath[] - An array of tower paths which conflict with the path passed. If no conflicts are found this will be an empty array (i.e. not null). | ||
<br>{{MethodHeader|public mandatory void SetAIState(int aiState)}} | <br>{{MethodHeader|public mandatory void SetAIState(int aiState)}} | ||
;Description | ;Description | ||
+ | Alters the current state of the towers automatic path selection processing. | ||
;Parameters | ;Parameters | ||
− | ; | + | *aiState - The new AI state for the tower, see PATH_ASSIGNMENT_* defines. |
+ | ;Note | ||
+ | This function is 'mandatory', meaning that any overriding function must call the inherited() in order to compile. | ||
<br>{{MethodHeader|public void AssignPathToTrain(Train train, string pathName)}} | <br>{{MethodHeader|public void AssignPathToTrain(Train train, string pathName)}} | ||
;Description | ;Description | ||
+ | Requests a specific path for the specified train. This will create a queue entry for the train if one doesn't already exist, set it's state to queued and set the path to that requested. The path may not be prepared immediately, if there are conflicting queued entries. | ||
;Parameters | ;Parameters | ||
− | + | *train - The train to assign the path to. | |
+ | *pathName - The name of the path to assign. | ||
<br>{{MethodHeader|public void CancelPathForTrain(Train train, string pathName)}} | <br>{{MethodHeader|public void CancelPathForTrain(Train train, string pathName)}} | ||
;Description | ;Description | ||
+ | Cancels a specific path for the train passed. If the train is not known, or there is no InterlockingTrainPath entry for this train and signal, then no action will be taken. | ||
;Parameters | ;Parameters | ||
− | + | *train - The train to cancel the path for. | |
+ | *pathName - The name of the path to cancel. | ||
<br>{{MethodHeader|public void SetPanicStateForPath(string pathName)}} | <br>{{MethodHeader|public void SetPanicStateForPath(string pathName)}} | ||
;Description | ;Description | ||
+ | Sets as specific path to a panic state, dropping all signals immediately, regardless of any occupying or approaching trains. | ||
;Parameters | ;Parameters | ||
− | + | *pathName - The name of the path to set to a panic/emergency state. | |
<br>{{MethodHeader|public void SetTrainAsPassing(Train train, Signal entrySignal)}} | <br>{{MethodHeader|public void SetTrainAsPassing(Train train, Signal entrySignal)}} | ||
;Description | ;Description | ||
+ | Sets a train's state for a specific entry signal to STATE_PASSING, so the tower knows the train is not entering the interlocking, and will ignore it until it leaves the area. If the train is not known, or there is no InterlockingTrainPath entry for this train and signal, then no action will be taken. | ||
;Parameters | ;Parameters | ||
− | + | *train - The train to set as passing. | |
+ | *entrySignal - The path entry signal that the train is passing. |
Latest revision as of 23:51, 28 December 2020
The InterlockingTower class is the script representation of an in game Interlocking Tower (aka Signal Tower). Interlocking Towers are used to define track "paths" that trains can travel down.
- API Hierarchy
- GSObject *
- GameObject
- TrainzGameObject
- MeshObject
- PropertyObject *
- MapObject
- InterlockingTower
- MapObject
- TrainzGameObject
- GameObject
- GSObject *
[edit] Related Classes
[edit] Common functions
Below is a list of some of the basic common functions on the InterlockingTower script class. This list is not intended to be comprehensive, merely provide an overview.
- Description
Creates a new blank path for use by this tower. Any script which needs to create a path should call this function. Any tower which needs to customise the class can then just override this to create their type.
- Returns
- InterlockingTowerPath - A newly created and initialised InterlockingTowerPath object.
- Description
Returns a list of the current (localised) path names.
- Returns
- string[] - A string array, containing the localised names of every path.
- Description
Finds and returns an interlocking path by name, or localised name (for the current language).
- Parameters
- pathName - The name (or localised name) of the path to find.
- Returns
- InterlockingTowerPath - The found InterlockingTowerPath, or null if no match was found.
- Description
Builds an array of tower paths which have conflicts with the path passed. This will include any other path which shares an object in its path definition or external requirements.
- Parameters
- path - The InterlockingTowerPath to examine and find conflicts for.
- Returns
- InterlockingTowerPath[] - An array of tower paths which conflict with the path passed. If no conflicts are found this will be an empty array (i.e. not null).
- Description
Alters the current state of the towers automatic path selection processing.
- Parameters
- aiState - The new AI state for the tower, see PATH_ASSIGNMENT_* defines.
- Note
This function is 'mandatory', meaning that any overriding function must call the inherited() in order to compile.
- Description
Requests a specific path for the specified train. This will create a queue entry for the train if one doesn't already exist, set it's state to queued and set the path to that requested. The path may not be prepared immediately, if there are conflicting queued entries.
- Parameters
- train - The train to assign the path to.
- pathName - The name of the path to assign.
- Description
Cancels a specific path for the train passed. If the train is not known, or there is no InterlockingTrainPath entry for this train and signal, then no action will be taken.
- Parameters
- train - The train to cancel the path for.
- pathName - The name of the path to cancel.
- Description
Sets as specific path to a panic state, dropping all signals immediately, regardless of any occupying or approaching trains.
- Parameters
- pathName - The name of the path to set to a panic/emergency state.
- Description
Sets a train's state for a specific entry signal to STATE_PASSING, so the tower knows the train is not entering the interlocking, and will ignore it until it leaves the area. If the train is not known, or there is no InterlockingTrainPath entry for this train and signal, then no action will be taken.
- Parameters
- train - The train to set as passing.
- entrySignal - The path entry signal that the train is passing.