‪TechbloxModdingAPI  ‪v2.2.0
‪The unofficial Techblox modding API
TechbloxModdingAPI.Blocks.Engine Class Reference
Inheritance diagram for TechbloxModdingAPI.Blocks.Engine:
TechbloxModdingAPI.Blocks.SignalingBlock TechbloxModdingAPI.Block TechbloxModdingAPI.EcsObjectBase

Public Member Functions

 Engine (EGID egid)
 ‪Constructs a(n) Engine object representing an existing block. More...
 
 Engine (uint id)
 ‪Constructs a(n) Engine object representing an existing block. More...
 
Wire Connect (byte sourcePort, SignalingBlock destination, byte destinationPort)
 ‪Connect an output on this block to an input on another block. More...
 
Wire[] ConnectedToOutput (byte port)
 ‪All wires connected to the output port. These wires will always be wired output -> input. More...
 
Block Copy ()
 ‪Creates a copy of the block in the game with the same properties, stats and wires. More...
 
bool Equals (Block other)
 
bool Equals (EGID other)
 
override bool Equals (object obj)
 
Block[] GetConnectedCubes ()
 ‪Returns an array of blocks that are connected to this one. Returns an empty array if the block doesn't exist. More...
 
override int GetHashCode ()
 
string InputPortName (byte port)
 ‪The input port's name. More...
 
string PortName (byte port, bool input)
 ‪The port's name. This is localized to the user's language, so this is not reliable for port identification. More...
 
override string ToString ()
 

Static Public Member Functions

static Block GetLastPlacedBlock ()
 ‪Returns the most recently placed block. More...
 
static void Init ()
 
static Block PlaceNew (BlockIDs block, float3 position, bool autoWire=false, Player player=null)
 ‪Place a new block at the given position. If scaled, position means the center of the block. The default block size is 0.2 in terms of position. Place blocks next to each other to connect them. The placed block will be a complete block with a placement grid and collision which will be saved along with the game. More...
 

Public Attributes

bool Exists => BlockEngine.BlockExists(Id)
 ‪Whether the block exists. The other properties will return a default value if the block doesn't exist. If the block was just placed, then this will also return false but the properties will work correctly. More...
 

Protected Member Functions

OptionalRef< ChannelDataStruct > GetChannelData (EGID portId)
 ‪[EXPERIMENTAL] Gets the channel data. More...
 
ref WireEntityStruct GetConnectedWire (PortEntityStruct port, out bool connected)
 ‪Gets the connected wire. More...
 
EGID[] GetInputIds ()
 ‪Generates the input port identifiers. More...
 
EGID[] GetOutputIds ()
 ‪Generates the output port identifiers. More...
 

Static Protected Attributes

static readonly BlockCloneEngine BlockCloneEngine = new BlockCloneEngine()
 
static readonly BlockEventsEngine BlockEventsEngine = new BlockEventsEngine()
 
static readonly MovementEngine MovementEngine = new MovementEngine()
 
static readonly PlacementEngine PlacementEngine = new PlacementEngine()
 
static readonly RemovalEngine RemovalEngine = new RemovalEngine()
 
static readonly RotationEngine RotationEngine = new RotationEngine()
 
static readonly ScalingEngine ScalingEngine = new ScalingEngine()
 
static readonly SignalEngine SignalEngine = new SignalEngine()
 

Static Package Functions

static T GetInstance< T > (EGID egid, Func< EGID, T > constructor, Type type=null)
 ‪Returns a cached instance if there's an actively used instance of the object already. Objects still get garbage collected and then they will be removed from the cache. More...
 
static WeakDictionary< EGID, EcsObjectBaseGetInstances (Type type)
 
static Block New (EGID egid, bool signaling=false)
 ‪Returns a correctly typed instance of this block. The instances are shared for a specific block. If an instance is no longer referenced a new instance is returned. More...
 

Package Attributes

EcsInitData InitData
 

Static Package Attributes

static readonly BlockEngine BlockEngine = new BlockEngine()
 

Properties

bool AutomaticGears [get, set]
 ‪Gets or sets the Engine's AutomaticGears property. Tweakable stat. More...
 
BlockGroup??????? BlockGroup [get, set]
 ‪Returns the block group this block is a part of. Block groups can also be placed using blueprints. Returns null if not part of a group, although all blocks should have their own by default.
