DayZ 1.24
Loading...
Searching...
No Matches
Hunger.c
Go to the documentation of this file.
2{
3 protected float m_EnergyDelta;
4 protected float m_LastEnergyLevel;
6
15
17 {
18 return true;
19 }
20
22 {
23 return false;
24 }
25
27 {
28
29 }
30
31 override void OnTick(PlayerBase player, float deltaT)
32 {
33 player.GetMovementState(m_MovementState);
34 float energy = player.GetStatEnergy().Get();
35 float metabolic_speed = MiscGameplayFunctions.GetEnergyMetabolicSpeed(m_MovementState.m_iMovement);
36
38 metabolic_speed *= modifier; //non linear shaping for consumption curve (comment out to have it linear)
39
40 player.GetStatEnergy().Add(-metabolic_speed * deltaT);
42 {
43 player.SetMixedSoundState(eMixedSoundStates.HUNGRY);
44 if ((player.GetStomach().GetDigestingType() & PlayerStomach.DIGESTING_ENERGY) == 0)
45 player.AddHealth("GlobalHealth", "Health", -PlayerConstants.LOW_ENERGY_DAMAGE_PER_SEC * deltaT);
46 }
47 else
48 player.UnsetMixedSoundState(eMixedSoundStates.HUNGRY);
49 }
50};
eMixedSoundStates
bits
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition Effect.c:49
bool m_TrackActivatedTime
void DisableDeactivateCheck()
float m_TickIntervalActive
float m_TickIntervalInactive
const int DEFAULT_TICK_TIME_INACTIVE
void PlayerStomach(PlayerBase player)
override void OnReconnect(PlayerBase player)
Definition Hunger.c:26
override void Init()
Definition Hunger.c:7
override void OnTick(PlayerBase player, float deltaT)
Definition Hunger.c:31
float m_EnergyDelta
Definition Hunger.c:3
float m_LastEnergyLevel
Definition Hunger.c:4
override bool ActivateCondition(PlayerBase player)
Definition Hunger.c:16
ref HumanMovementState m_MovementState
Definition Hunger.c:5
override bool DeactivateCondition(PlayerBase player)
Definition Hunger.c:21
static const float CONSUMPTION_MULTIPLIER_BASE
static const float LOW_ENERGY_DAMAGE_PER_SEC
static const float SL_ENERGY_MAX
static const float LOW_ENERGY_THRESHOLD
eModifiers
Definition eModifiers.c:2