Skip to main content

Destruct

Struct Destruct 

Source
pub struct Destruct { /* private fields */ }
Expand description

A destruction state of a building piece.

Each piece can have multiple destructs representing different damage states. Destructs contain all the gameplay logic for that damage state: platforms, pipes, gates, EF lines, collision, etc.

§Fields

  • name - Name identifier for this destruction state
  • index - Index of this destruct
  • collision_3d - Collision mesh (legacy, moved to .cs2.collision in newer games)
  • collision_outlines - 2D collision outlines
  • windows - Number of window positions
  • doors - Number of door positions
  • gates - Gate collision data for wall gates
  • pipes - Unit movement paths (stairs, ladders, doors, etc.)
  • footprints - Footprint rings of the level, beside its collision outlines (x and z)
  • platforms - Walkable surfaces for units
  • uk_2 - Unknown field
  • bounding_box - Bounding box for this destruct
  • cannon_emitters - Projectile emitter count for cannons (legacy)
  • arrow_emitters - Projectile emitters for arrows (legacy)
  • docking_points - Number of docking points
  • soft_collisions - Soft collision data
  • uk_7 - Unknown field (v18 and later)
  • vfx_emitters - VFX the destruct always plays (v13 and before)
  • file_refs - Attached model references (e.g., torches)
  • ef_lines - Entity Formation lines for unit positioning
  • docking_lines - Lines where siege equipment can attach
  • f_1 - Unknown field
  • action_vfx - VFX for actions
  • action_vfx_attachments - VFX attachment points
  • action_vfx_triangles - Per action_vfx entry, the hull triangles it belongs to
  • bin_data_2 - Unknown binary data (present in some Three Kingdoms gates)

§Examples

ⓘ
for destruct in piece.destructs() {
    println!("Destruct '{}': {} platforms, {} pipes",
        destruct.name(),
        destruct.platforms().len(),
        destruct.pipes().len()
    );
}

Implementations§

Source§

impl Destruct

Source

pub fn name(&self) -> &String

Name identifier for this destruction state.

Source

pub fn index(&self) -> &u32

Index of this destruct.

Source

pub fn collision_3d(&self) -> &Collision3d

Collision mesh (legacy, moved to separate .cs2.collision files in newer games).

Source

pub fn collision_outlines(&self) -> &Vec<CollisionOutline>

2D collision outlines.

Source

pub fn windows(&self) -> &i32

Number of window positions.

Source

pub fn doors(&self) -> &i32

Number of door positions.

Source

pub fn gates(&self) -> &Vec<Gate>

Gate collision data for wall gates.

Source

pub fn pipes(&self) -> &Vec<Pipe>

Unit movement paths between platforms.

Source

pub fn footprints(&self) -> &Vec<Vec<FootprintCorner>>

Footprint rings of the level, beside its collision outlines: the ground it covers (x and z). Drawn as an orange line in Terry.

Source

pub fn platforms(&self) -> &Vec<Platform>

Walkable platform surfaces.

Source

pub fn uk_2(&self) -> &i32

Unknown field.

Source

pub fn bounding_box(&self) -> &Cube

Bounding box for this destruct.

Source

pub fn cannon_emitters(&self) -> &i32

Projectile emitter count for cannons (legacy, moved to map in newer games).

Source

pub fn arrow_emitters(&self) -> &Vec<ProjectileEmitter>

Projectile emitters for arrows (legacy, moved to map in newer games).

Source

pub fn docking_points(&self) -> &i32

Number of docking points.

Source

pub fn soft_collisions(&self) -> &Vec<SoftCollisions>

Soft collision data.

Source

pub fn uk_7(&self) -> &i32

Unknown field (v18 and later; not checked whether it is the count of vfx_emitters there too).

Source

pub fn vfx_emitters(&self) -> &Vec<Vfx>

VFX the destruct always plays (v13 and before). In Attila, the name of the effect is the key without its first three and its last _ tokens: piece01_destruct01_emitter_action_vfx_torch_fire_small_01 plays action_vfx_torch_fire_small. No file shipped with the game has any, but they play in game.

Source

pub fn file_refs(&self) -> &Vec<FileRef>

Attached model references (e.g., torches).

Source

pub fn ef_lines(&self) -> &Vec<EFLine>

Entity Formation lines for unit positioning.