Setting the group after the block has been initialized will not update everything properly, so you can only set this property on blocks newly placed by your code.
To set it for existing blocks, you can use the Copy() method and set the property on the resulting block (and remove this block). More...
 
BlockColor?? Color [get, set]
 ‪The block's color. Returns BlockColors.Default if the block no longer exists. More...
 
BlockComplexity Complexity [get, set]
 Block complexity used for build rules. Determines the 'cost' of the block. More...
 
int CurrentGear [get, set]
 ‪Gets or sets the Engine's CurrentGear property. May not be saved. More...
 
float CurrentRpmAV [get, set]
 ‪Gets or sets the Engine's CurrentRpmAV property. May not be saved. More...
 
float CurrentRpmLV [get, set]
 ‪Gets or sets the Engine's CurrentRpmLV property. May not be saved. More...
 
float CurrentTorque [get, set]
 ‪Gets or sets the Engine's CurrentTorque property. May not be saved. More...
 
float4 CustomColor [get, set]
 ‪The block's exact color. Gets reset to the palette color (Color property) after reentering the game. More...
 
bool? Flipped [get, set]
 
float GearChangeCountdown [get, set]
 ‪Gets or sets the Engine's GearChangeCountdown property. May not be saved. More...
 
float GearChangeTime [get, set]
 ‪Gets or sets the Engine's GearChangeTime property. May not be saved. More...
 
float[] GearDownRpms [get]
 ‪Gets the Engine's GearDownRpms property. May not be saved. More...
 
float GearUpRpm [get, set]
 ‪Gets or sets the Engine's GearUpRpm property. May not be saved. More...
 
EGID Id [get]
 
uint InputCount [get]
 ‪The input port count. More...
 
string? Label [get, set]
 ‪The text displayed on the block if applicable, or null. Setting it is temporary to the session, it won't be saved. More...
 
bool LastGearDownInput [get, set]
 ‪Gets or sets the Engine's LastGearDownInput property. May not be saved. More...
 
bool LastGearUpInput [get, set]
 ‪Gets or sets the Engine's LastGearUpInput property. May not be saved. More...
 
float Load [get, set]
 ‪Gets or sets the Engine's Load property. May not be saved. More...
 
float ManualToAutoGearCoolOffCounter [get, set]
 ‪Gets or sets the Engine's ManualToAutoGearCoolOffCounter property. May not be saved. More...
 
float ManualToAutoGearCoolOffTime [get, set]
 ‪Gets or sets the Engine's ManualToAutoGearCoolOffTime property. May not be saved. More...
 
float Mass [get]
 ‪The mass of the block. More...
 
BlockMaterial?? Material [get, set]
 
float MaxRpm [get, set]
 ‪Gets or sets the Engine's MaxRpm property. May not be saved. More...
 
float MaxRpmChange [get, set]
 ‪Gets or sets the Engine's MaxRpmChange property. May not be saved. More...
 
float MinRpm [get, set]
 ‪Gets or sets the Engine's MinRpm property. May not be saved. More...
 
bool On [get, set]
 ‪Gets or sets the Engine's On property. May not be saved. More...
 
uint OutputCount [get]
 ‪The output port count. More...
 
float3 Position [get, set]
 ‪The block's current position or zero if the block no longer exists. A block is 0.2 wide by default in terms of position. More...
 
float Power [get, set]
 ‪Gets or sets the Engine's Power property. Tweakable stat. More...
 
float3 Rotation [get, set]
 ‪The block's current rotation in degrees or zero if the block doesn't exist. More...
 
float3 Scale [get, set]
 ‪The block's non-uniform scale or zero if the block's invalid. Independent of the uniform scaling. The default scale of 1 means 0.2 in terms of position. More...
 
bool Static [get, set]
 ‪Whether the block should be static in simulation. If set, it cannot be moved. The effect is temporary, it will not be saved with the block. More...
 
float TargetRpmAV [get, set]
 ‪Gets or sets the Engine's TargetRpmAV property. May not be saved. More...
 
float TargetRpmLV [get, set]
 ‪Gets or sets the Engine's TargetRpmLV property. May not be saved. More...
 
