Class Buildable

From TrainzOnline
Jump to: navigation, search


  • Parent class for industry objects.
  • In older versions Buildable contained attached track and trigger methods now located in SceneryWithTrack
  • Methods currently included were intended for RTS-style gameplay where individual industries start in an unbuilt state and can be built at some resource cost during gameplay.
  • These have not been widely used.


Contents

Constants & Messages

Buildable Object States

  • These values define the current state of the Buildable object.
public define int STATE_POTENTIAL = 0 Object has potential to build.
public define int STATE_BUILDING = 1 Construction is in progress.
public define int STATE_COMPLETE = 2 Construction is complete.


Related Messages

  • Messages sent to and from Buildable objects are listed below:
Major Minor Source Destination
Build Started -- Buildable
Build Cancelled -- Buildable
Build Completed -- Buildable


Methods

CancelBuild

public native bool CancelBuild(void)
  • Cancel construction.
Parameters
  • None
Returned Value
  • True to indicate success.


EnableUserCancelBuild

public native void EnableUserCancelBuild(bool enable)
  • Allow the user to cancel construction.
Parameters
  • enable = If true, the user will be able to cancel the build.
Returned Value
  • None


EnableUserStartBuild

public native void EnableUserStartBuild(bool enable)
  • Allow the user to commence construction.
Parameters
  • enable = If true, the user will be able to commence the build.
Returned Value
  • None


GetBuildingProgress

public native float GetBuildingProgress(void)
  • Gets the current progress of this buildable object.
Parameters
  • None
Returned Value
  • Current progress of the building.


GetBuildingState

public native int GetBuildingState(void)
  • Gets the current state of this buildable object.
Parameters
  • None
Returned Value


SetBuildingPaused

public native void SetBuildingPaused(bool paused)
  • Pauses or restarts construction.
Parameters
  • paused = if true, construction will be paused.
Returned Value
  • None


SetBuildingProgress

public native void SetBuildingProgress(float progress)
  • Sets the progress rate of this building
Parameters
  • progress = Rate of progress of the building.
Returned Value
  • None


SetBuildingState

public native void SetBuildingState(int state)
  • Sets the state of this buildable object.
Parameters
Returned Value
  • None


StartBuild

public native bool StartBuild(void)
  • Starts building.
Parameters
  • None
Returned Value
  • True if construction started, false otherwise.


Categories

Personal tools