Skip to main content

LuaSpacePlatform

Struct LuaSpacePlatform 

Source
pub struct LuaSpacePlatform;
Expand description

A space platform.

Implementations§

Source§

impl LuaSpacePlatform

Source

pub fn damaged_tiles(&self) -> Vec<LuaAny>

The damaged tiles on this platform.

Source

pub fn distance(&self) -> f64

The point on space connection this platform is at or nil.

It is represented as a number in range [0, 1], with 0 being LuaSpaceConnectionPrototype::from and 1 being LuaSpaceConnectionPrototype::to.

Source

pub fn ejected_items(&self) -> Vec<EjectedItem>

All items that have been thrown overboard.

Source

pub fn force(&self) -> LuaForce

The force of this space platform.

Source

pub fn hidden(&self) -> bool

If this platform is hidden from the remote view surface list.

Source

pub fn hub(&self) -> LuaEntity

The hub on this platform, if it exists. It does not exist if the platform has not had the starter pack applied.

If the hub dies the platform will be deleted at the end of the tick but is otherwise valid to use until that point.

If the hub is destroyed the platform is not affected.

Source

pub fn index(&self) -> u32

The unique index of this space platform.

Source

pub fn last_visited_space_location(&self) -> LuaSpaceLocationPrototype

The space location this space platform previously went through or stopped at.

Source

pub fn name(&self) -> &str

The name of this space platform.

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 paused(&self) -> bool

When true, the platform has paused thrust and does not advance its schedule.

Source

pub fn schedule(&self) -> PlatformSchedule

This platform’s current schedule, if any. Set to nil to clear.

The schedule can’t be changed by modifying the returned table. Instead, changes must be made by assigning a new table to this attribute.

This is a simplified schedule that does not include groups and interrupts. See LuaSpacePlatform::get_schedule for full access to the schedule, including interrupts and groups.

Source

pub fn scheduled_for_deletion(&self) -> u32

If this platform is scheduled for deletion.

Returns how many ticks are left before the platform will be deleted. 0 if not scheduled for deletion.

Source

pub fn space_connection(&self) -> LuaSpaceConnectionPrototype

The space connection this space platform is traveling through or nil.

Write operation requires a valid space connection and it sets the distance to 0.5.

Source

pub fn space_location(&self) -> LuaSpaceLocationPrototype

The space location this space platform is stopped at or nil.

Write operation requires a valid space location and will cancel pending item requests.

Source

pub fn speed(&self) -> f64

Source

pub fn starter_pack(&self) -> ItemIDAndQualityIDPair

The starter pack used to create this space platform.

Source

pub fn state(&self) -> &str

The current state of this space platform.

Source

pub fn surface(&self) -> LuaSurface

The surface that belongs to this platform (if it has been created yet).

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 weight(&self) -> LuaAny

The total weight of the platform.

Source

pub fn apply_starter_pack(&self, silent: Option<bool>) -> Option<LuaEntity>

Applies the starter pack for this platform if it hasn’t already been applied.

Source

pub fn can_leave_current_location(&self) -> bool

Returns true when the space platform isn’t waiting on any delivery from the planet.

Source

pub fn cancel_deletion(&self)

Cancels deletion of this space platform if it was scheduled for deletion.

Source

pub fn clear_ejected_items(&self)

Removes all ejected items from this space platform.

Source

pub fn create_asteroid_chunks(&self, asteroid_chunks: Vec<AsteroidChunk>)

Creates the given asteroid chunks on this platform.

Source

pub fn damage_tile(&self, params: LuaSpacePlatformDamageTileParams)

Damages the given tile if it exists, the chunk is generated, and it is a platform foundation tile.

Source

pub fn destroy(&self, ticks: Option<u32>)

Schedules this space platform for deletion.

Source

pub fn destroy_asteroid_chunks( &self, params: LuaSpacePlatformDestroyAsteroidChunksParams, ) -> u32

Destroys all asteroid chunks from the given area. If no area and no position are given, then the entire surface is searched.

Source

pub fn eject_item(&self, item: LuaAny, movement: Vector, position: MapPosition)

Ejects an item into space on this space platform.

If a LuaItemStack is provided, the actual item is ejected and removed from the source.

Source

pub fn find_asteroid_chunks_filtered( &self, params: LuaSpacePlatformFindAsteroidChunksFilteredParams, ) -> Vec<AsteroidChunk>

Find asteroid chunks of a given name in a given area.

If no filters are given, returns all asteroid chunks in the search area. If multiple filters are specified, returns only asteroid chunks matching every given filter. If no area and no position are given, the entire surface is searched.

Source

pub fn get_schedule(&self) -> LuaSchedule

This allows full access to the space platform schedule, including modifying the schedule records, the group and the interrupts.

Source

pub fn repair_tile(&self, amount: Option<f32>, position: TilePosition)

Repairs the given tile if it’s damaged.

Trait Implementations§

Source§

impl Clone for LuaSpacePlatform

Source§

fn clone(&self) -> LuaSpacePlatform

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 LuaSpacePlatform

Source§

impl Debug for LuaSpacePlatform

Source§

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

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

impl Default for LuaSpacePlatform

Source§

fn default() -> LuaSpacePlatform

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

impl Eq for LuaSpacePlatform

Source§

impl From<LuaSpacePlatform> for LuaAny

Source§

fn from(_: LuaSpacePlatform) -> Self

Converts to this type from the input type.
Source§

impl LuaObject for LuaSpacePlatform

Source§

impl PartialEq for LuaSpacePlatform

Source§

fn eq(&self, other: &LuaSpacePlatform) -> 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 LuaSpacePlatform

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.