19 protected float m_DrainThreshold
25 m_DrainThreshold = threshold2;
50 if (depletion_threshold == -1)
52 depletion_threshold = threshold;
71 if ( (isDepleted || (curStamina < sc.GetDrainThreshold())) )
94 if ( curStamina > sc.GetDrainThreshold() || curStamina == cap )
110 if ( (isDepleted || (curStamina < sc.GetActivationThreshold() && curStamina < cap)) )
141 void StaminaModifier(
int type,
float min,
float max,
float cooldown,
float startTime = 0,
float duration = 0)
266 #ifdef DIAG_DEVELOPER
267 protected bool m_StaminaEnabled =
true;
328 Error(
"attempting to activate unregistered depletion modifier");
364 Error(
"attempting to activate unregistered recovery modifier");
394 void Update(
float deltaT,
int pCurrentCommandID)
396 #ifdef DIAG_DEVELOPER
424 switch (pCurrentCommandID)
487 void OnRPC(
float stamina,
float stamina_cap,
bool cooldown)
494 switch ( pJunctureID )
501 if (!pCtx.
Read(stamina) || !pCtx.
Read(stamina_cap) || !pCtx.
Read(cooldown))
644 protected void SyncStamina(
float stamina,
float stamina_cap,
bool cooldown)
660 pCtx.
Write(p.param1);
661 pCtx.
Write(p.param2);
668 float depletionMultiplier;
669 float recoveryMultiplier;
670 if (!pCtx.
Read(depletionMultiplier) || !pCtx.
Read(recoveryMultiplier))
727 float exhaustion_value = 1;
733 exhaustion_value =
Math.
Min(1, exhaustion_value);
739 ad.SetExhaustion(0,
true);
743 ad.SetExhaustion(exhaustion_value,
true);
779 if (
m_TimerMap.Find(modifier, timer) && timer.IsRunning())
785 timer =
new ref
Timer;
788 timer.Run(time,
this,
"ResetCooldown",
new Param1<int>( modifier ));
887 #ifdef DIAG_DEVELOPER
894 float current_time =
m_Player.GetSimulationTimeStamp();
899 switch (sm.GetType())
917 sm.SetStartTime(current_time + ( (PlayerSwayConstants.SWAY_TIME_IN + PlayerSwayConstants.SWAY_TIME_STABLE) / dT ) );
918 sm.SetRunTimeTick(dT);
921 time =
Math.
Clamp( ((current_time - sm.GetStartTime()) / sm.GetDurationAdjusted()), 0, 1 );
922 val =
Math.
Lerp(sm.GetMinValue(), sm.GetMaxValue(), time);
930 sm.SetStartTime(current_time + ( (PlayerSwayConstants.SWAY_TIME_IN + PlayerSwayConstants.SWAY_TIME_STABLE) / dT ) );
931 sm.SetRunTimeTick(dT);
934 time =
Math.
Clamp( ((current_time - sm.GetStartTime()) / sm.GetDurationAdjusted()), 0, 1 );
936 if (sm.GetMinValue() < 1)
938 exp = 1 -
Math.
Lerp(0, sm.GetMaxValue(), time);
942 exp =
Math.
Lerp(0, sm.GetMaxValue(), time);
944 val =
Math.
Pow(sm.GetMinValue(),exp);
957 #ifdef DIAG_DEVELOPER
958 void SetStaminaEnabled(
bool value)
960 m_StaminaEnabled = value;
eBleedingSourceType m_Type
eBleedingSourceType GetType()
void OnSyncJuncture(int pJunctureID, ParamsReadContext pCtx)
void StaminaConsumer(float threshold, float threshold2, bool state)
ref map< EStaminaMultiplierTypes, float > m_RegisteredDepletionModifiers
bool HasEnoughStaminaToStart(EStaminaConsumers consumer, float curStamina, bool isDepleted, float cap)
protected SHumanCommandMoveSettings m_HumanMoveSettings
protected float m_Stamina
protected float CalcStaminaGainBonus()
Calulates stamina regain bonus coef based on current stamina cap and level.
void SetDepletionMultiplier(float val)
void SetRecoveryMultiplier(float val)
protected bool m_StaminaDepleted
DEPRECATED.
void SetMaxValue(float val)
void StaminaModifier(int type, float min, float max, float cooldown, float startTime=0, float duration=0)
protected float m_StaminaDepletionMultiplier
protected void RegisterStaminaConsumers()
void StaminaHandler(PlayerBase player)
void SetActivationThreshold(float threshold)
void SetStartTime(float val)
float GetRecoveryMultiplier()
void RecalculateDepletionMultiplier()
protected void StaminaProcessor_Ladder(HumanMovementState pHumanMovementState)
void SetDrainThreshold(float threshold)
protected void RegisterStaminaModifiers()
float GetSyncedStaminaNormalized()
void SetState(bool state)
void ActivateDepletionModifier(EStaminaMultiplierTypes type)
float GetStaminaNormalized()
protected bool m_IsInCooldown
protected void SyncStamina(float stamina, float stamina_cap, bool cooldown)
stamina sync - server part
void SetStamina(float stamina_value)
void DepleteStamina(EStaminaModifiers modifier, float dT=-1)
float GetDrainThreshold()
protected void StaminaProcessor_Swimming(HumanMovementState pHumanMovementState)
float GetActivationThreshold()
protected float m_StaminaSynced
protected ref map< int, ref Timer > m_TimerMap
protected void ApplyExhaustion()
protected void ReadAdditionalStaminaInfo(ParamsReadContext pCtx)
Order of read parameters must match the order of writing above.
protected void SyncAdditionalStaminaInfo(Param par)
Method to sync more info for stamina manager. Template parameter means it is very extendable for furt...
void OnRPC(float stamina, float stamina_cap, bool cooldown)
deprecated use, StaminaHandler uses SyncJunctures now
void SetRunTimeTick(float val)
ref map< EStaminaMultiplierTypes, float > m_RegisteredRecoveryModifiers
protected float m_StaminaDepletion
class StaminaModifiers m_PlayerLoad
protected ref StaminaModifiers m_StaminaModifiers
ref set< EStaminaMultiplierTypes > m_ActiveDepletionModifiers
void SetMinValue(float val)
protected void ResetCooldown(int modifier=-1)
protected void CheckStaminaState()
check if the stamina is completely depleted
protected float m_StaminaRecoveryMultiplier
protected float m_StaminaDelta
protected void StaminaProcessor_Move(HumanMovementState pHumanMovementState)
Timer GetCooldownTimer(int modifier)
protected ref map< EStaminaConsumers, ref StaminaConsumer > m_StaminaConsumers
void ActivateRecoveryModifier(EStaminaMultiplierTypes type)
void SetCooldown(float val)
protected ref Param3< float, float, bool > m_StaminaParams
protected float m_StaminaCap
void DeactivateRecoveryModifier(EStaminaMultiplierTypes type)
void DeactivateDepletionModifier(EStaminaMultiplierTypes type)
bool HasEnoughStaminaFor(EStaminaConsumers consumer, float curStamina, bool isDepleted, float cap)
float GetDurationAdjusted()
float GetDepletionMultiplier()
void AddRunTime(float val)
ref set< EStaminaMultiplierTypes > m_ActiveRecoveryModifiers
void RecalculateRecoveryMultiplier()
protected float m_DrainThreshold protected bool m_State
static float GetObstacleTraversalStaminaModifier()
static float GetStaminaMinCap()
static float GetStaminaKgToStaminaPercentPenalty()
static float GetSprintSwimmingStaminaModifier()
static float GetHoldBreathStaminaModifier()
static float GetSprintLadderStaminaModifier()
static float GetSprintStaminaModifierCro()
static float GetSprintStaminaModifierErc()
static float GetStaminaWeightLimitThreshold()
static float GetMeleeStaminaModifier()
static float GetStaminaMax()
override float GetCurrentWaterLevel()
static const int SJ_STAMINA
static const int SJ_STAMINA_MISC
static const float STAMINA_RECOVERY_MULTIPLIER
const float STAMINA_DEPLETION_MULTIPLIER
static const float STAMINA_DEPLETION_MULTIPLIER
static const float STAMINA_RECOVERY_MULTIPLIER
int m_iStanceIdx
current command's id
int m_iMovement
current stance (DayZPlayerConstants.STANCEIDX_ERECT, ...), only if the command has a stance
const float STAMINA_DEPLETION_MODIFIER
const float STAMINA_RECOVERY_MODIFIER
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Serialization general interface. Serializer API works with:
proto bool Write(void value_out)
proto bool Read(void value_in)
bool HasEnoughStaminaToStart(EStaminaConsumers consumer, float curStamina, bool isDepleted, float cap)
void RegisterConsumer(EStaminaConsumers consumer, float threshold, float depletion_threshold=-1)
bool HasEnoughStaminaFor(EStaminaConsumers consumer, float curStamina, bool isDepleted, float cap)
protected ref map< EStaminaConsumers, ref StaminaConsumer > m_StaminaConsumers
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,...
protected ref map< EStaminaModifiers, ref StaminaModifier > m_StaminaModifiers
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
StaminaModifier GetModifierData(EStaminaModifiers modifier)
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;
DayZPlayerInstanceType
defined in C++
DayZPlayerConstants
defined in C++
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Pow(float v, float power)
Return power of v ^ power.
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 RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
const float STAMINA_JUMP_THRESHOLD
const int STAMINA_GAIN_SWIM_PER_SEC
const float STAMINA_DRAIN_HOLD_BREATH_START
const float STAMINA_DRAIN_CLIMB
const float STAMINA_VAULT_THRESHOLD
const float STAMINA_REGEN_COOLDOWN_EXHAUSTION
const float STAMINA_CLIMB_THRESHOLD
const float STAMINA_KG_TO_GRAMS
in grams (weight where the player is not penalized by stamina)
const float STAMINA_DRAIN_MELEE_LIGHT
const float STAMINA_DRAIN_VAULT
const float STAMINA_SYNC_RATE
const int STAMINA_GAIN_IDLE_PER_SEC
const int STAMINA_GAIN_ROLL_PER_SEC
const float STAMINA_MELEE_EVADE_THRESHOLD
const int STAMINA_GAIN_JOG_PER_SEC
const float STAMINA_DRAIN_MELEE_HEAVY
const float STAMINA_DRAIN_HOLD_BREATH_DURATION
const float STAMINA_DRAIN_JUMP
const float STAMINA_MELEE_HEAVY_THRESHOLD
const float STAMINA_DRAIN_MELEE_EVADE
const int STAMINA_DRAIN_SWIM_FAST_PER_SEC
const float STAMINA_GAIN_BONUS_CAP
const int STAMINA_DRAIN_STANDING_SPRINT_PER_SEC
const float STAMINA_ROLL_THRESHOLD
const float STAMINA_DRAIN_HOLD_BREATH_EXPONENT
const float STAMINA_REGEN_COOLDOWN_DEPLETION
const float STAMINA_HOLD_BREATH_THRESHOLD_DRAIN
const int STAMINA_DRAIN_LADDER_FAST_PER_SEC
const float STAMINA_DRAIN_ROLL
const int STAMINA_DRAIN_CROUCHED_SPRINT_PER_SEC
const int STAMINA_GAIN_LADDER_PER_SEC
const int STAMINA_GAIN_WALK_PER_SEC
const float STAMINA_HOLD_BREATH_THRESHOLD_ACTIVATE
proto native int GetState()
returns one of STATE_...
class HumanCommandWeapons HumanCommandAdditives()
class SHumanGlobalSettings SHumanCommandMoveSettings()