Skip to main content

LuaSurfaceRequestPathParams

Struct LuaSurfaceRequestPathParams 

Source
pub struct LuaSurfaceRequestPathParams {
    pub bounding_box: BoundingBox,
    pub can_open_gates: bool,
    pub collision_mask: CollisionMask,
    pub entity_to_ignore: LuaEntity,
    pub force: LuaAny,
    pub goal: MapPosition,
    pub max_attack_distance: f64,
    pub max_gap_size: i32,
    pub path_resolution_modifier: i32,
    pub pathfind_flags: PathfinderFlags,
    pub radius: f64,
    pub start: MapPosition,
}
Expand description

Generates a path with the specified constraints (as an array of PathfinderWaypoints) using the unit pathfinding algorithm. This path can be used to emulate pathing behavior by script for non-unit entities, such as vehicles. If you want to command actual units (such as biters or spitters) to move, use LuaCommandable::set_command via LuaEntity::commandable instead.

The resulting path is ultimately returned asynchronously via on_script_path_request_finished.

Fields§

§bounding_box: BoundingBox

The dimensions of the object that’s supposed to travel the path.

§can_open_gates: bool

Whether the path request can open gates. Defaults to false.

§collision_mask: CollisionMask

The collision mask the bounding_box collides with.

§entity_to_ignore: LuaEntity

Makes the pathfinder ignore collisions with this entity if it is given.

§force: LuaAny

The force for which to generate the path, determining which gates can be opened for example.

§goal: MapPosition

The position to find a path to.

§max_attack_distance: f64

Defines the maximum allowed distance between the last traversable path waypoint and an obstacle entity to be destroyed. Only used when finding a discontiguous path, i.e. when max_gap_size > 0. This field filters out paths that are blocked by obstacles that are outside the entity’s attack range. Allowed values are 0 or greater. Defaults to max_gap_size.

§max_gap_size: i32

Defines the maximum allowed distance between path waypoints. 0 means that paths must be contiguous (as they are for biters). Values greater than 0 will produce paths with “gaps” that are suitable for spiders. Allowed values are from 0 to 31. Defaults to 0.

§path_resolution_modifier: i32

Defines how coarse the pathfinder’s grid is, where smaller values mean a coarser grid. Defaults to 0, which equals a resolution of 1x1 tiles, centered on tile centers. Values range from -8 to 8 inclusive, where each integer increment doubles/halves the resolution. So, a resolution of -8 equals a grid of 256x256 tiles, and a resolution of 8 equals 1/256 of a tile.

§pathfind_flags: PathfinderFlags

Flags that affect pathfinder behavior.

§radius: f64

How close the pathfinder needs to get to its goal (in tiles). Defaults to 1.

§start: MapPosition

The position from which to start pathfinding.

Trait Implementations§

Source§

impl Clone for LuaSurfaceRequestPathParams

Source§

fn clone(&self) -> LuaSurfaceRequestPathParams

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 Debug for LuaSurfaceRequestPathParams

Source§

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

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

impl Default for LuaSurfaceRequestPathParams

Source§

fn default() -> LuaSurfaceRequestPathParams

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

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.