DayZ 1.28
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
WeaponStableState.c
См. документацию.
1
13
15{
17 U = -1,
19 E = 0,
21 F = 1,
23 L = 2
24}
25
27{
29
31
32 void WeaponStableState(Weapon_Base w = NULL, WeaponStateBase parent = NULL, int anim_state = -1)
33 {
34 m_animState = anim_state;
37 }
38
40 {
41 int curr = m_weapon.GetWeaponAnimState();
42 if (curr != m_animState)
43 {
44 //if (LogManager.IsWeaponLogEnable()) fsmDebugSpam("[wpnfsm] " + Object.GetDebugName(m_weapon) + " synchronizing anim state: " + curr + " --> " + m_animState);
45 PlayerBase p;
46 if (Class.CastTo(p, m_weapon.GetHierarchyParent()))
47 {
48 if (p.GetItemInHands() == m_weapon)
49 {
50 HumanCommandWeapons hcw = p.GetCommandModifier_Weapons();
51 if (hcw)
52 {
54 if (LogManager.IsWeaponLogEnable()) fsmDebugSpam("[wpnfsm] " + Object.GetDebugName(m_weapon) + " state=" + m_weapon.GetCurrentState().Type() + " synchronized anim state: " + typename.EnumToString(PistolAnimState, curr) + " --> " + typename.EnumToString(PistolAnimState, m_animState));
55 }
56 else
57 {
58 Human wpnOwner = Human.Cast(m_weapon.GetHierarchyRootPlayer());
60 if (LogManager.IsWeaponLogEnable()) fsmDebugSpam("[wpnfsm] " + Object.GetDebugName(m_weapon) + " state=" + m_weapon.GetCurrentState().Type() + " synchronized remote anim state: " + typename.EnumToString(PistolAnimState, curr) + " --> " + typename.EnumToString(PistolAnimState, m_animState));
61 }
62 }
63 m_weapon.SetWeaponAnimState(m_animState);
64 }
65 else
66 {
67 m_weapon.SetGroundAnimFrameIndex(m_animState);
68 }
69 }
70 }
71
72 override void OnEntry(WeaponEventBase e)
73 {
74 super.OnEntry(e);
75
76 if (e)
78
79 m_weapon.SetJammed(IsJammed());
80 m_weapon.SetCharged(!IsDischarged());
81 m_weapon.SetWeaponOpen(IsWeaponOpen());
82 m_weapon.ResetWeaponAnimState();
83 }
84 override void OnUpdate(float dt)
85 {
86 super.OnUpdate(dt);
88 }
89 override void OnExit(WeaponEventBase e)
90 {
91 m_weapon.ResetWeaponAnimState();
92 super.OnExit(e);
93 }
94
95 override bool IsIdle() { return true; }
96
97 int GetCurrentStateID() { return 0; }
98
110
119 bool IsRepairEnabled() { return false; }
120
126 bool HasBullet() { return false; }
127
129 bool HasMagazine() { return false; }
130
132 bool IsJammed() { return false; }
133
135 bool IsDischarged() { return false; }
136
138 bool IsWeaponOpen() { return false; }
139
142
144 bool IsSingleState() { return false; }
145
147
152
155 int GetMuzzleStateCount() { return m_muzzleHasBullet.Count(); }
156 bool IsChamberValid(int idx) { return m_muzzleHasBullet[idx] != MuzzleState.U; }
157 bool IsChamberFiredOut(int idx) { return m_muzzleHasBullet[idx] == MuzzleState.F; }
158 bool IsChamberFull(int idx) { return m_muzzleHasBullet[idx] != MuzzleState.E; }
159
161
164 {
165 // There is only one
166 if (IsSingleState())
167 return;
168
169 bool failed = false;
170
171 if (!failed)
172 {
173 foreach (MuzzleState state : m_muzzleHasBullet)
174 {
175 if ( state == MuzzleState.U )
176 {
177 failed = true;
178 break;
179 }
180 }
181 }
182
183 if (failed)
184 {
185 ErrorExSeverity severity = ErrorExSeverity.ERROR;
186
187 #ifdef DEVELOPER
188 if (DayZGame.m_IsPreviewSpawn)
189 {
190 // we do not want VMEs when spawning the item in order to visualize it for preview in script console
191 severity = ErrorExSeverity.INFO;
192 }
193 #endif
194
195 ErrorEx("Muzzle array validation has failed. Please set up the correct muzzle states by overriding InitMuzzleArray.", severity);
196 }
197 }
198};
199
200
class WeaponGuardIsDestroyed extends WeaponGuardBase m_weapon
Определения Guards.c:604
void fsmDebugSpam(string s)
Определения HFSMBase.c:9
PistolAnimState
Определения Pistol_Base.c:3
class SSPFireout extends WeaponStableState OnEntry
class WeaponChambering_Chamber_OnEntry extends WeaponChambering_Base OnExit
Определения WeaponChambering.c:352
int GetMuzzleStateCount()
Определения WeaponStableState.c:155
bool IsChamberValid(int idx)
Определения WeaponStableState.c:156
void SyncAnimState()
Определения WeaponStableState.c:39
enum MuzzleState m_animState
MuzzleState
Определения WeaponStableState.c:15
@ E
EMPTY.
Определения WeaponStableState.c:19
@ U
UNKNOWN.
Определения WeaponStableState.c:17
@ L
LOADED.
Определения WeaponStableState.c:23
@ F
FIRED.
Определения WeaponStableState.c:21
void ValidateMuzzleArray()
Safety check and error message in case not set up correctly.
Определения WeaponStableState.c:163
override bool IsIdle()
Определения WeaponStableState.c:95
ref array< MuzzleState > m_muzzleHasBullet
Определения WeaponStableState.c:30
bool IsSingleState()
Special one for when the weapon only has one singular state (like Magnum)
Определения WeaponStableState.c:144
void WeaponStableState(Weapon_Base w=NULL, WeaponStateBase parent=NULL, int anim_state=-1)
Определения WeaponStableState.c:32
bool IsChamberFiredOut(int idx)
Определения WeaponStableState.c:157
bool IsWeaponOpen()
Whether the gun is open.
Определения WeaponStableState.c:138
MuzzleState GetMuzzleState(int idx)
Get chamber state of the muzzle at index.
Определения WeaponStableState.c:154
bool IsChamberFull(int idx)
Определения WeaponStableState.c:158
Super root of all classes in Enforce script.
Определения EnScript.c:11
proto static native void StaticSetInitState(Human pHuman, int pFrameIdx)
just static version of SetInitState
proto native void SetInitState(int pFrameIndex)
Определения human.c:998
static bool IsWeaponLogEnable()
Определения 3_Game/tools/Debug.c:718
Определения 3_Game/tools/Debug.c:594
Определения ObjectTyped.c:2
Определения PlayerBaseClient.c:2
shorthand
Определения BoltActionRifle_Base.c:6
signalize mechanism manipulation
Определения Events.c:35
override bool IsJammed()
Определения Crossbow.c:33
override bool IsDischarged()
Определения OpenBolt_Base.c:44
override void InitMuzzleArray()
Определения Crossbow.c:35
override void OnEntry(WeaponEventBase e)
Определения Crossbow.c:28
override bool HasBullet()
Определения Crossbow.c:31
override int GetCurrentStateID()
Определения Crossbow.c:30
override bool IsRepairEnabled()
Определения Crossbow.c:34
override bool HasMagazine()
Определения Crossbow.c:32
represents weapon's stable state (i.e. the basic states that the weapon will spend the most time in)
Определения Crossbow.c:27
represent weapon state base
Определения BulletHide.c:2
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
ErrorExSeverity
Определения EnDebug.c:62
enum ShapeType ErrorEx
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
proto native void OnUpdate()
Определения 3_Game/tools/tools.c:349