Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
notifiersmanager.c
Go to the documentation of this file.
2 {
15  //NTF_AGENT_INFECTION,
20  //----------------------------
21  NTF_COUNT,// !!! LAST ITEM !!!
22 
23 }
24 
25 
26 class NotifiersManager
27 {
28  static const int MAX_COUNT = 64;
30  ref NotifierBase m_NotifiersStatic[MAX_COUNT];//introduced as a seperate array to allow for fast lookup, keeping the old one for quick looping through but also to keep modding compatibility
34  string m_System = "Notifiers";
35 
37  {
38  m_Player = player;
39 
41 
43  Init();
44  }
45 
46  void Init()
47  {
48  m_Notifiers.Insert(new HungerNotfr(this));
49  m_Notifiers.Insert(new ThirstNotfr(this));
50  m_Notifiers.Insert(new WarmthNotfr(this));
51  m_Notifiers.Insert(new WetnessNotfr(this));
52  m_Notifiers.Insert(new HealthNotfr(this));
53  m_Notifiers.Insert(new FeverNotfr(this));
54  m_Notifiers.Insert(new SickNotfr(this));
55  m_Notifiers.Insert(new StuffedNotfr(this));
56  m_Notifiers.Insert(new BloodNotfr(this));
57  m_Notifiers.Insert(new PillsNotfr(this));
58  m_Notifiers.Insert(new HeartbeatNotfr(this));
59  m_Notifiers.Insert(new FracturedLegNotfr(this));
60  m_Notifiers.Insert(new InjuredLegNotfr(this));
61 
62  }
63 
64  void RegisterItself(int notifier_id, NotifierBase modifier)
65  {
66  if(notifier_id >= MAX_COUNT)
67  Error("out of bounds for notifier id: " + notifier_id);
68  else
69  m_NotifiersStatic[notifier_id] = modifier;
70  }
71 
73  {
74  return m_Player;
75  }
76 
78  {
79  return m_VirtualHud;
80  }
81 
83  {
84  return m_NotifiersStatic[type];
85  }
86 
87  void ActivateByType(int notifier, bool triggerEvent = true)
88  {
89  FindNotifier(notifier).SetActive(true);
90  }
91 
92  void DeactivateByType(int notifier, bool triggerEvent = true)
93  {
94  FindNotifier(notifier).SetActive(false);
95  }
96 
98  {
99  if( !GetPlayer().IsPlayerSelected() ) return;
100 
101  TickNotifiers();
102  }
103 
105  {
106  int current_time = GetGame().GetTime();
107 
108  foreach(NotifierBase notifier: m_Notifiers)
109  {
110  if ( notifier.IsActive() && notifier.IsTimeToTick(current_time) )
111  {
112  notifier.OnTick(current_time);
113  }
114  }
115 
116  }
117 
118 }
GetGame
proto native CGame GetGame()
MIN_TICK_NOTIFIERS
const int MIN_TICK_NOTIFIERS
Definition: constants.c:341
NTF_PILLS
@ NTF_PILLS
Definition: notifiersmanager.c:16
OnScheduledTick
void OnScheduledTick()
Definition: notifiersmanager.c:97
Error
void Error(string err)
Messagebox with error message.
Definition: endebug.c:90
TickNotifiers
void TickNotifiers()
Definition: notifiersmanager.c:104
GetPlayer
PlayerBase GetPlayer()
Definition: notifiersmanager.c:72
HeartbeatNotfr
Definition: heartbeatnotfr.c:1
SickNotfr
Definition: sicknotfr.c:1
VirtualHud
void VirtualHud(PlayerBase player)
Definition: displaystatus.c:36
FindNotifier
NotifierBase FindNotifier(int type)
Definition: notifiersmanager.c:82
BloodNotfr
Definition: bloodnotfr.c:1
NTF_BLOOD
@ NTF_BLOOD
Definition: notifiersmanager.c:12
NTF_BLEEDISH
@ NTF_BLEEDISH
Definition: notifiersmanager.c:4
PillsNotfr
Definition: pillsnotfr.c:1
NTF_HUNGRY
@ NTF_HUNGRY
Definition: notifiersmanager.c:5
NTF_SICK
@ NTF_SICK
Definition: notifiersmanager.c:8
FracturedLegNotfr
Definition: fracturedlegnotfr.c:1
StuffedNotfr
Definition: stuffednotfr.c:1
DeactivateByType
void DeactivateByType(int notifier, bool triggerEvent=true)
Definition: notifiersmanager.c:92
GetVirtualHud
VirtualHud GetVirtualHud()
Definition: notifiersmanager.c:77
NTF_STAMINA
@ NTF_STAMINA
Definition: notifiersmanager.c:14
NotifiersManager
void NotifiersManager(PlayerBase player)
Definition: notifiersmanager.c:36
m_Notifiers
ref array< ref NotifierBase > m_Notifiers
Definition: notifiersmanager.c:29
PlayerBase
Definition: playerbaseclient.c:1
HealthNotfr
Definition: healthnotfr.c:1
HungerNotfr
Definition: hungernotfr.c:1
NTF_THIRSTY
@ NTF_THIRSTY
Definition: notifiersmanager.c:6
NTF_WETNESS
@ NTF_WETNESS
Definition: notifiersmanager.c:9
RegisterItself
void RegisterItself(int notifier_id, NotifierBase modifier)
Definition: notifiersmanager.c:64
m_MinTickTime
int m_MinTickTime
Definition: notifiersmanager.c:33
NTF_COUNT
@ NTF_COUNT
Definition: notifiersmanager.c:21
m_NotifiersStatic
ref NotifierBase m_NotifiersStatic[MAX_COUNT]
Definition: notifiersmanager.c:30
NTF_FRACTURE
@ NTF_FRACTURE
Definition: notifiersmanager.c:18
NTF_LEGS
@ NTF_LEGS
Definition: notifiersmanager.c:19
NotifierBase
Definition: notifierbase.c:1
ActivateByType
void ActivateByType(int notifier, bool triggerEvent=true)
Definition: notifiersmanager.c:87
NTF_HEARTBEAT
@ NTF_HEARTBEAT
Definition: notifiersmanager.c:17
WarmthNotfr
Definition: warmthnotfr.c:1
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition: isboxcollidinggeometryproxyclasses.c:27
WetnessNotfr
Definition: wetnessnotfr.c:1
eNotifiers
eNotifiers
Definition: notifiersmanager.c:1
Init
void Init()
Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside o...
Definition: notifiersmanager.c:46
m_Player
PlayerBase m_Player
Definition: notifiersmanager.c:31
NTF_LIVES
@ NTF_LIVES
Definition: notifiersmanager.c:13
m_System
string m_System
Definition: notifiersmanager.c:34
InjuredLegNotfr
Definition: injuredlegnotfr.c:1
NTF_HEALTHY
@ NTF_HEALTHY
Definition: notifiersmanager.c:3
MAX_COUNT
enum eNotifiers MAX_COUNT
m_VirtualHud
ref VirtualHud m_VirtualHud
Definition: notifiersmanager.c:32
NTF_FEVERISH
@ NTF_FEVERISH
Definition: notifiersmanager.c:11
FeverNotfr
Definition: fevernotfr.c:1
NTF_WARMTH
@ NTF_WARMTH
Definition: notifiersmanager.c:10
NTF_STUFFED
@ NTF_STUFFED
Definition: notifiersmanager.c:7
ThirstNotfr
Definition: thirstnotfr.c:1