Source

pub fn docking_lines(&self) -> &Vec<DockingLine>

Lines where siege equipment can attach.

Source

pub fn f_1(&self) -> &f32

Unknown field.

Source

pub fn action_vfx(&self) -> &Vec<Vfx>

VFX for actions.

Source

pub fn action_vfx_attachments(&self) -> &Vec<Vfx>

VFX attachment points.

Source

pub fn action_vfx_triangles(&self) -> &Vec<Vec<i16>>

Lists of indices into the level’s collision_3d triangles, as many lists as action_vfx entries, together covering every hull triangle once: probably which effect a hit on that part of the hull plays (the pairing by index is not checked in game).

Source

pub fn bin_data_2(&self) -> &Vec<Vec<i16>>

Unknown binary data (present in some Three Kingdoms gates).

Source§

impl Destruct

Source

pub fn name_mut(&mut self) -> &mut String

Name identifier for this destruction state.

Source

pub fn index_mut(&mut self) -> &mut u32

Index of this destruct.

Source

pub fn collision_3d_mut(&mut self) -> &mut Collision3d

Collision mesh (legacy, moved to separate .cs2.collision files in newer games).

Source

pub fn collision_outlines_mut(&mut self) -> &mut Vec<CollisionOutline>

2D collision outlines.

Source

pub fn windows_mut(&mut self) -> &mut i32

Number of window positions.

Source

pub fn doors_mut(&mut self) -> &mut i32

Number of door positions.

Source

pub fn gates_mut(&mut self) -> &mut Vec<Gate>

Gate collision data for wall gates.

Source

pub fn pipes_mut(&mut self) -> &mut Vec<Pipe>

Unit movement paths between platforms.

Source

pub fn footprints_mut(&mut self) -> &mut Vec<Vec<FootprintCorner>>

Footprint rings of the level, beside its collision outlines: the ground it covers (x and z). Drawn as an orange line in Terry.

Source

pub fn platforms_mut(&mut self) -> &mut Vec<Platform>

Walkable platform surfaces.

Source

pub fn uk_2_mut(&mut self) -> &mut i32

Unknown field.

Source

pub fn bounding_box_mut(&mut self) -> &mut Cube

Bounding box for this destruct.

Source

pub fn cannon_emitters_mut(&mut self) -> &mut i32

Projectile emitter count for cannons (legacy, moved to map in newer games).

Source

pub fn arrow_emitters_mut(&mut self) -> &mut Vec<ProjectileEmitter>

Projectile emitters for arrows (legacy, moved to map in newer games).

Source

pub fn docking_points_mut(&mut self) -> &mut i32

Number of docking points.

Source

pub fn soft_collisions_mut(&mut self) -> &mut Vec<SoftCollisions>

Soft collision data.

Source

pub fn uk_7_mut(&mut self) -> &mut i32

Unknown field (v18 and later; not checked whether it is the count of vfx_emitters there too).

Source

pub fn vfx_emitters_mut(&mut self) -> &mut Vec<Vfx>

VFX the destruct always plays (v13 and before). In Attila, the name of the effect is the key without its first three and its last _ tokens: piece01_destruct01_emitter_action_vfx_torch_fire_small_01 plays action_vfx_torch_fire_small. No file shipped with the game has any, but they play in game.

Source

pub fn file_refs_mut(&mut self) -> &mut Vec<FileRef>

Attached model references (e.g., torches).

Source

pub fn ef_lines_mut(&mut self) -> &mut Vec<EFLine>

Entity Formation lines for unit positioning.

Source

pub fn docking_lines_mut(&mut self) -> &mut Vec<DockingLine>

Lines where siege equipment can attach.

Source

pub fn f_1_mut(&mut self) -> &mut f32

Unknown field.

Source

pub fn action_vfx_mut(&mut self) -> &mut Vec<Vfx>

VFX for actions.

Source

pub fn action_vfx_attachments_mut(&mut self) -> &mut Vec<Vfx>

VFX attachment points.

Source

pub fn action_vfx_triangles_mut(&mut self) -> &mut Vec<Vec<i16>>

Lists of indices into the level’s collision_3d triangles, as many lists as action_vfx entries, together covering every hull triangle once: probably which effect a hit on that part of the hull plays (the pairing by index is not checked in game).

