LuaEquipmentGrid

class LuaEquipmentGrid
take{position=…, equipment=…} → SimpleItemStack Remove an equipment from the grid.
take_all() → dictionary stringuint Remove all equipment from the grid.
clear() Clear all equipment from the grid.
put{name=…, position=…} → 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.
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.
valid :: boolean [R] Is this object valid?

An equipment grid is the inside of a power armour.

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

Remove an equipment from the grid.

Parameters
Table with the following fields:
  • position :: Position (optional): Take the equipment that contains this position in the grid.
  • equipment :: LuaEquipment (optional): Take this exact equipment.
Either position or equipment must be specified.
Return value
The removed equipment, or nil if no equipment was removed.
take_all() → dictionary stringuint

Remove all equipment from the grid.

Return value
Count of each removed equipment, indexed by their prototype names.
clear()

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

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

Insert an equipment into the grid.

Parameters
Table with the following fields:
  • name :: string: Equipment prototype name
  • position :: Position (optional): Grid position to put the equipment in.
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.
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.