DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
BleedingIndicator.c
См. документацию.
1
3class BleedingIndicator extends Managed
4{
5 protected bool m_Initialized;
6 protected bool m_Terminating = false; //doesn't spawn more drops and ends when the last one does
7 protected bool m_EndNow = false;
8 protected bool m_IsRunning = false;
9 protected int m_DropSpawnsQueued;
10 protected int m_ActiveDropsCount;
11 protected int m_Severity;
12 protected int m_SourceID; //pairs this with the 'BleedingSource' bit/ID
13 protected GameplayEffectsDataBleeding m_ParentMetaData;
15
16 protected float m_AverageFrequency; //average drops per interval. NOT changeable on the fly, just a helper value!
17 protected float m_SequenceTick;
18 protected float m_SequenceDuration;
19 protected float m_TimeElapsedTotal;
20 protected float m_TimeElapsedSequence;
21 protected float m_LastDropSpawnTime; //relative to the TOTAL time, not the sequence!
22 protected float m_DropSpawnMinDelay;
23 protected float m_DropSpawnMaxDelay;
27
28 ref set<ref BleedingIndicatorDropData> m_ActiveDrops;
29 ref set<int> m_CleanupQueue;
30
31 void BleedingIndicator(int source_ID, int severity, GameplayEffectsDataBleeding parent)
32 {
33 m_Initialized = false;
34 m_SourceID = source_ID;
35 m_Severity = severity;
36 m_ParentMetaData = parent;
38 m_ActiveDrops = new set<ref BleedingIndicatorDropData>;
39 m_CleanupQueue = new set<int>;
42
43 switch (m_Severity)
44 {
46 {
51 break;
52 }
54 {
59 break;
60 }
62 {
67 break;
68 }
69
70 default:
71 {
75 Debug.Log("Unknown severity value!");
76 }
77#ifdef DIAG_DEVELOPER
79 {
83 }
84#endif
85 }
86
89 }
90
91 void InitIndicator(vector position)
92 {
93 m_BasePosition = position;
95 m_Initialized = true;
96 }
97
98 void StopIndicator(bool instant = false)
99 {
100 if (!m_Terminating)
101 {
102 m_IsRunning = false;
103
104 if (instant)
105 {
106 m_EndNow = true;
107 }
108 m_Terminating = true;
109 }
110 }
111
121
123 protected bool IsRunningDrops()
124 {
125 return m_ActiveDropsCount > 0;
126 }
127
129 {
130 ImageWidget dropImage;
131 if (Class.CastTo(dropImage,m_ParentMetaData.GetNextDropImage()) && !dropImage.IsVisible()) //IsVisible false means the drop is free to be used
132 {
135 data.StartDrop();
136
137 m_ActiveDrops.Insert(data);
139 }
140
143 }
144
145 protected void ResetSequence()
146 {
150 }
151
153 {
154 m_Terminating = false;
155 m_EndNow = false;
161 }
162
163 void Update(float timeSlice)
164 {
165 if ( !m_Initialized )
166 {
167 return;
168 }
169
170#ifdef DIAG_DEVELOPER
172 {
174 }
175#endif
177
178 //run drops, if possible
179 if (!m_Terminating)
180 {
181 if (m_IsRunning)
182 {
184 {
186 {
187 float rnd = Math.RandomFloat01();
189 {
191 }
192
194 }
195 }
196
197 float sinceLastDrop = m_TimeElapsedTotal - m_LastDropSpawnTime;
199 {
201 }
202 else if (m_DropSpawnsQueued > 0) //spawn queued drop
203 {
204 if (sinceLastDrop >= m_DropSpawnMinDelay)
205 {
207 }
208 }
209 else if (sinceLastDrop > m_DropSpawnMaxDelay)
210 {
211 TrySpawnNextDrop(); //guaranteed drop
212 m_CurrentDropProbabilityStep++; //substitutes a regular roll..
213 }
214 }
215 else //1st drop ignores delay
216 {
218 }
219 }
220
221 for (int i = 0; i < m_ActiveDropsCount; i++)
222 {
223 if (!m_EndNow)
224 {
225 //Simulate drops
226 m_ActiveDrops[i].Update(timeSlice);
227 }
228 else
229 {
230 m_ActiveDrops[i].StopDrop();
231 }
232
233 if (!m_ActiveDrops[i].IsRunning())
234 {
235 m_CleanupQueue.Insert(i);
236 }
237 }
238
239 //Cleanup drops
240 for (i = m_CleanupQueue.Count() - 1; i >= 0; i--)
241 {
242 m_ActiveDrops.Remove(m_CleanupQueue[i]);
244 }
245 m_CleanupQueue.Clear();
246
248 {
249 m_EndNow = true;
250 }
251
252 m_TimeElapsedTotal += timeSlice;
253 m_TimeElapsedSequence += timeSlice;
254 }
255
257 {
258 return m_EndNow;
259 }
260
262 {
263 return m_Severity;
264 }
265}
Param3 int
static const float SEQUENCE_DURATION_MEDIUM
Определения BleedingIndicationConstants.c:37
static const float SEQUENCE_DROP_AVERAGE_HIGH
Определения BleedingIndicationConstants.c:51
static const float SEQUENCE_DROP_DELAY_MAX_HIGH
Определения BleedingIndicationConstants.c:54
static const float SEQUENCE_DROP_AVERAGE_MEDIUM
Определения BleedingIndicationConstants.c:38
static const float SEQUENCE_DURATION_LOW
Определения BleedingIndicationConstants.c:24
static const int INDICATOR_SEVERITY_MEDIUM
Определения BleedingIndicationConstants.c:6
static const float SEQUENCE_DROP_DELAY_MAX_MEDIUM
Определения BleedingIndicationConstants.c:41
static const float SEQUENCE_DROP_DELAY_MAX_LOW
Определения BleedingIndicationConstants.c:28
static const float SEQUENCE_DROP_DELAY_MIN_MEDIUM
Определения BleedingIndicationConstants.c:40
static const float SEQUENCE_DROP_AVERAGE_LOW
Определения BleedingIndicationConstants.c:25
static const int INDICATOR_SEVERITY_LOW
Определения BleedingIndicationConstants.c:5
static const float SEQUENCE_DURATION_HIGH
Определения BleedingIndicationConstants.c:50
static const float SEQUENCE_DROP_DELAY_MIN_LOW
Определения BleedingIndicationConstants.c:27
static const int INDICATOR_SEVERITY_HIGH
Определения BleedingIndicationConstants.c:7
static const float SEQUENCE_DROP_DELAY_MIN_HIGH
Определения BleedingIndicationConstants.c:53
void StartDrop()
Определения BleedingDrop.c:154
void SetBasePosition(vector pos)
Определения BleedingDrop.c:182
Super root of all classes in Enforce script.
Определения EnScript.c:11
static info (non-constants)
Определения BleedingIndicationStaticInfo.c:3
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Определения Debug.c:122
Определения Debug.c:2
float m_SequenceDuration
Определения BleedingIndicator.c:18
int m_SourceID
Определения BleedingIndicator.c:12
ref set< ref BleedingIndicatorDropData > m_ActiveDrops
Определения BleedingIndicator.c:28
void ResetSequence()
Определения BleedingIndicator.c:145
bool GetEndNow()
Определения BleedingIndicator.c:256
ref set< int > m_CleanupQueue
Определения BleedingIndicator.c:29
GameplayEffectsDataBleeding m_ParentMetaData
Определения BleedingIndicator.c:13
int m_Severity
Определения BleedingIndicator.c:11
int m_CurrentDropProbabilityStep
Определения BleedingIndicator.c:24
int m_ActiveDropsCount
Определения BleedingIndicator.c:10
bool m_Terminating
Определения BleedingIndicator.c:6
array< float > m_DropProbabilityArray
Определения BleedingIndicator.c:14
bool IsRunningDrops()
Are any drops currently being animated?
Определения BleedingIndicator.c:123
int GetSeverity()
Определения BleedingIndicator.c:261
void InitIndicator(vector position)
Определения BleedingIndicator.c:91
void BleedingIndicator(int source_ID, int severity, GameplayEffectsDataBleeding parent)
Определения BleedingIndicator.c:31
int m_DropSpawnsQueued
Определения BleedingIndicator.c:9
float m_TimeElapsedTotal
Определения BleedingIndicator.c:19
float m_LastDropSpawnTime
Определения BleedingIndicator.c:21
void StopIndicator(bool instant=false)
Определения BleedingIndicator.c:98
float m_SequenceTick
Определения BleedingIndicator.c:17
void StartRunningDrops()
Определения BleedingIndicator.c:112
static bool m_Initialized
Определения PPERequesterBank.c:7
void ResetIndicator()
Определения BleedingIndicator.c:152
float m_TimeElapsedSequence
Определения BleedingIndicator.c:20
bool m_IsRunning
Определения BleedingIndicator.c:8
int m_DropProbabilityRollsCount
Определения BleedingIndicator.c:25
float m_AverageFrequency
Определения BleedingIndicator.c:16
void Update(float timeSlice)
Определения BleedingIndicator.c:163
float m_DropSpawnMinDelay
Определения BleedingIndicator.c:22
bool m_EndNow
Определения BleedingIndicator.c:7
float m_DropSpawnMaxDelay
Определения BleedingIndicator.c:23
void TrySpawnNextDrop()
Определения BleedingIndicator.c:128
vector m_BasePosition
Определения BleedingIndicator.c:26
TODO doc.
Определения EnScript.c:118
Определения EnMath.c:7
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения EnConvert.c:106
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Определения EnMath.c:126
bool IsRunning()
Определения tools.c:264