Source

pub fn bin_data_2_mut(&mut self) -> &mut Vec<Vec<i16>>

Unknown binary data (present in some Three Kingdoms gates).

Source§

impl Destruct

Source

pub fn set_name(&mut self, val: String) -> &mut Self

Name identifier for this destruction state.

Source

pub fn set_index(&mut self, val: u32) -> &mut Self

Index of this destruct.

Source

pub fn set_collision_3d(&mut self, val: Collision3d) -> &mut Self

Collision mesh (legacy, moved to separate .cs2.collision files in newer games).

Source

pub fn set_collision_outlines( &mut self, val: Vec<CollisionOutline>, ) -> &mut Self

2D collision outlines.

Source

pub fn set_windows(&mut self, val: i32) -> &mut Self

Number of window positions.

Source

pub fn set_doors(&mut self, val: i32) -> &mut Self

Number of door positions.

Source

pub fn set_gates(&mut self, val: Vec<Gate>) -> &mut Self

Gate collision data for wall gates.

Source

pub fn set_pipes(&mut self, val: Vec<Pipe>) -> &mut Self

Unit movement paths between platforms.

Source

pub fn set_footprints(&mut self, val: Vec<Vec<FootprintCorner>>) -> &mut Self

Footprint rings of the level, beside its collision outlines: the ground it covers (x and z). Drawn as an orange line in Terry.

Source

pub fn set_platforms(&mut self, val: Vec<Platform>) -> &mut Self

Walkable platform surfaces.

Source

pub fn set_uk_2(&mut self, val: i32) -> &mut Self

Unknown field.

Source

pub fn set_bounding_box(&mut self, val: Cube) -> &mut Self

Bounding box for this destruct.

Source

pub fn set_cannon_emitters(&mut self, val: i32) -> &mut Self

Projectile emitter count for cannons (legacy, moved to map in newer games).

Source

pub fn set_arrow_emitters(&mut self, val: Vec<ProjectileEmitter>) -> &mut Self

Projectile emitters for arrows (legacy, moved to map in newer games).

Source

pub fn set_docking_points(&mut self, val: i32) -> &mut Self

Number of docking points.

Source

pub fn set_soft_collisions(&mut self, val: Vec<SoftCollisions>) -> &mut Self

Soft collision data.

Source

pub fn set_uk_7(&mut self, val: i32) -> &mut Self

Unknown field (v18 and later; not checked whether it is the count of vfx_emitters there too).

Source

pub fn set_vfx_emitters(&mut self, val: Vec<Vfx>) -> &mut Self

VFX the destruct always plays (v13 and before). In Attila, the name of the effect is the key without its first three and its last _ tokens: piece01_destruct01_emitter_action_vfx_torch_fire_small_01 plays action_vfx_torch_fire_small. No file shipped with the game has any, but they play in game.

Source

pub fn set_file_refs(&mut self, val: Vec<FileRef>) -> &mut Self

Attached model references (e.g., torches).

Source

pub fn set_ef_lines(&mut self, val: Vec<EFLine>) -> &mut Self

Entity Formation lines for unit positioning.

Source

pub fn set_docking_lines(&mut self, val: Vec<DockingLine>) -> &mut Self

Lines where siege equipment can attach.

Source

pub fn set_f_1(&mut self, val: f32) -> &mut Self

Unknown field.

Source

pub fn set_action_vfx(&mut self, val: Vec<Vfx>) -> &mut Self

VFX for actions.

Source

pub fn set_action_vfx_attachments(&mut self, val: Vec<Vfx>) -> &mut Self

VFX attachment points.

Source

pub fn set_action_vfx_triangles(&mut self, val: Vec<Vec<i16>>) -> &mut Self

Lists of indices into the level’s collision_3d triangles, as many lists as action_vfx entries, together covering every hull triangle once: probably which effect a hit on that part of the hull plays (the pairing by index is not checked in game).

Source

pub fn set_bin_data_2(&mut self, val: Vec<Vec<i16>>) -> &mut Self

Unknown binary data (present in some Three Kingdoms gates).

Trait Implementations§

Source§

impl Clone for Destruct

Source§

fn clone(&self) -> Self

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 Destruct

Source§

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

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

impl Default for Destruct

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Destruct

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Destruct

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for Destruct

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Destruct

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.