DayZ 1.24
Loading...
Searching...
No Matches
DayZPlayerImplementJumpClimb.c
Go to the documentation of this file.
2{
7
10 {
12 }
13
16 {
18 m_bWasClimb = false;
19
21 if (m_Player.IsInFullbodyDamageAnimation())
22 return;
23
24 SHumanCommandClimbSettings hcls = m_Player.GetDayZPlayerType().CommandClimbSettingsW();
25
26 if (m_Player.m_MovementState.m_iMovement != DayZPlayerConstants.MOVEMENTIDX_IDLE)
27 hcls.m_fFwMaxDistance = 2.5;
28 else
29 hcls.m_fFwMaxDistance = 1.2;
30
32
34 if (climbRes.m_bIsClimb || climbRes.m_bIsClimbOver)
35 {
36 int climbType = GetClimbType(climbRes.m_fClimbHeight);
37
38 if (!m_Player.CanClimb(climbType, climbRes))
39 return;
40
41 if (Climb(climbRes))
42 {
43 if (climbType == 1)
44 m_Player.DepleteStamina(EStaminaModifiers.VAULT);
45 else if (climbType == 2)
46 m_Player.DepleteStamina(EStaminaModifiers.CLIMB);
47
48 return;
49 }
50 }
51
52 if (m_Player.CanJump())
53 {
54 Jump();
55 m_Player.DepleteStamina(EStaminaModifiers.JUMP);
56 }
57 }
58
60 {
62 {
63 m_bIsJumpInProgress = false;
64 m_Player.OnJumpEnd(pLandType);
65 }
66 }
67
69 {
70 int climbType = GetClimbType(pClimbRes.m_fClimbHeight);
71 if (climbType != -1)
72 {
73 m_Player.StartCommand_Climb(pClimbRes, climbType);
74 m_Player.StopHandEvent();
75
76 m_bWasClimb = true;
77 }
78
79 return climbType != -1;
80 }
81
82 private void Jump()
83 {
85 m_Player.SetFallYDiff(m_Player.GetPosition()[1]);
86
87 m_Player.OnJumpStart();
88 m_Player.StartCommand_Fall(2.6);
89 m_Player.StopHandEvent();
90 }
91
92 private int GetClimbType(float pHeight)
93 {
94 int climbType = -1;
95 if (pHeight < 1.1)
96 climbType = 0;
97 else if (pHeight >= 1.1 && pHeight < 1.7)
98 climbType = 1;
99 else if (pHeight >= 1.7 && pHeight < 2.75)
100 climbType = 2;
101
102 return climbType;
103 }
104
105 // Public variable members
107
108 // Private variable members
110 private bool m_bWasClimb;
111}
EStaminaModifiers
void JumpOrClimb()
Can't change to bool return.
void DayZPlayerImplementJumpClimb(DayZPlayerImplement pPlayer)
bool WasSuccessful()
Only valid immediately after 'JumpOrClimb' is called.
bool Climb(SHumanCommandClimbResult pClimbRes)
command itself
Definition human.c:761
proto static native bool DoClimbTest(Human pHuman, SHumanCommandClimbResult pResult, int pDebugDrawLevel)
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
class SHumanCommandSwimSettings SHumanCommandClimbSettings()