132 symptomPrimary.OnOwnerKilled();
135 symptomSecondary.OnOwnerKilled();
155 ErrorEx(
string.Format(
"Symptom %1 already registered!", Symptom.
GetName()));
198 animMeta.m_StateType = symptom_id;
270 #ifdef DIAG_DEVELOPER
278 DisplayDebug1(
"Symptoms Client", 50, primary_debug, secondary_debug);
280 ShowAvailableSymptoms();
284 CleanDebug1(
"Symptoms Client", 50);
285 CleanDebug2(
"Symptoms Server", 300);
286 CleanAvailableSymptoms();
312 if (ctx.
Read(state_type))
332 primarySymptom.
Update(deltatime);
338 for (
int i = nSecondarySymptoms - 1; i >= 0; --i)
341 if (secondarySymptom)
347 secondarySymptom.
Update(deltatime);
366 Debug.
LogError(
"Symptom with this UID does not exist",
"PlayerSymptoms");
391 m_Player.SetActivePrimarySymptomID(0);
393 #ifdef DIAG_DEVELOPER
394 if (
g_Game ) SendServerDebugToClient();
449 ErrorEx(
string.Format(
"Symptoms: Unique ID (=%1) already exists!", uid));
459 Error(
"Symptom not registered");
469 symptom.RequestDestroy();
502 #ifdef DIAG_DEVELOPER
503 SendServerDebugToClient();
552 if ( !
g_Game.IsDedicatedServer() )
578 else if ( prio2 > prio1 )
598 if ( rpc_type ==
ERPCs.RPC_PLAYER_SYMPTOM_ON )
610 else if ( rpc_type ==
ERPCs.RPC_PLAYER_SYMPTOM_OFF )
643 ctx.
Write( m_SaveQueue );
650 if (ctx.
Read(m_SaveQueue))
652 for (
int i = 0; i < m_SaveQueue.Count(); i++ )
654 int id = m_SaveQueue.Get(i);
686 case ERPCs.DIAG_PLAYER_SYMPTOMS_DEBUG_ON:
702 case ERPCs.DIAG_PLAYER_SYMPTOMS_DEBUG_OFF:
704 if (ctx.
Read(CachedObjectsParams.PARAM1_INT))
709 case ERPCs.DIAG_PLAYER_SYMPTOMS_DEBUG:
711 int primary_Symptoms_count;
712 int secondary_Symptoms_count;
716 if (ctx.
Read(CachedObjectsParams.PARAM1_INT))
718 primary_Symptoms_count = CachedObjectsParams.PARAM1_INT.param1;
721 if (ctx.
Read(CachedObjectsParams.PARAM1_INT))
723 secondary_Symptoms_count = CachedObjectsParams.PARAM1_INT.param1;
730 int overall_count = primary_Symptoms_count + secondary_Symptoms_count;
731 for (
int i = 0; i < overall_count ; ++i)
733 Param3<bool, int, int> p3 =
new Param3<bool, int, int>(
false,0,0);
735 bool is_primary = p3.param1;
760 void SendServerDebugToClient()
762 array<ref Param> debug_list =
new array<ref Param>;
764 Param1<int> p1 =
new Param1<int>(0);
765 Param1<int> p2 =
new Param1<int>(0);
770 debug_list.Insert(p1);
771 debug_list.Insert(p2);
773 Param3<bool,int,int> p;
781 is_primary = symptom.IsPrimary();
782 symptom_id = symptom.GetType();
783 SYMPTOM_uid = symptom.GetUID();
785 p =
new Param3<bool,int,int>(is_primary, symptom_id, SYMPTOM_uid );
786 debug_list.Insert(p);
791 is_primary = secSymptom.IsPrimary();
792 symptom_id = secSymptom.GetType();
793 SYMPTOM_uid = secSymptom.GetUID();
795 p =
new Param3<bool,int,int>(is_primary, symptom_id, SYMPTOM_uid );
796 debug_list.Insert(p);
802 void DebugRequestExitSymptom(
int SYMPTOM_uid)
804 CachedObjectsParams.PARAM1_INT.param1 = SYMPTOM_uid;
809 array<ref Param> PrepareClientDebug(array<ref SymptomBase> Symptoms)
811 array<ref Param> debug_array =
new array<ref Param>;
813 Param3<bool, int, int> p3;
815 for (
int i = 0; i < Symptoms.Count(); i++)
817 bool is_primary = Symptoms.Get(i).IsPrimary();
818 int symptom_id = Symptoms.Get(i).GetType();
819 int SYMPTOM_uid = Symptoms.Get(i).GetUID();
821 p3 =
new Param3<bool,int,int>(is_primary, symptom_id, SYMPTOM_uid );
822 debug_array.Insert(p3);
827 void DisplayDebug1(
string name,
int y_offset, array<ref Param> Symptoms_primary, array<ref Param> Symptoms_secondary)
830 Param3<bool, int, int> p3 =
new Param3<bool, int, int>(
false,0,0);
832 DbgUI.BeginCleanupScope();
833 DbgUI.Begin(
name, 50, y_offset);
834 DbgUI.Text(
"Primary: ");
841 for (
int i = 0; i < Symptoms_primary.Count(); i++)
843 p3 = Param3<bool, int, int>.Cast(Symptoms_primary.Get(i));
845 is_primary = p3.param1;
846 symptom_id = p3.param2;
847 SYMPTOM_uid = p3.param3;
850 primary += SYMPTOM_name +
" | ";
854 DbgUI.Text(
"Secondary: ");
855 for (i = 0; i < Symptoms_secondary.Count(); i++)
857 p3 = Param3<bool, int, int>.Cast(Symptoms_secondary.Get(i));
859 is_primary = p3.param1;
860 symptom_id = p3.param2;
861 SYMPTOM_uid = p3.param3;
863 DbgUI.Text(SYMPTOM_name);
867 DbgUI.EndCleanupScope();
870 void DisplayDebug2(
string name,
int y_offset, array<ref Param> Symptoms_primary, array<ref Param> Symptoms_secondary)
873 Param3<bool, int, int> p3 =
new Param3<bool, int, int>(
false,0,0);
875 DbgUI.BeginCleanupScope();
876 DbgUI.Begin(
name, 50, y_offset);
877 DbgUI.Text(
"Primary: ");
884 for (
int i = 0; i < Symptoms_primary.Count(); i++)
886 p3 = Param3<bool, int, int>.Cast(Symptoms_primary.Get(i));
888 is_primary = p3.param1;
889 symptom_id = p3.param2;
890 SYMPTOM_uid = p3.param3;
893 if (DbgUI.Button( i.ToString() +
" " + SYMPTOM_name, 80))
895 DebugRequestExitSymptom(SYMPTOM_uid);
899 DbgUI.Text(
"Secondary: ");
900 for (i = 0; i < Symptoms_secondary.Count(); i++)
902 p3 = Param3<bool, int, int>.Cast(Symptoms_secondary.Get(i));
904 is_primary = p3.param1;
905 symptom_id = p3.param2;
906 SYMPTOM_uid = p3.param3;
909 if (DbgUI.Button( i.ToString() +
" " + SYMPTOM_name, 80))
911 DebugRequestExitSymptom(SYMPTOM_uid);
916 DbgUI.EndCleanupScope();
919 void ShowAvailableSymptoms()
921 DbgUI.BeginCleanupScope();
922 DbgUI.Begin(
"available Symptoms", 300, 50);
927 string SYMPTOM_name = Symptom.
GetName();
928 int symptom_id = Symptom.
GetType();
930 if (DbgUI.Button( i.ToString() +
" " + SYMPTOM_name, 80))
932 DebugRequestActivateSymptom(symptom_id);
937 DbgUI.EndCleanupScope();
940 void CleanAvailableSymptoms()
942 DbgUI.BeginCleanupScope();
943 DbgUI.Begin(
"available Symptoms", 300, 50);
945 DbgUI.EndCleanupScope();
948 void CleanDebug1(
string name,
int y_offset)
950 DbgUI.BeginCleanupScope();
951 DbgUI.Begin(
name, 50, y_offset);
953 DbgUI.EndCleanupScope();
956 void CleanDebug2(
string name,
int y_offset)
958 DbgUI.BeginCleanupScope();
959 DbgUI.Begin(
name, 50, y_offset);
961 DbgUI.EndCleanupScope();
964 void DebugRequestActivateSymptom(
int symptom_id)
966 CachedObjectsParams.PARAM1_INT.param1 = symptom_id;
@ OK
0 - No error. Can be returned from any call.
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
override SmptAnimMetaBase SpawnAnimMetaObject()
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_GASP
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
enum AnimType SYMPTOM_PAIN_HEAVY
enum AnimType SYMPTOM_SNEEZE
enum AnimType SYMPTOM_HMP_SEVERE
enum AnimType SYMPTOM_HOT
enum AnimType SYMPTOM_DEAFNESS_COMPLETE
enum AnimType SYMPTOM_FREEZE_RATTLE
static ref Param1< int > PARAM1_INT
static ref Param2< int, int > PARAM2_INT_INT
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.
proto bool Write(void value_out)
proto bool Read(void value_in)
bool AllowInUnconscious()
void Init(SymptomManager manager, PlayerBase player, int uid)
void Update(float deltatime)
const int STORAGE_VERSION
int GetSymptomCount(int symptom_id)
void DecreaseSymptomCount(int symptom_id)
void SetAnimation(ParamsReadContext ctx)
void OnInputUserDataReceived(ParamsReadContext ctx)
void QueueUpSecondarySymptom(int symptom_id, int uid=-1)
int GetSymptomMaxCount(int symptom_id)
void AutoactivateSymptoms()
ref SmptAnimMetaBase m_AnimMeta
void OnStoreSave(ParamsWriteContext ctx)
ref map< int, int > m_ActiveSymptomTypes
int GetCurrentCommandID()
bool IsSymptomPrimary(int symptom_id)
ref array< ref Param > m_SymptomQueueServerDbg
string GetSymptomName(int symptom_id)
int GetSymptomPriority(int symptom_id)
void OnSymptomExit(SymptomBase Symptom, int uid)
ref array< ref Param > m_SymptomQueueServerDbgPrimary
ref map< int, ref SymptomBase > m_AvailableSymptoms
SymptomBase GetCurrentPrimaryActiveSymptom()
SymptomBase QueueUpSecondarySymptomEx(int symptom_id, int uid=-1)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnTick(float deltatime, int pCurrentCommandID, HumanMovementState movement_state)
void RemoveSecondarySymptom(int symptom_id)
Removes a single Symptom.
SymptomBase QueueUpPrimarySymptom(int symptom_id, int uid=-1)
ref array< ref SymptomBase > m_SymptomQueueSecondary
void IncreaseSymptomCount(int symptom_id)
int m_ActiveSymptomIndexPrimary
ref array< ref SymptomBase > m_SymptomQueuePrimary
void OnAnimationFinished(eAnimFinishType type=eAnimFinishType.SUCCESS)
ref array< ref Param > m_SymptomQueueServerDbgSecondary
SmptAnimMetaBase SpawnAnimMetaObject(int symptom_id)
void SymptomManager(PlayerBase player)
SymptomBase SpawnSymptom(int symptom_id, int uid=-1)
void UpdateActiveSymptoms(float deltatime)
int FindFirstAvailableSymptomIndex()
void OnRPC(int rpc_type, ParamsReadContext ctx)
void RequestSymptomExit(int SYMPTOM_uid)
Exits a specific Symptom with a given UID.
SymptomBase GetSymptomByUID(int SYMPTOM_uid)
void CleanUpPrimaryQueue()
void RegisterSymptom(SymptomBase Symptom)
void OnAnimationStarted()
int ComparePriority(int prio1, int prio2)
bool CanUpdateSymptom(SymptomBase symptom)
ref map< int, SymptomBase > m_SymptomsUIDs
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Serializer ParamsReadContext
Serializer ParamsWriteContext
void Error(string err)
Messagebox with error message.
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].