DayZ 1.24
Loading...
Searching...
No Matches
StaminaConsumers Class Reference

Protected Member Functions

void StaminaConsumers ()
 
void RegisterConsumer (EStaminaConsumers consumer, float threshold, float depletion_threshold=-1)
 
bool HasEnoughStaminaFor (EStaminaConsumers consumer, float curStamina, bool isDepleted, float cap)
 
bool HasEnoughStaminaToStart (EStaminaConsumers consumer, float curStamina, bool isDepleted, float cap)
 

Protected Attributes

ref map< EStaminaConsumers, ref StaminaConsumerm_StaminaConsumers
 

Detailed Description

Definition at line 39 of file StaminaHandler.c.

Constructor & Destructor Documentation

◆ StaminaConsumers()

void StaminaConsumers::StaminaConsumers ( )
inlineprotected

Definition at line 43 of file StaminaHandler.c.

44 {
46 }
ref map< EStaminaConsumers, ref StaminaConsumer > m_StaminaConsumers

References m_StaminaConsumers.

Member Function Documentation

◆ HasEnoughStaminaFor()

bool StaminaConsumers::HasEnoughStaminaFor ( EStaminaConsumers consumer,
float curStamina,
bool isDepleted,
float cap )
inlineprotected

Definition at line 61 of file StaminaHandler.c.

62 {
64 {
66
67 if (consumer != EStaminaConsumers.SPRINT)
68 {
69 if ((isDepleted || (curStamina < sc.GetDrainThreshold()/* && curStamina < cap*/)))
70 {
71 sc.SetState(false);
72 return false;
73 }
74 }
75 else
76 {
77 if (!isDepleted)
78 {
79 if (sc.GetState())
80 {
81 sc.SetState(true);
82 return true;
83 }
84 }
85 else
86 {
87 sc.SetState(false);
88 return false;
89 }
90 }
91
92 if (curStamina > sc.GetDrainThreshold() || curStamina == cap) //Sometimes player can't go up to drain threshold
93 {
94 sc.SetState(true);
95 return true;
96 }
97 }
98
99 return false;
100 }
EStaminaConsumers
void StaminaConsumer(float threshold, float threshold2, bool state)

References m_StaminaConsumers, and StaminaConsumer().

◆ HasEnoughStaminaToStart()

bool StaminaConsumers::HasEnoughStaminaToStart ( EStaminaConsumers consumer,
float curStamina,
bool isDepleted,
float cap )
inlineprotected

Definition at line 102 of file StaminaHandler.c.

103 {
105 {
107
108 if ((isDepleted || (curStamina < sc.GetActivationThreshold() && curStamina < cap)))
109 {
110 sc.SetState(false);
111 return false;
112 }
113 else
114 {
115 sc.SetState(true);
116 return true;
117 }
118 }
119
120 return false;
121 }

References m_StaminaConsumers, and StaminaConsumer().

◆ RegisterConsumer()

void StaminaConsumers::RegisterConsumer ( EStaminaConsumers consumer,
float threshold,
float depletion_threshold = -1 )
inlineprotected

init of StaminaConsumer - threshold, state

Definition at line 48 of file StaminaHandler.c.

References m_StaminaConsumers, and StaminaConsumer().

Member Data Documentation

◆ m_StaminaConsumers

ref map<EStaminaConsumers, ref StaminaConsumer> StaminaConsumers::m_StaminaConsumers
protected

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