Class Buildable

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
m
m (Change link to library reference, not language reference)
 
Line 1: Line 1:
*[[TrainzScript Language 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


  • 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

[edit] Constants & Messages

[edit] 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.


[edit] 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


[edit] Methods

[edit] CancelBuild

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


[edit] 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


[edit] 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


[edit] GetBuildingProgress

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


[edit] GetBuildingState

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


[edit] SetBuildingPaused

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


[edit] 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


[edit] SetBuildingState

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


[edit] StartBuild

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


[edit] Categories

Personal tools