Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
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 {
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};
ref HumanMovementState m_MovementState
movement state
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition effect.c:51
eMixedSoundStates
bits
eModifiers
Definition emodifiers.c:2
bool m_TrackActivatedTime
overall time this modifier was active
void DisableDeactivateCheck()
float m_TickIntervalActive
float m_TickIntervalInactive
const int DEFAULT_TICK_TIME_INACTIVE
void PlayerStomach(PlayerBase player)