commonlibsse_ng\re\e/
ExtraHealth.rs1use crate::re::BSExtraData::{BSExtraData, DerivedBSExtraData};
13use crate::re::ExtraDataType::ExtraDataType;
14use crate::re::NiMath::{ComparisonOptions, nearly_equal};
15use crate::re::offsets_rtti::RTTI_ExtraHealth;
16use crate::re::offsets_vtable::VTABLE_ExtraHealth;
17use crate::rel::id::VariantID;
18
19#[repr(C)]
20#[derive(Debug, PartialEq)]
21pub struct ExtraHealth {
22 pub __base: BSExtraData,
24
25 pub health: f32,
28
29 pub pad14: u32,
32}
33
34const _: () = {
35 assert!(core::mem::offset_of!(ExtraHealth, __base) == 0x0);
36 assert!(core::mem::offset_of!(ExtraHealth, health) == 0x10);
37 assert!(core::mem::offset_of!(ExtraHealth, pad14) == 0x14);
38 assert!(core::mem::size_of::<ExtraHealth>() == 0x18);
39};
40
41impl Default for ExtraHealth {
42 #[inline]
43 fn default() -> Self {
44 Self::new()
45 }
46}
47
48impl DerivedBSExtraData for ExtraHealth {
49 #[inline]
50 fn get_extra_data(&self) -> &BSExtraData {
51 &self.__base
52 }
53
54 #[inline]
55 fn get_extra_data_type() -> ExtraDataType {
56 Self::EXTRA_DATA_TYPE
57 }
58}
59
60impl ExtraHealth {
61 pub const RTTI: VariantID = RTTI_ExtraHealth;
63
64 pub const VTABLE: [VariantID; 1] = VTABLE_ExtraHealth;
66
67 pub const EXTRA_DATA_TYPE: ExtraDataType = ExtraDataType::Health;
69
70 #[inline]
72 pub const fn new() -> Self {
73 Self { __base: BSExtraData::new(), health: 0.0, pad14: 0 }
74 }
75
76 #[inline]
78 pub const fn from_health(health: f32) -> Self {
79 Self { __base: BSExtraData::new(), health, pad14: 0 }
80 }
81
82 #[inline]
84 pub const fn get_type(&self) -> ExtraDataType {
85 ExtraDataType::Health
86 }
87
88 #[inline]
90 pub const fn is_not_equal(&self, rhs: &Self) -> bool {
91 nearly_equal(self.health, rhs.health, ComparisonOptions::const_default())
92 }
93}
94
95#[repr(C)]
99#[derive(Debug)]
100pub struct ExtraHealthVtbl {
101 pub CxxDrop: fn(this: &mut ExtraHealth),
103
104 pub GetType: fn(this: &ExtraHealth) -> ExtraDataType,
106
107 pub IsNotEqual: fn(this: &ExtraHealth, rhs: &ExtraHealth) -> bool,
109}
110
111impl Default for ExtraHealthVtbl {
112 #[inline]
113 fn default() -> Self {
114 Self::new()
115 }
116}
117
118impl ExtraHealthVtbl {
119 pub const fn new() -> Self {
121 const fn CxxDrop(_this: &mut ExtraHealth) {}
122
123 const fn GetType(_this: &ExtraHealth) -> ExtraDataType {
124 ExtraHealth::EXTRA_DATA_TYPE
125 }
126
127 const fn IsNotEqual(this: &ExtraHealth, rhs: &ExtraHealth) -> bool {
128 nearly_equal(this.health, rhs.health, ComparisonOptions::const_default())
129 }
130
131 Self { CxxDrop, GetType, IsNotEqual }
132 }
133}