21 protected float m_DrainThreshold
27 m_DrainThreshold = threshold2;
52 if (depletion_threshold == -1)
54 depletion_threshold = threshold;
72 if (isDepleted || (curStamina < sc.GetDrainThreshold()))
95 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)
234 StaminaModifier sm =
new StaminaModifier(
LINEAR, startValue, endValue, cooldown, startTime, duration);
291 #ifdef DIAG_DEVELOPER
292 protected bool m_StaminaDisabled;
300 m_State =
new HumanMovementState();
357 Error(
"attempting to activate unregistered depletion modifier");
393 Error(
"attempting to activate unregistered recovery modifier");
423 void Update(
float deltaT,
int pCurrentCommandID)
425 #ifdef DIAG_DEVELOPER
426 if (m_StaminaDisabled)
434 if (isServerOrSingleplayer)
453 switch (
m_State.m_CommandTypeId)
490 if (isServerOrSingleplayer)
516 void OnRPC(
float stamina,
float stamina_cap,
bool cooldown)
523 switch ( pJunctureID )
530 if (!pCtx.Read(stamina) || !pCtx.Read(stamina_cap) || !pCtx.Read(cooldown))
560 switch (pHumanMovementState.m_iMovement)
623 switch (pHumanMovementState.m_iMovement)
648 switch (pHumanMovementState.m_iMovement)
673 protected void SyncStamina(
float stamina,
float stamina_cap,
bool cooldown)
689 pCtx.Write(p.param1);
690 pCtx.Write(p.param2);
697 float depletionMultiplier;
698 float recoveryMultiplier;
699 if (!pCtx.Read(depletionMultiplier) || !pCtx.Read(recoveryMultiplier))
811 HumanCommandAdditives ad =
m_Player.GetCommandModifier_Additives();
813 float exhaustion_value = 1;
819 exhaustion_value =
Math.Min(1, exhaustion_value);
825 ad.SetExhaustion(0,
true);
829 ad.SetExhaustion(exhaustion_value,
true);
865 if (
m_TimerMap.Find(modifier, timer) && timer.IsRunning())
874 timer.Run(time,
this,
"ResetCooldown",
new Param1<int>( modifier ));
973 #ifdef DIAG_DEVELOPER
974 if (m_StaminaDisabled)
978 float current_time =
m_Player.GetSimulationTimeStamp();
983 switch (sm.GetType())
995 val =
Math.RandomFloat(sm.GetMinValue(), sm.GetMaxValue());
1003 sm.SetStartTime(current_time + sm.GetStartTimeAdjustment()/dT);
1004 sm.SetRunTimeTick(dT);
1007 valueProgress =
Math.Clamp((current_time - sm.GetStartTime())/sm.GetDurationAdjusted(), 0, 1 );
1008 val =
Math.Lerp(sm.GetMinValue(), sm.GetMaxValue(), valueProgress);
1015 if (!
Class.CastTo(smex,sm))
1017 ErrorEx(
"StaminaModifierExponential not found for modifier type: " + sm.GetType());
1021 if (!smex.IsInUse())
1024 smex.SetRunTimeTick(dT);
1025 smex.SetInUse(
true);
1052 #ifdef DIAG_DEVELOPER
1053 void SetStaminaDisabled(
bool value)
1055 m_StaminaDisabled = value;
eBleedingSourceType m_Type
eBleedingSourceType GetType()
proto native bool IsMultiplayer()
proto native bool IsServer()
Super root of all classes in Enforce script.
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Serialization general interface. Serializer API works with:
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)
Deprecated.
void DepleteStaminaEx(EStaminaModifiers modifier, float dT=-1, float coef=1.0)
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
ref map< int, ref Timer > m_TimerMap
void DeactivateRecoveryModifier(EStaminaMultiplierTypes type)
void RegisterStaminaConsumers()
bool HasEnoughStaminaFor(EStaminaConsumers consumer)
void StaminaHandler(PlayerBase player)
float GetRecoveryMultiplier()
void OnRPC(float stamina, float stamina_cap, bool cooldown)
deprecated use, StaminaHandler uses SyncJunctures now
float CalcStaminaGainBonus()
Calulates stamina regain bonus coef based on current stamina cap and level.
ref set< EStaminaMultiplierTypes > m_ActiveRecoveryModifiers
ref Param3< float, float, bool > m_StaminaParams
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()
override float GetCooldown()
override float GetDuration()
void SetData(SMDataExponential data)
override float GetDurationAdjusted()
ref SMDataExponential m_SMDataEx
DayZPlayerInstanceType
defined in C++
DayZPlayerConstants
defined in C++
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
class SHumanGlobalSettings SHumanCommandMoveSettings()
enum EObjectTemperatureState m_State
class PlayerStatBase m_MinValue
void StaminaConsumer(float threshold, float threshold2, bool state)
void SetMaxValue(float val)
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 SetStartTime(float val)
StaminaModifierExponential FIXED
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 GetStartTimeAdjustment()
float GetDrainThreshold()
float GetActivationThreshold()
void SetRunTimeTick(float val)
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
void SetCooldown(float val)
StaminaModifier GetModifierData(EStaminaModifiers modifier)
float GetDurationAdjusted()
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;