Class Trackside

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
m (1 revision)
m (Change link to library reference, not language reference)
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
*[[TrainzScript Langage Reference|API Hierarchy]]
+
*[[TrainzScript Library Reference|API Hierarchy]]
 
**[[Class GSObject|GSObject]] *
 
**[[Class GSObject|GSObject]] *
 
***[[Class GameObject|GameObject]]
 
***[[Class GameObject|GameObject]]

Latest revision as of 23:44, 28 December 2020


  • A parent class for track related items such as junctions, signals, trackmarks, triggers or vehicles.
  • Methods generic to all trackside items are provided within this class
  • Although more specialised trackside items such as signals and junctions are catered for with appropriate child classes, there is no child class for speedboard items.
  • GetSpeedLimit() can be used to determine weather a Trackside object is a speed board or not.


Contents

[edit] Related Messages

  • Details of messages sent and received by Trackside objects are listed in the appropriate child classes.


[edit] BeginTrackSearch

public native GSTrackSearch BeginTrackSearch(bool direction)
Parameters
  • direction = Direction to search in based on the orientation of the Trackside item relative to the track to which it is attached.
Returned Value
  • A GSTrackSearch object which can be used by GSTrackSearch methods to conduct searches in the specified direction along the current track.
Syntax
GSTrackSearch gst = BeginTrackSearch(true); 
Notes


[edit] GetIsSearchLimit

public native bool GetIsSearchLimit(void)
Parameters
  • None
Returned Value
  • True if the current object is an AI Direction Marker, false otherwise.
Syntax
if (GetIsSearchLimit()) Interface.Print("Track direction marker found");
Notes


[edit] GetSignalState

public native int GetSignalState(void)
Parameters
  • None
Returned Value
  • One of the Signal State constants representing the current aspect of a signal.
Syntax
int aspect = GetSignalState();
Notes
  • This method will return GREEN, YELLOW or RED, but will never return AUTOMATIC.


[edit] GetSignalStateEx

public native int GetSignalStateEx(void)
Parameters
  • None
Returned Value
Syntax
int aspect = GetSignalState();
Notes
  • See Signal for further details.


[edit] GetSpeedLimit

public native float GetSpeedLimit (void)
Parameters
  • None
Returned Value
  • The speed limit associated with this object in metres per second.
Syntax
float limit = GetSpeedLimit();
Notes
  • If the object is not a speedboard a zero or negative value is returned.
  • Returned values are in MPS, use the conversion factors in the train class to convert to other units.


[edit] GetTrack

public native Track GetTrack(void)
Parameters
  • None
Returned Value
  • The track segment that the current object is located on.
Syntax
Track track = GetTrack(); 
Notes


[edit] InnerReEnter

public native bool InnerReEnter(int node)
Parameters
  • node = Node Id of a train to be re-entered into inner trigger radius.
Returned Value
  • True if any part of the train is within the inner trigger radius at the time of the call and the message has been sent, false otherwise.
Syntax
InnerReEnter(train.GetId());
Notes
  • The effect of this method is to cause a new Object,InnerEnter message to be sent from the train to this object.


[edit] ReEnter

public native bool ReEnter(int node)
Parameters
  • node = Node Id of a train to be re-entered into the outer trigger radius.
Returned Value
  • True if any part of the train is within the outer trigger radius at the time of the call and the message has been sent, false otherwise.
Syntax
ReEnter(train.GetId());
Notes
  • The effect of this method is to cause a new Object,Enter message to be sent from the train to this object.


[edit] RequestTrackPermit

public native Permit RequestTrackPermit(bool direction)
public native Permit RequestTrackPermit(bool direction,GameObject owner)
Parameters
  • direction = Direction required by the Permit.
  • owner = The object which is to own the Permit, to which any relevant messages are sent.
Returned Value
  • A Permit object for the track on which the current object is placed and for the direction specified.
Syntax
Permit permit = RequestTrackPermit(true);
Notes
  • If the Trackside object is not on a track a null result may be returned.
  • In other cases a Permit object will always be returned, but may or may not be Granted.


[edit] SetSpeedLimit

public native void SetSpeedLimit(float limit)
Parameters
  • limit = Speed limit to set, in metres per second.
Returned Value
  • None
Syntax
SetSpeedLimit(100.0) 
Notes
  • Use the conversion factors in the train class to convert from other units.
  • This method allows the speed limit of a trackside item that is a speed board to be changed.
  • Using this method for a variable speed limit sign is not fully supported and behavior is not guaranteed.
  • It is generally best not to use or rely on this method. (There's confidence for you)
  • Use a value of zero or less to rescind an existing speed limit.


[edit] Related Methods

GSTrackSearch.GetDistance()
GSTrackSearch.GetFacingRelativeToSearchDirection()
GSTrackSearch.GetMapObject()
GSTrackSearch.SearchNext()

TrainUtil.IsPartTrainInTrigger
TrainUtil.IsTrainInTrigger

World.GetJunctionList()
World.GetSignalList()
World.GetTriggerList()
World.GetTrackMarkList()

[edit] Categories

Personal tools