pub struct BattleTreeItem { /* private fields */ }Expand description
Individual tree instance with position, rotation, and scale.
Represents a single tree placed on the battle map with its transform data. The rotation is compressed into a single byte representing Y-axis rotation.
§Fields
id- Unique identifier for this tree instancex- X coordinate in world spacey- Y coordinate in world space (height)z- Z coordinate in world spacerotation- Y-axis rotation compressed to 0-255 range (multiply by 1.40625 to get degrees)scale- Uniform scale factor applied to all axesflags- Behavior flags for this tree instance
§Examples
let tree = BattleTreeItem {
id: 0x1609e7e52919a40,
x: -22.92,
y: 58.75,
z: -3.01,
rotation: 72, // ~102 degrees when converted
scale: 1.0,
flags: 3,
};Implementations§
Source§impl BattleTreeItem
impl BattleTreeItem
Sourcepub fn rotation(&self) -> &u8
pub fn rotation(&self) -> &u8
Y-axis rotation (0-255 maps to 0-360 degrees). Version 4 only.
To convert to degrees: rotation as f32 * 1.40625
Sourcepub fn scale(&self) -> &f32
pub fn scale(&self) -> &f32
Uniform scale factor. In versions 1 to 3 it is stored as a byte, 127 being 1.0.
Sourcepub fn flags(&self) -> &u8
pub fn flags(&self) -> &u8
Behavior flags for this tree instance. In versions 1 to 3 the byte is the tree’s is_freeform: 1 keeps the stored height, 0 puts
the tree on the terrain.
Sourcepub fn is_burnable(&self) -> &u8
pub fn is_burnable(&self) -> &u8
Version 2 only: whether the tree can burn. Always 1 in Attila.
Source§impl BattleTreeItem
impl BattleTreeItem
Sourcepub fn rotation_mut(&mut self) -> &mut u8
pub fn rotation_mut(&mut self) -> &mut u8
Y-axis rotation (0-255 maps to 0-360 degrees). Version 4 only.
To convert to degrees: rotation as f32 * 1.40625
Sourcepub fn scale_mut(&mut self) -> &mut f32
pub fn scale_mut(&mut self) -> &mut f32
Uniform scale factor. In versions 1 to 3 it is stored as a byte, 127 being 1.0.
Sourcepub fn flags_mut(&mut self) -> &mut u8
pub fn flags_mut(&mut self) -> &mut u8
Behavior flags for this tree instance. In versions 1 to 3 the byte is the tree’s is_freeform: 1 keeps the stored height, 0 puts
the tree on the terrain.
Sourcepub fn is_burnable_mut(&mut self) -> &mut u8
pub fn is_burnable_mut(&mut self) -> &mut u8
Version 2 only: whether the tree can burn. Always 1 in Attila.
Source§impl BattleTreeItem
impl BattleTreeItem
Sourcepub fn set_rotation(&mut self, val: u8) -> &mut Self
pub fn set_rotation(&mut self, val: u8) -> &mut Self
Y-axis rotation (0-255 maps to 0-360 degrees). Version 4 only.
To convert to degrees: rotation as f32 * 1.40625
Sourcepub fn set_scale(&mut self, val: f32) -> &mut Self
pub fn set_scale(&mut self, val: f32) -> &mut Self
Uniform scale factor. In versions 1 to 3 it is stored as a byte, 127 being 1.0.
Sourcepub fn set_flags(&mut self, val: u8) -> &mut Self
pub fn set_flags(&mut self, val: u8) -> &mut Self
Behavior flags for this tree instance. In versions 1 to 3 the byte is the tree’s is_freeform: 1 keeps the stored height, 0 puts
the tree on the terrain.
Sourcepub fn set_is_burnable(&mut self, val: u8) -> &mut Self
pub fn set_is_burnable(&mut self, val: u8) -> &mut Self
Version 2 only: whether the tree can burn. Always 1 in Attila.
Trait Implementations§
Source§impl Clone for BattleTreeItem
impl Clone for BattleTreeItem
Source§fn clone(&self) -> BattleTreeItem
fn clone(&self) -> BattleTreeItem
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BattleTreeItem
impl Debug for BattleTreeItem
Source§impl Default for BattleTreeItem
impl Default for BattleTreeItem
Source§impl<'de> Deserialize<'de> for BattleTreeItem
impl<'de> Deserialize<'de> for BattleTreeItem
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for BattleTreeItem
impl PartialEq for BattleTreeItem
Source§impl Serialize for BattleTreeItem
impl Serialize for BattleTreeItem
impl StructuralPartialEq for BattleTreeItem
Auto Trait Implementations§
impl Freeze for BattleTreeItem
impl RefUnwindSafe for BattleTreeItem
impl Send for BattleTreeItem
impl Sync for BattleTreeItem
impl Unpin for BattleTreeItem
impl UnsafeUnpin for BattleTreeItem
impl UnwindSafe for BattleTreeItem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().impl<T> Scalar for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.