BlockSpecification

While not a literal class in Lua, BlockSpecification is a variant referring to any of the types listed on this page. These types serve to fully describe the possible blocks that may exist on the grid.

Basic

The most basic kind of block.

Constructors

Basic.new(Int subtype)
Returns a description of the given subtype, which determines which texture it is drawn with. The subtype should be non-negative and no more than 255. Level specific textures may be loaded with the level and indices for these textures can be passed to scripts and then to this function.

Members

int overlay_index
The index of the overlay to display for this block.
int normal_overlay_index
The index of the overlay to display for this block's normal vectors.
ExtraBlockData extra
The painting data associated to this block.
String type (read-only)
Always equal to "Basic"

Counterweight

A block with a specified (presumably heavy) mass.

Constructors

Counterweight.new(Int mass)
Returns a description of a Counterweight with the specified mass. The mass must be even.

For reference, ordinary blocks have a mass of 1000. By default, pistons can apply a force of up to 10^8, magnets can hold a force of up to 10^11, and welded joints and pins can support forces of up to 10^15. The absolute maximum force is 2^62 (around 4 * 10^18) - which is the force by which a block will resist another block crashing through it (which crashes the game if it happens). You must not create a situation where such a large force could push two blocks together. Negative masses are acceptable in the same range.

Members

Int mass
The mass of the object. Always even.
ExtraBlockData extra
The painting data associated to this block.
String type (read-only)
Always equal to "Counterweight"

Sensor

A sensor block.

Constructors

Sensor.new()
Returns a description of a Sensor.

Members

ElectricStatus status
The output status of the sensor.
ExtraBlockData extra
The painting data associated to this block.
String type (read-only)
Always equal to "Sensor"

PistonBase

The base of a piston.

Constructors

PistonBase.new()
PistonBase.new(Int hyperextendStrength, Int shearStrength, int pushStrength, int pullStrength)
Returns a description of the base of a motor with the described attributes. See below for a description of each attribute. The constructor taking no arguments sets the push and pull strengths to 10^8 and the shear and hyperextend strengths to 2^62. All parameters must be even.

Members

ElectricStatus status
The incoming electric status of the portal.
Int hyperextend_strength
The strength of the joint created to resist the arm being pulled out further when the piston is already open. Always even.
Int shear_strength
The strength of the joint created to resist the arm being sheared off when the piston is already open. Always even.
Int pull_strength
The amount of force which pulls the arm back into the base when the motor is off. Always even.
Int push_strength
The amount of force which pushes the arm back out of the base when the motor is on. Always even.
ExtraBlockData extra
The painting data associated to this block.
String type (read-only)
Always equal to "PistonBase"

PistonArm

The arm of a motor assembly.

Constructors

PistonArm.new()
Returns a description of a piston arm.

Members

ExtraBlockData extra
The painting data associated to this block.
String type (read-only)
Always equal to "PistonArm"

PortalIn

The input (blue) side of a portal. The UP face of this block is the portal.

Constructors

PortalIn.new()
Returns a description of a portal input.

Members

Boolean open
Records whether the portal is open - that is, whether the game considers its input and output to be identified in the internal geometry. Typically this is true when status is OFF, but can differ in case opening the portal would identify a face with itself (which the game engine will not allow to happen).
Note that the status member controls the visible representation of the portal. Whether the portal is truly open is never relevant to the user, but may be relevant to scripts.
ElectricStatus status
The incoming electric status of the portal.
Boolean left_merged
Records whether an object which is in front of the portal and which has a joint with a block to the front-left of the portal may pass through the portal.
Boolean right_merged
Records whether an object which is in front of the portal and which has a joint with a block to the front-right of the portal may pass through the portal.
CellView output
If the portal is paired, this member specifies where the portal outputs. The view is such that a block passing through the portal will come out DOWN from the output - it is as if the portal's position has been identified with this position.
ExtraBlockData extra
The painting data associated to this block.
String type (read-only)
Always equal to "PortalIn"

PortalOut

The output (red) side of a portal. The DOWN face of this block is the portal.

Constructors

PortalOut.new()
Returns a description of a portal output.

Members

Boolean open
Records whether the portal is open. See the PortalIn documentation for more details.
ElectricStatus status
The incoming electric status of the portal's pair or OFF if the portal is orphaned.
Boolean left_merged
Records whether an object which is in front of the portal and which has a joint with a block to the front-left of the portal may pass through the portal.
Boolean right_merged
Records whether an object which is in front of the portal and which has a joint with a block to the front-right of the portal may pass through the portal.
CellView output
If the portal is paired, this member specifies where the portal outputs. The view is such that a block passing through the portal will come out UP from the output - it is as if the portal's position has been identified with this position.
ExtraBlockData extra
The painting data associated to this block.
String type (read-only)
Always equal to "PortalOut"

Conveyor

A conveyor block. Pushes object above it to the right.

Constructors

Conveyor.new(Int strength)
Returns a description of a conveyor with the specified strength. The strength must be even.

Members

Int strength
The strength of the conveyor. Always even. Defaults to 2.
ExtraBlockData extra
The painting data associated to this block.
String type (read-only)
Always equal to "Conveyor"

Welder

Half of a welder assembly.

Constructors

Welder.new(Int tensileStrength, Int lateralStrength)
Returns a description of a welder with the specified parameters. See below for a detailed description of the parameters. Both parameters must be even and default to the same strength as user's weld (10^15).

Members

Boolean active
Records whether the welder is active (capable of welding) or not.
Int tensile_strength
The strength of joints created by this welder against forces which pull the welded blocks apart. Always even.
Int shear_strength
The strength of joints created by this welder against forces which shear the welded blocks in opposite directions. Always even.
ExtraBlockData extra
The painting data associated to this block.
String type (read-only)
Always equal to "Welder"

WelderRight

A deprecated type of block which may still exist in old saves. A WelderRight will work like a Welder flipped vertically when placed next to a Welder, but does not store the welder's characteristics and does not work when paired with another WelderRight.

This should never not be used for new development.

Constructors

WelderRight.new()
Returns a description of the right portion of a welder.

Members

Boolean active
Records whether the welder is active (capable of welding) or not.
ExtraBlockData extra
The painting data associated to this block.
String type (read-only)
Always equal to "WelderRight"

Magnet

A magnet. When it is active and there is a block touching its UP face, it creates a joint with that block.

Constructors

Magnet.new(Int tensileStrength, Int lateralStrength)
Returns a description of a magnet with the specified parameters. See below for a detailed description of the parameters. Both parameters must be even and default to 10^11.

Members

ElectricStatus status
The electric signal incoming to the magnet.
Int tensile_strength
The force with which the welder pulls objects in front of it towards itself. Always even.
Int shear_strength
The maximum shearing force between the magnet and the held block that the magnet can resist. Always even.
ExtraBlockData extra
The painting data associated to this block.
String type (read-only)
Always equal to "Magnet"

Nortal

A nortal block.

Constructors

Nortal.new()
Returns a description of a nortal.

Members

ExtraBlockData extra
The painting data associated to this block.
String type (read-only)
Always equal to "Nortal"

PowerNode

A power node block.

Constructors

PowerNode.new()
Returns a description of a power node.

Members

ElectricStatus status
The electric status of the power node.
ExtraBlockData extra
The painting data associated to this block.
String type (read-only)
Always equal to "Nortal"