int TotalWheelCount [get, set]
 ‪Gets or sets the Engine's TotalWheelCount property. May not be saved. More...
 
float TotalWheelVelocityAV [get, set]
 ‪Gets or sets the Engine's TotalWheelVelocityAV property. May not be saved. More...
 
float TotalWheelVelocityLV [get, set]
 ‪Gets or sets the Engine's TotalWheelVelocityLV property. May not be saved. More...
 
BlockIDsType [get]
 ‪The block's type (ID). Returns BlockIDs.Invalid if the block doesn't exist anymore. More...
 
int UniformScale [get, set]
 ‪The block's uniform scale or zero if the block's invalid. Also sets the non-uniform scale. The default scale of 1 means 0.2 in terms of position. More...
 

Events

static EventHandler< BlockPlacedRemovedEventArgsPlaced [add, remove]
 ‪An event that fires each time a block is placed. More...
 
static EventHandler< BlockPlacedRemovedEventArgsRemoved [add, remove]
 ‪An event that fires each time a block is removed. More...
 

Constructor & Destructor Documentation

◆ Engine() [1/2]

TechbloxModdingAPI.Blocks.Engine.Engine ( EGID  egid)
inline

‪Constructs a(n) Engine object representing an existing block.

◆ Engine() [2/2]

TechbloxModdingAPI.Blocks.Engine.Engine ( uint  id)
inline

‪Constructs a(n) Engine object representing an existing block.

Member Function Documentation

◆ Connect()

Wire TechbloxModdingAPI.Blocks.SignalingBlock.Connect ( byte  sourcePort,
SignalingBlock  destination,
byte  destinationPort 
)
inlineinherited

‪Connect an output on this block to an input on another block.

Parameters
sourcePort‪Output port number.
destinationInput block.
destinationPortInput port number.
Returns
‪The wire connection
Exceptions
WiringException‪The wire could not be created.

◆ ConnectedToOutput()

Wire [] TechbloxModdingAPI.Blocks.SignalingBlock.ConnectedToOutput ( byte  port)
inlineinherited

‪All wires connected to the output port. These wires will always be wired output -> input.

Parameters
port‪Port number.
Returns
‪Wires connected to the output port.

◆ Copy()

Block TechbloxModdingAPI.Block.Copy ( )
inlineinherited

‪Creates a copy of the block in the game with the same properties, stats and wires.

Returns

◆ Equals() [1/3]

bool TechbloxModdingAPI.Block.Equals ( Block  other)
inlineinherited

◆ Equals() [2/3]

bool TechbloxModdingAPI.Block.Equals ( EGID  other)
inlineinherited

◆ Equals() [3/3]

override bool TechbloxModdingAPI.Block.Equals ( object  obj)
inlineinherited

◆ GetChannelData()

OptionalRef<ChannelDataStruct> TechbloxModdingAPI.Blocks.SignalingBlock.GetChannelData ( EGID  portId)
inlineprotectedinherited

‪[EXPERIMENTAL] Gets the channel data.

Returns
‪The channel data.
Parameters
portId‪Port identifier.

◆ GetConnectedCubes()

Block [] TechbloxModdingAPI.Block.GetConnectedCubes ( )
inlineinherited

‪Returns an array of blocks that are connected to this one. Returns an empty array if the block doesn't exist.

◆ GetConnectedWire()

ref WireEntityStruct TechbloxModdingAPI.Blocks.SignalingBlock.GetConnectedWire ( PortEntityStruct  port,
out bool  connected 
)
inlineprotectedinherited

‪Gets the connected wire.

Returns
‪The connected wire.
Parameters
portId‪Port identifier.
connected‪Whether the port has a wire connected to it.

◆ GetHashCode()

override int TechbloxModdingAPI.Block.GetHashCode ( )
inlineinherited

◆ GetInputIds()

EGID [] TechbloxModdingAPI.Blocks.SignalingBlock.GetInputIds ( )
inlineprotectedinherited

‪Generates the input port identifiers.

Returns
‪The input identifiers.

◆ GetInstance< T >()

static T TechbloxModdingAPI.EcsObjectBase.GetInstance< T > ( EGID  egid,
Func< EGID, T >  constructor,
Type  type = null 
)
inlinestaticpackageinherited

