Scripting API

Home Scripting API Index Class Overview

com.nolimitscoaster

Class Coaster


public class Coaster
extends Entity

Represents a coaster in a park

Field Summary

static final int E_BLOCK_SYSTEM_MODE_AUTOMATIC
Value used for getBlockSystemMode, setBlockSystemMode, canSetBlockSystemMode
static final int E_BLOCK_SYSTEM_MODE_FULL_MANUAL
Value used for getBlockSystemMode, setBlockSystemMode, canSetBlockSystemMode
static final int E_BLOCK_SYSTEM_MODE_OFFLINE
Value used for getBlockSystemMode, setBlockSystemMode, canSetBlockSystemMode
static final int E_BLOCK_SYSTEM_MODE_SEMI_MANUAL
Value used for getBlockSystemMode, setBlockSystemMode, canSetBlockSystemMode


Method Summary

bool canChangeEmergencyStop()
  Returns if the emergency stop state can be changed using setEmergencyStop.
bool canSetBlockSystemMode(int mode)
  Checks if the block system mode can be changed to a desired mode.
TrackPos findNearestTrack(nlvm.math3d.Vector3f pos, float range)
  Searches for the nearest track of this coaster within a specified range.
Train findNearestTrain(nlvm.math3d.Vector3f pos, float range)
  Returns the nearest train at pos within range
Block getBlock(String name)
  Returns a block with a specific name.
int getBlockSystemMode()
  Returns the current block system mode, the coaster is working in.
int getCoasterStyleId()
  Returns the coaster style's type number.
String getName()
  Returns the coaster's name
Section getSection(String name)
  Returns a section with a specific name.
SpecialTrack getSpecialTrack(String name)
  Returns a handle to a special track with a specific name.
TrackTrigger getTrackTrigger(String name)
  Gets a track trigger by name
com.nolimitscoaster.TrackTrigger[] getTrackTriggers(String name)
  Gets all track triggers having the same name
Train getTrainAt(int index)
  Returns a handle to a train
int getTrainCount()
  Returns the number of trains
bool isEmergencyStop()
  Returns the state of the emergency stop
bool isScriptedOperationMode()
  Returns true when the coaster is in scripted operation mode.
void requestReset()
  Requests resetting the coaster.
void setBlockSystemController(BlockSystemController a)
  Sets the block system controller, which is required for coasters that are in scripted operation mode.
bool setBlockSystemMode(int mode)
  Sets the current block system mode, the coaster should be working in.
void setEmergencyStop(bool estop)
  Sets the state of the emergency stop
String toString()
  Returns the coaster's name


Field Detail


E_BLOCK_SYSTEM_MODE_AUTOMATIC

public static final int E_BLOCK_SYSTEM_MODE_AUTOMATIC

Value used for getBlockSystemMode, setBlockSystemMode, canSetBlockSystemMode


E_BLOCK_SYSTEM_MODE_FULL_MANUAL

public static final int E_BLOCK_SYSTEM_MODE_FULL_MANUAL

Value used for getBlockSystemMode, setBlockSystemMode, canSetBlockSystemMode


E_BLOCK_SYSTEM_MODE_OFFLINE

public static final int E_BLOCK_SYSTEM_MODE_OFFLINE

Value used for getBlockSystemMode, setBlockSystemMode, canSetBlockSystemMode


E_BLOCK_SYSTEM_MODE_SEMI_MANUAL

public static final int E_BLOCK_SYSTEM_MODE_SEMI_MANUAL

Value used for getBlockSystemMode, setBlockSystemMode, canSetBlockSystemMode


Method Detail


canChangeEmergencyStop

public final bool canChangeEmergencyStop()

Returns if the emergency stop state can be changed using setEmergencyStop.

When implementing control panel controls, this method might be usefull in order to give feedback to the user. Note: Sometimes it is not possible to deactivate emergency stop. E.g. on shuttle coasters, enabling emergency stop will initiate a mode transition from auto mode to maintenance mode. In that case, the emergency stop can only be deactivated when the state transition has completed.

Since:
    2.6.4.0


canSetBlockSystemMode

public final bool canSetBlockSystemMode(int mode)

Checks if the block system mode can be changed to a desired mode.

