DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
NotifiersManager.c
Go to the documentation of this file.
2{
15 //NTF_AGENT_INFECTION,
20 //----------------------------
21 NTF_COUNT,// !!! LAST ITEM !!!
22
23}
24
25
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
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}
override Widget Init()
Definition DayZGame.c:122
void VirtualHud(PlayerBase player)
DayZPlayer m_Player
Definition Hand_Events.c:42
PlayerBase GetPlayer()
string m_System
void NotifiersManager(PlayerBase player)
ref VirtualHud m_VirtualHud
eNotifiers
@ NTF_HEALTHY
@ NTF_HEARTBEAT
@ NTF_BLOOD
@ NTF_THIRSTY
@ NTF_STAMINA
@ NTF_LEGS
@ NTF_FRACTURE
@ NTF_STUFFED
@ NTF_WETNESS
@ NTF_COUNT
@ NTF_PILLS
@ NTF_SICK
@ NTF_WARMTH
@ NTF_FEVERISH
@ NTF_LIVES
@ NTF_BLEEDISH
@ NTF_HUNGRY
void OnScheduledTick()
VirtualHud GetVirtualHud()
void TickNotifiers()
int m_MinTickTime
NotifierBase FindNotifier(int type)
enum eNotifiers MAX_COUNT
void DeactivateByType(int notifier, bool triggerEvent=true)
ref NotifierBase m_NotifiersStatic[MAX_COUNT]
ref array< ref NotifierBase > m_Notifiers
void RegisterItself(int notifier_id, NotifierBase modifier)
void ActivateByType(int notifier, bool triggerEvent=true)
proto int GetTime()
returns mission time in milliseconds
void SetActive(bool state)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
const int MIN_TICK_NOTIFIERS
Definition constants.c:325