DayZ 1.30
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

bad transition: prone-on-back -> crouch/stand while throw wind-up is active

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

12 {
13 if ( !pEntityInHands && !m_bThrowingAnimationPlaying )
14 {
16 {
17 CancelThrowing(pHic, pHcw);
18 }
19
20 return;
21 }
22
25
28 {
29 ResetState();
30
31 pHcw.SetActionProgressParams(0, 0);
33 }
34
37 {
39
40 if ( !CanContinueThrowingEx(pHic, pEntityInHands) )
41 {
42 CancelThrowing(pHic, pHcw);
43 return;
44 }
45
47 if ( pHcw.WasItemLeaveHandsEvent() )
48 {
49 float lr = pHcw.GetBaseAimingAngleLR();
50 float ud = pHcw.GetBaseAimingAngleUD();
51 vector aimOrientation = m_Player.GetOrientation();
52 aimOrientation[0] = aimOrientation[0] + lr;
53
54 //add 5 deg
55 aimOrientation[1] = aimOrientation[1] + ud + 5;
56
57 //clear inventoy reservation in case item is reserved (e.g. action was executed on this player)
58 InventoryLocation loc = new InventoryLocation;
59 pEntityInHands.GetInventory().GetCurrentInventoryLocation(loc);
60 m_Player.GetInventory().ClearInventoryReservationEx(pEntityInHands, loc);
61
62 m_Player.GetHumanInventory().ThrowEntity(pEntityInHands, aimOrientation.AnglesToVector(), c_fThrowingForceMin + m_fThrowingForce01 * (c_fThrowingForceMax - c_fThrowingForceMin));
63 return;
64 }
65
68 {
69 if ( pHic.IsAttackButton() )
70 {
73
75 if ( m_fThrowingForce01 > 1.0 )
77
79 }
80 else
81 {
82 HumanCommandMove hcm = m_Player.GetCommand_Move();
83 bool standingFromBack = hcm && hcm.IsStandingFromBack();
84
86 if (m_bThrowingInProgress && standingFromBack)
87 {
88 CancelThrowing(pHic, pHcw);
89 return;
90 }
91
93 {
95
96 int throwType = 1;
97
98 HumanItemBehaviorCfg itemCfg = m_Player.GetItemAccessor().GetItemInHandsBehaviourCfg();
99 itemCfg = m_Player.GetItemAccessor().GetItemInHandsBehaviourCfg();
100 if ( itemCfg )
101 {
102 switch ( itemCfg.m_iType )
103 {
104 case ItemBehaviorType.TWOHANDED:
105 case ItemBehaviorType.POLEARMS:
106 throwType = 2;
107 break;
108 case ItemBehaviorType.FIREARMS:
109 throwType = 3;
110 }
111 }
112
113 pHcw.ThrowItem(throwType);
115 }
116 }
117 }
118 }
119 else
120 {
121 ResetState();
122 }
123 }
bool CanContinueThrowingEx(HumanInputController pHic, EntityAI pEntityInHands)
Определения DayZPlayerImplementThrowing.c:242
void SetThrowingModeEnabled(bool enable)
Определения DayZPlayerImplementThrowing.c:149
const float c_fThrowingForceCoef
Определения DayZPlayerImplementThrowing.c:263
const float c_fThrowingForceMin
Определения DayZPlayerImplementThrowing.c:261
bool CanChangeThrowingStance(HumanInputController pHic)
Определения DayZPlayerImplementThrowing.c:175
void CancelThrowing(HumanInputController pHic, HumanCommandWeapons pHcw)
Определения DayZPlayerImplementThrowing.c:125
const float c_fThrowingForceMax
Определения DayZPlayerImplementThrowing.c:262
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:534

Перекрестные ссылки vector::AnglesToVector(), c_fThrowingForceCoef, c_fThrowingForceMax, c_fThrowingForceMin, CancelThrowing(), 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().