Class InterlockingTower

From TrainzOnline
Revision as of 10:57, 14 October 2015 by Pw3r (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.

InterlockingTower ClassHierarchy.jpg

Related Classes


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.


public InterlockingTowerPath CreateNewPath()
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

public string[] GetLocalisedPathNames()
Description

Returns a list of the current (localised) path names.

Returns
  • string[] - A string array, containing the localised names of every path.

public InterlockingTowerPath FindPathByName(string pathName)
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



public InterlockingTowerPath[] GetConflictingPaths(InterlockingTowerPath path)
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
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).

public mandatory void SetAIState(int aiState)
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.


public void AssignPathToTrain(Train train, string pathName)
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.

public void CancelPathForTrain(Train train, string pathName)
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.

public void SetPanicStateForPath(string pathName)
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.

public void SetTrainAsPassing(Train train, Signal entrySignal)
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.
Personal tools