DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
StateManager.c
Go to the documentation of this file.
2{
5}
6
7enum SymptomIDs
8{
24};
25
27{
30};
31
33{
37};
38
40const int MAX_QUEUE_SIZE = 5;
41
43{
46 ref map<int, int> m_ActiveSymptomTypes;//for each type(symptom id), keep track of how many times it is in queue
47
50
52
53
57 //ref array<string> m_SymptomQueueSecondaryServerDbg;
59
62
63 const int STORAGE_VERSION = 121;
64
65 bool m_ShowDebug = false;
66 bool m_ShowDebug2 = false;
67
69
70 void Init()
71 {
72 RegisterSymptom(new CoughSymptom);
73 RegisterSymptom(new VomitSymptom);
74 RegisterSymptom(new BlindnessSymptom);
75 RegisterSymptom(new SneezeSymptom);
76 RegisterSymptom(new FeverBlurSymptom);
77 RegisterSymptom(new BloodLoss);
78 RegisterSymptom(new LaughterSymptom);
79 RegisterSymptom(new FreezeSymptom);
80 RegisterSymptom(new HotSymptom);
81 RegisterSymptom(new PainLightSymptom);
82 RegisterSymptom(new PainHeavySymptom);
83 RegisterSymptom(new HandShiversSymptom);
84 //RegisterSymptom(new BulletHitSymptom);
85 }
86
88 {
89 return STORAGE_VERSION;
90 }
91
92
94 {
95 if ( GetGame().IsClient() )
96 {
97 return;
98 }
99
100 QueueUpSecondarySymptom(SymptomIDs.SYMPTOM_BLOODLOSS);
101 }
102
104 {
113 m_Player = player;
114 Init();
116 }
117
119 {
120 for (int i = 0; i < m_SymptomQueuePrimary.Count(); i++)
121 {
122 m_SymptomQueuePrimary.Get(i).OnOwnerKilled();
123 }
124
125 for (i = 0; i < m_SymptomQueueSecondary.Count(); i++)
126 {
127 if (m_SymptomQueueSecondary.Get(i)) m_SymptomQueueSecondary.Get(i).OnOwnerKilled();
128 }
129 }
130
132 {
133 return m_SymptomsUIDs.Get(SYMPTOM_uid);
134 }
135
136
138 {
139 }
140
142 {
143 return m_Player;
144 }
145
147 {
148 Symptom.Init(this, m_Player,0);
149 int id = Symptom.GetType();
150
151 if ( m_AvailableSymptoms.Contains(id) )
152 {
153 Error("SymptomBase Symptom already registered !");
154 return;
155 }
156
157 m_AvailableSymptoms.Insert(id, Symptom);
158 //PrintString("inserting id: "+ToString(id));
159 }
160
162 {
163 if ( m_AnimMeta )
164 {
165 m_AnimMeta.AnimFinished(type);
166 }
167 }
168
170 {
173 }
174
176 {
177 int uid = Math.RandomInt( 1, 2147483647);
178 if ( !IsUIDUsed(uid) ) return uid;
179 else return CreateUniqueID();
180 }
181
182 bool IsUIDUsed(int uid)
183 {
184 return m_SymptomsUIDs.Contains(uid);
185 }
186
187 string GetSymptomName(int symptom_id)
188 {
189 return m_AvailableSymptoms.Get(symptom_id).GetName();
190 }
191
193 {
194 return m_AvailableSymptoms.Get(symptom_id).SpawnAnimMetaObject();
195 }
196
198 void RequestSymptomExit(int SYMPTOM_uid)
199 {
200 if ( m_SymptomsUIDs.Get(SYMPTOM_uid) ) m_SymptomsUIDs.Get(SYMPTOM_uid).RequestDestroy();
201 }
202
203 bool IsSymptomPrimary(int symptom_id)
204 {
205 return m_AvailableSymptoms.Get(symptom_id).IsPrimary();
206 }
207
209 {
210 }
211
213 {
214 return m_CurrentCommandID;
215 }
216
217 void OnTick(float deltatime, int pCurrentCommandID, HumanMovementState movement_state)
218 {
219 m_CurrentCommandID = pCurrentCommandID;
221 {
223 }
224
225 UpdateActiveSymptoms(deltatime);
226
227 if ( m_AnimMeta )
228 {
229 if ( m_AnimMeta.IsDestroyReqested() )
230 {
231 m_AnimMeta = null;
232 }
233 }
234
235 if ( m_AnimMeta )
236 {
237
238 //anim requested
239 if ( !m_AnimMeta.IsPlaying() )
240 {
241
242 if ( m_AnimMeta.PlayRequest() == EAnimPlayState.FAILED )
243 {
245 }
246 }
247 else
248 {
249 m_AnimMeta.Update(movement_state);
250 }
251 }
252
253 #ifdef DIAG_DEVELOPER
254 #ifndef SERVER //must be here !!!
255 if ( DiagMenu.GetBool(DiagMenuIDs.MISC_PLAYER_SYMPTOMS_SHOW) )
256 {
257 //DisplayDebug(true);
258 array<ref Param> primary_debug = PrepareClientDebug(m_SymptomQueuePrimary);
259 array<ref Param> secondary_debug = PrepareClientDebug(m_SymptomQueueSecondary);
260
261 DisplayDebug1("Symptoms Client", 50, primary_debug, secondary_debug);
262 DisplayDebug2("Symptoms Server", 300, m_SymptomQueueServerDbgPrimary, m_SymptomQueueServerDbgSecondary);
263 ShowAvailableSymptoms();
264 }
265 else
266 {
267 CleanDebug1("Symptoms Client", 50);
268 CleanDebug2("Symptoms Server", 300);
269 CleanAvailableSymptoms();
270 }
271 #endif
272 #endif
273 }
274
276 {
277 if (m_AnimMeta)
278 {
279 // animation meta already exists
280 // pass
281 }
282 else
283 {
284 int state_type;
285 if (ctx.Read(state_type))
286 {
287 m_AnimMeta = SpawnAnimMetaObject(state_type);
288 if (m_AnimMeta)
289 {
290 m_AnimMeta.Init(ctx, this, m_Player);
291 }
292 }
293 }
294 }
295
296 void UpdateActiveSymptoms(float deltatime)
297 {
298 //if( GetGame().IsClient() && !m_Player.IsPlayer() ) return;
299 //primary
301 {
302 if ( !GetCurrentPrimaryActiveSymptom().IsActivated() )
303 {
304 if ( GetCurrentPrimaryActiveSymptom().CanActivate() )
306 }
307 if ( GetCurrentPrimaryActiveSymptom().IsActivated() )
308 {
310 }
311 }
312 //secondary
313 for (int i = 0; i < m_SymptomQueueSecondary.Count(); i++)
314 {
315 if ( m_SymptomQueueSecondary.Get(i) && !m_SymptomQueueSecondary.Get(i).IsActivated() )
316 {
317 m_SymptomQueueSecondary.Get(i).Activate();
318 }
319 else
320 {
321 if (m_SymptomQueueSecondary.Get(i)) m_SymptomQueueSecondary.Get(i).Update(deltatime);
322 }
323 }
324 }
325
326
327 void OnSymptomExit(SymptomBase Symptom, int uid)
328 {
329 bool is_primary;
330 if ( Symptom )
331 {
332 is_primary = Symptom.IsPrimary();
333 DecreaseSymptomCount(Symptom.GetType());
334 }
335
336 if ( m_SymptomsUIDs.Contains(uid) )
337 {
338 m_SymptomsUIDs.Remove(uid);
339 }
340 else
341 {
342 Debug.LogError("Symptom with this UID does not exist", "PlayerSymptoms");
343 }
344
345 if (is_primary)
346 {
347 for (int i = 0; i < m_SymptomQueuePrimary.Count(); i++)
348 {
349 if ( m_SymptomQueuePrimary.Get(i) == Symptom )
350 {
351 m_SymptomQueuePrimary.RemoveOrdered(i);
352 break;
353 }
354 }
355 }
356 else
357 {
358 for (i = 0; i < m_SymptomQueueSecondary.Count(); i++)
359 {
360 if ( m_SymptomQueueSecondary.Get(i) == Symptom )
361 {
362 m_SymptomQueueSecondary.RemoveOrdered(i);
363 break;
364 }
365 }
366 }
368 #ifdef DIAG_DEVELOPER
369 if ( GetGame() ) SendServerDebugToClient();
370 #endif
371 }
372
373
374 int GetSymptomMaxCount(int symptom_id)
375 {
376 return m_AvailableSymptoms.Get(symptom_id).GetMaxCount();
377 }
378
379
380 int GetSymptomCount(int symptom_id)
381 {
382 if ( m_ActiveSymptomTypes.Contains(symptom_id) )
383 return m_ActiveSymptomTypes.Get(symptom_id);
384 else
385 return -1;
386 }
387
388 void IncreaseSymptomCount(int symptom_id)
389 {
390 if ( m_ActiveSymptomTypes.Contains(symptom_id) )
391 {
392 m_ActiveSymptomTypes.Set(symptom_id, m_ActiveSymptomTypes.Get(symptom_id) + 1);
393 }
394 else
395 {
396 m_ActiveSymptomTypes.Insert(symptom_id, 1);
397 }
398 }
399
400 void DecreaseSymptomCount(int symptom_id)
401 {
402 if ( m_ActiveSymptomTypes.Contains(symptom_id) )
403 {
404 if ( m_ActiveSymptomTypes.Get(symptom_id) == 1)
405 m_ActiveSymptomTypes.Remove(symptom_id);
406 else
407 m_ActiveSymptomTypes.Set(symptom_id, m_ActiveSymptomTypes.Get(symptom_id) - 1);
408 }
409 }
410
411 SymptomBase SpawnSymptom( int symptom_id, int uid = -1 )
412 {
413 if ( m_AvailableSymptoms.Get(symptom_id) )
414 {
415 SymptomBase Symptom = SymptomBase.Cast(m_AvailableSymptoms.Get(symptom_id).ClassName().ToType().Spawn());
416 if (uid == -1)
417 {
418 uid = CreateUniqueID();
419 }
420 Symptom.Init(this, m_Player,uid);
421 if ( m_SymptomsUIDs.Contains(uid) )
422 Error("Symptoms: Unique ID already exists !");
423 m_SymptomsUIDs.Insert(uid, Symptom);
424 IncreaseSymptomCount(symptom_id);
425 return Symptom;
426 }
427
428 if ( !Symptom )
429 {
430 Error("Symptom not registered");
431 }
432
433 return NULL;
434 }
435
437 {
438 for (int i = 0; i < m_SymptomQueuePrimary.Count(); i++)
439 {
440 m_SymptomQueuePrimary.Get(i).RequestDestroy();
441 }
442
443 }
444
445 SymptomBase QueueUpPrimarySymptom(int symptom_id, int uid = -1)
446 {
447 SymptomBase Symptom;
448 if ((GetSymptomCount(symptom_id) >= GetSymptomMaxCount(symptom_id)) && GetSymptomMaxCount(symptom_id) != -1)
449 return null;
450 for ( int i = 0; i < m_SymptomQueuePrimary.Count(); i++ )
451 {
452 if ( m_SymptomQueuePrimary.Get(i).CanBeInterupted() && ComparePriority( GetSymptomPriority(symptom_id), m_SymptomQueuePrimary.Get(i).GetPriority() ) == 1 )
453 {
454 Symptom = SpawnSymptom( symptom_id, uid );
455 m_SymptomQueuePrimary.InsertAt(Symptom,i);
456
458 {
459 m_SymptomQueuePrimary.Get(MAX_QUEUE_SIZE).RequestDestroy();// no need to remove from the array, that's done via Symptom callback on destruct
460 }
461 break;
462 }
463 }
464 if ( !Symptom && m_SymptomQueuePrimary.Count() < MAX_QUEUE_SIZE)
465 {
466 Symptom = SpawnSymptom( symptom_id, uid );
467 m_SymptomQueuePrimary.Insert(Symptom);
468 }
469 #ifdef DIAG_DEVELOPER
470 SendServerDebugToClient();
471 #endif
472 return Symptom;
473 }
474
475 void QueueUpSecondarySymptom(int symptom_id, int uid = -1)
476 {
477 QueueUpSecondarySymptomEx(symptom_id, uid);
478 }
479
480 SymptomBase QueueUpSecondarySymptomEx(int symptom_id, int uid = -1)
481 {
482 if ((GetSymptomCount(symptom_id) >= GetSymptomMaxCount(symptom_id)) && GetSymptomMaxCount(symptom_id) != -1)
483 return null;
484
485 if ( m_AvailableSymptoms.Get(symptom_id).IsPrimary() )
486 return null;
487
488 SymptomBase Symptom = SpawnSymptom( symptom_id, uid);
489
490 m_SymptomQueueSecondary.Insert(Symptom);
491 return Symptom;
492 }
493
495 void RemoveSecondarySymptom(int symptom_id)
496 {
497 for (int i = 0; i < m_SymptomQueueSecondary.Count();i++)
498 {
499 if ( m_SymptomQueueSecondary.Get(i) && m_SymptomQueueSecondary.Get(i).GetType() == symptom_id )
500 {
501 m_SymptomQueueSecondary.Get(i).RequestDestroy();
502 return;
503 }
504 }
505 }
506
508 {
509 if ( GetGame().IsServer() )
510 {
512 {
514 }
515 }
516 if ( !GetGame().IsDedicatedServer() )
517 {
518 if ( m_SymptomQueuePrimary.Count() > 0 )
519 return m_SymptomQueuePrimary.Get(0);
520 }
521 return NULL;
522 }
523
525 {
526 for (int i = 0; i < m_SymptomQueuePrimary.Count();i++)
527 {
528 if ( m_SymptomQueuePrimary.Get(i).CanActivate() )
529 {
530 return i;
531 }
532 }
533 return -1;
534 }
535
536 int ComparePriority( int prio1, int prio2 )
537 {
538 if ( prio1 > prio2 )
539 {
540 return 1;
541 }
542 else if ( prio2 > prio1 )
543 {
544 return 2;
545 }
546 return 0;
547 }
548
549 int GetSymptomPriority(int symptom_id)
550 {
551 return m_AvailableSymptoms.Get(symptom_id).GetPriority();
552 }
553
554 void OnRPC(int rpc_type, ParamsReadContext ctx)
555 {
557 int symptom_id = CachedObjectsParams.PARAM2_INT_INT.param1;
558 int uid = CachedObjectsParams.PARAM2_INT_INT.param2;
559
560 bool is_primary = m_AvailableSymptoms.Get(symptom_id).IsPrimary();
561
562 if ( rpc_type == ERPCs.RPC_PLAYER_SYMPTOM_ON )
563 {
564 if ( is_primary )
565 {
567 QueueUpPrimarySymptom(symptom_id,uid);
568 }
569 else
570 {
571 QueueUpSecondarySymptom(symptom_id,uid);
572 }
573 }
574 else if ( rpc_type == ERPCs.RPC_PLAYER_SYMPTOM_OFF )
575 {
576 if ( is_primary )
577 {
579 }
580 else
581 {
582 RemoveSecondarySymptom( symptom_id );
583 }
584 }
585 }
586
588 {
589 array<int> m_SaveQueue = new array<int>;
590
591 for ( int i = 0; i < m_SymptomQueuePrimary.Count(); i++ )
592 {
593 if ( m_SymptomQueuePrimary.Get(i).IsPersistent() )
594 {
595 m_SaveQueue.Insert( m_SymptomQueuePrimary.Get(i).GetType() );
596 }
597 }
598
599 for ( i = 0; i < m_SymptomQueueSecondary.Count(); i++ )
600 {
601 if ( m_SymptomQueueSecondary.Get(i).IsPersistent() )
602 {
603 m_SaveQueue.Insert( m_SymptomQueueSecondary.Get(i).GetType() );
604 }
605 }
606
607 ctx.Write( m_SaveQueue );
608 }
609
610 bool OnStoreLoad( ParamsReadContext ctx, int version )
611 {
612 array<int> m_SaveQueue;
613
614 if (ctx.Read(m_SaveQueue))
615 {
616 for ( int i = 0; i < m_SaveQueue.Count(); i++ )
617 {
618 int id = m_SaveQueue.Get(i);
619
620 if ( IsSymptomPrimary(id) )
621 {
623 }
624 else
625 {
627 }
628 }
629 return true;
630 }
631 else
632 {
633 return false;
634 }
635 }
636
637#ifdef DIAG_DEVELOPER
638 void OnRPCDebug(int rpc_type, ParamsReadContext ctx)
639 {
640 switch (rpc_type)
641 {
642 case ERPCs.DIAG_PLAYER_SYMPTOMS_DEBUG_ON:
643 {
645 {
647 {
649 }
650 else
651 {
653 }
654 }
655 break;
656 }
657
658 case ERPCs.DIAG_PLAYER_SYMPTOMS_DEBUG_OFF:
659 {
662 break;
663 }
664
665 case ERPCs.DIAG_PLAYER_SYMPTOMS_DEBUG:
666 {
667 int primary_Symptoms_count;
668 int secondary_Symptoms_count;
669
670 int symptom_id;
671
673 {
674 primary_Symptoms_count = CachedObjectsParams.PARAM1_INT.param1;
675 }
676
678 {
679 secondary_Symptoms_count = CachedObjectsParams.PARAM1_INT.param1;
680 }
681
685
686 int overall_count = primary_Symptoms_count + secondary_Symptoms_count;
687 for (int i = 0; i < overall_count ; ++i)
688 {
689 Param3<bool, int, int> p3 = new Param3<bool, int, int>(false,0,0);
690 ctx.Read(p3);
691 bool is_primary = p3.param1;
692
693 if (is_primary)
694 {
695 m_SymptomQueueServerDbgPrimary.Insert(p3);// m_SymptomQueueServerDbg.Insert(p3);
696 }
697 else
698 {
700 }
701 //PrintString("elements m_SymptomQueueServerDbgPrimary:" + m_SymptomQueueServerDbgPrimary.Count());
702 //PrintString("elements m_SymptomQueueServerDbgSecondary:" + m_SymptomQueueServerDbgSecondary.Count());
703
704 }
705 /*
706 for(i = 0; i < secondary_Symptoms_count; i++)
707 {
708 ctx.Read(CachedObjectsParams.PARAM1_STRING);
709 m_SymptomQueueSecondaryServerDbg.Insert(CachedObjectsParams.PARAM1_STRING.param1);
710 }*/
711 break;
712 }
713 }
714 }
715
716 void SendServerDebugToClient()
717 {
718 array<ref Param> debug_list = new array<ref Param>;
719
720 Param1<int> p1 = new Param1<int>(0);
721 Param1<int> p2 = new Param1<int>(0);
722
723 p1.param1 = m_SymptomQueuePrimary.Count();
724 p2.param1 = m_SymptomQueueSecondary.Count();
725
726 debug_list.Insert(p1);
727 debug_list.Insert(p2);
728
729 Param3<bool,int,int> p;
730
731 bool is_primary;
732 int symptom_id;
733 int SYMPTOM_uid;
734
735 foreach ( SymptomBase symptom : m_SymptomQueuePrimary )
736 {
737 is_primary = symptom.IsPrimary();
738 symptom_id = symptom.GetType();
739 SYMPTOM_uid = symptom.GetUID();
740
741 p = new Param3<bool,int,int>(is_primary, symptom_id, SYMPTOM_uid );
742 debug_list.Insert(p);
743 }
744
745 foreach ( SymptomBase secSymptom : m_SymptomQueueSecondary )
746 {
747 is_primary = secSymptom.IsPrimary();
748 symptom_id = secSymptom.GetType();
749 SYMPTOM_uid = secSymptom.GetUID();
750
751 p = new Param3<bool,int,int>(is_primary, symptom_id, SYMPTOM_uid );
752 debug_list.Insert(p);
753 }
754
755 GetGame().RPC(GetPlayer(), ERPCs.DIAG_PLAYER_SYMPTOMS_DEBUG, debug_list, true);
756 }
757
758 void DebugRequestExitSymptom(int SYMPTOM_uid)
759 {
760 CachedObjectsParams.PARAM1_INT.param1 = SYMPTOM_uid;
761 if (GetPlayer())
762 GetGame().RPCSingleParam(GetPlayer(), ERPCs.DIAG_PLAYER_SYMPTOMS_DEBUG_OFF, CachedObjectsParams.PARAM1_INT, true, GetPlayer().GetIdentity());
763 }
764
765 array<ref Param> PrepareClientDebug(array<ref SymptomBase> Symptoms)
766 {
767 array<ref Param> debug_array = new array<ref Param>;
768
769 Param3<bool, int, int> p3;
770
771 for (int i = 0; i < Symptoms.Count(); i++)
772 {
773 bool is_primary = Symptoms.Get(i).IsPrimary();
774 int symptom_id = Symptoms.Get(i).GetType();
775 int SYMPTOM_uid = Symptoms.Get(i).GetUID();
776
777 p3 = new Param3<bool,int,int>(is_primary, symptom_id, SYMPTOM_uid );
778 debug_array.Insert(p3);
779 }
780 return debug_array;
781 }
782
783 void DisplayDebug1(string name, int y_offset, array<ref Param> Symptoms_primary, array<ref Param> Symptoms_secondary)
784 {
785 string primary;
786 Param3<bool, int, int> p3 = new Param3<bool, int, int>(false,0,0);
787
789 DbgUI.Begin(name, 50, y_offset);
790 DbgUI.Text("Primary: ");
791
792 bool is_primary;
793 int symptom_id;
794 int SYMPTOM_uid;
795 string SYMPTOM_name;
796
797 for (int i = 0; i < Symptoms_primary.Count(); i++)
798 {
799 p3 = Param3<bool, int, int>.Cast(Symptoms_primary.Get(i));
800
801 is_primary = p3.param1;
802 symptom_id = p3.param2;
803 SYMPTOM_uid = p3.param3;
804 SYMPTOM_name = GetSymptomName(symptom_id);
805
806 primary += SYMPTOM_name + " | ";
807 }
808
809 DbgUI.Text(primary);
810 DbgUI.Text("Secondary: ");
811 for (i = 0; i < Symptoms_secondary.Count(); i++)
812 {
813 p3 = Param3<bool, int, int>.Cast(Symptoms_secondary.Get(i));
814
815 is_primary = p3.param1;
816 symptom_id = p3.param2;
817 SYMPTOM_uid = p3.param3;
818 SYMPTOM_name = GetSymptomName(symptom_id);
819 DbgUI.Text(SYMPTOM_name);
820 }
821
822 DbgUI.End();
824 }
825
826 void DisplayDebug2(string name, int y_offset, array<ref Param> Symptoms_primary, array<ref Param> Symptoms_secondary)
827 {
828 string primary;
829 Param3<bool, int, int> p3 = new Param3<bool, int, int>(false,0,0);
830
832 DbgUI.Begin(name, 50, y_offset);
833 DbgUI.Text("Primary: ");
834
835 bool is_primary;
836 int symptom_id;
837 int SYMPTOM_uid;
838 string SYMPTOM_name;
839
840 for (int i = 0; i < Symptoms_primary.Count(); i++)
841 {
842 p3 = Param3<bool, int, int>.Cast(Symptoms_primary.Get(i));
843
844 is_primary = p3.param1;
845 symptom_id = p3.param2;
846 SYMPTOM_uid = p3.param3;
847 SYMPTOM_name = GetSymptomName(symptom_id);
848
849 if (DbgUI.Button( i.ToString() + " " + SYMPTOM_name, 80))
850 {
851 DebugRequestExitSymptom(SYMPTOM_uid);
852 }
853 }
854
855 DbgUI.Text("Secondary: ");
856 for (i = 0; i < Symptoms_secondary.Count(); i++)
857 {
858 p3 = Param3<bool, int, int>.Cast(Symptoms_secondary.Get(i));
859
860 is_primary = p3.param1;
861 symptom_id = p3.param2;
862 SYMPTOM_uid = p3.param3;
863 SYMPTOM_name = GetSymptomName(symptom_id);
864
865 if (DbgUI.Button( i.ToString() + " " + SYMPTOM_name, 80))
866 {
867 DebugRequestExitSymptom(SYMPTOM_uid);
868 }
869 }
870
871 DbgUI.End();
873 }
874
875 void ShowAvailableSymptoms()
876 {
878 DbgUI.Begin("available Symptoms", 300, 50);
879
880 for (int i = 0; i < m_AvailableSymptoms.Count(); i++)
881 {
882 SymptomBase Symptom = m_AvailableSymptoms.GetElement(i);
883 string SYMPTOM_name = Symptom.GetName();
884 int symptom_id = Symptom.GetType();
885
886 if (DbgUI.Button( i.ToString() + " " + SYMPTOM_name, 80))
887 {
888 DebugRequestActivateSymptom(symptom_id);
889 }
890 }
891
892 DbgUI.End();
894 }
895
896 void CleanAvailableSymptoms()
897 {
899 DbgUI.Begin("available Symptoms", 300, 50);
900 DbgUI.End();
902 }
903
904 void CleanDebug1(string name, int y_offset)
905 {
907 DbgUI.Begin(name, 50, y_offset);
908 DbgUI.End();
910 }
911
912 void CleanDebug2(string name, int y_offset)
913 {
915 DbgUI.Begin(name, 50, y_offset);
916 DbgUI.End();
918 }
919
920 void DebugRequestActivateSymptom(int symptom_id)
921 {
922 CachedObjectsParams.PARAM1_INT.param1 = symptom_id;
923 if (GetPlayer())
924 GetGame().RPCSingleParam(GetPlayer(), ERPCs.DIAG_PLAYER_SYMPTOMS_DEBUG_ON, CachedObjectsParams.PARAM1_INT, true, GetPlayer().GetIdentity());
925 }
926
927#endif
928}
DiagMenuIDs
Definition EDiagMenuIDs.c:2
ERPCs
Definition ERPCs.c:2
string name
eAnimFinishType
Definition SmptAnimMeta.c:2
enum AnimType SYMPTOM_BLINDNESS
enum AnimType SYMPTOM_VOMIT
enum AnimType SYMPTOM_BLEEDING_SOURCE
enum AnimType SYMPTOM_UNCONSCIOUS
enum AnimType SYMPTOM_PAIN_LIGHT
enum AnimType SYMPTOM_BULLET_HIT
enum AnimType SYMPTOM_HAND_SHIVER
const int DEBUG_PADDING_OFFSET
enum AnimType SYMPTOM_FEVERBLUR
enum AnimType SYMPTOM_FREEZE
enum AnimType SYMPTOM_BLOODLOSS
enum AnimType SYMPTOM_LAUGHTER
enum AnimType SYMPTOM_COUGH
SymptomTypes
@ PRIMARY
@ SECONDARY
EAnimPlayState
@ OK
@ POSTPONED
@ FAILED
AnimType
Definition StateManager.c:2
@ FULL_BODY
Definition StateManager.c:3
@ ADDITIVE
Definition StateManager.c:4
enum AnimType SYMPTOM_PAIN_HEAVY
enum AnimType SYMPTOM_SNEEZE
enum AnimType SYMPTOM_HOT
const int MAX_QUEUE_SIZE
proto native void RPC(Object target, int rpcType, notnull array< ref Param > params, bool guaranteed, PlayerIdentity recipient=null)
Initiate remote procedure call. When called on client, RPC is evaluated on server; When called on ser...
void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient=null)
see CGame.RPC
Definition Game.c:882
static ref Param2< int, int > PARAM2_INT_INT
static ref Param1< int > PARAM1_INT
Definition DbgUI.c:60
Definition Debug.c:14
static void LogError(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as error message.
Definition Debug.c:235
Definition EnMath.c:7
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
proto bool Write(void value_out)
proto bool Read(void value_in)
override void Init(ParamsReadContext ctx, SymptomManager manager, PlayerBase player)
int GetType()
Definition StateBase.c:100
void Update(float deltatime)
Definition StateBase.c:210
bool IsPrimary()
Definition StateBase.c:135
void Init(SymptomManager manager, PlayerBase player, int uid)
Definition StateBase.c:39
void AnimationStart()
Definition StateBase.c:321
string GetName()
Definition StateBase.c:90
void Activate()
Definition StateBase.c:163
void SetAnimation(ParamsReadContext ctx)
void QueueUpSecondarySymptom(int symptom_id, int uid=-1)
ref array< ref Param > m_SymptomQueueServerDbgPrimary
void OnRPC(int rpc_type, ParamsReadContext ctx)
ref map< int, int > m_ActiveSymptomTypes
void RequestSymptomExit(int SYMPTOM_uid)
Exits a specific Symptom with a given UID.
void IncreaseSymptomCount(int symptom_id)
int GetStorageVersion()
ref array< ref Param > m_SymptomQueueServerDbg
SymptomBase QueueUpSecondarySymptomEx(int symptom_id, int uid=-1)
const int STORAGE_VERSION
int m_ActiveSymptomIndexPrimary
SymptomBase GetCurrentPrimaryActiveSymptom()
void RemoveSecondarySymptom(int symptom_id)
Removes a single Symptom.
ref array< ref SymptomBase > m_SymptomQueueSecondary
int GetSymptomPriority(int symptom_id)
SymptomBase SpawnSymptom(int symptom_id, int uid=-1)
void OnTick(float deltatime, int pCurrentCommandID, HumanMovementState movement_state)
void OnPlayerKilled()
PlayerBase m_Player
int GetSymptomCount(int symptom_id)
ref array< ref SymptomBase > m_SymptomQueuePrimary
int ComparePriority(int prio1, int prio2)
void UpdateActiveSymptoms(float deltatime)
SymptomBase QueueUpPrimarySymptom(int symptom_id, int uid=-1)
bool IsUIDUsed(int uid)
void ~SymptomManager()
int GetCurrentCommandID()
ref map< int, SymptomBase > m_SymptomsUIDs
ref SmptAnimMetaBase m_AnimMeta
bool IsSymptomPrimary(int symptom_id)
SymptomBase GetSymptomByUID(int SYMPTOM_uid)
int GetSymptomMaxCount(int symptom_id)
void OnAnimationStarted()
void AutoactivateSymptoms()
PlayerBase GetPlayer()
void OnInputUserDataReceived(ParamsReadContext ctx)
string GetSymptomName(int symptom_id)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnAnimationFinished(eAnimFinishType type=eAnimFinishType.SUCCESS)
void DecreaseSymptomCount(int symptom_id)
int FindFirstAvailableSymptomIndex()
void OnStoreSave(ParamsWriteContext ctx)
ref Timer m_Timer
void OnSymptomExit(SymptomBase Symptom, int uid)
SmptAnimMetaBase SpawnAnimMetaObject(int symptom_id)
void CleanUpPrimaryQueue()
void RegisterSymptom(SymptomBase Symptom)
ref map< int, ref SymptomBase > m_AvailableSymptoms
void SymptomManager(PlayerBase player)
ref array< ref Param > m_SymptomQueueServerDbgSecondary
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
void Update(float timeslice)
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
static proto native bool Button(string txt, int minWidth=0)
static proto native void Begin(string windowTitle, float x=0, float y=0)
static proto void BeginCleanupScope()
static proto native void Text(string label)
static proto native void EndCleanupScope()
static proto native void End()
static proto bool GetBool(int id, bool reverse=false)
Get value as bool from the given script id.
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].