‪Returns a cached instance if there's an actively used instance of the object already. Objects still get garbage collected and then they will be removed from the cache.

Parameters
egid‪The EGID of the entity
constructor‪The constructor to construct the object
Template Parameters
T‪The object type
Returns
Type Constraints
T :EcsObjectBase 

◆ GetInstances()

static WeakDictionary<EGID, EcsObjectBase> TechbloxModdingAPI.EcsObjectBase.GetInstances ( Type  type)
inlinestaticpackageinherited

◆ GetLastPlacedBlock()

static Block TechbloxModdingAPI.Block.GetLastPlacedBlock ( )
inlinestaticinherited

‪Returns the most recently placed block.

Returns
‪The block object or null if doesn't exist

◆ GetOutputIds()

EGID [] TechbloxModdingAPI.Blocks.SignalingBlock.GetOutputIds ( )
inlineprotectedinherited

‪Generates the output port identifiers.

Returns
‪The output identifiers.

◆ Init()

static void TechbloxModdingAPI.Block.Init ( )
inlinestaticinherited

◆ InputPortName()

string TechbloxModdingAPI.Blocks.SignalingBlock.InputPortName ( byte  port)
inlineinherited

‪The input port's name.

Parameters
portInput port number.
Returns
‪The port name, localized to the user's language.

◆ New()

static Block TechbloxModdingAPI.Block.New ( EGID  egid,
bool  signaling = false 
)
inlinestaticpackageinherited

‪Returns a correctly typed instance of this block. The instances are shared for a specific block. If an instance is no longer referenced a new instance is returned.

Parameters
egid‪The EGID of the block
signaling‪Whether the block is definitely a signaling block
Returns

◆ PlaceNew()

static Block TechbloxModdingAPI.Block.PlaceNew ( BlockIDs  block,
float3  position,
bool  autoWire = false,
Player  player = null 
)
inlinestaticinherited

‪Place a new block at the given position. If scaled, position means the center of the block. The default block size is 0.2 in terms of position. Place blocks next to each other to connect them. The placed block will be a complete block with a placement grid and collision which will be saved along with the game.

Parameters
block‪The block's type
position‪The block's position - default block size is 0.2
autoWire‪Whether the block should be auto-wired (if functional)
player‪The player who placed the block
Returns
‪The placed block or null if failed

◆ PortName()

string TechbloxModdingAPI.Blocks.SignalingBlock.PortName ( byte  port,
bool  input 
)
inlineinherited

‪The port's name. This is localized to the user's language, so this is not reliable for port identification.

Parameters
port‪Port number.
input‪Whether the port is an input (true) or an output (false).
Returns
‪The localized port name.

◆ ToString()

override string TechbloxModdingAPI.Block.ToString ( )
inlineinherited

Member Data Documentation

◆ BlockCloneEngine

readonly BlockCloneEngine TechbloxModdingAPI.Block.BlockCloneEngine = new BlockCloneEngine()
staticprotectedinherited

◆ BlockEngine

readonly BlockEngine TechbloxModdingAPI.Block.BlockEngine = new BlockEngine()
staticpackageinherited

◆ BlockEventsEngine

readonly BlockEventsEngine TechbloxModdingAPI.Block.BlockEventsEngine = new BlockEventsEngine()
staticprotectedinherited

◆ Exists

bool TechbloxModdingAPI.Block.Exists => BlockEngine.BlockExists(Id)
inherited

‪Whether the block exists. The other properties will return a default value if the block doesn't exist. If the block was just placed, then this will also return false but the properties will work correctly.

◆ InitData

EcsInitData TechbloxModdingAPI.EcsObjectBase.InitData
packageinherited

◆ MovementEngine

readonly MovementEngine TechbloxModdingAPI.Block.MovementEngine = new MovementEngine()
staticprotectedinherited

◆ PlacementEngine

readonly PlacementEngine TechbloxModdingAPI.Block.PlacementEngine = new PlacementEngine()
staticprotectedinherited

◆ RemovalEngine

readonly RemovalEngine TechbloxModdingAPI.Block.RemovalEngine = new RemovalEngine()
staticprotectedinherited

◆ RotationEngine

readonly RotationEngine TechbloxModdingAPI.Block.RotationEngine = new RotationEngine()
staticprotectedinherited