This method might be usefull for implementing control panel controls.

Parameters:

mode - See E_BLOCK_SYSTEM_MODE_ constants for possible values.

Returns:
    true when it is possible to change the mode to the desired mode.

Since:
    2.6.4.0


findNearestTrack

public final TrackPos findNearestTrack(nlvm.math3d.Vector3f pos, float range)

Searches for the nearest track of this coaster within a specified range.

This method is very slow, it is not recommended to call this method each frame.

Parameters:

pos - position in 3D editor space
range - Range of sphere (in meters) to search a track within. When negative or zero, no range test will be performed.

Returns:
    A TrackPos object that represents the track and position, or null if no track is within range.

Since:
    2.6.1.0


findNearestTrain

public final Train findNearestTrain(nlvm.math3d.Vector3f pos, float range)

Returns the nearest train at pos within range

Pos and range are in meters. Returns null when there is no train within range.


getBlock

public final Block getBlock(String name)

Returns a block with a specific name.

Returns null if there is no block having that name or if coaster is not in scripted operation mode.


getBlockSystemMode

public final int getBlockSystemMode()

Returns the current block system mode, the coaster is working in.

This method might be usefull for implementing control panel controls.

Returns:
    See E_BLOCK_SYSTEM_MODE_ constants for possible returned values.

Since:
    2.6.4.0


getCoasterStyleId

public final int getCoasterStyleId()

Returns the coaster style's type number.

Each coaster style has a unique number. See "Help -> Reference -> File Formats" for the table of IDs.

Returns:
    style type number


getName

public final String getName()

Returns the coaster's name

Returns:
    name as specified in the editor


getSection

public final Section getSection(String name)

Returns a section with a specific name.

Returns null if there is no section having that name.


getSpecialTrack

public final SpecialTrack getSpecialTrack(String name)

Returns a handle to a special track with a specific name.

Returns null if there is no special track having that name.


getTrackTrigger

public final TrackTrigger getTrackTrigger(String name)

Gets a track trigger by name

Parameters:

name - Name of track trigger as specified in the editor

Returns:
    TrackTrigger handle, or null if there is no track trigger with that name


getTrackTriggers

public final com.nolimitscoaster.TrackTrigger[] getTrackTriggers(String name)

Gets all track triggers having the same name

Parameters:

name - Name of track trigger as specified in the editor

Returns:
    Array of trackTrigger handles, or null if there is no track trigger with that name

Since:
    2.6.1.0


getTrainAt

public final Train getTrainAt(int index)

Returns a handle to a train

Parameters:

index - Train index, must be in the range 0...getTrainCount()-1

Returns:
    Train handle


getTrainCount

public final int getTrainCount()

Returns the number of trains

Returns:
    number of trains


isEmergencyStop

public final bool isEmergencyStop()

Returns the state of the emergency stop

Returns:
    true when emergency stop is enabled, otherwise false

Since:
    2.5.1.0


isScriptedOperationMode

public final bool isScriptedOperationMode()

Returns true when the coaster is in scripted operation mode.

Returns:
    true when in scripted operation mode, otherwise false.

Since:
    2.5.1.0


requestReset

public final void requestReset()

Requests resetting the coaster.

This method might be usefull for implementing control panel controls.

Since:
    2.6.4.0


setBlockSystemController

public void setBlockSystemController(BlockSystemController a)

Sets the block system controller, which is required for coasters that are in scripted operation mode.


setBlockSystemMode

public final bool setBlockSystemMode(int mode)

Sets the current block system mode, the coaster should be working in.

This method might be usefull for implementing control panel controls.

Parameters:

mode - See E_BLOCK_SYSTEM_MODE_ constants for possible values.

Returns:
    true when the mode was changed successfully, false if it could not be changed or if the mode parameter is invalid.

Since:
    2.6.4.0


setEmergencyStop

public final void setEmergencyStop(bool estop)

Sets the state of the emergency stop

Sets the state of the emergency stop. May do nothing when the emergency stop state cannot be changed (e.g. when the coaster is a shuttle coaster, and there is mode transition from automatic to maintenance mode in progress).

Parameters:

estop - true for enable, false for disable

Since:
    2.6.2.0


toString

public String toString()

Returns the coaster's name