DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
StateManager.c
См. документацию.
6
7enum SymptomIDs
8{
32};
33
39
46
48const int MAX_QUEUE_SIZE = 5;
49
51{
54
56 {
57 m_IntArray = new TIntArray();
59 }
60
61 override bool Serialize(Serializer ctx)
62 {
63 bool returnValue = true;
64
65 foreach (int i : m_IntArray)
66 {
67 returnValue = ctx.Read(i);
68 if (!returnValue)
69 return false;
70 }
71
72 foreach (int f : m_FloatArray)
73 {
74 returnValue = ctx.Read(f);
75 if (!returnValue)
76 return false;
77 }
78
79 return returnValue;
80 }
81
82 override bool Deserializer(Serializer ctx)
83 {
84 bool returnValue = true;
85
86 foreach (int i : m_IntArray)
87 {
88 returnValue = ctx.Read(i);
89 if (!returnValue)
90 return false;
91 }
92
93 foreach (int f : m_FloatArray)
94 {
95 returnValue = ctx.Read(f);
96 if (!returnValue)
97 return false;
98 }
99
100 return returnValue;
101 }
102}
103
104class SymptomManager
105{
108 ref map<int, int> m_ActiveSymptomTypes;//for each type(symptom id), keep track of how many times it is in queue
109
112
114
115
119 //ref array<string> m_SymptomQueueSecondaryServerDbg;
121
124
125 const int STORAGE_VERSION = 121;
126
127 bool m_ShowDebug = false;
128 bool m_ShowDebug2 = false;
129
131
132 void Init()
133 {
134 RegisterSymptom(new CoughSymptom);
136 RegisterSymptom(new BlindnessSymptom);
137 RegisterSymptom(new SneezeSymptom);
138 RegisterSymptom(new FeverBlurSymptom);
139 RegisterSymptom(new BloodLoss);
141 RegisterSymptom(new FreezeSymptom);
142 RegisterSymptom(new FreezeRattleSymptom);
143 RegisterSymptom(new HotSymptom);
144 RegisterSymptom(new PainLightSymptom);
145 RegisterSymptom(new PainHeavySymptom);
146 RegisterSymptom(new HandShiversSymptom);
148 RegisterSymptom(new HMP3Symptom);
149 RegisterSymptom(new GaspSymptom);
153 }
154
156 {
157 return STORAGE_VERSION;
158 }
159
160
162 {
163 if ( g_Game.IsClient() )
164 {
165 return;
166 }
167
168 QueueUpSecondarySymptom(SymptomIDs.SYMPTOM_BLOODLOSS);
169 }
170
188
190 {
191 foreach (SymptomBase symptomPrimary : m_SymptomQueuePrimary)
192 symptomPrimary.OnOwnerKilled();
193
194 foreach (SymptomBase symptomSecondary : m_SymptomQueueSecondary)
195 symptomSecondary.OnOwnerKilled();
196 }
197
199 {
200 return m_SymptomsUIDs.Get(SYMPTOM_uid);
201 }
202
204 {
205 return m_Player;
206 }
207
209 {
210 Symptom.Init(this, m_Player, 0);
211 int id = Symptom.GetType();
212
213 if (m_AvailableSymptoms.Contains(id))
214 {
215 ErrorEx(string.Format("Symptom %1 already registered!", Symptom.GetName()));
216 return;
217 }
218
219 m_AvailableSymptoms.Insert(id, Symptom);
220 }
221
223 {
224 if (m_AnimMeta)
225 {
226 m_AnimMeta.AnimFinished(type);
227 }
228 }
229
235
237 {
238 int uid = Math.RandomInt(1, 2147483647);
239 if (!IsUIDUsed(uid))
240 return uid;
241 else
242 return CreateUniqueID();
243 }
244
245 bool IsUIDUsed(int uid)
246 {
247 return m_SymptomsUIDs.Contains(uid);
248 }
249
250 string GetSymptomName(int symptom_id)
251 {
252 return m_AvailableSymptoms.Get(symptom_id).GetName();
253 }
254
256 {
257 SmptAnimMetaBase animMeta = m_AvailableSymptoms.Get(symptom_id).SpawnAnimMetaObject();
258 animMeta.m_StateType = symptom_id;
259
260 return animMeta;
261 }
262
264 void RequestSymptomExit(int SYMPTOM_uid)
265 {
266 if (m_SymptomsUIDs.Get(SYMPTOM_uid))
267 m_SymptomsUIDs.Get(SYMPTOM_uid).RequestDestroy();
268 }
269
270 bool IsSymptomPrimary(int symptom_id)
271 {
272 return m_AvailableSymptoms.Get(symptom_id).IsPrimary();
273 }
274
278
280 {
281 return m_CurrentCommandID;
282 }
283
284 void OnTick(float deltatime, int pCurrentCommandID, HumanMovementState movement_state)
285 {
286 // pCurrentCommandID might be the initial value, but the system itself requires
287 // current value, so retrieve the current value from player instead
288 m_CurrentCommandID = m_Player.GetCurrentCommandID();
290 {
292
294 m_Player.SetActivePrimarySymptomID(m_SymptomQueuePrimary.Get(m_ActiveSymptomIndexPrimary).GetType());
295 }
296
297 UpdateActiveSymptoms(deltatime);
298
299 if ( m_AnimMeta )
300 {
301 if ( m_AnimMeta.IsDestroyReqested() )
302 {
303 m_AnimMeta = null;
304 }
305 }
306
307 if ( m_AnimMeta )
308 {
309
310 //anim requested
311 if ( !m_AnimMeta.IsPlaying() )
312 {
313 // not playing yet and not possible to play
314 SymptomBase symptom = m_AvailableSymptoms.Get( m_AnimMeta.m_StateType );
315 if ( symptom && !symptom.CanActivate() )
316 {
317 m_AnimMeta = null;
318 }
319 else if ( m_AnimMeta.PlayRequest() == EAnimPlayState.FAILED )
320 {
322 }
323 }
324 else
325 {
326 m_AnimMeta.Update(movement_state);
327 }
328 }
329
330 #ifdef DIAG_DEVELOPER
331 #ifndef SERVER //must be here !!!
332 if ( DiagMenu.GetBool(DiagMenuIDs.MISC_PLAYER_SYMPTOMS_SHOW) )
333 {
334 //DisplayDebug(true);
335 array<ref Param> primary_debug = PrepareClientDebug(m_SymptomQueuePrimary);
336 array<ref Param> secondary_debug = PrepareClientDebug(m_SymptomQueueSecondary);
337
338 DisplayDebug1("Symptoms Client", 50, primary_debug, secondary_debug);
339 DisplayDebug2("Symptoms Server", 300, m_SymptomQueueServerDbgPrimary, m_SymptomQueueServerDbgSecondary);
340 ShowAvailableSymptoms();
341 }
342 else
343 {
344 CleanDebug1("Symptoms Client", 50);
345 CleanDebug2("Symptoms Server", 300);
346 CleanAvailableSymptoms();
347 }
348
349 int HMPRange = DiagMenu.GetRangeValue(DiagMenuIDs.MISC_PLAYER_SYMPTOMS_TOGGLE_HMP);
350 if (HMPRange == 1 && m_ActiveSymptomTypes.Get(SymptomIDs.SYMPTOM_HMP_SEVERE) == 0)
351 {
352 QueueUpSecondarySymptomEx(SymptomIDs.SYMPTOM_HMP_SEVERE);
353 }
354 else if (HMPRange == 0 && m_ActiveSymptomTypes.Get(SymptomIDs.SYMPTOM_HMP_SEVERE) > 0)
355 {
356 RemoveSecondarySymptom(SymptomIDs.SYMPTOM_HMP_SEVERE);
357 }
358 #endif
359 #endif
360 }
361
363 {
364 if (m_AnimMeta)
365 {
366 // animation meta already exists
367 // pass
368 }
369 else
370 {
371 int state_type;
372 if (ctx.Read(state_type))
373 {
374 m_AnimMeta = SpawnAnimMetaObject(state_type);
375 if (m_AnimMeta)
376 {
377 m_AnimMeta.Init(ctx, this, m_Player);
378 }
379 }
380 }
381 }
382
383 void UpdateActiveSymptoms(float deltatime)
384 {
386 if (primarySymptom)
387 {
388 if (!primarySymptom.IsActivated() && primarySymptom.CanActivate())
389 primarySymptom.Activate();
390
391 if (primarySymptom.IsActivated() && CanUpdateSymptom(primarySymptom))
392 primarySymptom.Update(deltatime);
393 else
394 primarySymptom.Destroy();
395 }
396
397 int nSecondarySymptoms = m_SymptomQueueSecondary.Count();
398 for (int i = nSecondarySymptoms - 1; i >= 0; --i)
399 {
400 SymptomBase secondarySymptom = m_SymptomQueueSecondary[i];
401 if (secondarySymptom)
402 {
403 if (!secondarySymptom.IsActivated())
404 secondarySymptom.Activate();
405
406 if (secondarySymptom.IsActivated() && CanUpdateSymptom(secondarySymptom))
407 secondarySymptom.Update(deltatime);
408 else
409 secondarySymptom.Destroy();
410 }
411 }
412 }
413
414 void OnSymptomExit(SymptomBase Symptom, int uid)
415 {
416 bool is_primary;
417 if ( Symptom )
418 {
419 is_primary = Symptom.IsPrimary();
420 DecreaseSymptomCount(Symptom.GetType());
421 }
422
423 if (m_SymptomsUIDs.Contains(uid))
424 m_SymptomsUIDs.Remove(uid);
425 else
426 Debug.LogError("Symptom with this UID does not exist", "PlayerSymptoms");
427
428 if (is_primary)
429 {
430 for (int i = 0; i < m_SymptomQueuePrimary.Count(); i++)
431 {
432 if ( m_SymptomQueuePrimary.Get(i) == Symptom )
433 {
434 m_SymptomQueuePrimary.RemoveOrdered(i);
435 break;
436 }
437 }
438 }
439 else
440 {
441 for (i = 0; i < m_SymptomQueueSecondary.Count(); i++)
442 {
443 if (m_SymptomQueueSecondary.Get(i) == Symptom)
444 {
445 m_SymptomQueueSecondary.RemoveOrdered(i);
446 break;
447 }
448 }
449 }
451 m_Player.SetActivePrimarySymptomID(0);
452
453 #ifdef DIAG_DEVELOPER
454 if ( g_Game ) SendServerDebugToClient();
455 #endif
456 }
457
458
459 int GetSymptomMaxCount(int symptom_id)
460 {
461 return m_AvailableSymptoms.Get(symptom_id).GetMaxCount();
462 }
463
464
465 int GetSymptomCount(int symptom_id)
466 {
467 if ( m_ActiveSymptomTypes.Contains(symptom_id) )
468 return m_ActiveSymptomTypes.Get(symptom_id);
469 else
470 return -1;
471 }
472
473 void IncreaseSymptomCount(int symptom_id)
474 {
475 if ( m_ActiveSymptomTypes.Contains(symptom_id) )
476 {
477 m_ActiveSymptomTypes.Set(symptom_id, m_ActiveSymptomTypes.Get(symptom_id) + 1);
478 }
479 else
480 {
481 m_ActiveSymptomTypes.Insert(symptom_id, 1);
482 }
483 }
484
485 void DecreaseSymptomCount(int symptom_id)
486 {
487 if ( m_ActiveSymptomTypes.Contains(symptom_id) )
488 {
489 if ( m_ActiveSymptomTypes.Get(symptom_id) == 1)
490 m_ActiveSymptomTypes.Remove(symptom_id);
491 else
492 m_ActiveSymptomTypes.Set(symptom_id, m_ActiveSymptomTypes.Get(symptom_id) - 1);
493 }
494 }
495
496 SymptomBase SpawnSymptom(int symptom_id, int uid = -1)
497 {
498 SymptomBase symptom;
499
500 if (m_AvailableSymptoms.Get(symptom_id))
501 {
502 symptom = SymptomBase.Cast(m_AvailableSymptoms.Get(symptom_id).ClassName().ToType().Spawn());
503 if (!symptom)
504 {
505 ErrorEx("Symptom not registered");
506
507 return null;
508 }
509
510 if (uid == -1)
511 uid = CreateUniqueID();
512
513 symptom.Init(this, m_Player,uid);
514
515 if ( m_SymptomsUIDs.Contains(uid) )
516 ErrorEx(string.Format("Symptoms: Unique ID (=%1) already exists!", uid));
517
518 m_SymptomsUIDs.Insert(uid, symptom);
519 IncreaseSymptomCount(symptom_id);
520
521 }
522
523 return symptom;
524 }
525
527 {
528 foreach (SymptomBase symptom : m_SymptomQueuePrimary)
529 {
530 symptom.RequestDestroy();
531 }
532 }
533
534 SymptomBase QueueUpPrimarySymptom(int symptom_id, int uid = -1)
535 {
536 if ((GetSymptomCount(symptom_id) >= GetSymptomMaxCount(symptom_id)) && GetSymptomMaxCount(symptom_id) != -1)
537 return null;
538
539 SymptomBase symptom = m_AvailableSymptoms.Get(symptom_id);
540 if (m_Player.IsUnconscious() && !symptom.AllowInUnconscious())
541 return null;
542 else
543 symptom = null; // needed for check below
544
545 for (int i = 0; i < m_SymptomQueuePrimary.Count(); i++)
546 {
547 if (m_SymptomQueuePrimary.Get(i).CanBeInterupted() && ComparePriority(GetSymptomPriority(symptom_id), m_SymptomQueuePrimary.Get(i).GetPriority()) == 1)
548 {
549 symptom = SpawnSymptom(symptom_id, uid);
550 m_SymptomQueuePrimary.InsertAt(symptom,i);
551
553 m_SymptomQueuePrimary.Get(MAX_QUEUE_SIZE).RequestDestroy();// no need to remove from the array, that's done via Symptom callback on destruct
554
555 break;
556 }
557 }
558 if ( !symptom && m_SymptomQueuePrimary.Count() < MAX_QUEUE_SIZE)
559 {
560 symptom = SpawnSymptom( symptom_id, uid );
561 m_SymptomQueuePrimary.Insert(symptom);
562 }
563 #ifdef DIAG_DEVELOPER
564 SendServerDebugToClient();
565 #endif
566 return symptom;
567 }
568
569 void QueueUpSecondarySymptom(int symptom_id, int uid = -1)
570 {
571 QueueUpSecondarySymptomEx(symptom_id, uid);
572 }
573
574 SymptomBase QueueUpSecondarySymptomEx(int symptom_id, int uid = -1)
575 {
576 if ((GetSymptomCount(symptom_id) >= GetSymptomMaxCount(symptom_id)) && GetSymptomMaxCount(symptom_id) != -1)
577 return null;
578
579 if (m_AvailableSymptoms.Get(symptom_id).IsPrimary())
580 return null;
581
582 if (m_Player.IsUnconscious() && !m_AvailableSymptoms.Get(symptom_id).AllowInUnconscious())
583 return null;
584
585 SymptomBase symptom = SpawnSymptom(symptom_id, uid);
586
587 m_SymptomQueueSecondary.Insert(symptom);
588 return symptom;
589 }
590
592 void RemoveSecondarySymptom(int symptom_id)
593 {
594 for (int i = 0; i < m_SymptomQueueSecondary.Count();i++)
595 {
596 if ( m_SymptomQueueSecondary.Get(i) && m_SymptomQueueSecondary.Get(i).GetType() == symptom_id )
597 {
598 m_SymptomQueueSecondary.Get(i).RequestDestroy();
599 return;
600 }
601 }
602 }
603
605 {
606 if ( g_Game.IsServer() )
607 {
609 {
611 }
612 }
613 if ( !g_Game.IsDedicatedServer() )
614 {
615 if ( m_SymptomQueuePrimary.Count() > 0 )
616 return m_SymptomQueuePrimary.Get(0);
617 }
618 return NULL;
619 }
620
622 {
623 for (int i = 0; i < m_SymptomQueuePrimary.Count();i++)
624 {
625 if ( m_SymptomQueuePrimary.Get(i).CanActivate() )
626 {
627 return i;
628 }
629 }
630 return -1;
631 }
632
633 int ComparePriority( int prio1, int prio2 )
634 {
635 if ( prio1 > prio2 )
636 {
637 return 1;
638 }
639 else if ( prio2 > prio1 )
640 {
641 return 2;
642 }
643 return 0;
644 }
645
646 int GetSymptomPriority(int symptom_id)
647 {
648 return m_AvailableSymptoms.Get(symptom_id).GetPriority();
649 }
650
651 void OnRPC(int rpc_type, ParamsReadContext ctx)
652 {
653 int symptomId;
654 int uid;
655
656 switch (rpc_type)
657 {
658 case ERPCs.RPC_PLAYER_SYMPTOM_ON:
660 symptomId = CachedObjectsParams.PARAM2_INT_INT.param1;
662 if (IsSymptomPrimary(symptomId))
663 {
665 QueueUpPrimarySymptom(symptomId, uid);
666 }
667 else
668 QueueUpSecondarySymptom(symptomId, uid);
669
670 break;
671 case ERPCs.RPC_PLAYER_SYMPTOM_OFF:
673 symptomId = CachedObjectsParams.PARAM2_INT_INT.param1;
675 if (IsSymptomPrimary(symptomId))
676 {
678 }
679 else
680 RemoveSecondarySymptom(symptomId);
681
682 break;
683 case ERPCs.RPC_SYMPTOM_PARAM_SYNC:
685 ctx.Read(paramsNew);
686 m_AvailableSymptoms.Get(paramsNew.param1).SetParam(paramsNew);
687
688 break;
689 }
690 }
691
693 {
694 array<int> m_SaveQueue = new array<int>;
695
696 for ( int i = 0; i < m_SymptomQueuePrimary.Count(); i++ )
697 {
698 if ( m_SymptomQueuePrimary.Get(i).IsPersistent() )
699 {
700 m_SaveQueue.Insert( m_SymptomQueuePrimary.Get(i).GetType() );
701 }
702 }
703
704 for ( i = 0; i < m_SymptomQueueSecondary.Count(); i++ )
705 {
706 if ( m_SymptomQueueSecondary.Get(i).IsPersistent() )
707 {
708 m_SaveQueue.Insert( m_SymptomQueueSecondary.Get(i).GetType() );
709 }
710 }
711
712 ctx.Write( m_SaveQueue );
713 }
714
715 bool OnStoreLoad( ParamsReadContext ctx, int version )
716 {
717 array<int> m_SaveQueue;
718
719 if (ctx.Read(m_SaveQueue))
720 {
721 for ( int i = 0; i < m_SaveQueue.Count(); i++ )
722 {
723 int id = m_SaveQueue.Get(i);
724
725 if ( IsSymptomPrimary(id) )
726 {
728 }
729 else
730 {
732 }
733 }
734 return true;
735 }
736 else
737 {
738 return false;
739 }
740 }
741
742 protected bool CanUpdateSymptom(SymptomBase symptom)
743 {
744 if (m_Player.IsUnconscious() && !symptom.AllowInUnconscious())
745 return false;
746
747 return true;
748 }
749
750#ifdef DIAG_DEVELOPER
751 void OnRPCDebug(int rpc_type, ParamsReadContext ctx)
752 {
753 switch (rpc_type)
754 {
755 case ERPCs.DIAG_PLAYER_SYMPTOMS_DEBUG_ON:
756 {
757 if (ctx.Read(CachedObjectsParams.PARAM1_INT))
758 {
759 if (IsSymptomPrimary(CachedObjectsParams.PARAM1_INT.param1))
760 {
761 QueueUpPrimarySymptom(CachedObjectsParams.PARAM1_INT.param1);
762 }
763 else
764 {
765 QueueUpSecondarySymptom(CachedObjectsParams.PARAM1_INT.param1);
766 }
767 }
768 break;
769 }
770
771 case ERPCs.DIAG_PLAYER_SYMPTOMS_DEBUG_OFF:
772 {
773 if (ctx.Read(CachedObjectsParams.PARAM1_INT))
774 RequestSymptomExit(CachedObjectsParams.PARAM1_INT.param1);
775 break;
776 }
777
778 case ERPCs.DIAG_PLAYER_SYMPTOMS_DEBUG:
779 {
780 int primary_Symptoms_count;
781 int secondary_Symptoms_count;
782
783 int symptom_id;
784
785 if (ctx.Read(CachedObjectsParams.PARAM1_INT))
786 {
787 primary_Symptoms_count = CachedObjectsParams.PARAM1_INT.param1;
788 }
789
790 if (ctx.Read(CachedObjectsParams.PARAM1_INT))
791 {
792 secondary_Symptoms_count = CachedObjectsParams.PARAM1_INT.param1;
793 }
794
798
799 int overall_count = primary_Symptoms_count + secondary_Symptoms_count;
800 for (int i = 0; i < overall_count ; ++i)
801 {
802 Param3<bool, int, int> p3 = new Param3<bool, int, int>(false,0,0);
803 ctx.Read(p3);
804 bool is_primary = p3.param1;
805
806 if (is_primary)
807 {
808 m_SymptomQueueServerDbgPrimary.Insert(p3);// m_SymptomQueueServerDbg.Insert(p3);
809 }
810 else
811 {
813 }
814 //PrintString("elements m_SymptomQueueServerDbgPrimary:" + m_SymptomQueueServerDbgPrimary.Count());
815 //PrintString("elements m_SymptomQueueServerDbgSecondary:" + m_SymptomQueueServerDbgSecondary.Count());
816
817 }
818 /*
819 for(i = 0; i < secondary_Symptoms_count; i++)
820 {
821 ctx.Read(CachedObjectsParams.PARAM1_STRING);
822 m_SymptomQueueSecondaryServerDbg.Insert(CachedObjectsParams.PARAM1_STRING.param1);
823 }*/
824 break;
825 }
826 }
827 }
828
829 void SendServerDebugToClient()
830 {
831 array<ref Param> debug_list = new array<ref Param>;
832
833 Param1<int> p1 = new Param1<int>(0);
834 Param1<int> p2 = new Param1<int>(0);
835
836 p1.param1 = m_SymptomQueuePrimary.Count();
837 p2.param1 = m_SymptomQueueSecondary.Count();
838
839 debug_list.Insert(p1);
840 debug_list.Insert(p2);
841
842 Param3<bool,int,int> p;
843
844 bool is_primary;
845 int symptom_id;
846 int SYMPTOM_uid;
847
848 foreach ( SymptomBase symptom : m_SymptomQueuePrimary )
849 {
850 is_primary = symptom.IsPrimary();
851 symptom_id = symptom.GetType();
852 SYMPTOM_uid = symptom.GetUID();
853
854 p = new Param3<bool,int,int>(is_primary, symptom_id, SYMPTOM_uid );
855 debug_list.Insert(p);
856 }
857
858 foreach ( SymptomBase secSymptom : m_SymptomQueueSecondary )
859 {
860 is_primary = secSymptom.IsPrimary();
861 symptom_id = secSymptom.GetType();
862 SYMPTOM_uid = secSymptom.GetUID();
863
864 p = new Param3<bool,int,int>(is_primary, symptom_id, SYMPTOM_uid );
865 debug_list.Insert(p);
866 }
867
868 g_Game.RPC(GetPlayer(), ERPCs.DIAG_PLAYER_SYMPTOMS_DEBUG, debug_list, true);
869 }
870
871 void DebugRequestExitSymptom(int SYMPTOM_uid)
872 {
873 CachedObjectsParams.PARAM1_INT.param1 = SYMPTOM_uid;
874 if (GetPlayer())
875 g_Game.RPCSingleParam(GetPlayer(), ERPCs.DIAG_PLAYER_SYMPTOMS_DEBUG_OFF, CachedObjectsParams.PARAM1_INT, true, GetPlayer().GetIdentity());
876 }
877
878 array<ref Param> PrepareClientDebug(array<ref SymptomBase> Symptoms)
879 {
880 array<ref Param> debug_array = new array<ref Param>;
881
882 Param3<bool, int, int> p3;
883
884 for (int i = 0; i < Symptoms.Count(); i++)
885 {
886 bool is_primary = Symptoms.Get(i).IsPrimary();
887 int symptom_id = Symptoms.Get(i).GetType();
888 int SYMPTOM_uid = Symptoms.Get(i).GetUID();
889
890 p3 = new Param3<bool,int,int>(is_primary, symptom_id, SYMPTOM_uid );
891 debug_array.Insert(p3);
892 }
893 return debug_array;
894 }
895
896 void DisplayDebug1(string name, int y_offset, array<ref Param> Symptoms_primary, array<ref Param> Symptoms_secondary)
897 {
898 string primary;
899 Param3<bool, int, int> p3 = new Param3<bool, int, int>(false,0,0);
900
901 DbgUI.BeginCleanupScope();
902 DbgUI.Begin(name, 50, y_offset);
903 DbgUI.Text("Primary: ");
904
905 bool is_primary;
906 int symptom_id;
907 int SYMPTOM_uid;
908 string SYMPTOM_name;
909
910 for (int i = 0; i < Symptoms_primary.Count(); i++)
911 {
912 p3 = Param3<bool, int, int>.Cast(Symptoms_primary.Get(i));
913
914 is_primary = p3.param1;
915 symptom_id = p3.param2;
916 SYMPTOM_uid = p3.param3;
917 SYMPTOM_name = GetSymptomName(symptom_id);
918
919 primary += SYMPTOM_name + " | ";
920 }
921
922 DbgUI.Text(primary);
923 DbgUI.Text("Secondary: ");
924 for (i = 0; i < Symptoms_secondary.Count(); i++)
925 {
926 p3 = Param3<bool, int, int>.Cast(Symptoms_secondary.Get(i));
927
928 is_primary = p3.param1;
929 symptom_id = p3.param2;
930 SYMPTOM_uid = p3.param3;
931 SYMPTOM_name = GetSymptomName(symptom_id);
932 DbgUI.Text(SYMPTOM_name);
933 }
934
935 DbgUI.End();
936 DbgUI.EndCleanupScope();
937 }
938
939 void DisplayDebug2(string name, int y_offset, array<ref Param> Symptoms_primary, array<ref Param> Symptoms_secondary)
940 {
941 string primary;
942 Param3<bool, int, int> p3 = new Param3<bool, int, int>(false,0,0);
943
944 DbgUI.BeginCleanupScope();
945 DbgUI.Begin(name, 50, y_offset);
946 DbgUI.Text("Primary: ");
947
948 bool is_primary;
949 int symptom_id;
950 int SYMPTOM_uid;
951 string SYMPTOM_name;
952
953 for (int i = 0; i < Symptoms_primary.Count(); i++)
954 {
955 p3 = Param3<bool, int, int>.Cast(Symptoms_primary.Get(i));
956
957 is_primary = p3.param1;
958 symptom_id = p3.param2;
959 SYMPTOM_uid = p3.param3;
960 SYMPTOM_name = GetSymptomName(symptom_id);
961
962 if (DbgUI.Button( i.ToString() + " " + SYMPTOM_name, 80))
963 {
964 DebugRequestExitSymptom(SYMPTOM_uid);
965 }
966 }
967
968 DbgUI.Text("Secondary: ");
969 for (i = 0; i < Symptoms_secondary.Count(); i++)
970 {
971 p3 = Param3<bool, int, int>.Cast(Symptoms_secondary.Get(i));
972
973 is_primary = p3.param1;
974 symptom_id = p3.param2;
975 SYMPTOM_uid = p3.param3;
976 SYMPTOM_name = GetSymptomName(symptom_id);
977
978 if (DbgUI.Button( i.ToString() + " " + SYMPTOM_name, 80))
979 {
980 DebugRequestExitSymptom(SYMPTOM_uid);
981 }
982 }
983
984 DbgUI.End();
985 DbgUI.EndCleanupScope();
986 }
987
988 void ShowAvailableSymptoms()
989 {
990 DbgUI.BeginCleanupScope();
991 DbgUI.Begin("available Symptoms", 300, 50);
992
993 for (int i = 0; i < m_AvailableSymptoms.Count(); i++)
994 {
995 SymptomBase Symptom = m_AvailableSymptoms.GetElement(i);
996 string SYMPTOM_name = Symptom.GetName();
997 int symptom_id = Symptom.GetType();
998
999 if (DbgUI.Button( i.ToString() + " " + SYMPTOM_name, 80))
1000 {
1001 DebugRequestActivateSymptom(symptom_id);
1002 }
1003 }
1004
1005 DbgUI.End();
1006 DbgUI.EndCleanupScope();
1007 }
1008
1009 void CleanAvailableSymptoms()
1010 {
1011 DbgUI.BeginCleanupScope();
1012 DbgUI.Begin("available Symptoms", 300, 50);
1013 DbgUI.End();
1014 DbgUI.EndCleanupScope();
1015 }
1016
1017 void CleanDebug1(string name, int y_offset)
1018 {
1019 DbgUI.BeginCleanupScope();
1020 DbgUI.Begin(name, 50, y_offset);
1021 DbgUI.End();
1022 DbgUI.EndCleanupScope();
1023 }
1024
1025 void CleanDebug2(string name, int y_offset)
1026 {
1027 DbgUI.BeginCleanupScope();
1028 DbgUI.Begin(name, 50, y_offset);
1029 DbgUI.End();
1030 DbgUI.EndCleanupScope();
1031 }
1032
1033 void DebugRequestActivateSymptom(int symptom_id)
1034 {
1035 CachedObjectsParams.PARAM1_INT.param1 = symptom_id;
1036 if (GetPlayer())
1037 g_Game.RPCSingleParam(GetPlayer(), ERPCs.DIAG_PLAYER_SYMPTOMS_DEBUG_ON, CachedObjectsParams.PARAM1_INT, true, GetPlayer().GetIdentity());
1038 }
1039
1040#endif
1041}
@ OK
0 - No error. Can be returned from any call.
Определения BIOSErrorModule.c:9
void OnRPC(PlayerIdentity sender, int rpcType, ParamsReadContext ctx)
Определения BunkerBroadcastComponent.c:182
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения CodeLockComponent.c:264
void OnStoreSave(ParamsWriteContext ctx)
Определения CodeLockComponent.c:257
map
Определения ControlsXboxNew.c:4
DayZGame g_Game
Определения DayZGame.c:4074
override Widget Init()
Определения DayZGame.c:127
ref Timer m_Timer
Определения DayZGame.c:723
DiagMenuIDs
Определения EDiagMenuIDs.c:2
ERPCs
Определения ERPCs.c:2
override SmptAnimMetaBase SpawnAnimMetaObject()
Определения FreezeState.c:147
DayZPlayer m_Player
Определения Hand_Events.c:42
void OnTick(PlayerBase player, float deltaT)
Определения HeatStroke.c:186
PlayerBase GetPlayer()
Определения ModifierBase.c:51
int GetStorageVersion()
Определения ModifiersManager.c:178
@ LAST_INDEX
Определения ModifiersManager.c:17
class ModifierDebugObj STORAGE_VERSION
eAnimFinishType
Определения SmptAnimMeta.c:2
void SetAnimation(ParamsReadContext ctx)
Определения StateManager.c:362
void QueueUpSecondarySymptom(int symptom_id, int uid=-1)
Определения StateManager.c:569
enum AnimType SYMPTOM_BLINDNESS
ref array< ref Param > m_SymptomQueueServerDbgPrimary
Определения StateManager.c:117
enum AnimType SYMPTOM_VOMIT
ref map< int, int > m_ActiveSymptomTypes
Определения StateManager.c:108
void RequestSymptomExit(int SYMPTOM_uid)
Exits a specific Symptom with a given UID.
Определения StateManager.c:264
enum AnimType SYMPTOM_BLEEDING_SOURCE
void IncreaseSymptomCount(int symptom_id)
Определения StateManager.c:473
enum AnimType SYMPTOM_UNCONSCIOUS
ref array< ref Param > m_SymptomQueueServerDbg
Определения StateManager.c:116
SymptomBase QueueUpSecondarySymptomEx(int symptom_id, int uid=-1)
Определения StateManager.c:574
enum AnimType SYMPTOM_PAIN_LIGHT
int m_ActiveSymptomIndexPrimary
Определения StateManager.c:122
SymptomBase GetCurrentPrimaryActiveSymptom()
Определения StateManager.c:604
enum AnimType SYMPTOM_BULLET_HIT
enum AnimType SYMPTOM_GASP
void RemoveSecondarySymptom(int symptom_id)
Removes a single Symptom.
Определения StateManager.c:592
ref array< ref SymptomBase > m_SymptomQueueSecondary
Определения StateManager.c:111
int GetSymptomPriority(int symptom_id)
Определения StateManager.c:646
SymptomBase SpawnSymptom(int symptom_id, int uid=-1)
Определения StateManager.c:496
bool m_ShowDebug
Определения StateManager.c:127
enum AnimType SYMPTOM_HAND_SHIVER
bool CanUpdateSymptom(SymptomBase symptom)
Определения StateManager.c:742
void OnPlayerKilled()
Определения StateManager.c:189
int GetSymptomCount(int symptom_id)
Определения StateManager.c:465
const int DEBUG_PADDING_OFFSET
Определения StateManager.c:47
ref array< ref SymptomBase > m_SymptomQueuePrimary
Определения StateManager.c:110
enum AnimType SYMPTOM_FAINT
int ComparePriority(int prio1, int prio2)
Определения StateManager.c:633
enum AnimType SYMPTOM_FEVERBLUR
void UpdateActiveSymptoms(float deltatime)
Определения StateManager.c:383
enum AnimType SYMPTOM_FREEZE
SymptomBase QueueUpPrimarySymptom(int symptom_id, int uid=-1)
Определения StateManager.c:534
enum AnimType SYMPTOM_SQUINT
int CreateUniqueID()
Определения StateManager.c:236
enum AnimType SYMPTOM_BLOODLOSS
bool IsUIDUsed(int uid)
Определения StateManager.c:245
int GetCurrentCommandID()
Определения StateManager.c:279
enum AnimType SYMPTOM_LAUGHTER
enum AnimType SYMPTOM_COUGH
SymptomTypes
Определения StateManager.c:35
@ PRIMARY
Определения StateManager.c:36
@ SECONDARY
Определения StateManager.c:37
ref map< int, SymptomBase > m_SymptomsUIDs
Определения StateManager.c:113
ref SmptAnimMetaBase m_AnimMeta
Определения StateManager.c:130
bool IsSymptomPrimary(int symptom_id)
Определения StateManager.c:270
SymptomBase GetSymptomByUID(int SYMPTOM_uid)
Определения StateManager.c:198
EAnimPlayState
Определения StateManager.c:41
@ POSTPONED
Определения StateManager.c:43
int GetSymptomMaxCount(int symptom_id)
Определения StateManager.c:459
void OnAnimationStarted()
Определения StateManager.c:230
bool m_ShowDebug2
Определения StateManager.c:128
enum AnimType SYMPTOM_IRRITATED_EYES
void AutoactivateSymptoms()
Определения StateManager.c:161
void OnInputUserDataReceived(ParamsReadContext ctx)
Определения StateManager.c:275
string GetSymptomName(int symptom_id)
Определения StateManager.c:250
AnimType
Определения StateManager.c:2
@ FULL_BODY
Определения StateManager.c:3
enum AnimType SYMPTOM_PAIN_HEAVY
enum AnimType SYMPTOM_SNEEZE
enum AnimType SYMPTOM_HMP_SEVERE
void OnAnimationFinished(eAnimFinishType type=eAnimFinishType.SUCCESS)
Определения StateManager.c:222
void DecreaseSymptomCount(int symptom_id)
Определения StateManager.c:485
int FindFirstAvailableSymptomIndex()
Определения StateManager.c:621
enum AnimType SYMPTOM_HOT
const int MAX_QUEUE_SIZE
Определения StateManager.c:48
void OnSymptomExit(SymptomBase Symptom, int uid)
Определения StateManager.c:414
enum AnimType SYMPTOM_DEAFNESS_COMPLETE
void CleanUpPrimaryQueue()
Определения StateManager.c:526
enum AnimType SYMPTOM_FREEZE_RATTLE
void RegisterSymptom(SymptomBase Symptom)
Определения StateManager.c:208
ref map< int, ref SymptomBase > m_AvailableSymptoms
Определения StateManager.c:107
int m_CurrentCommandID
Определения StateManager.c:123
void SymptomManager(PlayerBase player)
Определения StateManager.c:171
ref array< ref Param > m_SymptomQueueServerDbgSecondary
Определения StateManager.c:118
static ref Param2< int, int > PARAM2_INT_INT
Определения UtilityClasses.c:16
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.
Определения 3_Game/DayZ/tools/Debug.c:318
Определения 3_Game/DayZ/tools/Debug.c:2
Определения EnDebug.c:241
Определения FaintState.c:2
Определения human.c:1181
Определения LaughterState.c:2
Определения EnMath.c:7
Определения PPEConstants.c:68
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Определения param.c:12
Определения PlayerBaseClient.c:2
proto bool Write(void value_out)
proto bool Read(void value_in)
Serialization general interface. Serializer API works with:
Определения Serializer.c:56
Определения SmptAnimMeta.c:83
Определения SquintState.c:2
bool AllowInUnconscious()
Определения StateBase.c:149
bool CanActivate()
Определения StateBase.c:354
bool IsPrimary()
Определения StateBase.c:141
void Init(SymptomManager manager, PlayerBase player, int uid)
Определения StateBase.c:39
string GetName()
Определения StateBase.c:90
void Activate()
Определения StateBase.c:175
void Destroy()
Определения StateBase.c:319
void Update(float deltatime)
Определения StateBase.c:222
bool IsActivated()
Определения StateBase.c:215
int GetType()
Определения StateBase.c:100
void AnimationStart()
Определения StateBase.c:339
Определения StateBase.c:2
ref TFloatArray m_FloatArray
Определения StateManager.c:53
override bool Serialize(Serializer ctx)
Определения StateManager.c:61
override bool Deserializer(Serializer ctx)
Определения StateManager.c:82
void SymptomSyncData()
Определения StateManager.c:55
ref TIntArray m_IntArray
Определения StateManager.c:52
Определения DayZPlayerImplement.c:39
Определения VomitState.c:2
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения Transport.c:70
Serializer ParamsReadContext
Определения gameplay.c:15
Serializer ParamsWriteContext
Определения gameplay.c:16
enum ShapeType ErrorEx
@ ADDITIVE
Определения EnDebug.c:137
static proto bool GetBool(int id, bool reverse=false)
Get value as bool from the given script id.
static proto float GetRangeValue(int id)
Get range value at the given script id.
array< float > TFloatArray
Определения EnScript.c:732
array< int > TIntArray
Определения EnScript.c:733
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].