Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
healthregen.c
Go to the documentation of this file.
1
class
HealthRegenMdfr
:
ModifierBase
2
{
3
override
void
Init
()
4
{
5
m_TrackActivatedTime
=
false
;
6
m_ID
=
eModifiers
.MDF_HEALTH_REGEN;
7
m_TickIntervalInactive
=
DEFAULT_TICK_TIME_INACTIVE
;
8
m_TickIntervalActive
=
DEFAULT_TICK_TIME_ACTIVE
;
9
DisableDeactivateCheck
();
10
}
11
12
override
bool
ActivateCondition
(
PlayerBase
player)
13
{
14
return
true
;
15
}
16
17
override
void
OnActivate
(
PlayerBase
player)
18
{
19
}
20
21
override
void
OnReconnect
(
PlayerBase
player)
22
{
23
24
}
25
26
override
bool
DeactivateCondition
(
PlayerBase
player)
27
{
28
return
false
;
29
}
30
31
override
void
OnTick
(
PlayerBase
player,
float
deltaT)
32
{
33
if
(player.IsAlive())
//this needs to be here, some of the other modifiers can kill the character during the same modifier tick, and not checking here can partially revive him(resulting in a broken char)
34
{
35
36
float
regen_speed = player.GetHealthRegenSpeed() * deltaT;;
37
player.AddHealth(
"GlobalHealth"
,
"Health"
, regen_speed );
38
39
player.AddHealth(
"RightArm"
,
"Health"
,regen_speed *
PlayerConstants
.
DAMAGE_ZONE_BLOOD_REGEN_MODIFIER
);
40
player.AddHealth(
"RightHand"
,
"Health"
,regen_speed *
PlayerConstants
.
DAMAGE_ZONE_BLOOD_REGEN_MODIFIER
);
41
player.AddHealth(
"LeftArm"
,
"Health"
,regen_speed *
PlayerConstants
.
DAMAGE_ZONE_BLOOD_REGEN_MODIFIER
);
42
player.AddHealth(
"LeftHand"
,
"Health"
,regen_speed *
PlayerConstants
.
DAMAGE_ZONE_BLOOD_REGEN_MODIFIER
);
43
44
//Leg regen when legs are NOT BROKEN
45
if
( player.GetBrokenLegs() ==
eBrokenLegs
.NO_BROKEN_LEGS )
46
{
47
player.AddHealth(
"RightLeg"
,
"Health"
,
PlayerConstants
.
LEG_HEALTH_REGEN
);
48
player.AddHealth(
"RightFoot"
,
"Health"
,
PlayerConstants
.
LEG_HEALTH_REGEN
);
49
player.AddHealth(
"LeftLeg"
,
"Health"
,
PlayerConstants
.
LEG_HEALTH_REGEN
);
50
player.AddHealth(
"LeftFoot"
,
"Health"
,
PlayerConstants
.
LEG_HEALTH_REGEN
);
51
}
52
else
53
{
54
//Leg regen when legs are BROKEN or SPLINTED
55
player.AddHealth(
"RightLeg"
,
"Health"
,
PlayerConstants
.
LEG_HEALTH_REGEN_BROKEN
);
56
player.AddHealth(
"RightFoot"
,
"Health"
,
PlayerConstants
.
LEG_HEALTH_REGEN_BROKEN
);
57
player.AddHealth(
"LeftLeg"
,
"Health"
,
PlayerConstants
.
LEG_HEALTH_REGEN_BROKEN
);
58
player.AddHealth(
"LeftFoot"
,
"Health"
,
PlayerConstants
.
LEG_HEALTH_REGEN_BROKEN
);
59
}
60
61
player.AddHealth(
"Torso"
,
"Health"
,regen_speed *
PlayerConstants
.
DAMAGE_ZONE_BLOOD_REGEN_MODIFIER
);
62
63
// We increase head health regeneration as it is unclear to players what health level individual zones have
64
player.AddHealth(
"Head"
,
"Health"
,( regen_speed *
PlayerConstants
.
DAMAGE_ZONE_BLOOD_REGEN_MODIFIER
) * 2 );
65
}
66
}
67
};
HealthRegenMdfr
Definition
healthregen.c:2
HealthRegenMdfr::DeactivateCondition
override bool DeactivateCondition(PlayerBase player)
Definition
healthregen.c:26
HealthRegenMdfr::OnReconnect
override void OnReconnect(PlayerBase player)
Definition
healthregen.c:21
HealthRegenMdfr::OnActivate
override void OnActivate(PlayerBase player)
Definition
healthregen.c:17
HealthRegenMdfr::OnTick
override void OnTick(PlayerBase player, float deltaT)
Definition
healthregen.c:31
HealthRegenMdfr::Init
override void Init()
Definition
healthregen.c:3
HealthRegenMdfr::ActivateCondition
override bool ActivateCondition(PlayerBase player)
Definition
healthregen.c:12
ModifierBase
Definition
breathvapourmdfr.c:4
PlayerBase
Definition
playerbaseclient.c:2
PlayerConstants
Definition
playerconstants.c:2
PlayerConstants::LEG_HEALTH_REGEN
static const float LEG_HEALTH_REGEN
Definition
playerconstants.c:151
PlayerConstants::DAMAGE_ZONE_BLOOD_REGEN_MODIFIER
static const float DAMAGE_ZONE_BLOOD_REGEN_MODIFIER
Definition
playerconstants.c:100
PlayerConstants::LEG_HEALTH_REGEN_BROKEN
static const float LEG_HEALTH_REGEN_BROKEN
Definition
playerconstants.c:152
eBrokenLegs
eBrokenLegs
Definition
ebrokenlegs.c:2
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
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
DEFAULT_TICK_TIME_ACTIVE
enum eModifierSyncIDs DEFAULT_TICK_TIME_ACTIVE
Games
Dayz
scripts
4_world
classes
playermodifiers
modifiers
healthregen.c
Generated by
1.17.0