◆ ScalingEngine

readonly ScalingEngine TechbloxModdingAPI.Block.ScalingEngine = new ScalingEngine()
staticprotectedinherited

◆ SignalEngine

readonly SignalEngine TechbloxModdingAPI.Block.SignalEngine = new SignalEngine()
staticprotectedinherited

Property Documentation

◆ AutomaticGears

bool TechbloxModdingAPI.Blocks.Engine.AutomaticGears
getset

‪Gets or sets the Engine's AutomaticGears property. Tweakable stat.

◆ BlockGroup

BlockGroup??????? TechbloxModdingAPI.Block.BlockGroup
getsetinherited

‪Returns the block group this block is a part of. Block groups can also be placed using blueprints. Returns null if not part of a group, although all blocks should have their own by default.
Setting the group after the block has been initialized will not update everything properly, so you can only set this property on blocks newly placed by your code.
To set it for existing blocks, you can use the Copy() method and set the property on the resulting block (and remove this block).

◆ Color

BlockColor?? TechbloxModdingAPI.Block.Color
getsetinherited

‪The block's color. Returns BlockColors.Default if the block no longer exists.

◆ Complexity

BlockComplexity TechbloxModdingAPI.Block.Complexity
getsetinherited

Block complexity used for build rules. Determines the 'cost' of the block.

◆ CurrentGear

int TechbloxModdingAPI.Blocks.Engine.CurrentGear
getset

‪Gets or sets the Engine's CurrentGear property. May not be saved.

◆ CurrentRpmAV

float TechbloxModdingAPI.Blocks.Engine.CurrentRpmAV
getset

‪Gets or sets the Engine's CurrentRpmAV property. May not be saved.

◆ CurrentRpmLV

float TechbloxModdingAPI.Blocks.Engine.CurrentRpmLV
getset

‪Gets or sets the Engine's CurrentRpmLV property. May not be saved.

◆ CurrentTorque

float TechbloxModdingAPI.Blocks.Engine.CurrentTorque
getset

‪Gets or sets the Engine's CurrentTorque property. May not be saved.

◆ CustomColor

float4 TechbloxModdingAPI.Block.CustomColor
getsetinherited

‪The block's exact color. Gets reset to the palette color (Color property) after reentering the game.

◆ Flipped

bool? TechbloxModdingAPI.Block.Flipped
getsetinherited

Whether the block is flipped.

◆ GearChangeCountdown

float TechbloxModdingAPI.Blocks.Engine.GearChangeCountdown
getset

‪Gets or sets the Engine's GearChangeCountdown property. May not be saved.

◆ GearChangeTime

float TechbloxModdingAPI.Blocks.Engine.GearChangeTime
getset

‪Gets or sets the Engine's GearChangeTime property. May not be saved.

◆ GearDownRpms

float [] TechbloxModdingAPI.Blocks.Engine.GearDownRpms
get

‪Gets the Engine's GearDownRpms property. May not be saved.

◆ GearUpRpm

float TechbloxModdingAPI.Blocks.Engine.GearUpRpm
getset

‪Gets or sets the Engine's GearUpRpm property. May not be saved.

◆ Id

EGID TechbloxModdingAPI.EcsObjectBase.Id
getinherited

◆ InputCount

uint TechbloxModdingAPI.Blocks.SignalingBlock.InputCount
getinherited

‪The input port count.

◆ Label

string? TechbloxModdingAPI.Block.Label
getsetinherited

‪The text displayed on the block if applicable, or null. Setting it is temporary to the session, it won't be saved.

◆ LastGearDownInput

bool TechbloxModdingAPI.Blocks.Engine.LastGearDownInput
getset

‪Gets or sets the Engine's LastGearDownInput property. May not be saved.

◆ LastGearUpInput

bool TechbloxModdingAPI.Blocks.Engine.LastGearUpInput
getset

‪Gets or sets the Engine's LastGearUpInput property. May not be saved.

◆ Load

float TechbloxModdingAPI.Blocks.Engine.Load
getset

‪Gets or sets the Engine's Load property. May not be saved.

◆ ManualToAutoGearCoolOffCounter

float TechbloxModdingAPI.Blocks.Engine.ManualToAutoGearCoolOffCounter
getset

