63 bool returnValue =
true;
67 returnValue = ctx.
Read(i);
74 returnValue = ctx.
Read(f);
84 bool returnValue =
true;
88 returnValue = ctx.
Read(i);
95 returnValue = ctx.
Read(f);
192 symptomPrimary.OnOwnerKilled();
195 symptomSecondary.OnOwnerKilled();
215 ErrorEx(
string.Format(
"Symptom %1 already registered!", Symptom.
GetName()));
258 animMeta.m_StateType = symptom_id;
330 #ifdef DIAG_DEVELOPER
338 DisplayDebug1(
"Symptoms Client", 50, primary_debug, secondary_debug);
340 ShowAvailableSymptoms();
344 CleanDebug1(
"Symptoms Client", 50);
345 CleanDebug2(
"Symptoms Server", 300);
346 CleanAvailableSymptoms();
372 if (ctx.
Read(state_type))
392 primarySymptom.
Update(deltatime);
398 for (
int i = nSecondarySymptoms - 1; i >= 0; --i)
401 if (secondarySymptom)
407 secondarySymptom.
Update(deltatime);
426 Debug.
LogError(
"Symptom with this UID does not exist",
"PlayerSymptoms");
451 m_Player.SetActivePrimarySymptomID(0);
453 #ifdef DIAG_DEVELOPER
454 if (
g_Game ) SendServerDebugToClient();
505 ErrorEx(
"Symptom not registered");
516 ErrorEx(
string.Format(
"Symptoms: Unique ID (=%1) already exists!", uid));
530 symptom.RequestDestroy();
563 #ifdef DIAG_DEVELOPER
564 SendServerDebugToClient();
613 if ( !
g_Game.IsDedicatedServer() )
639 else if ( prio2 > prio1 )
658 case ERPCs.RPC_PLAYER_SYMPTOM_ON:
671 case ERPCs.RPC_PLAYER_SYMPTOM_OFF:
683 case ERPCs.RPC_SYMPTOM_PARAM_SYNC:
712 ctx.
Write( m_SaveQueue );
719 if (ctx.
Read(m_SaveQueue))
721 for (
int i = 0; i < m_SaveQueue.Count(); i++ )
723 int id = m_SaveQueue.Get(i);
755 case ERPCs.DIAG_PLAYER_SYMPTOMS_DEBUG_ON:
757 if (ctx.
Read(CachedObjectsParams.PARAM1_INT))
771 case ERPCs.DIAG_PLAYER_SYMPTOMS_DEBUG_OFF:
773 if (ctx.
Read(CachedObjectsParams.PARAM1_INT))
778 case ERPCs.DIAG_PLAYER_SYMPTOMS_DEBUG:
780 int primary_Symptoms_count;
781 int secondary_Symptoms_count;
785 if (ctx.
Read(CachedObjectsParams.PARAM1_INT))
787 primary_Symptoms_count = CachedObjectsParams.PARAM1_INT.param1;
790 if (ctx.
Read(CachedObjectsParams.PARAM1_INT))
792 secondary_Symptoms_count = CachedObjectsParams.PARAM1_INT.param1;
799 int overall_count = primary_Symptoms_count + secondary_Symptoms_count;
800 for (
int i = 0; i < overall_count ; ++i)
802 Param3<bool, int, int> p3 =
new Param3<bool, int, int>(
false,0,0);
804 bool is_primary = p3.param1;
829 void SendServerDebugToClient()
831 array<ref Param> debug_list =
new array<ref Param>;
833 Param1<int> p1 =
new Param1<int>(0);
834 Param1<int> p2 =
new Param1<int>(0);
839 debug_list.Insert(p1);
840 debug_list.Insert(p2);
842 Param3<bool,int,int> p;
850 is_primary = symptom.IsPrimary();
851 symptom_id = symptom.GetType();
852 SYMPTOM_uid = symptom.GetUID();
854 p =
new Param3<bool,int,int>(is_primary, symptom_id, SYMPTOM_uid );
855 debug_list.Insert(p);
860 is_primary = secSymptom.IsPrimary();
861 symptom_id = secSymptom.GetType();
862 SYMPTOM_uid = secSymptom.GetUID();
864 p =
new Param3<bool,int,int>(is_primary, symptom_id, SYMPTOM_uid );
865 debug_list.Insert(p);
871 void DebugRequestExitSymptom(
int SYMPTOM_uid)
873 CachedObjectsParams.PARAM1_INT.param1 = SYMPTOM_uid;
878 array<ref Param> PrepareClientDebug(array<ref SymptomBase> Symptoms)
880 array<ref Param> debug_array =
new array<ref Param>;
882 Param3<bool, int, int> p3;
884 for (
int i = 0; i < Symptoms.Count(); i++)
886 bool is_primary = Symptoms.Get(i).IsPrimary();
887 int symptom_id = Symptoms.Get(i).GetType();
888 int SYMPTOM_uid = Symptoms.Get(i).GetUID();
890 p3 =
new Param3<bool,int,int>(is_primary, symptom_id, SYMPTOM_uid );
891 debug_array.Insert(p3);
896 void DisplayDebug1(
string name,
int y_offset, array<ref Param> Symptoms_primary, array<ref Param> Symptoms_secondary)
899 Param3<bool, int, int> p3 =
new Param3<bool, int, int>(
false,0,0);
901 DbgUI.BeginCleanupScope();
902 DbgUI.Begin(
name, 50, y_offset);
903 DbgUI.Text(
"Primary: ");
910 for (
int i = 0; i < Symptoms_primary.Count(); i++)
912 p3 = Param3<bool, int, int>.Cast(Symptoms_primary.Get(i));
914 is_primary = p3.param1;
915 symptom_id = p3.param2;
916 SYMPTOM_uid = p3.param3;
919 primary += SYMPTOM_name +
" | ";
923 DbgUI.Text(
"Secondary: ");
924 for (i = 0; i < Symptoms_secondary.Count(); i++)
926 p3 = Param3<bool, int, int>.Cast(Symptoms_secondary.Get(i));
928 is_primary = p3.param1;
929 symptom_id = p3.param2;
930 SYMPTOM_uid = p3.param3;
932 DbgUI.Text(SYMPTOM_name);
936 DbgUI.EndCleanupScope();
939 void DisplayDebug2(
string name,
int y_offset, array<ref Param> Symptoms_primary, array<ref Param> Symptoms_secondary)
942 Param3<bool, int, int> p3 =
new Param3<bool, int, int>(
false,0,0);
944 DbgUI.BeginCleanupScope();
945 DbgUI.Begin(
name, 50, y_offset);
946 DbgUI.Text(
"Primary: ");
953 for (
int i = 0; i < Symptoms_primary.Count(); i++)
955 p3 = Param3<bool, int, int>.Cast(Symptoms_primary.Get(i));
957 is_primary = p3.param1;
958 symptom_id = p3.param2;
959 SYMPTOM_uid = p3.param3;
962 if (DbgUI.Button( i.ToString() +
" " + SYMPTOM_name, 80))
964 DebugRequestExitSymptom(SYMPTOM_uid);
968 DbgUI.Text(
"Secondary: ");
969 for (i = 0; i < Symptoms_secondary.Count(); i++)
971 p3 = Param3<bool, int, int>.Cast(Symptoms_secondary.Get(i));
973 is_primary = p3.param1;
974 symptom_id = p3.param2;
975 SYMPTOM_uid = p3.param3;
978 if (DbgUI.Button( i.ToString() +
" " + SYMPTOM_name, 80))
980 DebugRequestExitSymptom(SYMPTOM_uid);
985 DbgUI.EndCleanupScope();
988 void ShowAvailableSymptoms()
990 DbgUI.BeginCleanupScope();
991 DbgUI.Begin(
"available Symptoms", 300, 50);
996 string SYMPTOM_name = Symptom.
GetName();
997 int symptom_id = Symptom.
GetType();
999 if (DbgUI.Button( i.ToString() +
" " + SYMPTOM_name, 80))
1001 DebugRequestActivateSymptom(symptom_id);
1006 DbgUI.EndCleanupScope();
1009 void CleanAvailableSymptoms()
1011 DbgUI.BeginCleanupScope();
1012 DbgUI.Begin(
"available Symptoms", 300, 50);
1014 DbgUI.EndCleanupScope();
1017 void CleanDebug1(
string name,
int y_offset)
1019 DbgUI.BeginCleanupScope();
1020 DbgUI.Begin(
name, 50, y_offset);
1022 DbgUI.EndCleanupScope();
1025 void CleanDebug2(
string name,
int y_offset)
1027 DbgUI.BeginCleanupScope();
1028 DbgUI.Begin(
name, 50, y_offset);
1030 DbgUI.EndCleanupScope();
1033 void DebugRequestActivateSymptom(
int symptom_id)
1035 CachedObjectsParams.PARAM1_INT.param1 = symptom_id;
@ OK
0 - No error. Can be returned from any call.
void OnRPC(PlayerIdentity sender, int rpcType, ParamsReadContext ctx)
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
override SmptAnimMetaBase SpawnAnimMetaObject()
void OnTick(PlayerBase player, float deltaT)
class ModifierDebugObj STORAGE_VERSION
void SetAnimation(ParamsReadContext ctx)
void QueueUpSecondarySymptom(int symptom_id, int uid=-1)
enum AnimType SYMPTOM_BLINDNESS
ref array< ref Param > m_SymptomQueueServerDbgPrimary
enum AnimType SYMPTOM_VOMIT
ref map< int, int > m_ActiveSymptomTypes
void RequestSymptomExit(int SYMPTOM_uid)
Exits a specific Symptom with a given UID.
enum AnimType SYMPTOM_BLEEDING_SOURCE
void IncreaseSymptomCount(int symptom_id)
enum AnimType SYMPTOM_UNCONSCIOUS
ref array< ref Param > m_SymptomQueueServerDbg
SymptomBase QueueUpSecondarySymptomEx(int symptom_id, int uid=-1)
enum AnimType SYMPTOM_PAIN_LIGHT
int m_ActiveSymptomIndexPrimary
SymptomBase GetCurrentPrimaryActiveSymptom()
enum AnimType SYMPTOM_BULLET_HIT
enum AnimType SYMPTOM_GASP
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)
enum AnimType SYMPTOM_HAND_SHIVER
bool CanUpdateSymptom(SymptomBase symptom)
int GetSymptomCount(int symptom_id)
const int DEBUG_PADDING_OFFSET
ref array< ref SymptomBase > m_SymptomQueuePrimary
enum AnimType SYMPTOM_FAINT
int ComparePriority(int prio1, int prio2)
enum AnimType SYMPTOM_FEVERBLUR
void UpdateActiveSymptoms(float deltatime)
enum AnimType SYMPTOM_FREEZE
SymptomBase QueueUpPrimarySymptom(int symptom_id, int uid=-1)
enum AnimType SYMPTOM_SQUINT
enum AnimType SYMPTOM_BLOODLOSS
int GetCurrentCommandID()
enum AnimType SYMPTOM_LAUGHTER
enum AnimType SYMPTOM_COUGH
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()
enum AnimType SYMPTOM_IRRITATED_EYES
void AutoactivateSymptoms()
void OnInputUserDataReceived(ParamsReadContext ctx)
string GetSymptomName(int symptom_id)
enum AnimType SYMPTOM_PAIN_HEAVY
enum AnimType SYMPTOM_SNEEZE
enum AnimType SYMPTOM_HMP_SEVERE
void OnAnimationFinished(eAnimFinishType type=eAnimFinishType.SUCCESS)
void DecreaseSymptomCount(int symptom_id)
int FindFirstAvailableSymptomIndex()
enum AnimType SYMPTOM_HOT
void OnSymptomExit(SymptomBase Symptom, int uid)
enum AnimType SYMPTOM_DEAFNESS_COMPLETE
void CleanUpPrimaryQueue()
enum AnimType SYMPTOM_FREEZE_RATTLE
void RegisterSymptom(SymptomBase Symptom)
ref map< int, ref SymptomBase > m_AvailableSymptoms
void SymptomManager(PlayerBase player)
ref array< ref Param > m_SymptomQueueServerDbgSecondary
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.
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
proto bool Write(void value_out)
proto bool Read(void value_in)
Serialization general interface. Serializer API works with:
bool AllowInUnconscious()
void Init(SymptomManager manager, PlayerBase player, int uid)
void Update(float deltatime)
ref TFloatArray m_FloatArray
override bool Serialize(Serializer ctx)
override bool Deserializer(Serializer ctx)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Serializer ParamsReadContext
Serializer ParamsWriteContext
array< float > TFloatArray
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].