Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
saline.c
Go to the documentation of this file.
2 {
3  float m_RegenTime;
4  override void Init()
5  {
7  m_IsPersistent = true;
8  m_ID = eModifiers.MDF_SALINE;
11  m_RegenTime = CalculateRegenTime();
13  }
14 
15  override bool ActivateCondition(PlayerBase player)
16  {
17  return false;
18  }
19 
20  override bool DeactivateCondition(PlayerBase player)
21  {
22  float attached_time = GetAttachedTime();
23 
24  if ( attached_time > m_RegenTime )
25  {
26  return true;
27  }
28  else
29  {
30  return false;
31  }
32  }
33 
34  override void OnReconnect(PlayerBase player)
35  {
36  OnActivate(player);
37  }
38 
39  override void OnActivate(PlayerBase player)
40  {
41  player.IncreaseHealingsCount();
42  /*
43  if( player.GetNotifiersManager() )
44  player.GetNotifiersManager().ActivateByType(eNotifiers.NTF_PILLS);
45  */
46  }
47 
48  override void OnDeactivate(PlayerBase player)
49  {
50  player.DecreaseHealingsCount();
51  /*
52  if( player.GetNotifiersManager() )
53  player.GetNotifiersManager().DeactivateByType(eNotifiers.NTF_PILLS);
54  */
55  }
56 
57  override void OnTick(PlayerBase player, float deltaT)
58  {
59  player.AddHealth("", "Blood", PlayerConstants.SALINE_BLOOD_REGEN_PER_SEC * deltaT);
60  player.GetStatWater().Add( PlayerConstants.SALINE_WATER_REGEN_PER_SEC * deltaT );
61  }
62 
63  float CalculateRegenTime()
64  {
65  float regen_time = PlayerConstants.SALINE_LIQUID_AMOUNT / PlayerConstants.SALINE_BLOOD_REGEN_PER_SEC;
66  return regen_time;
67  }
68 };
m_TickIntervalActive
float m_TickIntervalActive
Definition: modifierbase.c:19
m_TrackActivatedTime
bool m_TrackActivatedTime
Definition: modifierbase.c:15
DEFAULT_TICK_TIME_ACTIVE
const int DEFAULT_TICK_TIME_ACTIVE
Definition: modifiersmanager.c:31
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_IsPersistent
bool m_IsPersistent
Definition: modifierbase.c:16
GetAttachedTime
float GetAttachedTime()
Definition: modifierbase.c:150
DisableActivateCheck
void DisableActivateCheck()
Definition: modifierbase.c:78
SalineMdfr
Definition: saline.c:1
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