Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
immunesystem.c
Go to the documentation of this file.
2 {
3  bool m_HasDisease;
4  bool m_HasHealings;
5  override void Init()
6  {
7  m_TrackActivatedTime = false;
8  m_ID = eModifiers.MDF_IMMUNE_SYSTEM;
11 
13  }
14 
15  override bool ActivateCondition(PlayerBase player)
16  {
17  return true;
18  }
19 
20  override void OnActivate(PlayerBase player)
21  {
22  }
23 
24  override void OnReconnect(PlayerBase player)
25  {
26 
27  }
28 
29  override bool DeactivateCondition(PlayerBase player)
30  {
31  return false;
32  }
33 
34  override void OnTick(PlayerBase player, float deltaT)
35  {
36 // Debug.Log("ticking immune system", "agent");
37  float result = player.GetImmunity() * deltaT;
38  player.ImmuneSystemTick(result, deltaT);
39 // Debug.Log("result: "+result.ToString(), "agent");
40 
41  if( m_HasDisease != player.HasDisease() )
42  {
43  if(player.HasDisease())
44  {
45  if( player.GetNotifiersManager() ) player.GetNotifiersManager().ActivateByType(eNotifiers.NTF_SICK);
46  }
47  else
48  {
49  if( player.GetNotifiersManager() ) player.GetNotifiersManager().DeactivateByType(eNotifiers.NTF_SICK);
50  }
51  m_HasDisease = player.HasDisease();
52  }
53 
54 
55  if( m_HasHealings != player.HasHealings() )
56  {
57 
58  if( player.HasHealings() )
59  {
60  if( player.GetNotifiersManager() )
61  player.GetNotifiersManager().ActivateByType(eNotifiers.NTF_PILLS);
62  }
63  else
64  {
65  if( player.GetNotifiersManager() )
66  player.GetNotifiersManager().DeactivateByType(eNotifiers.NTF_PILLS);
67  }
68  m_HasHealings = player.HasHealings();
69  }
70 
71  }
72 
73 };
m_TickIntervalActive
float m_TickIntervalActive
Definition: modifierbase.c:19
m_TrackActivatedTime
bool m_TrackActivatedTime
Definition: modifierbase.c:15
DisableDeactivateCheck
void DisableDeactivateCheck()
Definition: modifierbase.c:83
DEFAULT_TICK_TIME_ACTIVE
const int DEFAULT_TICK_TIME_ACTIVE
Definition: modifiersmanager.c:31
PlayerBase
Definition: playerbaseclient.c:1
m_TickIntervalInactive
float m_TickIntervalInactive
Definition: modifierbase.c:18
eModifiers
eModifiers
Definition: emodifiers.c:1
ModifierBase
Definition: breathvapourmdfr.c:3
eNotifiers
eNotifiers
Definition: notifiersmanager.c:1
ImmuneSystemMdfr
Definition: immunesystem.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