Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
thirst.c
Go to the documentation of this file.
2 {
3  float m_LastWaterLevel;
4  ref HumanMovementState m_MovementState = new HumanMovementState();
5 
6  override void Init()
7  {
8  m_TrackActivatedTime = false;
9  m_ID = eModifiers.MDF_THIRST;
13  }
14 
15  override bool ActivateCondition(PlayerBase player)
16  {
17  return true;
18  }
19 
20  override void OnReconnect(PlayerBase player)
21  {
22 
23  }
24 
25  override bool DeactivateCondition(PlayerBase player)
26  {
27  return false;
28  }
29 
30  override void OnTick(PlayerBase player, float deltaT)
31  {
32  player.GetMovementState(m_MovementState);
33  float water = player.GetStatWater().Get();
34  float metabolic_speed = MiscGameplayFunctions.GetWaterMetabolicSpeed(m_MovementState.m_iMovement);
35 
36  float modifier = water/PlayerConstants.SL_WATER_MAX + PlayerConstants.CONSUMPTION_MULTIPLIER_BASE;
37  metabolic_speed *= modifier; //non linear shaping for consumption curve (comment out to have it linear)
38 
39  player.GetStatWater().Add( (-metabolic_speed * deltaT) );
40 
41  if ( water <= PlayerConstants.LOW_WATER_THRESHOLD )
42  {
43  player.SetMixedSoundState( eMixedSoundStates.THIRSTY );
44  if ((player.GetStomach().GetDigestingType() & PlayerStomach.DIGESTING_WATER) == 0)
45  player.AddHealth("GlobalHealth", "Health", -PlayerConstants.LOW_WATER_DAMAGE_PER_SEC * deltaT );
46  }
47  else
48  {
49  player.UnsetMixedSoundState( eMixedSoundStates.THIRSTY );
50  }
51  }
52 };
eMixedSoundStates
eMixedSoundStates
bits
Definition: emixedsoundstates.c:2
m_TickIntervalActive
float m_TickIntervalActive
Definition: modifierbase.c:19
PlayerStomach
void PlayerStomach(PlayerBase player)
Definition: playerstomach.c:127
m_TrackActivatedTime
bool m_TrackActivatedTime
Definition: modifierbase.c:15
HumanMovementState
Definition: human.c:1125
m_MovementState
ref HumanMovementState m_MovementState
movement state
Definition: dayzplayercamera3rdperson.c:155
DisableDeactivateCheck
void DisableDeactivateCheck()
Definition: modifierbase.c:83
ThirstMdfr
Definition: thirst.c:1
PlayerBase
Definition: playerbaseclient.c:1
PlayerConstants
Definition: playerconstants.c:1
m_TickIntervalInactive
float m_TickIntervalInactive
Definition: modifierbase.c:18
eModifiers
eModifiers
Definition: emodifiers.c:1
ModifierBase
Definition: breathvapourmdfr.c:3
m_ID
protected int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition: effect.c:49
DEFAULT_TICK_TIME_INACTIVE
const int DEFAULT_TICK_TIME_INACTIVE
Definition: modifiersmanager.c:33