Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
breathvapourmdfr.c
Go to the documentation of this file.
1
const
int
BREATH_VAPOUR_LEVEL_MAX
= 3;
2
3
class
BreathVapourMdfr
extends
ModifierBase
4
{
5
override
void
Init
()
6
{
7
m_TrackActivatedTime
=
false
;
8
m_ID
=
eModifiers
.MDF_BREATH_VAPOUR;
9
m_TickIntervalInactive
=
DEFAULT_TICK_TIME_INACTIVE
;
10
m_TickIntervalActive
= 6;
11
DisableDeactivateCheck
();
12
13
}
14
15
override
bool
ActivateCondition
(
PlayerBase
player)
16
{
17
return
true
;
18
}
19
20
override
bool
DeactivateCondition
(
PlayerBase
player)
21
{
22
return
false
;
23
}
24
25
override
void
OnReconnect
(
PlayerBase
player)
26
{
27
28
}
29
30
override
string
GetDebugText
()
31
{
32
//return m_Player.GetStatHeatComfort().Get().ToString();
33
}
34
35
override
string
GetDebugTextSimple
()
36
{
37
//return m_Player.GetStatHeatComfort().Get().ToString();
38
}
39
40
41
override
void
OnTick
(
PlayerBase
player,
float
deltaT)
42
{
43
if
( !player.m_Environment.IsTemperatureSet() )
44
return
;
45
float
air_temperature = player.m_Environment.GetTemperature();
46
int
level = 0;
//default
47
if
( MiscGameplayFunctions.IsValueInRange( air_temperature,
PlayerConstants
.
BREATH_VAPOUR_THRESHOLD_HIGH
,
PlayerConstants
.
BREATH_VAPOUR_THRESHOLD_LOW
) )
48
{
49
float
value =
Math
.
InverseLerp
(
PlayerConstants
.
BREATH_VAPOUR_THRESHOLD_LOW
,
PlayerConstants
.
BREATH_VAPOUR_THRESHOLD_HIGH
,air_temperature);
50
value =
Math
.
Clamp
(value,0,1);
51
level =
Math
.
Round
(
Math
.
Lerp
(1,
BREATH_VAPOUR_LEVEL_MAX
,value));
52
}
53
else
if
(air_temperature <
PlayerConstants
.
BREATH_VAPOUR_THRESHOLD_HIGH
)
54
{
55
level =
BREATH_VAPOUR_LEVEL_MAX
;
56
}
57
if
( level != player.m_BreathVapour )
58
{
59
player.m_BreathVapour = level;
60
player.SetSynchDirty();
61
}
62
}
63
};
BREATH_VAPOUR_LEVEL_MAX
const int BREATH_VAPOUR_LEVEL_MAX
Definition
breathvapourmdfr.c:1
Math
Definition
enmath.c:7
ModifierBase
Definition
breathvapourmdfr.c:4
ModifierBase::DeactivateCondition
override bool DeactivateCondition(PlayerBase player)
Definition
breathvapourmdfr.c:20
ModifierBase::OnReconnect
override void OnReconnect(PlayerBase player)
Definition
breathvapourmdfr.c:25
ModifierBase::GetDebugText
override string GetDebugText()
Definition
breathvapourmdfr.c:30
ModifierBase::GetDebugTextSimple
override string GetDebugTextSimple()
Definition
breathvapourmdfr.c:35
ModifierBase::OnTick
override void OnTick(PlayerBase player, float deltaT)
Definition
breathvapourmdfr.c:41
ModifierBase::Init
override void Init()
Definition
breathvapourmdfr.c:5
ModifierBase::ActivateCondition
override bool ActivateCondition(PlayerBase player)
Definition
breathvapourmdfr.c:15
PlayerBase
Definition
playerbaseclient.c:2
PlayerConstants
Definition
playerconstants.c:2
PlayerConstants::BREATH_VAPOUR_THRESHOLD_HIGH
static const float BREATH_VAPOUR_THRESHOLD_HIGH
Definition
playerconstants.c:184
PlayerConstants::BREATH_VAPOUR_THRESHOLD_LOW
static const float BREATH_VAPOUR_THRESHOLD_LOW
Definition
playerconstants.c:185
m_ID
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it).
Definition
effect.c:51
eModifiers
eModifiers
Definition
emodifiers.c:2
Math::Round
static proto float Round(float f)
Returns mathematical round of value.
Math::Clamp
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
Math::InverseLerp
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
Math::Lerp
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
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
Games
Dayz
scripts
4_world
classes
playermodifiers
modifiers
breathvapourmdfr.c
Generated by
1.17.0