LuaEquipmentGrid

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

class LuaEquipmentGrid - sort
take{position=…, equipment=…, by_player=…} → SimpleItemStack 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, i.
put{name=…, position=…, by_player=…} → LuaEquipment 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) → LuaEquipment Find equipment in the Equipment Grid based off a position.
get_contents() → dictionary stringuint Get counts of all equipment in this grid.
prototype :: LuaEquipmentGridPrototype [R]
width :: uint [R] Width of the equipment grid.
height :: uint [R] Height of the equipment grid.
equipment :: array of LuaEquipment [R] All the equipment in this grid.
generator_energy :: double [R] Total energy per tick generated by the equipment inside this grid.
max_solar_energy :: double [R] Maximum energy per tick that can be created by any solar panels in the equipment grid.
available_in_batteries :: double [R] The total energy stored in all batteries in the equipment grid.
battery_capacity :: double [R] Total energy storage capacity of all batteries in the equipment grid.
shield :: float [R] The amount of shields this equipment grid has.
max_shield :: float [R] The maximum amount of shields this equipment grid has.
inhibit_movement_bonus :: boolean [RW] True if this movement bonus equipment is turned off, otherwise false.
valid :: boolean [R] Is this object valid?
object_name :: string [R] The class name of this object.
help() → string All methods, and properties that this object supports.
take{position=…, equipment=…, by_player=…} → SimpleItemStack

Remove an equipment from the grid.

Parameters
Table with the following fields: Either position or equipment must be specified.
Return value
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 :: PlayerSpecification (optional): If provided, the action is done 'as' this player and on_player_removed_equipment is triggered.
Return value
Count of each removed equipment, indexed by their prototype names.
clear(by_player)

Clear all equipment from the grid, i.e. remove it without actually returning it.

Parameters
by_player :: PlayerSpecification (optional): 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:
Return value
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:
move{equipment=…, position=…} → boolean

Move an equipment within this grid.

Parameters
Table with the following fields:
Return value
true if the equipment was successfully moved.
get(position) → LuaEquipment

Find equipment in the Equipment Grid based off a position.

Parameters
position :: Position: The position
Return value
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 value
The counts, indexed by equipment names.
prototype :: LuaEquipmentGridPrototype [Read-only]

width :: uint [Read-only]

Width of the equipment grid.

height :: uint [Read-only]

Height of the equipment grid.

equipment :: array of LuaEquipment [Read-only]

All the equipment in this grid.

generator_energy :: double [Read-only]

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

max_solar_energy :: double [Read-only]

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-only]

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

battery_capacity :: double [Read-only]

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

shield :: float [Read-only]

The amount of shields this equipment grid has.

max_shield :: float [Read-only]

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.