commonlibsse_ng\re\t\TESObjectWEAP/
data.rs

1use crate::re::ActorValues::{ActorValue_CEnum, ActorValue_u8};
2
3use super::RangedData;
4
5#[commonlibsse_ng_derive_internal::to_bitflags]
6#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
7#[repr(u32)]
8pub enum WEAPON_HIT_BEHAVIOR {
9    Normal = 0,
10    DismemberOnly = 1,
11    ExplodeOnly = 2,
12    NoDismemberOrExplode = 3,
13}
14
15#[commonlibsse_ng_derive_internal::to_bitflags]
16#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
17#[repr(u8)]
18pub enum WEAPON_TYPE {
19    HandToHandMelee = 0,
20    OneHandSword = 1,
21    OneHandDagger = 2,
22    OneHandAxe = 3,
23    OneHandMace = 4,
24    TwoHandSword = 5,
25    TwoHandAxe = 6,
26    Bow = 7,
27    Staff = 8,
28    Crossbow = 9,
29}
30
31#[commonlibsse_ng_derive_internal::to_bitflags]
32#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
33#[repr(u16)]
34pub enum Flag2 {
35    None = 0,
36    PlayerOnly = 1 << 0,
37    NPCsUseAmmo = 1 << 1,
38    NoJamAfterReload = 1 << 2, // unused
39    MinorCrime = 1 << 4,
40    RangeFixed = 1 << 5,
41    NotUsedInNormalCombat = 1 << 6,
42    DontUse3rdPersonISAnim = 1 << 8, // unused
43    BurstShot = 1 << 9,
44    RumbleAlternate = 1 << 10,
45    LongBursts = 1 << 11,
46    NonHostile = 1 << 12,
47    BoundWeapon = 1 << 13,
48}
49
50#[commonlibsse_ng_derive_internal::to_bitflags]
51#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
52#[repr(u8)]
53pub enum AttackAnimation {
54    AttackLeft = 26,
55    AttackRight = 32,
56    Attack3 = 38,
57    Attack4 = 44,
58    Attack5 = 50,
59    Attack7 = 62,
60    Attack8 = 68,
61    AttackLoop = 74,
62    AttackSpin = 80,
63    AttackSpin2 = 86,
64    PlaceMine = 97,
65    PlaceMine2 = 103,
66    AttackThrow = 109,
67    AttackThrow2 = 115,
68    AttackThrow3 = 121,
69    AttackThrow4 = 127,
70    AttackThrow5 = 133,
71    Default = 255,
72}
73
74#[commonlibsse_ng_derive_internal::to_bitflags]
75#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
76#[repr(u8)]
77pub enum Flag {
78    None = 0,
79    IgnoresNormalWeaponResistance = 1 << 0,
80    Automatic = 1 << 1, // unused
81    HasScope = 1 << 2,  // unused
82    CantDrop = 1 << 3,
83    HideBackpack = 1 << 4,             // unused
84    EmbeddedWeapon = 1 << 5,           // unused
85    DontUseFirstPersonISAnim = 1 << 6, // unused
86    NonPlayable = 1 << 7,
87}
88
89#[repr(C)]
90#[derive(Debug)]
91pub struct Data {
92    pub rangedData: *mut RangedData,      // 0x00
93    pub speed: f32,                       // 0x08
94    pub reach: f32,                       // 0x0C
95    pub minRange: f32,                    // 0x10
96    pub maxRange: f32,                    // 0x14
97    pub animationAttackMult: f32,         // 0x18
98    pub unk1C: f32,                       // 0x1C
99    pub staggerValue: f32,                // 0x20
100    pub hitBehavior: WEAPON_HIT_BEHAVIOR, // 0x24
101    pub skill: ActorValue_CEnum,          // 0x28
102    pub resistance: ActorValue_CEnum,     // 0x2C
103    pub flags2: Flag2,                    // 0x30
104    pub baseVATSToHitChance: u8,          // 0x32
105    pub attackAnimation: AttackAnimation, // 0x33
106    pub embeddedWeaponAV: ActorValue_u8,  // 0x34 - unused
107    pub animationType: WEAPON_TYPE,       // 0x35
108    pub flags: Flag,                      // 0x36
109    pub unk37: u8,                        // 0x37
110}
111const _: () = assert!(core::mem::size_of::<Data>() == 0x38);