Home

LuaEquipmentGrid

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

Attributes

prototype

width

Width of the equipment grid.

height

Height of the equipment grid.

equipment

All the equipment in this grid.

max_solar_energy

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

available_in_batteries

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

battery_capacity

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

shield

The amount of shield hitpoints this equipment grid currently has across all shield equipment.

max_shield

The maximum amount of shield hitpoints this equipment grid has across all shield equipment.

inventory_bonus

The total amount of inventory bonus this equipment grid gives.

movement_bonus

The total amount of movement bonus this equipment grid gives.

Returns 0 if LuaEquipmentGrid::inhibit_movement_bonus is true.

inhibit_movement_bonus

Whether this grid's equipment movement bonus is active.

unique_id

Unique identifier of this equipment grid.

entity_owner

The entity that this equipment grid is owned by (in some inventory or item stack.)

If the owning entity is a character owned by some player and the player is disconnected this will return nil.

player_owner

The player that this equipment grid is owned by (in some inventory or item stack.)

itemstack_owner

The item stack that this equipment grid is owned by.

valid

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

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.

Methods

take

LuaEquipmentGrid.take{ position?: EquipmentPosition, equipment?: LuaEquipment, by_player?: PlayerIdentification } -> ItemWithQualityCount?

Call As

equipmentGrid.take{ position=position }

Call Convention

Remove an equipment from the grid.

Parameters

Returns

take_all

LuaEquipmentGrid.take_all(by_player?: PlayerIdentification) -> ItemWithQualityCounts

Call As

equipmentGrid.take_all()

Call Convention

Remove all equipment from the grid.

Parameters

Returns

clear

LuaEquipmentGrid.clear(by_player?: PlayerIdentification)

Call As

equipmentGrid.clear()

Call Convention

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

Parameters

put

LuaEquipmentGrid.put{ name: EquipmentID, quality?: QualityID, position?: EquipmentPosition, by_player?: PlayerIdentification, ghost?: boolean } -> LuaEquipment?

Call As

equipmentGrid.put{ name="name" }

Call Convention

Insert an equipment into the grid.

Parameters

Returns

can_move

LuaEquipmentGrid.can_move{ equipment: LuaEquipment, position: EquipmentPosition } -> boolean

Call As

equipmentGrid.can_move{ equipment=equipment, position=position }

Call Convention

Check whether moving an equipment would succeed.

Parameters

Returns

move

LuaEquipmentGrid.move{ equipment: LuaEquipment, position: EquipmentPosition } -> boolean

Call As

equipmentGrid.move{ equipment=equipment, position=position }

Call Convention

Move an equipment within this grid.

Parameters

Returns

get

LuaEquipmentGrid.get(position: EquipmentPosition) -> LuaEquipment?

Call As

equipmentGrid.get(position)

Call Convention

Find equipment in the Equipment Grid colliding with this position.

Parameters

Returns

get_contents

LuaEquipmentGrid.get_contents() -> Array<EquipmentWithQualityCounts>

Call As

equipmentGrid.get_contents()

Call Convention

Get counts of all equipment in this grid.

Returns

get_generator_energy

LuaEquipmentGrid.get_generator_energy(quality?: QualityID) -> double

Call As

equipmentGrid.get_generator_energy()

Call Convention

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

Parameters

Returns

find

LuaEquipmentGrid.find(equipment: EquipmentWithQualityID, search_ghosts?: boolean) -> LuaEquipment?

Call As

equipmentGrid.find(equipment, true)

Call Convention

Find equipment by name.

Parameters

Returns

count

LuaEquipmentGrid.count(equipment?: EquipmentWithQualityID) -> uint32

Call As

equipmentGrid.count()

Call Convention

Get the number of all or some equipment in this grid.

Parameters

Returns

revive

LuaEquipmentGrid.revive(equipment: LuaEquipment) -> LuaEquipment

Call As

equipmentGrid.revive(equipment)

Call Convention

Revives the given equipment ghost if possible.

Parameters

Returns

order_removal

LuaEquipmentGrid.order_removal(equipment: LuaEquipment) -> boolean

Call As

equipmentGrid.order_removal(equipment)

Call Convention

Marks the given equipment for removal. If the given equipment is a ghost it is removed.

Parameters

Returns

cancel_removal

LuaEquipmentGrid.cancel_removal(equipment: LuaEquipment) -> boolean

Call As

equipmentGrid.cancel_removal(equipment)

Call Convention

Cancels removal for the given equipment.

Parameters

Returns