Skip to main content

LuaEquipmentGrid

Struct LuaEquipmentGrid 

Source
pub struct LuaEquipmentGrid;
Expand description

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

Implementations§

Source§

impl LuaEquipmentGrid

Source

pub fn available_in_batteries(&self) -> f64

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

Source

pub fn battery_capacity(&self) -> f64

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

Source

pub fn entity_owner(&self) -> LuaEntity

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.

Source

pub fn equipment(&self) -> Vec<LuaEquipment>

All the equipment in this grid.

Source

pub fn height(&self) -> u32

Height of the equipment grid.

Source

pub fn inhibit_movement_bonus(&self) -> bool

Whether this grid’s equipment movement bonus is active.

Source

pub fn inventory_bonus(&self) -> u32

The total amount of inventory bonus this equipment grid gives.

Source

pub fn itemstack_owner(&self) -> LuaItemStack

The item stack that this equipment grid is owned by.

Source

pub fn max_shield(&self) -> f32

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

Source

pub fn max_solar_energy(&self) -> f64

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.

Source

pub fn movement_bonus(&self) -> f64

The total amount of movement bonus this equipment grid gives.

Returns 0 if LuaEquipmentGrid::inhibit_movement_bonus is true.

Source

pub fn object_name(&self) -> &str

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.

Source

pub fn player_owner(&self) -> LuaPlayer

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

Source

pub fn prototype(&self) -> LuaEquipmentGridPrototype

Source

pub fn shield(&self) -> f32

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

Source

pub fn unique_id(&self) -> u32

Unique identifier of this equipment grid.

Source

pub fn valid(&self) -> bool

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.

Source

pub fn width(&self) -> u32

Width of the equipment grid.

Source

pub fn can_move(&self, params: LuaEquipmentGridCanMoveParams) -> bool

Check whether moving an equipment would succeed.

Source

pub fn cancel_removal(&self, equipment: LuaEquipment) -> bool

Cancels removal for the given equipment.

Source

pub fn clear(&self, by_player: Option<LuaAny>)

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

Source

pub fn count(&self, equipment: Option<LuaAny>) -> u32

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

Source

pub fn find( &self, equipment: LuaAny, search_ghosts: Option<bool>, ) -> Option<LuaEquipment>

Find equipment by name.

Source

pub fn get(&self, position: EquipmentPosition) -> Option<LuaEquipment>

Find equipment in the Equipment Grid colliding with this position.

Source

pub fn get_contents(&self) -> Vec<EquipmentWithQualityCounts>

Get counts of all equipment in this grid.

Source

pub fn get_generator_energy(&self, quality: Option<LuaAny>) -> f64

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

Source

pub fn move(&self, params: LuaEquipmentGridMoveParams) -> bool

Move an equipment within this grid.

Source

pub fn order_removal(&self, equipment: LuaEquipment) -> bool

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

Source

pub fn put(&self, params: LuaEquipmentGridPutParams) -> Option<LuaEquipment>

Insert an equipment into the grid.

Source

pub fn revive(&self, equipment: LuaEquipment) -> LuaEquipment

Revives the given equipment ghost if possible.

Source

pub fn take( &self, params: LuaEquipmentGridTakeParams, ) -> Option<ItemWithQualityCount>

Remove an equipment from the grid.

Source

pub fn take_all(&self, by_player: Option<LuaAny>) -> Vec<ItemWithQualityCount>

Remove all equipment from the grid.

Trait Implementations§

Source§

impl Clone for LuaEquipmentGrid

Source§

fn clone(&self) -> LuaEquipmentGrid

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for LuaEquipmentGrid

Source§

impl Debug for LuaEquipmentGrid

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LuaEquipmentGrid

Source§

fn default() -> LuaEquipmentGrid

Returns the “default value” for a type. Read more
Source§

impl Eq for LuaEquipmentGrid

Source§

impl From<LuaEquipmentGrid> for LuaAny

Source§

fn from(_: LuaEquipmentGrid) -> Self

Converts to this type from the input type.
Source§

impl LuaObject for LuaEquipmentGrid

Source§

impl PartialEq for LuaEquipmentGrid

Source§

fn eq(&self, other: &LuaEquipmentGrid) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LuaEquipmentGrid

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.