DayZ 1.28
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ 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

См. определение в файле DayZPlayerImplementThrowing.c строка 11

12 {
13 if ( !pEntityInHands && !m_bThrowingAnimationPlaying )
14 {
16 {
18 pHcw.SetThrowingMode(false);
19 }
20
21 return;
22 }
23
26
29 {
30 ResetState();
31
32 pHcw.SetActionProgressParams(0, 0);
34 }
35
38 {
40
41 if ( !CanContinueThrowingEx(pHic, pEntityInHands) )
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();
58 aimOrientation[0] = aimOrientation[0] + lr;
59
60 //add 5 deg
61 aimOrientation[1] = aimOrientation[1] + ud + 5;
62
63 //clear inventoy reservation in case item is reserved (e.g. action was executed on this player)
64 InventoryLocation loc = new InventoryLocation;
65 pEntityInHands.GetInventory().GetCurrentInventoryLocation(loc);
66 m_Player.GetInventory().ClearInventoryReservationEx(pEntityInHands, loc);
67
68 m_Player.GetHumanInventory().ThrowEntity(pEntityInHands, aimOrientation.AnglesToVector(), c_fThrowingForceMin + m_fThrowingForce01 * (c_fThrowingForceMax - c_fThrowingForceMin));
69 return;
70 }
71
74 {
75 if ( pHic.IsAttackButton() )
76 {
79
81 if ( m_fThrowingForce01 > 1.0 )
83
85 }
86 else
87 {
88 HumanCommandMove hcm = m_Player.GetCommand_Move();
89 bool standingFromBack = hcm && hcm.IsStandingFromBack();
90
91 if ( m_bThrowingInProgress && !standingFromBack)
92 {
94
95 int throwType = 1;
96
97 HumanItemBehaviorCfg itemCfg = m_Player.GetItemAccessor().GetItemInHandsBehaviourCfg();
98 itemCfg = m_Player.GetItemAccessor().GetItemInHandsBehaviourCfg();
99 if ( itemCfg )
100 {
101 switch ( itemCfg.m_iType )
102 {
103 case ItemBehaviorType.TWOHANDED:
104 case ItemBehaviorType.POLEARMS:
105 throwType = 2;
106 break;
107 case ItemBehaviorType.FIREARMS:
108 throwType = 3;
109 }
110 }
111
112 pHcw.ThrowItem(throwType);
114 }
115 }
116 }
117 }
118 else
119 {
120 ResetState();
121 }
122 }
bool CanContinueThrowingEx(HumanInputController pHic, EntityAI pEntityInHands)
Определения DayZPlayerImplementThrowing.c:222
void SetThrowingModeEnabled(bool enable)
Определения DayZPlayerImplementThrowing.c:131
const float c_fThrowingForceCoef
Определения DayZPlayerImplementThrowing.c:243
const float c_fThrowingForceMin
Определения DayZPlayerImplementThrowing.c:241
bool CanChangeThrowingStance(HumanInputController pHic)
Определения DayZPlayerImplementThrowing.c:157
const float c_fThrowingForceMax
Определения DayZPlayerImplementThrowing.c:242
proto native bool IsStandingFromBack()
return true if prone on back is chaning to crounch/stand
proto native bool WasItemLeaveHandsEvent()
proto native void SetThrowingMode(bool pState)
proto native void SetActionProgressParams(float pStart, float pEnd)
sets start and end animation position - f.e. for reload clip action
proto native bool IsThrowingMode()
proto native float GetBaseAimingAngleLR()
returns base aiming angle LR - without sway/offsets/...
proto native void ThrowItem(int throwType)
proto native float GetBaseAimingAngleUD()
returns base aiming angle UD - without sway/offsets/...
proto native bool IsAttackButton()
returns true if 'UAFire' button is pressed (== true for multiple ticks). Synced.
proto native bool IsThrowingModeChange()
returns true if change of throwing mode has been requested
int m_iType
Определения humanitems.c:15
proto vector AnglesToVector()
Converts spherical coordinates (yaw, pitch, roll in degrees) to unit length vector.
void HumanCommandMove()
Определения human.c:514

Перекрестные ссылки vector::AnglesToVector(), c_fThrowingForceCoef, c_fThrowingForceMax, c_fThrowingForceMin, CanChangeThrowingStance(), CanContinueThrowingEx(), HumanCommandWeapons::GetBaseAimingAngleLR(), HumanCommandWeapons::GetBaseAimingAngleUD(), HumanInputController::IsAttackButton(), HumanCommandMove::IsStandingFromBack(), HumanCommandWeapons::IsThrowingMode(), HumanInputController::IsThrowingModeChange(), m_bThrowingAnimationPlaying, m_bThrowingInProgress, m_bThrowingModeEnabled, m_fThrowingForce01, HumanItemBehaviorCfg::m_iType, m_Player, ResetState(), HumanCommandWeapons::SetActionProgressParams(), HumanCommandWeapons::SetThrowingMode(), SetThrowingModeEnabled(), HumanCommandWeapons::ThrowItem() и HumanCommandWeapons::WasItemLeaveHandsEvent().