DayZ 1.24
Loading...
Searching...
No Matches
DayZPlayerImplementThrowing.c
Go to the documentation of this file.
2{
10
12 {
14 {
16 {
18 pHcw.SetThrowingMode(false);
19 }
20
21 return;
22 }
23
25 SetThrowingModeEnabled(pHcw.IsThrowingMode());
26
28 if (pHic.IsThrowingModeChange() && CanChangeThrowingStance(pHic))
29 {
30 ResetState();
31
32 pHcw.SetActionProgressParams(0, 0);
33 pHcw.SetThrowingMode(!m_bThrowingModeEnabled);
34 }
35
38 {
40
42 {
44 ResetState();
45
46 pHcw.SetActionProgressParams(0, 0);
47 pHcw.SetThrowingMode(false);
48
49 return;
50 }
51
53 if (pHcw.WasItemLeaveHandsEvent())
54 {
55 float lr = pHcw.GetBaseAimingAngleLR();
56 float ud = pHcw.GetBaseAimingAngleUD();
57 vector aimOrientation = m_Player.GetOrientation();
59
60 //add 5 deg
61 aimOrientation[1] = aimOrientation[1] + ud + 5;
62
63
65 return;
66 }
67
70 {
71 if (pHic.IsAttackButton())
72 {
75
77 if (m_fThrowingForce01 > 1.0)
79
80 pHcw.SetActionProgressParams(m_fThrowingForce01, 0);
81 }
82 else
83 {
84 HumanCommandMove hcm = m_Player.GetCommand_Move();
85 bool standingFromBack = hcm && hcm.IsStandingFromBack();
86
88 {
90
91 int throwType = 1;
92
93 HumanItemBehaviorCfg itemCfg = m_Player.GetItemAccessor().GetItemInHandsBehaviourCfg();
94 itemCfg = m_Player.GetItemAccessor().GetItemInHandsBehaviourCfg();
95 if (itemCfg)
96 {
97 switch (itemCfg.m_iType)
98 {
99 case ItemBehaviorType.TWOHANDED:
100 case ItemBehaviorType.POLEARMS:
101 throwType = 2;
102 break;
103 case ItemBehaviorType.FIREARMS:
104 throwType = 3;
105 }
106 }
107
108 pHcw.ThrowItem(throwType);
110 }
111 }
112 }
113 }
114 else
115 ResetState();
116 }
117
119 {
121 m_bThrowingInProgress = false;
123 }
124
126 {
128 m_Player.OnThrowingModeChange(enable);
130 }
131
133 {
135 }
136
139 {
141 }
142
148
150 {
151 // basic stance has priority
152 if (pHic.IsStanceChange())
153 return false;
154
155 // don't change mode in raise
156 if (pHic.IsWeaponRaised())
157 return false;
158
159 // check if it's not a heavy item
160 HumanItemBehaviorCfg itemCfg = m_Player.GetItemAccessor().GetItemInHandsBehaviourCfg();
161 if (itemCfg && itemCfg.m_iType == ItemBehaviorType.HEAVY)
162 return false;
163
164 /* HumanMovementState movementState = new HumanMovementState();
165 m_Player.GetMovementState(movementState);
166 if( movementState.IsInProne() )
167 return false;*/
168
170 if (playerPB)
171 {
172 if (playerPB.GetEmoteManager().IsEmotePlaying())
173 return false;
174
175 if (playerPB.GetActionManager().GetRunningAction() != NULL)
176 return false;
177
178 if (playerPB.IsRestrained() || playerPB.IsItemsToDelete())
179 return false;
180
181 if (playerPB.GetDayZPlayerInventory().IsProcessing())
182 return false;
183
184 if (playerPB.GetWeaponManager().IsRunning())
185 return false;
186 }
187
188 if (!CheckFreeSpace())
189 return false;
190
191 return true;
192 }
193
195 {
196 HumanItemBehaviorCfg itemInHandsCfg = m_Player.GetItemAccessor().GetItemInHandsBehaviourCfg();
197 bool boo = false;
198 UAInterface input_interface = m_Player.GetInputInterface();
199 if (input_interface && input_interface.SyncedPress("UAGear"))
200 boo = true;
201 if (boo || pHic.IsWeaponRaised() || (itemInHandsCfg && itemInHandsCfg.m_iType == ItemBehaviorType.HEAVY))
202 return false;
203
204 if (!CheckFreeSpace())
205 return false;
206
207 return true;
208 }
209
211 {
212 if (pEntityInHands == null)
213 return false;
214
216 }
217
219 {
220 return m_Player.CheckFreeSpace(vector.Forward, 0.7, false);
221 }
222
227 private float m_fThrowingForce01;
228
229 private const float c_fThrowingForceMin = 20.0;
230 private const float c_fThrowingForceMax = 90.0;
231 private const float c_fThrowingForceCoef = 1.0;
232}
void DayZPlayerImplementThrowing(DayZPlayer pPlayer)
bool CanContinueThrowing(HumanInputController pHic)
bool CanContinueThrowingEx(HumanInputController pHic, EntityAI pEntityInHands)
bool CanChangeThrowingStance(HumanInputController pHic)
void HandleThrowing(HumanInputController pHic, HumanCommandWeapons pHcw, EntityAI pEntityInHands, float pDt)
bool IsThrowingInProgress()
Throwing wind-up only (button hold)
bool IsThrowingAnimationPlaying()
Throwing animation after button release.
static const vector Forward
Definition EnConvert.c:109