DayZ 1.24
Loading...
Searching...
No Matches
DayZPlayerImplementThrowing Class Reference
Collaboration diagram for DayZPlayerImplementThrowing:
[legend]

Private Member Functions

void DayZPlayerImplementThrowing (DayZPlayer pPlayer)
 
void HandleThrowing (HumanInputController pHic, HumanCommandWeapons pHcw, EntityAI pEntityInHands, float pDt)
 
void ResetState ()
 
void SetThrowingModeEnabled (bool enable)
 
bool IsThrowingModeEnabled ()
 
bool IsThrowingInProgress ()
 Throwing wind-up only (button hold)
 
bool IsThrowingAnimationPlaying ()
 Throwing animation after button release.
 
bool CanChangeThrowingStance (HumanInputController pHic)
 
bool CanContinueThrowing (HumanInputController pHic)
 
bool CanContinueThrowingEx (HumanInputController pHic, EntityAI pEntityInHands)
 
bool CheckFreeSpace ()
 

Private Attributes

DayZPlayer m_Player
 
bool m_bThrowingModeEnabled
 
bool m_bThrowingInProgress
 
bool m_bThrowingAnimationPlaying
 
float m_fThrowingForce01
 
const float c_fThrowingForceMin = 20.0
 
const float c_fThrowingForceMax = 90.0
 
const float c_fThrowingForceCoef = 1.0
 

Detailed Description

Definition at line 1 of file DayZPlayerImplementThrowing.c.

Constructor & Destructor Documentation

◆ DayZPlayerImplementThrowing()

void DayZPlayerImplementThrowing::DayZPlayerImplementThrowing ( DayZPlayer pPlayer)
inlineprivate

Member Function Documentation

◆ CanChangeThrowingStance()

bool DayZPlayerImplementThrowing::CanChangeThrowingStance ( HumanInputController pHic)
inlineprivate

Definition at line 149 of file DayZPlayerImplementThrowing.c.

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 }

References CheckFreeSpace(), and m_Player.

Referenced by HandleThrowing().

◆ CanContinueThrowing()

bool DayZPlayerImplementThrowing::CanContinueThrowing ( HumanInputController pHic)
inlineprivate

Definition at line 194 of file DayZPlayerImplementThrowing.c.

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 }

References CheckFreeSpace(), and m_Player.

Referenced by CanContinueThrowingEx().

◆ CanContinueThrowingEx()

bool DayZPlayerImplementThrowing::CanContinueThrowingEx ( HumanInputController pHic,
EntityAI pEntityInHands )
inlineprivate

Definition at line 210 of file DayZPlayerImplementThrowing.c.

211 {
212 if (pEntityInHands == null)
213 return false;
214
216 }
bool CanContinueThrowing(HumanInputController pHic)

References CanContinueThrowing().

Referenced by HandleThrowing().

◆ CheckFreeSpace()

bool DayZPlayerImplementThrowing::CheckFreeSpace ( )
inlineprivate

Definition at line 218 of file DayZPlayerImplementThrowing.c.

219 {
220 return m_Player.CheckFreeSpace(vector.Forward, 0.7, false);
221 }
static const vector Forward
Definition EnConvert.c:109

References vector::Forward, and m_Player.

Referenced by CanChangeThrowingStance(), and CanContinueThrowing().

◆ HandleThrowing()

void DayZPlayerImplementThrowing::HandleThrowing ( HumanInputController pHic,
HumanCommandWeapons pHcw,
EntityAI pEntityInHands,
float pDt )
inlineprivate

current state

handle mode change

handle action

cancel throwing in case of raising hands or heavy item in hands

check event for throw

handle throw force

Definition at line 11 of file DayZPlayerImplementThrowing.c.

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 }
bool CanContinueThrowingEx(HumanInputController pHic, EntityAI pEntityInHands)
bool CanChangeThrowingStance(HumanInputController pHic)

References c_fThrowingForceCoef, c_fThrowingForceMax, c_fThrowingForceMin, CanChangeThrowingStance(), CanContinueThrowingEx(), m_bThrowingAnimationPlaying, m_bThrowingInProgress, m_bThrowingModeEnabled, m_fThrowingForce01, m_Player, ResetState(), and SetThrowingModeEnabled().

◆ IsThrowingAnimationPlaying()

bool DayZPlayerImplementThrowing::IsThrowingAnimationPlaying ( )
inlineprivate

Throwing animation after button release.

Definition at line 144 of file DayZPlayerImplementThrowing.c.

145 {
147 }

References m_bThrowingAnimationPlaying.

Referenced by ActionPossibilityCheck().

◆ IsThrowingInProgress()

bool DayZPlayerImplementThrowing::IsThrowingInProgress ( )
inlineprivate

Throwing wind-up only (button hold)

Definition at line 138 of file DayZPlayerImplementThrowing.c.

139 {
141 }

References m_bThrowingInProgress.

◆ IsThrowingModeEnabled()

bool DayZPlayerImplementThrowing::IsThrowingModeEnabled ( )
inlineprivate

Definition at line 132 of file DayZPlayerImplementThrowing.c.

133 {
135 }

References m_bThrowingModeEnabled.

Referenced by CanPlayEmote().

◆ ResetState()

void DayZPlayerImplementThrowing::ResetState ( )
inlineprivate

◆ SetThrowingModeEnabled()

void DayZPlayerImplementThrowing::SetThrowingModeEnabled ( bool enable)
inlineprivate

Definition at line 125 of file DayZPlayerImplementThrowing.c.

126 {
128 m_Player.OnThrowingModeChange(enable);
130 }

References m_bThrowingModeEnabled, and m_Player.

Referenced by DayZPlayerImplementThrowing(), and HandleThrowing().

Member Data Documentation

◆ c_fThrowingForceCoef

const float DayZPlayerImplementThrowing::c_fThrowingForceCoef = 1.0
private

Definition at line 231 of file DayZPlayerImplementThrowing.c.

Referenced by HandleThrowing().

◆ c_fThrowingForceMax

const float DayZPlayerImplementThrowing::c_fThrowingForceMax = 90.0
private

Definition at line 230 of file DayZPlayerImplementThrowing.c.

Referenced by HandleThrowing().

◆ c_fThrowingForceMin

const float DayZPlayerImplementThrowing::c_fThrowingForceMin = 20.0
private

Definition at line 229 of file DayZPlayerImplementThrowing.c.

Referenced by HandleThrowing().

◆ m_bThrowingAnimationPlaying

bool DayZPlayerImplementThrowing::m_bThrowingAnimationPlaying
private

◆ m_bThrowingInProgress

bool DayZPlayerImplementThrowing::m_bThrowingInProgress
private

Definition at line 225 of file DayZPlayerImplementThrowing.c.

Referenced by HandleThrowing(), IsThrowingInProgress(), and ResetState().

◆ m_bThrowingModeEnabled

bool DayZPlayerImplementThrowing::m_bThrowingModeEnabled
private

◆ m_fThrowingForce01

float DayZPlayerImplementThrowing::m_fThrowingForce01
private

Definition at line 227 of file DayZPlayerImplementThrowing.c.

Referenced by HandleThrowing(), and ResetState().

◆ m_Player


The documentation for this class was generated from the following file: