DayZ 1.24
Loading...
Searching...
No Matches
StaminaHandler.c
Go to the documentation of this file.
8
9
17{
18 protected float m_ActivationThreshold;
19 protected float m_DrainThreshold
20 protected bool m_State;
21
22 void StaminaConsumer(float threshold, float threshold2, bool state)
23 {
24 m_ActivationThreshold = threshold; //can be activated if above this threshold
25 m_DrainThreshold = threshold2; //can continually drain until it reaches this threshold
26 m_State = state;
27 }
28
29 bool GetState() { return m_State; }
30 void SetState(bool state) { m_State = state; }
31
34
37}
38
40{
42
47
60
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 }
101
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 }
122}
123
124
133class StaminaModifier
134{
135 bool m_InUse = false;
138
139 void StaminaModifier(int type, float min, float max, float cooldown, float startTime = 0, float duration = 0)
140 {
141 m_Type = type;
142 m_MinValue = min;
143 m_MaxValue = max;
147 m_Tick = 1;
148 }
149
150 int GetType() { return m_Type; }
151
152 float GetMinValue() { return m_MinValue; }
153 void SetMinValue(float val) { m_MinValue = val; }
154
155 float GetMaxValue() { return m_MaxValue; }
156 void SetMaxValue(float val) { m_MaxValue = val; }
157
158 float GetCooldown() { return m_Cooldown; }
159 void SetCooldown(float val) { m_Cooldown = val; }
160
161 float GetStartTime() { return m_StartTime; } //Actual game time (progressive modifiers only)
162 void SetStartTime(float val) { m_StartTime = val; }
163
164 float GetStartTimeAdjustment() {return m_StartTimeAdjustment;} //adjustment to current time (progressive modifiers only)
165
166 float GetDuration() { return m_Duration; }
168
169 bool IsInUse() { return m_InUse; }
170 void SetInUse(bool val) { m_InUse = val; }
171
172 float GetRunTime() { return m_ProgressTime; }
173 void AddRunTime(float val) { m_ProgressTime += val; }
174 void SetRunTimeTick(float val) { m_Tick = val; }
176}
177
178class StaminaModifierExponential : StaminaModifier
179{
180 protected ref SMDataExponential m_SMDataEx;
181
182 float GetBaseValue() { return m_SMDataEx.m_BaseValue; }
183 float GetExponent() { return m_SMDataEx.m_Exponent; }
184 float GetMultiplier() { return m_SMDataEx.m_Multiplier; }
185 override float GetCooldown() { return m_SMDataEx.m_Cooldown; }
186 override float GetStartTimeAdjustment() { return m_SMDataEx.m_StartTimeAdjustment; }
187 override float GetDuration() { return m_SMDataEx.m_Duration; }
188 override float GetDurationAdjusted() { return m_SMDataEx.m_Duration / m_Tick; }
189
190 void SetData(SMDataExponential data) { m_SMDataEx = data; }
191}
192
194{
195 const int FIXED = 0;
196 const int RANDOMIZED = 1;
197 const int LINEAR = 2; //Useful ONLY for regular, over-time stamina drain
198 const int EXPONENTIAL = 3; //Useful ONLY for regular, over-time stamina drain
199
201
206
209 {
210 if (!m_StaminaModifiers.Contains(modifier))
211 {
213 StaminaModifier sm = new StaminaModifier(FIXED, -1, value, cooldown);
215 }
216 }
217
228
235
242
245 {
246 StaminaModifierExponential smex = new StaminaModifierExponential(EXPONENTIAL, data.m_BaseValue, data.m_Exponent, data.m_Cooldown, data.m_StartTimeAdjustment, data.m_Duration);
247 smex.SetData(data);
249 }
250
252 {
253 return m_StaminaModifiers.Get(modifier);
254 }
255}
256
257
259{
260 protected float m_PlayerLoad;
261 protected float m_StaminaDelta;
262 protected float m_Stamina;
263 protected float m_StaminaSynced; //guaranteed to be identical on server and client
264 protected float m_StaminaCap;
265 protected float m_StaminaDepletion;
266 protected float m_StaminaDepletionMultiplier; //controls depletion rate
267 protected float m_StaminaRecoveryMultiplier; //controls recovery rate
268 protected float m_Time;
273
274 protected bool m_Debug;
275 protected bool m_StaminaDepleted;
276
280
283
284 protected bool m_IsInCooldown;
285
288
289#ifdef DIAG_DEVELOPER
290 protected bool m_StaminaDisabled;
291#endif
292
294 {
295 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
297
305 m_Time = 0;
306 m_StaminaDepleted = false;
307 m_IsInCooldown = false;
308 m_HumanMoveSettings = m_Player.GetDayZPlayerType().CommandMoveSettingsW();
309
312
314
315 //----------------- depletion --------------------
318
319 //----------------- recovery --------------------
322
323 Init();
324 }
325
326
340
342 {
343 if (m_RegisteredDepletionModifiers.Contains(type))
344 {
345 m_ActiveDepletionModifiers.Insert(type);
347 }
348 else
349 Error("attempting to activate unregistered depletion modifier");
350 }
351
353 {
354 int index = m_ActiveDepletionModifiers.Find(type);
355 if (index != -1)
356 {
359 }
360 }
361
372
374 {
375 if (m_RegisteredRecoveryModifiers.Contains(type))
376 {
377 m_ActiveRecoveryModifiers.Insert(type);
379 }
380 else
381 Error("attempting to activate unregistered recovery modifier");
382 }
383
384
386 {
387 int index = m_ActiveRecoveryModifiers.Find(type);
388 if (index != -1)
389 {
392 }
393 }
394
405
407 {
408#ifdef DIAG_DEVELOPER
410 return;
411#endif
412 if (m_Player)
413 {
414 // Calculates actual max stamina based on player's load
415 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
416 {
418 m_PlayerLoad = m_Player.GetWeightEx();
419
423 else
425 }
426
427 // Calculates stamina gain/loss based on movement and load
428 m_Player.GetMovementState(m_State);
429
430 switch (m_State.m_CommandTypeId)
431 {
432 case DayZPlayerConstants.COMMANDID_MOVE:
434 break;
435 case DayZPlayerConstants.COMMANDID_LADDER:
437 break;
438 case DayZPlayerConstants.COMMANDID_SWIM:
440 break;
441 case DayZPlayerConstants.COMMANDID_FALL:
442 case DayZPlayerConstants.COMMANDID_MELEE2:
443 case DayZPlayerConstants.COMMANDID_CLIMB:
444 break;
445 default:
446 if (!m_IsInCooldown)
448 break;
449 }
450
451 //Sets current stamina & stores + syncs data with client
452 float temp = m_StaminaDelta * deltaT;
453 if (temp < 0)
455 else
457
460
461 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
462 {
463 m_Player.GetStatStamina().Set(m_Stamina);
464 m_Time += deltaT;
465
467 {
468 m_Time = 0;
470 }
471 }
472
473#ifndef SERVER
475#endif
476
479
480 m_StaminaDelta = 0;
481 m_StaminaDepletion = 0; // resets depletion modifier
482
483 }
484 }
485
487 void OnRPC(float stamina, float stamina_cap, bool cooldown)
488 {
489 }
490
493 {
494 switch (pJunctureID)
495 {
497 float stamina;
498 float stamina_cap;
499 bool cooldown;
500
501 if (!pCtx.Read(stamina) || !pCtx.Read(stamina_cap) || !pCtx.Read(cooldown))
502 return;
503
504 m_Stamina = stamina; //?
506
507 if (m_Player.GetInstanceType() != DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
508 return;
509
512
514 m_Player.SetStamina(m_Stamina, m_StaminaCap);
515 break;
516
519 break;
520 }
521 }
522
524 {
525 switch (pHumanMovementState.m_iMovement)
526 {
527 case DayZPlayerConstants.MOVEMENTIDX_SPRINT: //sprint
528 if (pHumanMovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_ERECT)
529 {
532 break;
533 }
534 else if (pHumanMovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_CROUCH)
535 {
538 break;
539 }
540
542 break;
543
544 case DayZPlayerConstants.MOVEMENTIDX_RUN: //jog
545 if (m_Player.GetCurrentWaterLevel() >= m_HumanMoveSettings.m_fWaterLevelSpeedRectrictionHigh)
546 {
548 break;
549 }
550
551 if (!m_IsInCooldown)
553 break;
554
555 case DayZPlayerConstants.MOVEMENTIDX_WALK: //walk
556 if (!m_IsInCooldown)
558 break;
559
560 case DayZPlayerConstants.MOVEMENTIDX_IDLE: //idle
561 if (m_Player.IsRolling())
562 {
564 break;
565 }
566
567 if (!m_IsInCooldown)
569 break;
570
571 default:
572 if (!m_IsInCooldown)
574 break;
575 }
576 }
577
598
620
622 protected void SyncStamina(float stamina, float stamina_cap, bool cooldown)
623 {
624 m_Player.GetStatStamina().Set(m_Stamina);
626 pCtx.Write(m_Stamina);
627 pCtx.Write(m_StaminaCap);
628 pCtx.Write(m_IsInCooldown);
630 }
631
634 {
636
638 pCtx.Write(p.param1);
639 pCtx.Write(p.param2);
641 }
642
654
656 {
658
659 m_StaminaConsumers.RegisterConsumer(
660 EStaminaConsumers.HOLD_BREATH,
663 );
664 m_StaminaConsumers.RegisterConsumer(
665 EStaminaConsumers.SPRINT,
667 );
668 m_StaminaConsumers.RegisterConsumer(
671 );
672 m_StaminaConsumers.RegisterConsumer(
673 EStaminaConsumers.VAULT,
675 );
676 m_StaminaConsumers.RegisterConsumer(
677 EStaminaConsumers.CLIMB,
679 );
680 m_StaminaConsumers.RegisterConsumer(
681 EStaminaConsumers.MELEE_HEAVY,
683 );
684 m_StaminaConsumers.RegisterConsumer(
685 EStaminaConsumers.MELEE_EVADE,
687 );
688 m_StaminaConsumers.RegisterConsumer(
691 );
692 m_StaminaConsumers.RegisterConsumer(EStaminaConsumers.DROWN, 0);
693 m_StaminaConsumers.RegisterConsumer(EStaminaConsumers.PUSH, 0);
694 }
695
697 {
699
701 m_StaminaModifiers.RegisterExponentialEx(
702 EStaminaModifiers.HOLD_BREATH,
703 data,
704 );
705 m_StaminaModifiers.RegisterExponentialEx(
706 EStaminaModifiers.PUSH_CAR,
707 data,
708 );
709 m_StaminaModifiers.RegisterFixed(EStaminaModifiers.DROWN, 10);
710 m_StaminaModifiers.RegisterFixed(
713 );
714 m_StaminaModifiers.RegisterFixed(
715 EStaminaModifiers.VAULT,
717 );
718 m_StaminaModifiers.RegisterFixed(
719 EStaminaModifiers.CLIMB,
721 );
722 m_StaminaModifiers.RegisterFixed(
723 EStaminaModifiers.MELEE_LIGHT,
725 );
726 m_StaminaModifiers.RegisterFixed(
727 EStaminaModifiers.MELEE_HEAVY,
729 );
730 m_StaminaModifiers.RegisterFixed(
731 EStaminaModifiers.OVERALL_DRAIN,
733 5.0,
734 );
735 m_StaminaModifiers.RegisterRandomized(
736 EStaminaModifiers.MELEE_EVADE,
739 );
741 }
742
744 protected float CalcStaminaGainBonus()
745 {
746 if (m_StaminaDepletion > 0)
747 return 0;
748
749 if (m_Stamina > 25)
750 return Math.Min((m_Stamina / 10), GameConstants.STAMINA_GAIN_BONUS_CAP); // exp version
751 else
752 return GameConstants.STAMINA_GAIN_BONUS_CAP; // linear version
753 }
754
755 protected void ApplyExhaustion()
756 {
758 HumanCommandAdditives ad = m_Player.GetCommandModifier_Additives();
759
760 float exhaustion_value = 1;
761 if (m_StaminaCap != 0)
762 exhaustion_value = 1 - ((m_Stamina / (m_StaminaCap * 0.01)) * 0.01);
763
765 if (ad)
766 {
767 // do not apply exhaustion on local client if player is in ADS/Optics (camera shakes)
768 if (m_Player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT && (m_Player.IsInOptics() || m_Player.IsInIronsights()))
769 ad.SetExhaustion(0, true);
770 else
771 ad.SetExhaustion(exhaustion_value, true);
772 }
773 }
774
776 protected void CheckStaminaState()
777 {
778 if (m_Stamina <= 0)
779 {
780 m_StaminaDepleted = true;
782 if (!m_IsInCooldown)
783 {
784 // set this only once
786 }
787 }
788 else
789 m_StaminaDepleted = false;
790 }
791
793 protected void SetCooldown(float time, int modifier = -1)
794 {
795 if (m_StaminaDepleted || m_Stamina <= 0.0)
796 {
798 return;
799 }
800
801 m_IsInCooldown = true;
802
803 Timer timer;
804 if (m_TimerMap.Find(modifier, timer) && timer.IsRunning())
805 timer.Stop();
806 else
807 {
808 timer = new ref Timer;
810 }
811 timer.Run(time, this, "ResetCooldown", new Param1<int>(modifier));
812 //Print(m_TimerMap.Count());
813 }
814
815 protected void ResetCooldown(int modifier = -1)
816 {
817 StaminaModifier sm = m_StaminaModifiers.GetModifierData(modifier);
818 if (sm)
819 {
820 //Print(modifier);
821 //Error("Error: No StaminaModifier found! | StaminaHandler | ResetCooldown");
822 sm.SetStartTime(-1);
823 sm.ResetRunTime();
824 sm.SetInUse(false);
825 }
826 m_IsInCooldown = false;
827 }
828
830 {
831
832 }
833
834 // ---------------------------------------------------
839
844
850
852 {
853 return m_Stamina;
854 }
855
857 {
858 return m_Stamina / GetStaminaMax();
859 }
860
862 {
863 return m_StaminaSynced;
864 }
865
867 {
868 return GetSyncedStamina() / GetStaminaMax();
869 }
870
872 {
873 return m_StaminaCap;
874 }
875
877 {
879 }
880
881 //obsolete, use ActivateDepletionModifier/DeactivateDepletionModifier instead
889 //obsolete, use ActivateRecoveryModifier/DeactivateRecoveryModifier instead
897
902
904 {
906 }
907
909 {
910#ifdef DIAG_DEVELOPER
912 return;
913#endif
914 float val = 0.0;
915 float current_time = m_Player.GetSimulationTimeStamp();
916 float valueProgress;
917 StaminaModifier sm = m_StaminaModifiers.GetModifierData(modifier);
918
919 // select by modifier type and drain stamina
920 switch (sm.GetType())
921 {
922 case m_StaminaModifiers.FIXED:
923 if (dT == -1)
924 dT = 1;
925 m_StaminaDepletion = m_StaminaDepletion + sm.GetMaxValue() * dT;
926
927 break;
928
929 case m_StaminaModifiers.RANDOMIZED:
930 val = Math.RandomFloat(sm.GetMinValue(), sm.GetMaxValue());
932
933 break;
934
935 case m_StaminaModifiers.LINEAR:
936 if (!sm.IsInUse())
937 {
938 sm.SetStartTime(current_time + sm.GetStartTimeAdjustment() / dT);
939 sm.SetRunTimeTick(dT);
940 sm.SetInUse(true);
941 }
942 valueProgress = Math.Clamp((current_time - sm.GetStartTime()) / sm.GetDurationAdjusted(), 0, 1);
943 val = Math.Lerp(sm.GetMinValue(), sm.GetMaxValue(), valueProgress);
945
946 break;
947
948 case m_StaminaModifiers.EXPONENTIAL:
950 if (!Class.CastTo(smex, sm))
951 {
952 ErrorEx("StaminaModifierExponential not found for modifier type: " + sm.GetType());
953 break;
954 }
955
956 if (!smex.IsInUse())
957 {
958 smex.SetStartTime(current_time + smex.GetStartTimeAdjustment() / dT);
959 smex.SetRunTimeTick(dT);
960 smex.SetInUse(true);
961 }
962 valueProgress = Math.Clamp((current_time - smex.GetStartTime()) / smex.GetDurationAdjusted(), 0, 1);
963 float exp;
964 if (Math.AbsFloat(smex.GetBaseValue()) < 1)
965 {
966 exp = 1 - Math.Lerp(0, smex.GetExponent(), valueProgress);
967 val = Math.Pow(smex.GetBaseValue(), exp);
968 }
969 else
970 {
971 exp = Math.Lerp(Math.Min(0, smex.GetExponent()), Math.Max(0, smex.GetExponent()), valueProgress);
972 val = Math.Pow(smex.GetBaseValue(), exp) + smex.GetBaseValue() - 1;
973 }
974
976 m_StaminaDepletion *= smex.GetMultiplier();
977
978 break;
979 }
980
982 SetCooldown(sm.GetCooldown(), modifier);
984
986 }
987
988#ifdef DIAG_DEVELOPER
989 void SetStaminaDisabled(bool value)
990 {
992 }
993#endif
994}
eBleedingSourceType m_Type
eBleedingSourceType GetType()
float m_Duration
EStaminaConsumers
EStaminaModifiers
void StaminaConsumer(float threshold, float threshold2, bool state)
const int RANDOMIZED
m_ActivationThreshold
EStaminaMultiplierTypes
DROWNING
float GetMinValue()
float m_MaxValue
void SetMaxValue(float val)
const int LINEAR
float m_ProgressTime
void StaminaModifier(int type, float min, float max, float cooldown, float startTime=0, float duration=0)
void RegisterLinear(EStaminaModifiers modifier, float startValue, float endValue, float startTime, float duration, float cooldown=GameConstants.STAMINA_REGEN_COOLDOWN_DEPLETION)
register lerped modifier - depletes stamina for startValue, and, after a startTime,...
void SetActivationThreshold(float threshold)
void ResetRunTime()
FATIGUE
float m_Tick
void SetStartTime(float val)
void SetInUse(bool val)
StaminaModifierExponential FIXED
m_InUse
void StaminaConsumers()
void SetDrainThreshold(float threshold)
float m_StartTimeAdjustment
void SetState(bool state)
ref map< EStaminaModifiers, ref StaminaModifier > m_StaminaModifiers
void RegisterExponentialEx(EStaminaModifiers modifier, SMDataExponential data)
register exponential modifier, extended parameters
float GetMaxValue()
float GetStartTimeAdjustment()
bool IsInUse()
float m_Multiplier
float m_StartTime
float GetDrainThreshold()
float m_MinValue
const int EXPONENTIAL
float GetActivationThreshold()
void SetRunTimeTick(float val)
bool m_State
void StaminaModifiers()
void SetMinValue(float val)
void RegisterExponential(EStaminaModifiers modifier, float startValue, float exponent, float startTime, float duration, float cooldown=GameConstants.STAMINA_REGEN_COOLDOWN_DEPLETION)
register exponential modifier - depletes stamina for startValue, and, after a startTime,...
void RegisterFixed(EStaminaModifiers modifier, float value, float cooldown=GameConstants.STAMINA_REGEN_COOLDOWN_DEPLETION)
register single value modifier - depletes stamina for that value
EPINEPHRINE
float GetStartTime()
void SetCooldown(float val)
StaminaModifier GetModifierData(EStaminaModifiers modifier)
MASK
float GetCooldown()
float GetDurationAdjusted()
float m_Cooldown
void AddRunTime(float val)
void RegisterRandomized(EStaminaModifiers modifier, float minValue, float maxValue, float cooldown=GameConstants.STAMINA_REGEN_COOLDOWN_DEPLETION)
register randomized modifier - stamina will be depleted by value between min and max value;
static float GetSprintLadderStaminaModifier()
static float GetStaminaKgToStaminaPercentPenalty()
static float GetStaminaMinCap()
static float GetSprintStaminaModifierCro()
static float GetSprintStaminaModifierErc()
static float GetObstacleTraversalStaminaModifier()
static float GetStaminaMax()
static float GetMeleeStaminaModifier()
static float GetSprintSwimmingStaminaModifier()
static float GetStaminaWeightLimitThreshold()
Super root of all classes in Enforce script.
Definition EnScript.c:11
static const float STAMINA_RECOVERY_MULTIPLIER
Definition Drowning.c:4
const float STAMINA_DEPLETION_MULTIPLIER
static const float STAMINA_DEPLETION_MULTIPLIER
Definition Fatigue.c:9
static const float STAMINA_RECOVERY_MULTIPLIER
Definition Fatigue.c:8
Definition Mask.c:2
const float STAMINA_RECOVERY_MODIFIER
Definition Mask.c:6
const float STAMINA_DEPLETION_MODIFIER
Definition Mask.c:7
Definition EnMath.c:7
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
void RegisterConsumer(EStaminaConsumers consumer, float threshold, float depletion_threshold=-1)
ref map< EStaminaConsumers, ref StaminaConsumer > m_StaminaConsumers
bool HasEnoughStaminaToStart(EStaminaConsumers consumer, float curStamina, bool isDepleted, float cap)
bool HasEnoughStaminaFor(EStaminaConsumers consumer, float curStamina, bool isDepleted, float cap)
float m_StaminaDepletionMultiplier
Timer GetCooldownTimer(int modifier)
void StaminaProcessor_Ladder(HumanMovementState pHumanMovementState)
void RegisterStaminaModifiers()
ref HumanMovementState m_State
void StaminaProcessor_Swimming(HumanMovementState pHumanMovementState)
float GetDepletionMultiplier()
void RecalculateRecoveryMultiplier()
void DepleteStamina(EStaminaModifiers modifier, float dT=-1)
void SetDepletionMultiplier(float val)
void SetRecoveryMultiplier(float val)
float m_StaminaRecoveryMultiplier
ref set< EStaminaMultiplierTypes > m_ActiveDepletionModifiers
void SyncAdditionalStaminaInfo(Param par)
Method to sync more info for stamina manager. Template parameter means it is very extendable for furt...
ref StaminaModifiers m_StaminaModifiers
void OnSyncJuncture(int pJunctureID, ParamsReadContext pCtx)
called from PlayerBase - syncs stamina values on server with client AND sets the value to match on se...
void CheckStaminaState()
check if the stamina is completely depleted
void DeactivateRecoveryModifier(EStaminaMultiplierTypes type)
void RegisterStaminaConsumers()
bool HasEnoughStaminaFor(EStaminaConsumers consumer)
void StaminaHandler(PlayerBase player)
ref map< int, ref Timer > m_TimerMap
ref Param3< float, float, bool > m_StaminaParams
PlayerBase m_Player
float GetRecoveryMultiplier()
void OnRPC(float stamina, float stamina_cap, bool cooldown)
deprecated use, StaminaHandler uses SyncJunctures now
float GetSyncedStamina()
float CalcStaminaGainBonus()
Calulates stamina regain bonus coef based on current stamina cap and level.
ref set< EStaminaMultiplierTypes > m_ActiveRecoveryModifiers
void RecalculateDepletionMultiplier()
void StaminaProcessor_Move(HumanMovementState pHumanMovementState)
float GetStaminaNormalized()
float GetSyncedStaminaNormalized()
void DeactivateDepletionModifier(EStaminaMultiplierTypes type)
bool m_StaminaDepleted
DEPRECATED.
bool HasEnoughStaminaToStart(EStaminaConsumers consumer)
void SetCooldown(float time, int modifier=-1)
set cooldown timer between each consume of stamina
void SetStamina(float stamina_value)
void ReadAdditionalStaminaInfo(ParamsReadContext pCtx)
Order of read parameters must match the order of writing above.
ref StaminaConsumers m_StaminaConsumers
void ActivateDepletionModifier(EStaminaMultiplierTypes type)
SHumanCommandMoveSettings m_HumanMoveSettings
void ResetCooldown(int modifier=-1)
void SyncStamina(float stamina, float stamina_cap, bool cooldown)
stamina sync - server part
ref map< EStaminaMultiplierTypes, float > m_RegisteredRecoveryModifiers
void ActivateRecoveryModifier(EStaminaMultiplierTypes type)
ref map< EStaminaMultiplierTypes, float > m_RegisteredDepletionModifiers
void Update(float deltaT, int pCurrentCommandID)
override float GetStartTimeAdjustment()
void SetData(SMDataExponential data)
override float GetDurationAdjusted()
ref SMDataExponential m_SMDataEx
DayZPlayerInstanceType
defined in C++
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
enum ShapeType ErrorEx
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float Pow(float v, float power)
Return power of v ^ power.
static proto float AbsFloat(float f)
Returns absolute value.
const float STAMINA_DRAIN_CLIMB
Definition constants.c:629
const float STAMINA_HOLD_BREATH_THRESHOLD_DRAIN
Definition constants.c:649
const float STAMINA_DRAIN_MELEE_LIGHT
Definition constants.c:630
const float STAMINA_KG_TO_GRAMS
in grams (weight where the player is not penalized by stamina)
Definition constants.c:661
const float STAMINA_ROLL_THRESHOLD
Definition constants.c:653
const float STAMINA_CLIMB_THRESHOLD
Definition constants.c:652
const float STAMINA_DRAIN_MELEE_HEAVY
Definition constants.c:631
const int STAMINA_GAIN_IDLE_PER_SEC
Definition constants.c:640
const float STAMINA_GAIN_BONUS_CAP
Definition constants.c:644
const float STAMINA_JUMP_THRESHOLD
Definition constants.c:650
const float STAMINA_REGEN_COOLDOWN_EXHAUSTION
Definition constants.c:659
const int STAMINA_DRAIN_SWIM_FAST_PER_SEC
Definition constants.c:622
const int STAMINA_GAIN_WALK_PER_SEC
Definition constants.c:639
const int STAMINA_GAIN_JOG_PER_SEC
Definition constants.c:638
const float STAMINA_VAULT_THRESHOLD
Definition constants.c:651
const float STAMINA_MELEE_EVADE_THRESHOLD
Definition constants.c:657
const float STAMINA_HOLD_BREATH_THRESHOLD_ACTIVATE
Definition constants.c:648
const float STAMINA_MELEE_HEAVY_THRESHOLD
Definition constants.c:656
const int STAMINA_GAIN_ROLL_PER_SEC
Definition constants.c:643
const float STAMINA_DRAIN_JUMP
Definition constants.c:627
const float STAMINA_DRAIN_ROLL
Definition constants.c:633
const float STAMINA_DRAIN_MELEE_EVADE
Definition constants.c:632
const float STAMINA_REGEN_COOLDOWN_DEPLETION
Definition constants.c:658
const int STAMINA_DRAIN_STANDING_SPRINT_PER_SEC
Definition constants.c:619
const int STAMINA_DRAIN_CROUCHED_SPRINT_PER_SEC
Definition constants.c:620
const int STAMINA_DRAIN_LADDER_FAST_PER_SEC
Definition constants.c:623
const float STAMINA_DRAIN_VAULT
Definition constants.c:628
const int STAMINA_GAIN_SWIM_PER_SEC
Definition constants.c:641
const int STAMINA_GAIN_LADDER_PER_SEC
Definition constants.c:642
const float STAMINA_SYNC_RATE
Definition constants.c:662
float GetRunTime()
Definition tools.c:307
float GetDuration()
Definition tools.c:297
proto native int GetState()
returns one of STATE_...
class HumanCommandWeapons HumanCommandAdditives()
Definition human.c:1086
class SHumanGlobalSettings SHumanCommandMoveSettings()