‪Gets or sets the Engine's ManualToAutoGearCoolOffCounter property. May not be saved.

◆ ManualToAutoGearCoolOffTime

float TechbloxModdingAPI.Blocks.Engine.ManualToAutoGearCoolOffTime
getset

‪Gets or sets the Engine's ManualToAutoGearCoolOffTime property. May not be saved.

◆ Mass

float TechbloxModdingAPI.Block.Mass
getinherited

‪The mass of the block.

◆ Material

BlockMaterial?? TechbloxModdingAPI.Block.Material
getsetinherited

The block's material.

◆ MaxRpm

float TechbloxModdingAPI.Blocks.Engine.MaxRpm
getset

‪Gets or sets the Engine's MaxRpm property. May not be saved.

◆ MaxRpmChange

float TechbloxModdingAPI.Blocks.Engine.MaxRpmChange
getset

‪Gets or sets the Engine's MaxRpmChange property. May not be saved.

◆ MinRpm

float TechbloxModdingAPI.Blocks.Engine.MinRpm
getset

‪Gets or sets the Engine's MinRpm property. May not be saved.

◆ On

bool TechbloxModdingAPI.Blocks.Engine.On
getset

‪Gets or sets the Engine's On property. May not be saved.

◆ OutputCount

uint TechbloxModdingAPI.Blocks.SignalingBlock.OutputCount
getinherited

‪The output port count.

◆ Position

float3 TechbloxModdingAPI.Block.Position
getsetinherited

‪The block's current position or zero if the block no longer exists. A block is 0.2 wide by default in terms of position.

◆ Power

float TechbloxModdingAPI.Blocks.Engine.Power
getset

‪Gets or sets the Engine's Power property. Tweakable stat.

◆ Rotation

float3 TechbloxModdingAPI.Block.Rotation
getsetinherited

‪The block's current rotation in degrees or zero if the block doesn't exist.

◆ Scale

float3 TechbloxModdingAPI.Block.Scale
getsetinherited

‪The block's non-uniform scale or zero if the block's invalid. Independent of the uniform scaling. The default scale of 1 means 0.2 in terms of position.

◆ Static

bool TechbloxModdingAPI.Block.Static
getsetinherited

‪Whether the block should be static in simulation. If set, it cannot be moved. The effect is temporary, it will not be saved with the block.

◆ TargetRpmAV

float TechbloxModdingAPI.Blocks.Engine.TargetRpmAV
getset

‪Gets or sets the Engine's TargetRpmAV property. May not be saved.

◆ TargetRpmLV

float TechbloxModdingAPI.Blocks.Engine.TargetRpmLV
getset

‪Gets or sets the Engine's TargetRpmLV property. May not be saved.

◆ TotalWheelCount

int TechbloxModdingAPI.Blocks.Engine.TotalWheelCount
getset

‪Gets or sets the Engine's TotalWheelCount property. May not be saved.

◆ TotalWheelVelocityAV

float TechbloxModdingAPI.Blocks.Engine.TotalWheelVelocityAV
getset

‪Gets or sets the Engine's TotalWheelVelocityAV property. May not be saved.

◆ TotalWheelVelocityLV

float TechbloxModdingAPI.Blocks.Engine.TotalWheelVelocityLV
getset

‪Gets or sets the Engine's TotalWheelVelocityLV property. May not be saved.

◆ Type

BlockIDs? TechbloxModdingAPI.Block.Type
getinherited

‪The block's type (ID). Returns BlockIDs.Invalid if the block doesn't exist anymore.

◆ UniformScale

int TechbloxModdingAPI.Block.UniformScale
getsetinherited

‪The block's uniform scale or zero if the block's invalid. Also sets the non-uniform scale. The default scale of 1 means 0.2 in terms of position.

Event Documentation

◆ Placed

EventHandler< BlockPlacedRemovedEventArgs> TechbloxModdingAPI.Block.Placed
staticaddremoveinherited

‪An event that fires each time a block is placed.

◆ Removed

EventHandler< BlockPlacedRemovedEventArgs> TechbloxModdingAPI.Block.Removed
staticaddremoveinherited

‪An event that fires each time a block is removed.


The documentation for this class was generated from the following file: