Factorio API Docs

1.1.63 <>

Class LuaEquipmentGrid

An equipment grid is for example the inside of a power armor.

take{position=…, equipment=…, by_player=…}

Remove an equipment from the grid.


take_all(by_player)
→ dictionary[stringuint]

Remove all equipment from the grid.


clear(by_player)

Clear all equipment from the grid, removing it without actually returning it.


put{name=…, position=…, by_player=…}

Insert an equipment into the grid.


can_move{equipment=…, position=…}
boolean

Check whether moving an equipment would succeed.


move{equipment=…, position=…}
boolean

Move an equipment within this grid.


get(position)

Find equipment in the Equipment Grid based off a position.


→ dictionary[stringuint]

Get counts of all equipment in this grid.


help()
string

All methods and properties that this object supports.



:: uint
[R]

Width of the equipment grid.


:: uint
[R]

Height of the equipment grid.


:: array[LuaEquipment]
[R]

All the equipment in this grid.


:: double
[R]

Total energy per tick generated by the equipment inside this grid.


:: double
[R]

Maximum energy per tick that can be created by any solar panels in the equipment grid.


:: double
[R]

The total energy stored in all batteries in the equipment grid.


:: double
[R]

Total energy storage capacity of all batteries in the equipment grid.


:: float
[R]

The amount of shields this equipment grid has.


:: float
[R]

The maximum amount of shields this equipment grid has.


:: boolean
[RW]

True if this movement bonus equipment is turned off, otherwise false.


:: uint
[R]

Unique identifier of this equipment grid.


:: boolean
[R]

Is this object valid?


:: string
[R]

The class name of this object.

Methods

take{position=…, equipment=…, by_player=…} → SimpleItemStack?

Remove an equipment from the grid.

Parameters

Table with the following fields:
position

Take the equipment that contains this position in the grid.


equipment

Take this exact equipment.


by_player

If provided the action is done 'as' this player and on_player_removed_equipment is triggered.

Return values

The removed equipment, or nil if no equipment was removed.


take_all(by_player) → dictionary[stringuint]

Remove all equipment from the grid.

Parameters

by_player

If provided, the action is done 'as' this player and on_player_removed_equipment is triggered.

Return values

:: dictionary[stringuint]

Count of each removed equipment, indexed by their prototype names.


clear(by_player)

Clear all equipment from the grid, removing it without actually returning it.

Parameters

by_player

If provided, the action is done 'as' this player and on_player_removed_equipment is triggered.


put{name=…, position=…, by_player=…} → LuaEquipment?

Insert an equipment into the grid.

Parameters

Table with the following fields:
name
:: string

Equipment prototype name


position

Grid position to put the equipment in.


by_player

If provided the action is done 'as' this player and on_player_placed_equipment is triggered.

Return values

The newly-added equipment, or nil if the equipment could not be added.


can_move{equipment=…, position=…} → boolean

Check whether moving an equipment would succeed.

Parameters

Table with the following fields:
equipment

The equipment to move


position

Where to put it


move{equipment=…, position=…} → boolean

Move an equipment within this grid.

Parameters

Table with the following fields:
equipment

The equipment to move


position

Where to put it

Return values

:: boolean

true if the equipment was successfully moved.


get(position) → LuaEquipment?

Find equipment in the Equipment Grid based off a position.

Parameters

position

The position

Return values

The found equipment, or nil if equipment could not be found at the given position.


get_contents() → dictionary[stringuint]

Get counts of all equipment in this grid.

Return values

:: dictionary[stringuint]

The counts, indexed by equipment names.


help() → string

All methods and properties that this object supports.

Attributes

prototype :: LuaEquipmentGridPrototype [Read]


width :: uint [Read]

Width of the equipment grid.


height :: uint [Read]

Height of the equipment grid.


equipment :: array[LuaEquipment] [Read]

All the equipment in this grid.


generator_energy :: double [Read]

Total energy per tick generated by the equipment inside this grid.


max_solar_energy :: double [Read]

Maximum energy per tick that can be created by any solar panels in the equipment grid. Actual generated energy varies depending on the daylight levels.


available_in_batteries :: double [Read]

The total energy stored in all batteries in the equipment grid.


battery_capacity :: double [Read]

Total energy storage capacity of all batteries in the equipment grid.


shield :: float [Read]

The amount of shields this equipment grid has.


max_shield :: float [Read]

The maximum amount of shields this equipment grid has.


inhibit_movement_bonus :: boolean [Read/Write]

True if this movement bonus equipment is turned off, otherwise false.


unique_id :: uint [Read]

Unique identifier of this equipment grid.


valid :: boolean [Read]

Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be false. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.


object_name :: string [Read]

The class name of this object. Available even when valid is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.

|<

Classes

Events

Concepts

Defines

Builtin types

>|