Skip to main content

BuildingData

Struct BuildingData 

Source
#[repr(C)]
pub struct BuildingData { pub header: Header, pub entity: Entity, pub player: Entity, pub item: ItemId, pub kind: u8, pub replay: u8, pub template: [u8; 16], pub position: [f32; 3], }
Expand description

The data of the BuildingPlaced and BuildingRemoved events.

§Examples

use enshwick::abi::{BuildingData, Header};

let placed = BuildingData {
    header: Header::of::<BuildingData>(),
    entity: enshwick::Entity(4096),
    player: enshwick::Entity(2),
    item: enshwick::ItemId::new(1_302_084_846),
    kind: BuildingData::PLACED,
    replay: 0,
    template: [0; 16],
    position: [1.0, 2.0, 3.0],
};
assert_eq!(placed.kind, BuildingData::PLACED);

Fields§

§header: Header

Size and version of this struct.

§entity: Entity

The placed entity; for a removal, the entity as it was.

§player: Entity

The acting player’s character entity.

§item: ItemId

The item placed, which the entity keeps as its UsedItem; 0 for a removal.

§kind: u8

What happened: 0 placed, 1 picked up, 2 torn down.

§replay: u8

1 when undo or redo replayed the action.

§template: [u8; 16]

The template GUID of the placed entity, in file order; zero for a removal.

§position: [f32; 3]

Where it was placed, in metres; zero for a removal.

Implementations§

Source§

impl BuildingData

Source

pub const PLACED: u8 = 0

Placed by a player.

Source

pub const PICKED_UP: u8 = 1

Picked up, its item returned.

Source

pub const TORN_DOWN: u8 = 2

Torn down.

Trait Implementations§

Source§

impl Clone for BuildingData

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 Copy for BuildingData

Source§

impl Debug for BuildingData

Source§

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

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

impl Headed for BuildingData

Source§

impl IntoScript for BuildingData

Source§

fn into_value(self) -> Value

Available on crate feature unstable only.
The value as Typed::TY shapes it.
Source§

impl Typed for BuildingData

Source§

const TY: &'static Ty

Available on crate feature unstable only.
Its type in a script.
Source§

impl Zeroable for BuildingData

Source§

fn zeroed() -> Self

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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 = !

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.