Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
thirst.c
Go to the documentation of this file.
1
class
ThirstMdfr
:
ModifierBase
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;
10
m_TickIntervalInactive
=
DEFAULT_TICK_TIME_INACTIVE
;
11
m_TickIntervalActive
= 1;
12
DisableDeactivateCheck
();
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
};
HumanMovementState
Definition
human.c:1154
ModifierBase
Definition
breathvapourmdfr.c:4
PlayerBase
Definition
playerbaseclient.c:2
PlayerConstants
Definition
playerconstants.c:2
PlayerConstants::SL_WATER_MAX
static const float SL_WATER_MAX
Definition
playerconstants.c:50
PlayerConstants::CONSUMPTION_MULTIPLIER_BASE
static const float CONSUMPTION_MULTIPLIER_BASE
Definition
playerconstants.c:62
PlayerConstants::LOW_WATER_THRESHOLD
static const float LOW_WATER_THRESHOLD
Percents of agents count <-1.0; 1.0>.
Definition
playerconstants.c:70
PlayerConstants::LOW_WATER_DAMAGE_PER_SEC
static const float LOW_WATER_DAMAGE_PER_SEC
Definition
playerconstants.c:143
ThirstMdfr
Definition
thirst.c:2
ThirstMdfr::DeactivateCondition
override bool DeactivateCondition(PlayerBase player)
Definition
thirst.c:25
ThirstMdfr::OnReconnect
override void OnReconnect(PlayerBase player)
Definition
thirst.c:20
ThirstMdfr::OnTick
override void OnTick(PlayerBase player, float deltaT)
Definition
thirst.c:30
ThirstMdfr::Init
override void Init()
Definition
thirst.c:6
ThirstMdfr::ActivateCondition
override bool ActivateCondition(PlayerBase player)
Definition
thirst.c:15
ThirstMdfr::m_MovementState
ref HumanMovementState m_MovementState
Definition
thirst.c:4
ThirstMdfr::m_LastWaterLevel
float m_LastWaterLevel
Definition
thirst.c:3
m_ID
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it).
Definition
effect.c:51
eMixedSoundStates
eMixedSoundStates
bits
Definition
emixedsoundstates.c:3
eModifiers
eModifiers
Definition
emodifiers.c:2
m_TrackActivatedTime
bool m_TrackActivatedTime
overall time this modifier was active
Definition
modifierbase.c:14
DisableDeactivateCheck
void DisableDeactivateCheck()
Definition
modifierbase.c:86
m_TickIntervalActive
float m_TickIntervalActive
Definition
modifierbase.c:18
m_TickIntervalInactive
float m_TickIntervalInactive
Definition
modifierbase.c:17
DEFAULT_TICK_TIME_INACTIVE
const int DEFAULT_TICK_TIME_INACTIVE
Definition
modifiersmanager.c:29
PlayerStomach
void PlayerStomach(PlayerBase player)
Definition
playerstomach.c:142
Games
Dayz
scripts
4_world
classes
playermodifiers
modifiers
thirst.c
Generated by
1.17.0