3 const int SIMPLIFIED_SHOCK_CAP = 63;
4 const int SHAKE_LEVEL_MAX = 7;
5 private int m_LifeSpanState;
6 private int m_LastShavedSeconds;
8 private bool m_HasBloodTypeVisible;
9 private bool m_LiquidTendencyDrain;
10 private bool m_FlagRaisingTendency;
11 private int m_HasBloodyHandsVisible;
12 private int m_FaceCoveredForShaveLayers = 0;
13 protected bool m_HasHeatBuffer;
14 protected bool m_PlayerLoaded;
15 protected bool m_PlayerDisconnectProcessed;
16 protected bool m_ProcessUIWarning;
17 protected int m_LocalRefreshAnimStateIdx;
18 protected int m_RefreshAnimStateIdx;
19 private int m_StoreLoadVersion;
20 const int ACT_STORE_SAVE_VERSION = 4;
21 protected int m_LifespanLevelLocal;
22 protected int m_AnimCommandStarting;
26 PluginConfigEmotesProfile m_ConfigEmotesProfile;
32 PluginRecipesManager m_ModuleRecipesManager;
33 ref BleedingSourcesManagerServer m_BleedingManagerServer;
34 ref BleedingSourcesManagerRemote m_BleedingManagerRemote;
50 ref TransferValues m_TrasferValues;
52 const int OVERLOAD_LIMIT = 30000;
54 float m_VisibilityCoef;
55 float m_OriginalSlidePoseAngle;
57 int m_SoundEventParam;
59 bool m_SoundEventSent;
63 ref Param1<string> m_UAParamMessage;
64 ref Param1<float> m_UnconParam;
65 ref Param1<float> m_DeathDarkeningParam;
82 ref PlayerSoundManagerServer m_PlayerSoundManagerServer;
87 bool m_QuickBarFT =
false;
89 protected int m_RecipePick;
90 protected bool m_IsHoldingBreath;
91 protected bool m_IsInWater;
92 float m_LastPostFrameTickTime;
94 ref
Timer m_DeathCheckTimer;
95 bool m_CorpseProcessing;
97 protected int m_CorpseStateLocal;
99 int m_PersistentFlags;
101 float m_UnconsciousTime;
102 int m_ShockSimplified;
103 float m_CurrentShock;
105 bool m_IsRestrainStarted;
106 bool m_IsRestrainPrelocked;
107 bool m_ImmunityBoosted;
108 bool m_AreHandsLocked;
109 float m_UnconsciousVignetteTarget = 2;
110 float m_CameraSwayModifier = 0.2;
111 float m_LastShockHitTime;
114 vector m_DirectionToCursor;
115 vector m_DefaultHitPosition;
118 protected bool m_AllowQuickRestrain;
119 protected bool m_AllowQuickFishing;
120 protected int m_Shakes;
121 protected int m_ShakesForced;
124 int m_MixedSoundStates;
126 bool m_IsVehicleSeatDriver;
127 float m_UnconsciousEndTime = 0;
128 int m_BleedingSourceCount;
129 Head_Default m_CharactersHead;
134 bool m_HideHairAnimated;
135 string m_DecayedTexture;
138 int m_LocalBrokenState =
eBrokenLegs.NO_BROKEN_LEGS;
139 bool m_BrokenLegsJunctureReceived;
141 const string SOUND_BREAK_LEG =
"broken_leg_SoundSet";
142 bool m_CanPlayBrokenLegSound;
143 static bool DEBUG_INVENTORY_ACCESS =
false;
146 float m_UnconRefillModifier = 1;
148 int m_AntibioticsActive;
151 bool m_ContaminatedAreaEffectEnabled;
152 const string CONTAMINATED_AREA_AMBIENT =
"ContaminatedArea_SoundSet";
154 protected int m_ContaminatedAreaCount;
155 protected int m_EffectAreaCount;
156 protected bool m_InsideEffectArea;
157 protected bool m_InsideEffectAreaPrev;
161 protected bool m_CanDisplayHitEffectPPE;
163 protected string m_CachedPlayerName;
164 protected string m_CachedPlayerID;
167 #ifdef DIAG_DEVELOPER
168 int m_IsInsideTrigger;
169 bool m_CanBeTargetedDebug;
171 bool m_PresetSpawned;
172 ref CameraToolsMenuClient m_CameraToolsMenuClient;
189 vector m_LocalProjectionPosition =
"0 0 0 ";
190 vector m_LocalProjectionOrientation =
"0 0 0 ";
194 int m_AddModifier = -1;
199 bool m_IsCraftingReady;
200 float m_RecipeAnimLength;
201 vector m_CraftingInitialPos;
207 string m_SaySoundLastSetName;
209 bool m_ActionQBControl;
215 float m_LastFirePointRot;
216 int m_LastFirePointIndex;
218 bool ItemToInventory;
219 bool m_IsFighting =
false;
223 int m_DebugMonitorEnabled;
228 bool m_MapCloseRequestProcessed;
229 protected bool m_MapClosingSyncSent;
230 protected float m_LastMapScale = -1.0;
231 protected vector m_LastMapPos;
235 protected bool m_InventorySoftLocked;
236 protected int m_InventorySoftLockCount = 0;
241 ref
Timer m_AnalyticsTimer;
244 protected bool m_MeleeDebug;
246 protected ItemBase m_CheckMeleeItem;
249 protected string m_UALastMessage;
250 protected ref
Timer m_UALastMessageTimer;
252 bool m_WorkingNVGHeadset;
253 bool m_LoweredNVGHeadset;
256 int m_SyncedModifiers;
257 int m_SyncedModifiersPrev;
261 protected static Particle m_ContaminatedAroundPlayer;
262 protected static Particle m_ContaminatedAroundPlayerTiny;
264 protected PlayerStat<float> m_StatWater;
265 protected PlayerStat<float> m_StatToxicity;
266 protected PlayerStat<float> m_StatEnergy;
267 protected PlayerStat<float> m_StatHeatComfort;
268 protected PlayerStat<float> m_StatTremor;
269 protected PlayerStat<int> m_StatWet
270 protected PlayerStat<int> m_StatBloodType
271 protected PlayerStat<float> m_StatDiet
272 protected PlayerStat<float> m_StatStamina
273 protected PlayerStat<float> m_StatSpecialty
274 protected PlayerStat<float> m_StatHeatBuffer
278 protected ref
array<int> m_ProcessAddEffectWidgets;
279 protected ref
array<int> m_ProcessRemoveEffectWidgets;
282 protected ref
array<int> m_ProcessAddGlassesEffects;
283 protected ref
array<int> m_ProcessRemoveGlassesEffects;
293 m_StoreLoadVersion = 0;
294 m_IsCraftingReady =
false;
296 m_LastShavedSeconds = 0;
298 m_HasBloodTypeVisible =
false;
300 m_LifespanLevelLocal = -1;
302 m_CorpseStateLocal = 0;
303 m_HasBloodyHandsVisible = 0;
304 m_PlayerLoaded =
false;
305 m_PlayerSelected =
false;
306 m_ProcessUIWarning =
false;
307 m_FlagRaisingTendency =
true;
308 m_LiquidTendencyDrain =
false;
309 m_UAParamMessage =
new Param1<string>(
"");
310 m_UnconParam =
new Param1<float>(0);
311 m_DeathDarkeningParam =
new Param1<float>(0);
317 m_VisibilityCoef = 1.0;
320 m_ActionQBControl =
false;
321 m_QuickBarHold =
false;
322 m_HideHairAnimated =
true;
323 m_WorkingNVGHeadset =
false;
324 m_LoweredNVGHeadset =
false;
325 m_AreHandsLocked =
false;
329 m_CanDisplayHitEffectPPE =
true;
331 #ifdef DIAG_DEVELOPER
332 m_CanBeTargetedDebug =
true;
350 m_BleedingManagerServer =
new BleedingSourcesManagerServer(
this);
353 m_PlayerSoundManagerServer =
new PlayerSoundManagerServer(
this);
360 m_ModuleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
362 m_TrasferValues =
new TransferValues(
this);
370 if (!
GetGame().IsDedicatedServer())
372 m_MeleeDebug =
false;
373 m_UALastMessage =
"";
374 m_UALastMessageTimer =
new Timer;
376 m_BleedingManagerRemote =
new BleedingSourcesManagerRemote(
this);
383 m_ProcessRemoveEffectWidgets =
new array<int>;
386 m_ProcessRemoveGlassesEffects =
new array<int>;
389 m_ActionManager = NULL;
392 m_ConfigEmotesProfile = PluginConfigEmotesProfile.Cast(
GetPlugin(PluginConfigEmotesProfile));
396 PluginConfigDebugProfileFixed m_ConfigDebugProfileFixed = PluginConfigDebugProfileFixed.Cast(
GetPlugin(PluginConfigDebugProfileFixed));
398 PluginDeveloper m_Developer = PluginDeveloper.Cast(
GetPlugin(PluginDeveloper));
405 if (player && default_preset !=
"")
408 m_ConfigDebugProfileFixed.GetPresetItems(default_preset, preset_array);
410 bool is_preset_fixed =
true;
411 if (preset_array.Count() == 0)
414 is_preset_fixed =
false;
417 if (preset_array.Count() > 0)
419 m_Developer.ClearInventory(player);
421 for (
int i = 0; i < preset_array.Count(); i++)
427 health = m_ConfigDebugProfileFixed.GetItemHealth(default_preset, i);
428 quantity = m_ConfigDebugProfileFixed.GetItemQuantity(default_preset, i);
435 m_Developer.SpawnEntityInPlayerInventory(player, preset_array.Get(i), health, quantity);
448 m_BleedingSourcesLow.Insert(
"RightToeBase");
449 m_BleedingSourcesLow.Insert(
"RightFoot");
450 m_BleedingSourcesLow.Insert(
"LeftToeBase");
451 m_BleedingSourcesLow.Insert(
"LeftFoot");
452 m_BleedingSourcesLow.Insert(
"RightUpLegRoll");
453 m_BleedingSourcesLow.Insert(
"RightUpLeg");
454 m_BleedingSourcesLow.Insert(
"RightLegRoll");
455 m_BleedingSourcesLow.Insert(
"RightLeg");
456 m_BleedingSourcesLow.Insert(
"LeftUpLegRoll");
457 m_BleedingSourcesLow.Insert(
"LeftUpLeg");
458 m_BleedingSourcesLow.Insert(
"LeftLegRoll");
459 m_BleedingSourcesLow.Insert(
"LeftLeg");
462 m_BleedingSourcesUp.Insert(
"RightForeArmRoll");
463 m_BleedingSourcesUp.Insert(
"LeftForeArmRoll");
464 m_BleedingSourcesUp.Insert(
"RightForeArm");
465 m_BleedingSourcesUp.Insert(
"RightArmRoll");
466 m_BleedingSourcesUp.Insert(
"RightArm");
467 m_BleedingSourcesUp.Insert(
"RightShoulder");
468 m_BleedingSourcesUp.Insert(
"LeftForeArm");
469 m_BleedingSourcesUp.Insert(
"LeftArmRoll");
470 m_BleedingSourcesUp.Insert(
"LeftArm");
471 m_BleedingSourcesUp.Insert(
"LeftShoulder");
472 m_BleedingSourcesUp.Insert(
"Spine3");
473 m_BleedingSourcesUp.Insert(
"Spine2");
474 m_BleedingSourcesUp.Insert(
"Spine1");
475 m_BleedingSourcesUp.Insert(
"Spine");
476 m_BleedingSourcesUp.Insert(
"Pelvis");
477 m_BleedingSourcesUp.Insert(
"Neck");
479 RegisterNetSyncVariableInt(
"m_LifeSpanState", LifeSpanState.BEARD_NONE, LifeSpanState.COUNT);
480 RegisterNetSyncVariableInt(
"m_BloodType", 0, 128);
481 RegisterNetSyncVariableInt(
"m_ShockSimplified",0, SIMPLIFIED_SHOCK_CAP);
483 RegisterNetSyncVariableInt(
"m_SoundEventParam", 0, ((EPlayerSoundEventParam.ENUM_COUNT - 1) * 2) - 1);
484 RegisterNetSyncVariableInt(
"m_StaminaState",0, eStaminaState.COUNT - 1);
485 RegisterNetSyncVariableInt(
"m_BleedingBits");
486 RegisterNetSyncVariableInt(
"m_Shakes", 0, SHAKE_LEVEL_MAX);
489 RegisterNetSyncVariableInt(
"m_MixedSoundStates", 0,
eMixedSoundStates.COUNT - 1);
491 RegisterNetSyncVariableInt(
"m_RefreshAnimStateIdx",0,3);
492 RegisterNetSyncVariableInt(
"m_BrokenLegState", -
eBrokenLegs.BROKEN_LEGS_SPLINT,
eBrokenLegs.BROKEN_LEGS_SPLINT);
493 RegisterNetSyncVariableInt(
"m_SyncedModifiers", 0, ((
eModifierSyncIDs.LAST_INDEX - 1) * 2) - 1);
494 RegisterNetSyncVariableInt(
"m_HasBloodyHandsVisible", 0,
eBloodyHandsTypes.LAST_INDEX - 1);
495 RegisterNetSyncVariableInt(
"m_ActionSoundCategoryHash");
497 RegisterNetSyncVariableBool(
"m_IsUnconscious");
498 RegisterNetSyncVariableBool(
"m_IsRestrained");
499 RegisterNetSyncVariableBool(
"m_IsInWater");
500 RegisterNetSyncVariableBool(
"m_InsideEffectArea");
502 RegisterNetSyncVariableBool(
"m_HasBloodTypeVisible");
504 RegisterNetSyncVariableBool(
"m_IsRestrainStarted");
505 RegisterNetSyncVariableBool(
"m_IsRestrainPrelocked");
506 RegisterNetSyncVariableBool(
"m_HasHeatBuffer");
508 RegisterNetSyncVariableFloat(
"m_CurrentShock");
510 m_OriginalSlidePoseAngle = GetSlidePoseAngle();
515 m_DecayedTexture = ConfigGetString(
"decayedTexture");
520 void IncreaseAntibioticsCount()
522 m_AntibioticsActive++;
525 void DecreaseAntibioticsCount()
527 m_AntibioticsActive--;
528 if (m_AntibioticsActive < 0)
530 m_AntibioticsActive = 0;
531 Error(
"DecreaseAntibioticsCount called more times than IncreaseAntibioticsCount (should be equal) - check your code, forcing clamp to 0");
535 bool IsAntibioticsActive()
537 return (m_AntibioticsActive > 0);
540 void SetSoundCategoryHash(
int hash)
542 m_ActionSoundCategoryHash = hash;
547 void RequestTriggerEffect(
EffectTrigger trigger,
int ppeIdx = -1,
int aroundId =
ParticleList.CONTAMINATED_AREA_GAS_AROUND,
int tinyId =
ParticleList.CONTAMINATED_AREA_GAS_TINY,
string soundset =
"",
bool partDynaUpdate =
false,
int newBirthRate = 0,
bool forceUpdate =
false)
551 if (!m_InsideEffectArea)
554 if (!m_CurrentEffectTrigger)
558 else if (trigger == m_CurrentEffectTrigger && forceUpdate)
563 else if (trigger.GetEffectsPriority() > m_CurrentEffectTrigger.GetEffectsPriority())
565 RemoveCurrentEffectTrigger();
576 m_CurrentEffectTrigger = trigger;
577 SetContaminatedEffectEx(
true, ppeIdx, aroundId, tinyId, soundset,partDynaUpdate, newBirthRate );
582 void RemoveCurrentEffectTrigger()
584 if (m_CurrentEffectTrigger)
591 SetContaminatedEffectEx(
false, m_CurrentEffectTrigger.m_PPERequester );
592 m_CurrentEffectTrigger =
null;
596 void IncreaseContaminatedAreaCount()
598 if (m_ContaminatedAreaCount == 0)
599 OnContaminatedAreaEnterServer();
600 m_ContaminatedAreaCount++;
603 void DecreaseContaminatedAreaCount()
605 m_ContaminatedAreaCount--;
606 if (m_ContaminatedAreaCount <= 0)
608 m_ContaminatedAreaCount = 0;
609 OnContaminatedAreaExitServer();
612 void IncreaseEffectAreaCount()
614 if (m_EffectAreaCount == 0)
616 m_InsideEffectArea =
true;
618 OnPlayerIsNowInsideEffectAreaBeginServer();
623 void DecreaseEffectAreaCount()
626 if (m_EffectAreaCount <= 0)
628 m_EffectAreaCount = 0;
629 m_InsideEffectArea =
false;
631 OnPlayerIsNowInsideEffectAreaEndServer();
636 protected void OnContaminatedAreaEnterServer()
638 GetModifiersManager().ActivateModifier(
eModifiers.MDF_AREAEXPOSURE );
642 protected void OnContaminatedAreaExitServer()
644 GetModifiersManager().DeactivateModifier(
eModifiers.MDF_AREAEXPOSURE );
648 protected void OnPlayerIsNowInsideEffectAreaBeginServer()
653 protected void OnPlayerIsNowInsideEffectAreaEndServer()
658 protected void OnPlayerIsNowInsideEffectAreaBeginClient()
663 protected void OnPlayerIsNowInsideEffectAreaEndClient()
665 RemoveCurrentEffectTrigger();
670 ItemBase GetItemOnSlot(
string slot_type)
673 EntityAI item_EAI = this.GetInventory().FindAttachment(slot_id);
676 if (item_EAI && !item_IB)
678 string str =
"Warning! GetItemOnSlot() >> found item on slot " + slot_type +
" can't be cast to ItemBase! Found item is " + item_EAI.GetType() +
" and the player is " +
GetType() +
"!";
689 return GetItemOnSlot(
"Headgear");
700 override bool CanDropEntity (notnull
EntityAI item)
702 if (GetInventory().HasInventoryReservation(item,
null))
709 if (GetHumanInventory().GetEntityInHands() == item)
720 int GetBreathVapourLevel()
722 return m_BreathVapour;
728 int bit_mask_remove = ~state;
732 if (new_states != m_MixedSoundStates)
734 m_MixedSoundStates = new_states;
744 if (new_states != m_MixedSoundStates)
746 m_MixedSoundStates = new_states;
751 override bool IsPlayer()
758 return (m_BleedingBits != 0);
761 void SetBleedingBits(
int bits)
763 if (m_BleedingBits != bits)
765 if (m_BleedingBits == 0)
774 m_BleedingBits = bits;
778 int GetBleedingBits()
780 return m_BleedingBits;
783 void IncreaseDiseaseCount()
788 void DecreaseDiseaseCount()
793 void IncreaseHealingsCount()
798 void DecreaseHealingsCount()
806 return m_HealingsCount;
811 return m_DiseaseCount;
822 m_PulseType = pulse_type;
827 m_ProcessAddEffectWidgets.InsertArray(effects);
830 void QueueRemoveEffectWidget(
array<int> effects)
832 m_ProcessRemoveEffectWidgets.InsertArray(effects);
835 void QueueAddGlassesEffect(
int id)
837 m_ProcessAddGlassesEffects.Insert(
id);
840 void QueueRemoveGlassesEffect(
int id)
842 m_ProcessRemoveGlassesEffects.Insert(
id);
847 return m_DamageDealtEffect;
850 override void SpawnDamageDealtEffect()
852 if (m_DamageDealtEffect)
854 delete m_DamageDealtEffect;
857 if (m_CanDisplayHitEffectPPE)
863 void SpawnDamageDealtEffect2(
Param param1 =
null,
Param param2 =
null)
867 delete m_EffectRadial;
875 return m_FlashbangEffect;
878 void SpawnFlashbangEffect(
PlayerBase player,
bool visual)
880 if (m_FlashbangEffect)
882 m_FlashbangEffect.Stop();
883 delete m_FlashbangEffect;
891 return m_ShockDealtEffect;
894 void SpawnShockEffect(
float intensity_max)
896 if (m_ShockDealtEffect)
898 delete m_ShockDealtEffect;
913 if (GetBleedingManagerServer())
914 delete GetBleedingManagerServer();
916 if (GetModifiersManager())
917 GetModifiersManager().DeactivateAllModifiers();
926 GetGame().EnableVoN(
this,
false);
927 if (!
GetGame().IsDedicatedServer())
929 GetSymptomManager().OnPlayerKilled();
931 if (GetEconomyProfile() && !m_CorpseProcessing && m_CorpseState == 0 &&
GetGame().GetMission().InsertCorpse(
this))
933 m_CorpseProcessing =
true;
941 GetGame().GetMission().SyncRespawnModeInfo(GetIdentity());
945 super.EEKilled(killer);
950 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
957 if (damageResult !=
null && damageResult.GetDamage(dmgZone,
"Shock") > 0)
959 m_LastShockHitTime =
GetGame().GetTime();
961 if (!IsUnconscious())
963 if (
GetGame().ConfigIsExisting(
"cfgAmmo " + ammo +
" unconRefillModifier"))
965 m_UnconRefillModifier =
GetGame().ConfigGetInt(
"cfgAmmo " + ammo +
" unconRefillModifier");
969 m_UnconRefillModifier = 1;
975 if (damageType == DT_EXPLOSION && ammo ==
"FlashGrenade_Ammo")
982 if (damageResult !=
null && GetBleedingManagerServer())
984 float dmg = damageResult.GetDamage(dmgZone,
"Blood");
985 GetBleedingManagerServer().ProcessHit(dmg, source,
component, dmgZone, ammo, modelPos);
989 #ifdef DIAG_DEVELOPER
991 Print(
"EEHitBy() | " + GetDisplayName() +
" hit by " + source.GetDisplayName() +
" to " + dmgZone);
993 PluginRemotePlayerDebugServer plugin_remote_server = PluginRemotePlayerDebugServer.Cast(
GetPlugin(PluginRemotePlayerDebugServer));
994 if (plugin_remote_server)
996 plugin_remote_server.OnDamageEvent(
this, damageResult);
1000 if (
GetGame().IsDebugMonitor())
1001 m_DebugMonitorValues.SetLastDamage(source.GetDisplayName());
1003 if (m_ActionManager)
1004 m_ActionManager.Interrupt();
1006 int transferShockToDamageCoef =
g_Game.ConfigGetInt(
string.Format(
"%1 %2 DamageApplied transferShockToDamage",
CFG_AMMO, ammo));
1007 if (transferShockToDamageCoef == 1)
1010 AddHealth(
"",
"Health", -ConvertNonlethalDamage(damageResult.GetDamage(dmgZone,
"Shock"), damageType));
1011 if (dmgZone !=
"Head")
1012 AddHealth(dmgZone,
"Health", -damageResult.GetDamage(dmgZone,
"Shock"));
1017 if (GetHealth(
"RightLeg",
"Health") <= 1 || GetHealth(
"LeftLeg",
"Health") <= 1 || GetHealth(
"RightFoot",
"Health") <= 1 || GetHealth(
"LeftFoot",
"Health") <= 1)
1021 GetModifiersManager().DeactivateModifier(
eModifiers.MDF_BROKEN_LEGS);
1023 GetModifiersManager().ActivateModifier(
eModifiers.MDF_BROKEN_LEGS);
1026 if (ammo ==
"Bullet_CupidsBolt" && IsAlive())
1028 DamageSystem.ResetAllZones(
this);
1029 m_ModifiersManager.ResetAll();
1030 m_ModifiersManager.ActivateModifier(
eModifiers.MDF_IMMUNITYBOOST);
1033 if (m_BleedingManagerServer)
1034 m_BleedingManagerServer.RemoveAllSources();
1037 if (GetPlayerStats())
1039 int bloodType = GetStatBloodType().Get();
1040 float energyValue = GetStatEnergy().Get();
1041 float waterValue = GetStatWater().Get();
1042 float heatBuffer = GetStatHeatBuffer().Get();
1043 float heatComfort = GetStatHeatComfort().Get();
1045 GetPlayerStats().ResetAllStats();
1047 GetStatBloodType().Set(bloodType);
1048 GetStatWater().Set(waterValue);
1049 GetStatEnergy().Set(energyValue);
1050 GetStatHeatBuffer().Set(heatBuffer);
1051 GetStatHeatComfort().Set(heatComfort);
1056 m_AgentPool.RemoveAllAgents();
1062 if (IsUnconscious())
1067 m_ShockHandler.CheckValue(
true);
1070 GetGame().GetAnalyticsServer().OnEntityHit(source,
this);
1075 super.EEHitByRemote(damageType, source,
component, dmgZone, ammo, modelPos);
1077 if (m_MeleeFightLogic.IsInBlock())
1080 sound.SetAutodestroy(
true);
1087 StopSoundSet(m_SoundFliesEffect);
1093 override protected float ConvertNonlethalDamage(
float damage,
DamageType damageType)
1095 return damage *
GameConstants.NL_DAMAGE_FIREARM_CONVERSION_PLAYERS;
1101 override void OnReceivedHit(ImpactEffectsData hitData)
1105 float shakeStrength =
Math.InverseLerp(0, 500, hitData.m_InSpeed.Length());
1107 OnPlayerRecievedHit();
1110 if (hitData.m_AmmoType ==
"Bullet_CupidsBolt")
1111 Ammo_CupidsBolt.PlayOnHitParticle(hitData.m_Position);
1117 override void OnPlayerRecievedHit()
1120 if (m_MeleeFightLogic.IsInBlock())
1123 sound.SetAutodestroy(
true);
1127 SpawnDamageDealtEffect();
1136 void OnPlayerReceiveFlashbangHitStart(
bool visual)
1138 SpawnFlashbangEffect(
this, visual);
1141 void OnPlayerReceiveFlashbangHitEnd() {}
1161 return m_DefaultHitPosition;
1170 protected vector SetDefaultHitPosition(
string pSelection)
1172 return GetSelectionPositionMS(pSelection);
1177 void AddPossibleCoverFaceForShave()
1179 m_FaceCoveredForShaveLayers++;
1182 void RemovePossibleCoverFaceForShave()
1184 m_FaceCoveredForShaveLayers--;
1189 super.EEItemAttached(item, slot_name);
1192 SwitchItemSelectionTexture(item, slot_name);
1193 Param1<PlayerBase> p =
new Param1<PlayerBase>(
this);
1194 item.SwitchItemSelectionTextureEx(EItemManipulationContext.ATTACHING, p);
1195 m_QuickBarBase.updateSlotsCount();
1196 CalculateVisibilityForAI();
1197 UpdateShoulderProxyVisibility(item, slot_name);
1199 HideHairSelections(itemIB,
true);
1201 GetGame().GetAnalyticsClient().OnItemAttachedAtPlayer(item, slot_name);
1205 if (!
GetGame().IsDedicatedServer())
1207 if (clothing.GetEffectWidgetTypes())
1209 QueueAddEffectWidget(clothing.GetEffectWidgetTypes());
1212 if (clothing.GetGlassesEffectID() > -1)
1214 QueueAddGlassesEffect(clothing.GetGlassesEffectID());
1218 UpdateCorpseStateVisual();
1220 else if (
GetGame().IsServer())
1222 if (clothing.IsGasMask())
1224 GetModifiersManager().ActivateModifier(
eModifiers.MDF_MASK);
1228 clothing.UpdateNVGStatus(
this,
true);
1231 AdjustBandana(item,slot_name);
1236 super.EEItemDetached(item, slot_name);
1238 SwitchItemSelectionTexture(item, slot_name);
1239 item.SwitchItemSelectionTextureEx(EItemManipulationContext.DETACHING);
1240 m_QuickBarBase.updateSlotsCount();
1241 CalculateVisibilityForAI();
1243 HideHairSelections(item_base,
false);
1249 if (!
GetGame().IsDedicatedServer())
1251 if (clothing.GetEffectWidgetTypes())
1253 QueueRemoveEffectWidget(clothing.GetEffectWidgetTypes());
1256 if (clothing.GetGlassesEffectID() > -1)
1258 QueueRemoveGlassesEffect(clothing.GetGlassesEffectID());
1264 if (clothing.IsGasMask())
1266 GetModifiersManager().DeactivateModifier(
eModifiers.MDF_MASK);
1270 clothing.UpdateNVGStatus(
this);
1272 UpdateCorpseStateVisual();
1276 void SwitchItemTypeAttach(
EntityAI item,
string slot)
1297 void SwitchItemTypeDetach(
EntityAI item,
string slot)
1302 void UpdateShoulderProxyVisibility(
EntityAI item,
string slot_name)
1304 string slot = slot_name;
1306 boo = item.IsWeapon();
1308 if (slot ==
"Melee")
1313 else if (slot ==
"Shoulder")
1320 override void SwitchItemSelectionTexture(
EntityAI item,
string slot_name)
1322 super.SwitchItemSelectionTexture(item,slot_name);
1325 EntityAI armband = FindAttachmentBySlotName(
"Armband");
1326 if (slot_name ==
"Body" && armband)
1328 Param1<PlayerBase> p =
new Param1<PlayerBase>(
this);
1329 armband.SwitchItemSelectionTextureEx(EItemManipulationContext.UPDATE,p);
1333 void RemoveAllItems()
1339 for (
int i = 0; i < itemsArray.Count(); i++)
1341 Class.CastTo(item, itemsArray.Get(i));
1342 if (item && !item.IsInherited(SurvivorBase)) GetInventory().LocalDestroyEntity(item);
1346 bool GetHitPPEEnabled()
1348 return m_CanDisplayHitEffectPPE;
1351 void SetHitPPEEnabled(
bool enabled)
1353 m_CanDisplayHitEffectPPE = enabled;
1358 if (ConfigGetBool(
"woman") != 1)
1367 int voice_type = ConfigGetInt(
"voiceType");
1369 if (voice_type == 0)
1377 PlayerSoundManagerServer GetPlayerSoundManagerServer()
1379 return m_PlayerSoundManagerServer;
1385 if (!m_UndergroundHandler && IsAlive())
1390 return m_UndergroundHandler;
1393 void KillUndergroundHandler()
1395 m_UndergroundHandler =
null;
1441 void SetActionsRemoteTarget()
1448 if (IsControlledPlayer())
1456 SetActionsRemoteTarget();
1464 SetActionsRemoteTarget(m_InputActionMapAsTarget);
1479 if (IsControlledPlayer())
1480 actions = m_InputActionMapControled.Get(action_input_type);
1482 actions = m_InputActionMapAsTarget.Get(action_input_type);
1489 if (IsControlledPlayer())
1490 actions.InsertAll(m_InputActionMapControled.Get(action_input_type));
1492 actions.InsertAll(m_InputActionMapAsTarget.Get(action_input_type));
1494 actions.InsertAll(bcActions);
1502 typename ai = action.GetInputType();
1514 InputActionMap.Insert(ai, action_array);
1516 action_array.Insert(action);
1527 typename ai = action.GetInputType();
1532 for (
int i = 0; i < action_array.Count(); i++)
1534 if (action == action_array.Get(i))
1536 action_array.Remove(i);
1540 InputActionMap.Insert(ai, action_array);
1542 action_array.Insert(action);
1550 int GetCurrentRecipe()
1552 return m_RecipePick;
1555 void SetNextRecipe()
1560 void SetFirstRecipe()
1570 return m_ActionManager;
1575 return m_EmoteManager;
1580 return m_RGSManager;
1586 ProcessHandDamage(delta_time, pState);
1598 if (gloves && gloves.GetHealthLevel() < 4)
1600 gloves.AddHealth(
"",
"",
PlayerConstants.GLOVES_DAMAGE_SLIDING_LADDER_PER_SEC * delta_time);
1604 if (
Math.RandomFloat01() <
PlayerConstants.CHANCE_TO_BLEED_SLIDING_LADDER_PER_SEC * delta_time)
1606 if (
Math.RandomFloat01() < 0.5)
1608 if (GetBleedingManagerServer().AttemptAddBleedingSourceBySelection(
"LeftForeArmRoll"))
1615 if (GetBleedingManagerServer().AttemptAddBleedingSourceBySelection(
"RightForeArmRoll"))
1626 override void ProcessFeetDamageServer(
int pUserInt)
1631 string surface;
int liquid;
1632 GetGame().SurfaceUnderObject(
this, surface, liquid);
1633 float modifier_surface =
Surface.GetParamFloat(surface,
"footDamage");
1635 if (shoes && shoes.GetHealthLevel() < 4)
1642 float rnd =
Math.RandomFloat01();
1643 float modifier_movement = GetFeetDamageMoveModifier();
1647 if (pUserInt % 2 == 0)
1649 if (GetBleedingManagerServer().AttemptAddBleedingSourceBySelection(
"RightFoot"))
1655 if (GetBleedingManagerServer().AttemptAddBleedingSourceBySelection(
"LeftFoot"))
1661 float GetFeetDamageMoveModifier()
1679 void SetStamina(
int value,
int range)
1685 #ifdef DIAG_DEVELOPER
1686 void SetStaminaDisabled(
bool value)
1693 void SetQuickRestrain(
bool enable)
1695 m_AllowQuickRestrain = enable;
1698 void SetQuickFishing(
bool enable)
1700 m_AllowQuickFishing = enable;
1703 bool IsQuickRestrain()
1705 return m_AllowQuickRestrain;
1708 bool IsQuickFishing()
1710 return m_AllowQuickFishing;
1720 return m_CraftingManager;
1730 return m_WeaponManager;
1738 bool CanBeRestrained()
1744 if (GetThrowing() && GetThrowing().IsThrowingModeEnabled())
1751 void SetRestrainStarted(
bool restrain_started)
1753 m_IsRestrainStarted = restrain_started;
1757 bool IsRestrainStarted()
1759 return m_IsRestrainStarted;
1762 void SetRestrainPrelocked(
bool restrain_prelock)
1764 m_IsRestrainPrelocked = restrain_prelock;
1768 bool IsRestrainPrelocked()
1770 return m_IsRestrainPrelocked;
1775 m_IsRestrained = is_restrained;
1779 override bool IsRestrained()
1781 return m_IsRestrained;
1789 bool CanManipulateInventory()
1791 if (IsControlledPlayer())
1793 return !IsRestrained() && !IsRestrainPrelocked();
1800 return super.CanReleaseAttachment(attachment);
1803 override bool CanReleaseCargo (
EntityAI cargo)
1805 return super.CanReleaseCargo(cargo);
1810 return super.CanReceiveItemIntoCargo(item);
1813 override bool CanSwapItemInCargo (
EntityAI child_entity,
EntityAI new_entity)
1815 return super.CanSwapItemInCargo(child_entity, new_entity);
1818 override bool CanReceiveItemIntoHands(
EntityAI item_to_hands)
1823 if (!CanPickupHeavyItem(item_to_hands))
1826 return super.CanReceiveItemIntoHands(item_to_hands);
1829 override bool CanSaveItemInHands(
EntityAI item_in_hands)
1831 return super.CanSaveItemInHands(item_in_hands);
1834 override bool CanReleaseFromHands(
EntityAI handheld)
1836 return super.CanReleaseFromHands(handheld);
1839 int GetCraftingRecipeID()
1843 return GetCraftingManager().GetRecipeID();
1851 void SetCraftingRecipeID(
int recipeID)
1855 GetCraftingManager().SetRecipeID(recipeID);
1868 return m_ConstructionActionData;
1871 void ResetConstructionActionData()
1873 if (m_ConstructionActionData)
1875 m_ConstructionActionData.ResetActionIndexes();
1882 vector GetLastFirePoint()
1884 return m_LastFirePoint;
1886 float GetLastFirePointRot()
1888 return m_LastFirePointRot;
1890 int GetLastFirePointIndex()
1892 return m_LastFirePointIndex;
1895 void SetLastFirePoint(
vector last_fire_point)
1897 m_LastFirePoint = last_fire_point;
1899 void SetLastFirePointRot(
float last_fire_point_rot)
1901 m_LastFirePointRot = last_fire_point_rot;
1903 void SetLastFirePointIndex(
int last_fire_point_index)
1905 m_LastFirePointIndex = last_fire_point_index;
1912 void RemoveQuickBarEntityShortcut(
EntityAI entity)
1914 int index = m_QuickBarBase.FindEntityIndex(entity);
1916 m_QuickBarBase.SetEntityShortcut(entity,-1);
1919 void SetEnableQuickBarEntityShortcut(
EntityAI entity,
bool value)
1921 int index = m_QuickBarBase.FindEntityIndex(entity);
1923 m_QuickBarBase.SetShotcutEnable(index,value);
1927 int FindQuickBarEntityIndex(
EntityAI entity)
1930 index = m_QuickBarBase.FindEntityIndex(entity);
1932 if (m_QuickBarBase.GetEntity(index) == NULL)
1939 int GetQuickBarSize()
1941 return m_QuickBarBase.GetSize();
1944 EntityAI GetQuickBarEntity(
int index)
1946 return m_QuickBarBase.GetEntity(index);
1949 void UpdateQuickBarEntityVisibility(
EntityAI entity)
1951 int i = FindQuickBarEntityIndex(entity);
1953 m_QuickBarBase.UpdateShotcutVisibility(i);
1956 void SetQuickBarEntityShortcut(
EntityAI entity,
int index,
bool force =
false)
1958 m_QuickBarBase.SetEntityShortcut(entity, index, force);
1963 m_QuickBarBase.OnSetEntityRequest(ctx);
1970 float add_health_coef = 0.33;
1974 AddHealth(
"LeftLeg",
"Health", (GetMaxHealth(
"LeftLeg",
"Health") - GetHealth(
"LeftLeg",
"Health") ) * add_health_coef );
1975 AddHealth(
"RightLeg",
"Health", (GetMaxHealth(
"RightLeg",
"Health") - GetHealth(
"RightLeg",
"Health")) * add_health_coef );
1976 AddHealth(
"RightFoot",
"Health", (GetMaxHealth(
"RightFoot",
"Health") - GetHealth(
"RightFoot",
"Health")) * add_health_coef );
1977 AddHealth(
"LeftFoot",
"Health", (GetMaxHealth(
"LeftFoot",
"Health") - GetHealth(
"LeftFoot",
"Health")) * add_health_coef );
1981 void ProcessDrowning(
float dT)
1987 PPERequester_Drowning req = PPERequester_Drowning.Cast(PPERequesterBank.GetRequester(PPERequesterBank.REQ_DROWNING));
1988 req.SetStamina01(GetStaminaHandler().GetStaminaNormalized());
1992 void SpawnDrowningBubbles()
1994 if (!GetDrowningWaterLevelCheck())
1996 float bubbleFrequency =
Math.Lerp(
PlayerConstants.DROWNING_BUBBLE_FREQUENCY_MIN,
PlayerConstants.DROWNING_BUBBLE_FREQUENCY_MAX, GetStaminaHandler().GetSyncedStaminaNormalized());
2008 void ProcessHoldBreath(
float dT)
2010 if (IsTryingHoldBreath() && CanStartConsumingStamina(
EStaminaConsumers.HOLD_BREATH))
2012 if (!m_IsHoldingBreath)
2014 OnHoldBreathStart();
2015 m_IsHoldingBreath =
true;
2018 else if (!IsTryingHoldBreath() || !CanConsumeStamina(
EStaminaConsumers.HOLD_BREATH))
2020 if (m_IsHoldingBreath) OnHoldBreathEnd();
2021 m_IsHoldingBreath =
false;
2025 void OnHoldBreathStart()
2028 RequestSoundEventEx(
EPlayerSoundEventID.HOLD_BREATH,
true, EPlayerSoundEventParam.SKIP_CONTROLLED_PLAYER);
2031 void OnHoldBreathExhausted()
2033 RequestSoundEventEx(
EPlayerSoundEventID.EXHAUSTED_BREATH,
true, EPlayerSoundEventParam.SKIP_CONTROLLED_PLAYER);
2036 void OnHoldBreathEnd()
2039 RequestSoundEventEx(
EPlayerSoundEventID.RELEASE_BREATH,
true, EPlayerSoundEventParam.SKIP_CONTROLLED_PLAYER);
2044 return m_IsHoldingBreath;
2054 return m_MixedSoundStates;
2059 if (m_SaySoundLastSetName !=
name)
2064 m_SaySoundLastSetName =
name;
2067 m_SaySoundObject = m_SaySoundBuilder.BuildSoundObject();
2069 return GetGame().GetSoundScene().Play3D(m_SaySoundObject, m_SaySoundBuilder);
2072 EntityAI FindCargoByBaseType(
string searched_item)
2076 int attcount = this.GetInventory().AttachmentCount();
2078 for (
int att = 0; att < attcount; att++)
2080 attachment = GetInventory().GetAttachmentFromIndex(att);
2081 if (attachment.IsItemBase())
2083 item_name = attachment.GetType();
2084 if (
GetGame().IsKindOf(item_name, searched_item))
2099 PluginSceneManager scene_editor = PluginSceneManager.Cast(
GetPlugin(PluginSceneManager));
2100 scene_editor.InitLoad();
2106 void OnPlayerLoaded()
2112 if (m_ModuleLifespan)
2114 m_ModuleLifespan.SynchLifespanVisual(
this, m_LifeSpanState, m_HasBloodyHandsVisible, m_HasBloodTypeVisible,
m_BloodType);
2118 if (IsControlledPlayer())
2124 m_Hud.UpdateBloodName();
2125 PPERequesterBank.GetRequester(PPERequester_DeathDarkening).Stop();
2126 PPERequesterBank.GetRequester(PPERequester_ShockHitReaction).Stop();
2127 PPERequesterBank.GetRequester(PPERequester_UnconEffects).Stop();
2128 GetGame().GetUIManager().CloseAll();
2129 GetGame().GetMission().SetPlayerRespawning(
false);
2130 GetGame().GetMission().OnPlayerRespawned(
this);
2132 m_Hud.ShowHudUI(
true);
2133 m_Hud.ShowQuickbarUI(
true);
2134 m_Hud.UpdateQuickbarGlobalVisibility();
2136 m_EffectWidgets =
GetGame().GetMission().GetEffectWidgets();
2138 if (!
GetGame().IsDedicatedServer())
2144 m_CharactersHead = Head_Default.Cast(GetInventory().FindPlaceholderForSlot(slot_id));
2145 CheckHairClippingOnCharacterLoad();
2146 UpdateHairSelectionVisibility();
2147 PreloadDecayTexture();
2151 wpn.ValidateAndRepair();
2156 m_PlayerLoaded =
true;
2162 void SetPlayerDisconnected(
bool state)
2164 m_PlayerDisconnectProcessed = state;
2167 bool IsPlayerDisconnected()
2169 return m_PlayerDisconnectProcessed;
2179 return m_HologramServer;
2184 return m_HologramLocal;
2187 void PlacingStartServer(
ItemBase item)
2191 m_HologramServer =
new Hologram(
this, GetLocalProjectionPosition(), item);
2192 GetHologramServer().SetProjectionPosition(GetLocalProjectionPosition());
2193 GetHologramServer().SetProjectionOrientation(GetLocalProjectionOrientation());
2194 GetHologramServer().GetProjectionEntity().OnPlacementStarted(
this);
2195 GetHologramServer().CheckPowerSource();
2196 GetHologramServer().RefreshVisual();
2200 void PlacingStartLocal(
ItemBase item)
2207 m_HologramLocal =
new Hologram(
this, GetLocalProjectionPosition(), item);
2208 GetHologramLocal().GetProjectionEntity().OnPlacementStarted(
this);
2212 void PlacingCancelServer()
2214 EntityAI entityInHands = GetHumanInventory().GetEntityInHands();
2216 if (IsPlacingServer())
2218 GetHologramServer().CheckPowerSource();
2219 GetHologramServer().GetParentEntity().OnPlacementCancelled(
this);
2220 SetLocalProjectionPosition(
vector.Zero);
2222 delete m_HologramServer;
2226 else if (entityInHands && entityInHands.HasEnergyManager())
2228 if (entityInHands.GetCompEM().IsPlugged())
2229 entityInHands.OnPlacementCancelled(
this);
2234 void LockHandsUntilItemHeld()
2236 m_AreHandsLocked =
true;
2239 void PlacingCancelLocal()
2241 EntityAI entityInHands = GetHumanInventory().GetEntityInHands();
2242 if (entityInHands && entityInHands.HasEnergyManager())
2244 if (entityInHands.GetCompEM().IsPlugged())
2245 entityInHands.OnPlacementCancelled(
this);
2248 SetLocalProjectionPosition(
vector.Zero);
2250 delete m_HologramLocal;
2253 void PlacingCompleteServer()
2255 SetLocalProjectionPosition(
vector.Zero);
2256 delete m_HologramServer;
2259 void PlacingCompleteLocal()
2261 SetLocalProjectionPosition(
vector.Zero);
2262 delete m_HologramLocal;
2265 bool IsPlacingServer()
2267 if (m_HologramServer)
2273 bool IsPlacingLocal()
2275 if (m_HologramLocal)
2281 void SetDrowning(
bool enable)
2283 if (enable != m_IsDrowning)
2291 m_IsDrowning = enable;
2294 void OnDrowningStart()
2297 if (IsControlledPlayer())
2299 PPERequester_Drowning req = PPERequester_Drowning.Cast(PPERequesterBank.GetRequester(PPERequesterBank.REQ_DROWNING));
2303 SpawnDrowningBubbles();
2307 void OnDrowningEnd()
2310 if (IsControlledPlayer())
2312 PPERequester_Drowning req = PPERequester_Drowning.Cast(PPERequesterBank.GetRequester(PPERequesterBank.REQ_DROWNING));
2323 PlacingCancelServer();
2330 void RequestResetADSSync()
2341 else if (!
GetGame().IsMultiplayer())
2360 override bool CanPlaceItem(
EntityAI item)
2365 foreach (
string t: disallowedUndergroundTypes)
2367 if (item.IsKindOf(t))
2376 m_UndergroundPresence = presence;
2379 void TogglePlacingLocal(
ItemBase item =
null)
2381 if (IsPlacingLocal())
2392 PlacingCancelLocal();
2396 PlacingStartLocal(GetItemInHands());
2400 PlacingStartLocal(item);
2404 void SetLocalProjectionPosition(
vector local_position)
2406 m_LocalProjectionPosition = local_position;
2409 void SetLocalProjectionOrientation(
vector local_orientation)
2411 m_LocalProjectionOrientation = local_orientation;
2414 vector GetLocalProjectionPosition()
2416 return m_LocalProjectionPosition;
2419 vector GetLocalProjectionOrientation()
2421 return m_LocalProjectionOrientation;
2425 void AddToEnvironmentTemperature(
float pTemperature) {};
2430 void SetInWater(
bool pState)
2432 m_IsInWater = pState;
2447 SetContaminatedEffectEx(
false);
2451 StopSoundSet(m_SoundFliesEffect);
2456 m_CameraSwayModifier = new_camera.GetWeaponSwayModifier();
2457 m_CurrentCamera = new_camera;
2462 return m_CurrentCamera;
2465 bool IsCurrentCameraAimedAtGround()
2467 if (!m_CurrentCamera)
2470 return m_CurrentCamera.GetCurrentPitch() <
PlayerConstants.CAMERA_THRESHOLD_PITCH;
2473 BleedingSourcesManagerServer GetBleedingManagerServer()
2475 return m_BleedingManagerServer;
2478 BleedingSourcesManagerRemote GetBleedingManagerRemote()
2480 return m_BleedingManagerRemote;
2485 return m_SymptomManager;
2496 TransferValues GetTransferValues()
2498 return m_TrasferValues;
2503 return m_DebugMonitorValues;
2649 if (!IsPlayerSelected() || !IsAlive())
2651 if (m_ModifiersManager)
2652 m_ModifiersManager.OnScheduledTick(deltaTime);
2653 if (m_NotifiersManager)
2654 m_NotifiersManager.OnScheduledTick();
2655 if (m_TrasferValues)
2656 m_TrasferValues.OnScheduledTick(deltaTime);
2659 if (GetBleedingManagerServer())
2660 GetBleedingManagerServer().OnTick(deltaTime);
2662 m_Environment.Update(deltaTime);
2665 ItemBase heldItem = GetItemInHands();
2666 if (heldItem && heldItem.HasEnergyManager() && heldItem.GetCompEM().IsPlugged())
2672 placed_entity.GetCompEM().UpdatePlugState();
2676 void OnCommandHandlerTick(
float delta_time,
int pCurrentCommandID)
2680 if (!m_DeathSyncSent && m_KillerData)
2682 SyncEvents.SendEntityKilled(
this, m_KillerData.m_Killer, m_KillerData.m_MurderWeapon, m_KillerData.m_KillerHiTheBrain);
2685 m_DeathSyncSent =
true;
2689 if (m_DebugMonitorValues)
2690 m_DebugMonitorValues.OnScheduledTick(delta_time);
2691 if (GetSymptomManager())
2692 GetSymptomManager().OnTick(delta_time, pCurrentCommandID,
m_MovementState);
2698 if (m_PlayerSoundEventHandler)
2699 m_PlayerSoundEventHandler.OnTick(delta_time);
2701 if (m_ProcessRemoveEffectWidgets && m_ProcessRemoveEffectWidgets.Count() > 0)
2703 m_EffectWidgets.RemoveActiveEffects(m_ProcessRemoveEffectWidgets);
2706 if (m_ProcessAddEffectWidgets && m_ProcessAddEffectWidgets.Count() > 0)
2708 m_EffectWidgets.AddActiveEffects(m_ProcessAddEffectWidgets);
2711 HandleGlassesEffect();
2713 if (m_ContaminatedAreaEffectEnabled)
2714 ContaminatedParticleAdjustment();
2716 #ifdef DIAG_DEVELOPER
2719 m_WeaponDebug.OnCommandHandlerUpdate();
2723 m_ProcessAddEffectWidgets.Clear();
2724 m_ProcessRemoveEffectWidgets.Clear();
2730 UpdateMovementInertia();
2734 void UpdateMovementInertia()
2739 float staminaPercentage = GetStaminaHandler().GetSyncedStaminaNormalized();
2740 hcm.SetTurnSpanSprintModifier(2 - staminaPercentage);
2741 hcm.SetRunSprintFilterModifier((2 - staminaPercentage) * 0.5);
2742 hcm.SetDirectionSprintFilterModifier(2 - staminaPercentage);
2747 int m_DbgListSelection = 0;
2748 float m_DbgSliderValue = 0.0;
2753 return m_NotifiersManager;
2769 override void EEItemIntoHands(
EntityAI item)
2771 super.EEItemIntoHands(item);
2775 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(item, {
Bolt_Base});
2778 if (
Class.CastTo(w, item))
2780 w.ResetWeaponAnimState();
2785 cm.SetMeleeBlock(
false);
2786 GetMeleeFightLogic().SetBlock(
false);
2791 if (item.IsHeavyBehaviour() &&
IsRaised())
2804 override void EEItemOutOfHands(
EntityAI item)
2806 super.EEItemOutOfHands(item);
2808 if (IsPlacingLocal())
2818 return m_PlayerStomach;
2821 override void CommandHandler(
float pDt,
int pCurrentCommandID,
bool pCurrentCommandFinished)
2823 EvaluateDamageHit(pCurrentCommandID);
2826 super.CommandHandler(pDt,pCurrentCommandID,pCurrentCommandFinished);
2830 CheckZeroSoundEvent();
2831 CheckSendSoundEvent();
2833 ProcessADDModifier();
2835 if (m_BrokenLegsJunctureReceived)
2837 m_BrokenLegsJunctureReceived =
false;
2838 bool initial = m_BrokenLegState < 0;
2845 BrokenLegForceProne();
2847 GetUApi().GetInputByID(UATempRaiseWeapon).Supress();
2853 GetDayZPlayerInventory().HandleInventory(pDt);
2855 if (IsFireWeaponRaised() || m_IsHoldingBreath)
2857 ProcessHoldBreath(pDt);
2862 if (m_AreHandsLocked && GetHumanInventory().GetEntityInHands())
2864 m_AreHandsLocked =
false;
2868 if (hic.CameraIsFreeLook() && m_DirectionToCursor ==
vector.Zero)
2870 m_DirectionToCursor =
GetGame().GetCurrentCameraDirection();
2872 else if (!hic.CameraIsFreeLook() && m_DirectionToCursor !=
vector.Zero)
2874 m_DirectionToCursor =
vector.Zero;
2877 if (m_WeaponManager)
2879 m_WeaponManager.Update(pDt);
2881 if (m_EmoteManager && IsPlayerSelected())
2883 m_EmoteManager.Update(pDt);
2887 m_RGSManager.Update();
2889 if (m_StanceIndicator)
2891 m_StanceIndicator.Update();
2897 if (m_InjuryHandler)
2899 m_InjuryHandler.Update(pDt);
2901 if (m_HCAnimHandler)
2907 m_ShockHandler.Update(pDt);
2912 GetPlayerSoundManagerServer().Update();
2917 GetHumanInventory().Update(pDt);
2920 ProcessDrowning(pDt);
2924 HandleDamageHit(pCurrentCommandID);
2928 mngr.Update(pCurrentCommandID);
2933 if (!m_UnconsciousDebug)
2936 if (m_ShouldBeUnconscious && m_IsUnconscious)
2941 m_Swimming.m_bWasSwimming |= hcu.IsInWater();
2944 if (m_Swimming.m_bWasSwimming)
2949 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
2952 else if (m_ShouldBeUnconscious)
2955 bool isTransitioning = hcv && (hcv.IsGettingIn() || hcv.IsGettingOut() || hcv.IsSwitchSeat());
2959 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
2961 m_IsUnconscious =
true;
2962 OnUnconsciousStart();
2969 m_LastCommandBeforeUnconscious = pCurrentCommandID;
2973 m_TransportCache = hcv.GetTransport();
2977 m_JumpClimb.CheckAndFinishJump();
2983 else if (m_IsUnconscious)
2988 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
2991 if (m_UnconsciousTime > 2)
2996 if (m_Swimming.m_bWasSwimming || m_LastCommandBeforeUnconscious ==
DayZPlayerConstants.COMMANDID_VEHICLE)
2999 hcu.WakeUp(wakeUpStance);
3001 m_IsUnconscious =
false;
3002 OnUnconsciousStop(pCurrentCommandID);
3010 m_IsUnconscious =
false;
3011 OnUnconsciousStop(pCurrentCommandID);
3018 int quickBarSlot = hic.IsQuickBarSlot();
3019 if (quickBarSlot && IsAlive())
3021 if (hic.IsQuickBarSingleUse())
3023 OnQuickBarSingleUse(quickBarSlot);
3026 if (hic.IsQuickBarContinuousUseStart() && ((!
GetGame().IsDedicatedServer()) && !
GetGame().GetUIManager().GetMenu()))
3028 OnQuickBarContinuousUseStart(quickBarSlot);
3031 if (hic.IsQuickBarContinuousUseEnd() && ((!
GetGame().IsDedicatedServer())))
3033 OnQuickBarContinuousUseEnd(quickBarSlot);
3048 hic.LimitsDisableSprint(
true);
3052 hic.LimitsDisableSprint(
false);
3059 if (!
GetGame().IsDedicatedServer())
3067 if (IsMapCallbackCancelInput())
3071 else if (IsMapCallbackEndInput())
3082 m_Bot.OnUpdate(pDt);
3085 if (m_CheckMeleeItem && (!
GetGame().IsDedicatedServer()))
3087 CheckMeleeItemDamage(m_CheckMeleeItem);
3088 SetCheckMeleeItem();
3092 TryGetInVehicleDebug();
3095 OnCommandHandlerTick(pDt, pCurrentCommandID);
3100 void SetGetInVehicleDebug(
EntityAI ent)
3102 m_GetInVehicleTransportDebug =
Transport.Cast(ent);
3105 void TryGetInVehicleDebug()
3107 if (m_GetInVehicleTransportDebug)
3112 vehCommand.SetVehicleType(m_GetInVehicleTransportDebug.GetAnimInstance());
3114 m_GetInVehicleTransportDebug =
null;
3126 void CloseMapEx(
bool cancelled)
3128 if (m_hac && !GetMapClosingSyncSent())
3139 mngr_client.RequestInterruptAction();
3143 mngr_client.RequestEndAction();
3146 GetGame().GetMission().RemoveActiveInputExcludes({
"map"});
3147 GetGame().GetMission().RemoveActiveInputRestriction(EInputRestrictors.MAP);
3149 else if (!
GetGame().IsMultiplayer())
3156 m_hac.InternalCommand(command_ID);
3158 SetMapClosingSyncSet(
true);
3162 if (!
GetGame().IsDedicatedServer())
3169 m_Hud.ShowHudPlayer(
true);
3170 m_Hud.ShowQuickbarPlayer(
true);
3173 GetGame().GetMission().RemoveActiveInputExcludes({
"map"});
3174 GetGame().GetMission().RemoveActiveInputRestriction(EInputRestrictors.MAP);
3179 void SetMapOpen(
bool state)
3189 void SetMapClosingSyncSet(
bool state)
3191 m_MapClosingSyncSent = state;
3194 bool GetMapClosingSyncSent()
3196 return m_MapClosingSyncSent;
3199 bool IsMapCallbackCancelInput()
3201 if (
IsRaised() || (
GetUApi().GetInputByID(UAUIMenu).LocalPress() ||
GetUApi().GetInputByID(UAGear).LocalPress()))
3209 bool IsMapCallbackEndInput()
3211 if (
GetUApi().GetInputByID(UADefaultAction).LocalPress())
3221 return m_MapNavigationBehaviour;
3224 void MapNavigationItemInPossession(
EntityAI item)
3226 if (GetMapNavigationBehaviour())
3228 GetMapNavigationBehaviour().OnItemInPlayerPossession(item);
3232 void MapNavigationItemNotInPossession(
EntityAI item)
3234 if (GetMapNavigationBehaviour())
3236 GetMapNavigationBehaviour().OnItemNotInPlayerPossession(item);
3240 void SetCheckMeleeItem(
ItemBase item =
null)
3242 m_CheckMeleeItem = item;
3270 void SetShakesForced(
int value)
3272 m_ShakesForced = value;
3278 if (m_ShakesForced > 0)
3280 level = m_ShakesForced;
3284 float heat_comfort = GetStatHeatComfort().Get();
3285 if (heat_comfort <=
PlayerConstants.THRESHOLD_HEAT_COMFORT_MINUS_WARNING)
3288 level =
Math.Lerp(1,7,value);
3289 level =
Math.Clamp(value,1,7);
3296 if (level != m_Shakes)
3303 override bool IsLanded(
int pCurrentCommandID)
3305 if (super.IsLanded(pCurrentCommandID))
3313 bool wasFalling = m_IsUnconsciousFalling;
3315 return wasFalling && !m_IsUnconsciousFalling;
3323 override bool OnLand(
int pCurrentCommandID,
FallDamageData fallDamageData)
3325 if (super.OnLand(pCurrentCommandID, fallDamageData))
3336 override bool IsAlreadyInFallingCommand(
int pCurrentCommandID)
3338 if (super.IsAlreadyInFallingCommand(pCurrentCommandID))
3348 void OnUnconsciousStart()
3350 CloseInventoryMenu();
3354 SetInventorySoftLock(
true);
3357 EntityAI entity_in_hands = GetHumanInventory().GetEntityInHands();
3358 if (entity_in_hands && CanDropEntity(entity_in_hands) && !IsRestrained())
3360 DropItem(
ItemBase.Cast(entity_in_hands));
3363 GetGame().GetSoundScene().SetSoundVolume(0,2);
3364 m_EffectWidgets.AddSuspendRequest(EffectWidgetSuspends.UNCON);
3373 if (m_TransportCache)
3374 m_TransportCache.MarkCrewMemberUnconscious(m_TransportCache.CrewMemberIndex(
this));
3378 GetGame().EnableVoN(
this,
false);
3386 if (GetMeleeFightLogic())
3388 GetMeleeFightLogic().SetBlock(
false);
3392 SetMasterAttenuation(
"UnconsciousAttenuation");
3395 void OnUnconsciousStop(
int pCurrentCommandID)
3397 m_UnconRefillModifier =1;
3399 m_UnconsciousTime = 0;
3400 m_UnconsciousVignetteTarget = 2;
3405 GetGame().GetSoundScene().SetSoundVolume(
g_Game.m_volume_sound,1);
3406 PPERequesterBank.GetRequester(PPERequester_UnconEffects).Stop();
3407 GetGame().GetMission().GetHud().ShowHudUI(
true);
3408 GetGame().GetMission().GetHud().ShowQuickbarUI(
true);
3409 if (
GetGame().GetUIManager().IsDialogVisible())
3411 GetGame().GetUIManager().CloseDialog();
3418 SetInventorySoftLock(
false);
3419 m_EffectWidgets.RemoveSuspendRequest(EffectWidgetSuspends.UNCON);
3425 GetGame().EnableVoN(
this,
true);
3433 SetMasterAttenuation(
"");
3436 void OnUnconsciousUpdate(
float pDt,
int last_command)
3438 m_UnconsciousTime += pDt;
3441 int shock_simplified = SimplifyShock();
3443 if (m_ShockSimplified != shock_simplified)
3445 m_ShockSimplified = shock_simplified;
3451 SetHealth(
"",
"",-100);
3456 GetGame().GetMission().GetHud().ShowHudUI(
false);
3457 GetGame().GetMission().GetHud().ShowQuickbarUI(
false);
3460 float shock_simple_normalized = GetSimplifiedShockNormalized();
3462 float sin =
Math.Sin(m_UnconsciousTime * 0.3);
3463 float sin_normalized = (sin + 1) / 2;
3464 if (sin_normalized < 0.05)
3466 m_UnconsciousVignetteTarget = (1 - shock_simple_normalized / 3) * 2;
3468 float vignette =
Math.Lerp(2,m_UnconsciousVignetteTarget, sin_normalized);
3470 m_UnconParam.param1 = vignette;
3471 PPERequesterBank.GetRequester(PPERequester_UnconEffects).Start(m_UnconParam);
3478 int shock =
Math.Lerp(0, SIMPLIFIED_SHOCK_CAP, GetHealth(
"",
"Shock") / GetMaxHealth(
"",
"Shock"));
3479 shock =
Math.Clamp(shock, 0, SIMPLIFIED_SHOCK_CAP);
3483 float GetSimplifiedShockNormalized()
3485 return (m_ShockSimplified / SIMPLIFIED_SHOCK_CAP);
3488 override bool IsUnconscious()
3493 override bool CanBeTargetedByAI(
EntityAI ai)
3495 #ifdef DIAG_DEVELOPER
3496 if (!m_CanBeTargetedDebug)
3502 return super.CanBeTargetedByAI(ai) && !IsUnconscious() && !IsInVehicle();
3505 void GiveShock(
float shock)
3507 AddHealth(
"",
"Shock",shock);
3511 void OnRestrainStart()
3513 CloseInventoryMenu();
3514 GetGame().GetMission().RemoveActiveInputExcludes({
"inventory"},
true);
3515 GetGame().GetMission().RemoveActiveInputRestriction(EInputRestrictors.INVENTORY);
3519 void ShockRefill(
float pDt);
3526 return Math.AbsInt(m_BrokenLegState);
3530 void SetBrokenLegs(
int stateId)
3532 m_BrokenLegState = stateId;
3539 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS;
3540 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS_SPLINT;
3555 void UpdateBrokenLegs(
int stateId)
3565 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.PRONE_ANIM_OVERRIDE;
3566 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS;
3567 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask | eInjuryOverrides.BROKEN_LEGS_SPLINT;
3569 m_InjuryHandler.CheckValue(
false);
3577 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.PRONE_ANIM_OVERRIDE;
3578 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS_SPLINT;
3579 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask | eInjuryOverrides.BROKEN_LEGS;
3582 BrokenLegWalkShock();
3583 m_InjuryHandler.CheckValue(
false);
3589 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS;
3590 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS_SPLINT;
3595 void BreakLegSound()
3597 PlaySoundSet(m_BrokenLegSound, SOUND_BREAK_LEG, 0.1, 0.1);
3599 void BrokenLegForceProne(
bool forceOverride =
false)
3606 Class.CastTo(attachment, GetItemOnSlot(
"Splint_Right"));
3607 if (attachment && attachment.GetType() ==
"Splint_Applied")
3609 attachment.Delete();
3613 m_ShockHandler.CheckValue(
true);
3616 if (m_ShockHandler.GetCurrentShock() >= 25)
3638 m_JumpClimb.CheckAndFinishJump();
3642 void BrokenLegWalkShock()
3647 float avgLegHealth = GetHealth(
"RightLeg",
"") + GetHealth(
"LeftLeg",
"") + GetHealth(
"RightFoot",
"") + GetHealth(
"LeftFoot",
"");
3648 avgLegHealth *= 0.25;
3656 if (v.LengthSq() > 0)
3663 if (IsClimbingLadder())
3686 m_ShockHandler.CheckValue(
true);
3691 void MovingShock(
float legHealth,
float highShock,
float midShock,
float lowShock)
3696 m_ShockHandler.SetShock(highShock);
3698 else if (legHealth >=
PlayerConstants.BROKEN_LEGS_HIGH_HEALTH_THRESHOLD)
3701 m_ShockHandler.SetShock(lowShock);
3706 m_ShockHandler.SetShock(midShock);
3710 void DealShock(
float dmg)
3712 Param1<float> damage =
new Param1<float>(0);
3713 damage.param1 = dmg;
3714 GetGame().RPCSingleParam(
this,
ERPCs.RPC_SHOCK, damage,
true, GetIdentity());
3718 override bool CanPickupHeavyItem(notnull
EntityAI item)
3720 if (item.IsHeavyBehaviour() && (GetBrokenLegs() ==
eBrokenLegs.BROKEN_LEGS || GetBrokenLegs() ==
eBrokenLegs.BROKEN_LEGS_SPLINT))
3723 return super.CanPickupHeavyItem(item);
3729 SetHealth(
"RightLeg",
"", 0);
3730 SetHealth(
"RightFoot",
"", 0);
3731 SetHealth(
"LeftLeg",
"", 0);
3732 SetHealth(
"LeftFoot",
"", 0);
3735 void DropHeavyItem()
3737 ItemBase itemInHands = GetItemInHands();
3738 if (itemInHands && itemInHands.IsHeavyBehaviour())
3739 DropItem(itemInHands);
3742 bool IsWearingSplint()
3745 Class.CastTo(attachment, GetItemOnSlot(
"Splint_Right"));
3746 if (attachment && attachment.GetType() ==
"Splint_Applied")
3758 ItemBase itemInHands = GetItemInHands();
3761 if (itemInHands.IsHeavyBehaviour())
3763 TryHideItemInHands(
false);
3768 TryHideItemInHands(
true);
3770 itemInHands.OnItemInHandsPlayerSwimStart(
this);
3775 GetInventory().LockInventory(LOCK_FROM_SCRIPT);
3777 CloseInventoryMenu();
3781 GetWeaponManager().DelayedRefreshAnimationState(10);
3782 RequestHandAnimationStateRefresh();
3784 GetGame().GetMission().AddActiveInputExcludes({
"swimming"});
3789 TryHideItemInHands(
false,
true);
3792 GetInventory().UnlockInventory(LOCK_FROM_SCRIPT);
3796 GetWeaponManager().RefreshAnimationState();
3798 GetGame().GetMission().RemoveActiveInputExcludes({
"swimming"});
3804 TryHideItemInHands(
true);
3807 GetInventory().LockInventory(LOCK_FROM_SCRIPT);
3809 CloseInventoryMenu();
3811 GetGame().GetMission().AddActiveInputExcludes({
"ladderclimbing"});
3816 TryHideItemInHands(
false,
true);
3819 GetInventory().UnlockInventory(LOCK_FROM_SCRIPT);
3821 GetGame().GetMission().RemoveActiveInputExcludes({
"ladderclimbing"});
3829 GetInventory().LockInventory(LOCK_FROM_SCRIPT);
3831 CloseInventoryMenu();
3834 GetWeaponManager().DelayedRefreshAnimationState(10);
3835 RequestHandAnimationStateRefresh();
3841 GetInventory().UnlockInventory(LOCK_FROM_SCRIPT);
3843 GetWeaponManager().RefreshAnimationState();
3851 GetInventory().LockInventory(LOCK_FROM_SCRIPT);
3853 CloseInventoryMenu();
3856 GetWeaponManager().DelayedRefreshAnimationState(10);
3857 RequestHandAnimationStateRefresh();
3863 GetInventory().UnlockInventory(LOCK_FROM_SCRIPT);
3865 GetWeaponManager().RefreshAnimationState();
3873 GetInventory().LockInventory(LOCK_FROM_SCRIPT);
3875 CloseInventoryMenu();
3877 ItemBase itemInHand = GetItemInHands();
3878 EntityAI itemOnHead = FindAttachmentBySlotName(
"Headgear");
3880 if (itemInHand && itemInHand.GetCompEM())
3881 itemInHand.GetCompEM().SwitchOff();
3883 TryHideItemInHands(
true);
3885 if (itemOnHead && itemOnHead.GetCompEM())
3886 itemOnHead.GetCompEM().SwitchOff();
3890 OnVehicleSeatDriverEnter();
3892 GetGame().GetMission().AddActiveInputExcludes({
"vehicledriving"});
3898 GetInventory().UnlockInventory(LOCK_FROM_SCRIPT);
3900 TryHideItemInHands(
false,
true);
3902 if (m_IsVehicleSeatDriver)
3903 OnVehicleSeatDriverLeft();
3905 GetGame().GetMission().RemoveActiveInputExcludes({
"vehicledriving"});
3911 m_IsFighting =
true;
3914 GetWeaponManager().DelayedRefreshAnimationState(10);
3915 RequestHandAnimationStateRefresh();
3920 RunFightBlendTimer();
3922 GetWeaponManager().RefreshAnimationState();
3931 GetWeaponManager().DelayedRefreshAnimationState(10);
3932 RequestHandAnimationStateRefresh();
3937 m_ActionManager.OnJumpStart();
3940 GetWeaponManager().DelayedRefreshAnimationState(10);
3941 RequestHandAnimationStateRefresh();
3945 override void OnJumpEnd(
int pLandType = 0)
3947 if (m_PresenceNotifier)
3962 GetWeaponManager().RefreshAnimationState();
3965 bool IsStance(
int stance,
int stanceMask)
3967 return ((1 << stance) & stanceMask) != 0;
3976 m_SprintedTimePerStanceMin =
PlayerConstants.FULL_SPRINT_DELAY_FROM_PRONE;
3979 m_SprintedTimePerStanceMin =
PlayerConstants.FULL_SPRINT_DELAY_FROM_CROUCH;
3981 if ((IsStance(previousStance, prone) && IsStance(newStance, notProne)) || (IsStance(previousStance, notProne) && IsStance(newStance, prone)))
3984 GetWeaponManager().RefreshAnimationState();
3991 if (GetThrowing().IsThrowingAnimationPlaying())
3999 if (
Math.AbsInt(previousStance - newStance) == 3)
4030 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.PRONE_ANIM_OVERRIDE;
4031 ForceUpdateInjuredState();
4041 if (IsInFBEmoteState() || m_EmoteManager.m_MenuEmote)
4061 void OnJumpOutVehicleFinish(
float carSpeed)
4065 GetGame().SurfaceUnderObject(
this, surfaceType, liquidType);
4068 void OnVehicleSwitchSeat(
int seatIndex)
4072 OnVehicleSeatDriverEnter();
4076 OnVehicleSeatDriverLeft();
4080 void OnVehicleSeatDriverEnter()
4082 m_IsVehicleSeatDriver =
true;
4084 m_Hud.ShowVehicleInfo();
4087 void OnVehicleSeatDriverLeft()
4089 m_IsVehicleSeatDriver =
false;
4091 m_Hud.HideVehicleInfo();
4096 if (change_to_enabled)
4098 PlacingCancelLocal();
4099 PlacingCancelServer();
4108 m_Hud.Update(timeSlice);
4109 m_Hud.ToggleHeatBufferPlusSign(m_HasHeatBuffer);
4111 if (IsControlledPlayer() && m_EffectWidgets && m_EffectWidgets.IsAnyEffectRunning())
4113 m_EffectWidgets.Update(timeSlice);
4117 if (m_UndergroundHandler)
4118 m_UndergroundHandler.Tick(timeSlice);
4122 override void EOnPostFrame(
IEntity other,
int extra)
4124 float delta_time = (
GetGame().GetTime() - m_LastPostFrameTickTime) / 1000;
4125 m_LastPostFrameTickTime =
GetGame().GetTime();
4128 if (GetDamageDealtEffect())
4131 GetDamageDealtEffect().Update(delta_time);
4133 delete GetDamageDealtEffect();
4140 m_EffectRadial.Update(delta_time);
4143 m_EffectRadial =
null;
4147 if (GetFlashbangEffect())
4151 GetFlashbangEffect().Update(delta_time);
4155 GetFlashbangEffect().Stop();
4156 delete GetFlashbangEffect();
4160 if (GetShockEffect())
4163 GetShockEffect().Update(delta_time);
4165 delete GetShockEffect();
4168 m_InventoryActionHandler.OnUpdate();
4171 #ifdef DIAG_DEVELOPER
4172 DiagOnPostFrame(other, extra);
4176 #ifdef DIAG_DEVELOPER
4177 protected void DiagOnPostFrame(
IEntity other,
int extra)
4183 m_WeaponDebug.OnPostFrameUpdate();
4186 if (GetBleedingManagerRemote())
4188 GetBleedingManagerRemote().OnUpdate();
4195 m_MeleeDebug =
true;
4200 m_MeleeDebug =
false;
4210 PluginDrawCheckerboard drawCheckerboard = PluginDrawCheckerboard.Cast(
GetPluginManager().GetPluginByType(PluginDrawCheckerboard));
4211 if (drawCheckerboard && !drawCheckerboard.IsActive())
4217 if (m_PresenceNotifier)
4225 GetCollisionBox(minmax);
4228 if (m_IsInsideTrigger)
4235 dbgShape.CreateMatrix(mat);
4236 dbgShape.SetMatrix(mat);
4240 if (m_Environment && m_Environment.m_Debug)
4243 EnvDebugData envDebugData = m_Environment.GetEnvDebugData();
4244 GetGame().RPCSingleParam(
this,
ERPCs.DIAG_MISC_ENVIRONMENT_DEBUG_DATA, envDebugData,
false, GetIdentity());
4246 m_Environment.ShowEnvDebugPlayerInfo(
DiagMenu.GetBool(
DiagMenuIDs.MISC_ENVIRONMENT_DEBUG));
4250 if (m_FallDamage && m_FallDamage.m_Debug)
4253 FallDamageDebugData fallDamageDebugData = m_FallDamage.GetFallDamageDebugData();
4254 GetGame().RPCSingleParam(
this,
ERPCs.DIAG_MISC_FALLDAMAGE_DEBUG_DATA, fallDamageDebugData,
false, GetIdentity());
4256 m_FallDamage.ShowFallDamageDebugInfo(
DiagMenu.GetBool(
DiagMenuIDs.MISC_FALLDAMAGE_DEBUG));
4263 super.OnEnterTrigger(trigger);
4265 ++m_IsInsideTrigger;
4270 super.OnLeaveTrigger(trigger);
4272 --m_IsInsideTrigger;
4276 void StaminaHUDNotifier(
bool show)
4279 m_Hud.SetStaminaBarVisibility(show);
4284 if (GetStaminaHandler())
4285 GetStaminaHandler().DepleteStamina(modifier,dT);
4290 if (!GetStaminaHandler())
return false;
4292 bool val = (GetStaminaHandler().HasEnoughStaminaFor(consumer) && !IsRestrained() && !IsInFBEmoteState());
4295 StaminaHUDNotifier(
false);
4302 if (!GetStaminaHandler())
return false;
4304 bool val = (GetStaminaHandler().HasEnoughStaminaToStart(consumer) && !IsRestrained() && !IsInFBEmoteState());
4307 StaminaHUDNotifier(
false);
4313 bool HasStaminaRemaining()
4315 if (!GetStaminaHandler())
4318 return GetStaminaHandler().GetStamina() > 0;
4321 override bool CanClimb(
int climbType, SHumanCommandClimbResult climbRes)
4334 if (climbType > 0 && m_InjuryHandler && m_InjuryHandler.GetInjuryAnimValue() >=
InjuryAnimValues.LVL3)
4337 return super.CanClimb(climbType,climbRes);
4340 override bool CanJump()
4342 if (GetBrokenLegs() !=
eBrokenLegs.NO_BROKEN_LEGS)
4351 if (m_InjuryHandler && m_InjuryHandler.GetInjuryAnimValue() >=
InjuryAnimValues.LVL3)
4354 if (IsInFBEmoteState() || m_EmoteManager.m_MenuEmote)
4359 return super.CanJump();
4362 bool IsJumpInProgress()
4364 return m_JumpClimb.m_bIsJumpInProgress;
4367 bool IsTargetInActiveRefresherRange(
EntityAI target)
4370 temp =
GetGame().GetMission().GetActiveRefresherLocations();
4371 int count = temp.Count();
4374 vector pos = target.GetPosition();
4375 for (
int i = 0; i < count; i++)
4389 void RequestHandAnimationStateRefresh()
4393 m_RefreshAnimStateIdx++;
4394 if (m_RefreshAnimStateIdx > 3)
4395 m_RefreshAnimStateIdx = 0;
4400 void RefreshHandAnimationState(
int delay = 0)
4417 bool IsFacingTarget(
Object target)
4419 vector pdir = GetDirection();
4424 if (
Math.AbsFloat(pdir[0]-ptv[0]) < 0.5 &&
Math.AbsFloat(pdir[2]-ptv[2]) < 0.5)
4432 void OnQuickBarSingleUse(
int slotClicked)
4437 if (m_AreHandsLocked)
4443 if (GetThrowing().IsThrowingModeEnabled() || GetThrowing().IsThrowingAnimationPlaying())
4446 if (
IsRaised() ||
GetCommand_Melee() || IsSwimming() || IsClimbingLadder() || IsClimbing() || IsRestrained() || IsRestrainPrelocked())
4449 if (GetDayZPlayerInventory().
IsProcessing() || IsItemsToDelete())
4455 if (GetWeaponManager() && GetWeaponManager().
IsRunning())
4465 EntityAI quickBarEntity = GetQuickBarEntity(slotClicked - 1);
4467 if (!quickBarEntity)
4473 if (
Class.CastTo(mag, quickBarEntity) &&
Class.CastTo(wpn, mag.GetHierarchyParent()))
4476 EntityAI inHandEntity = GetHumanInventory().GetEntityInHands();
4478 if (!GetDayZPlayerInventory().
IsIdle())
4482 handInventoryLocation.SetHands(
this,quickBarEntity);
4483 if (this.GetInventory().HasInventoryReservation(quickBarEntity, handInventoryLocation))
4486 if (inHandEntity == quickBarEntity)
4488 if (GetHumanInventory().CanRemoveEntityInHands())
4490 if (
LogManager.IsSyncLogEnable())
syncDebugPrint(
"[QB] Stash - PredictiveMoveItemFromHandsToInventory HND=" +
Object.GetDebugName(inHandEntity));
4491 PredictiveMoveItemFromHandsToInventory();
4497 quickBarEntity.GetInventory().GetCurrentInventoryLocation(invLocQBItem);
4498 if (GetInventory().HasInventoryReservation(quickBarEntity,invLocQBItem))
4506 inHandEntity.GetInventory().GetCurrentInventoryLocation(inHandEntityFSwapDst);
4508 int index = GetHumanInventory().FindUserReservedLocationIndex(inHandEntity);
4510 GetHumanInventory().GetUserReservedLocation(index, Reserved_Item_il);
4512 if (Reserved_Item_il)
4513 inHandEntityFSwapDst.CopyLocationFrom(Reserved_Item_il,
true);
4515 if (index < 0 &&
GameInventory.CanSwapEntitiesEx(quickBarEntity, inHandEntity))
4518 PredictiveSwapEntities(quickBarEntity, inHandEntity);
4520 else if (
GameInventory.CanForceSwapEntitiesEx(quickBarEntity, handInventoryLocation, inHandEntity, inHandEntityFSwapDst))
4523 PredictiveForceSwapEntities(quickBarEntity, inHandEntity, inHandEntityFSwapDst);
4528 if (GetInventory().HasInventoryReservation(quickBarEntity,handInventoryLocation))
4531 if (GetInventory().CanAddEntityIntoHands(quickBarEntity))
4534 PredictiveTakeEntityToHands(quickBarEntity);
4540 void OnQuickBarContinuousUseStart(
int slotClicked)
4542 if (GetInventory().IsInventoryLocked())
4545 if (IsSwimming() || IsClimbingLadder() ||
GetCommand_Melee() || IsClimbing() || IsRestrained() || IsRestrainPrelocked())
4552 ItemBase itemInHands =
ItemBase.Cast(GetHumanInventory().GetEntityInHands());
4554 if (itemInHands != quickBarItem)
4558 if (amc.CanPerformActionFromQuickbar(itemInHands, quickBarItem))
4560 amc.PerformActionFromQuickbar(itemInHands, quickBarItem);
4567 amc.ForceTarget(quickBarItem);
4568 m_QuickBarFT =
true;
4572 m_QuickBarHold =
true;
4575 void OnQuickBarContinuousUseEnd(
int slotClicked)
4583 if (m_ActionQBControl)
4588 if (!action.GetInput().IsActive())
4590 am.EndActionInput();
4598 am.ClearForceTarget();
4599 m_QuickBarFT =
false;
4603 m_QuickBarHold =
false;
4607 m_ActionQBControl = !action.GetInput().IsActive();
4612 return m_ActionQBControl;
4614 void ResetActionEndInput()
4616 m_ActionQBControl =
false;
4623 void RadialQuickBarSingleUse(
int slotClicked)
4625 OnQuickBarSingleUse(slotClicked);
4629 void RadialQuickBarCombine(
int slotClicked)
4631 EntityAI quickBarEntity = GetQuickBarEntity(slotClicked - 1);
4632 EntityAI entity_in_hands = GetHumanInventory().GetEntityInHands();
4634 ReloadWeapon(entity_in_hands, quickBarEntity);
4638 void QuickReloadWeapon(
EntityAI weapon)
4640 EntityAI magazine = GetMagazineToReload(weapon);
4641 ReloadWeapon(weapon, magazine);
4654 mngr_client.Interrupt();
4656 else if (GetHumanInventory().GetEntityInHands()!= magazine)
4660 Class.CastTo(wpn, weapon);
4661 Class.CastTo(mag, magazine);
4662 if (GetWeaponManager().CanUnjam(wpn))
4664 GetWeaponManager().Unjam();
4666 else if (GetWeaponManager().CanAttachMagazine(wpn, mag))
4668 GetWeaponManager().AttachMagazine(mag);
4670 else if (GetWeaponManager().CanSwapMagazine(wpn, mag))
4672 GetWeaponManager().SwapMagazine(mag);
4674 else if (GetWeaponManager().CanLoadBullet(wpn, mag))
4694 int last_ammo_magazine_count;
4695 int ammo_magazine_count;
4698 int last_ammo_pile_count;
4699 int ammo_pile_count;
4702 for (
int att_i = 0; att_i < GetInventory().AttachmentCount(); ++att_i)
4704 EntityAI attachment = GetInventory().GetAttachmentFromIndex(att_i);
4705 ref
CargoBase attachment_cargo = attachment.GetInventory().GetCargo();
4707 if (attachment_cargo)
4709 for (
int cgo_i = 0; cgo_i < attachment_cargo.GetItemCount(); ++cgo_i)
4711 EntityAI cargo_item = attachment_cargo.GetItem(cgo_i);
4714 if (cargo_item.IsMagazine())
4716 Magazine magazine = Magazine.Cast(cargo_item);
4717 ammo_pile_count = magazine.GetAmmoCount();
4720 if (weapon_manager.CanAttachMagazine(weapon_base, magazine) || weapon_manager.CanSwapMagazine(weapon_base, magazine))
4722 if (ammo_pile_count > 0)
4724 if (last_ammo_magazine_count == 0)
4726 ammo_magazine = magazine;
4727 last_ammo_magazine_count = ammo_pile_count;
4731 if (last_ammo_magazine_count < ammo_pile_count)
4733 ammo_magazine = magazine;
4734 last_ammo_magazine_count = ammo_pile_count;
4740 else if (weapon_manager.CanLoadBullet(weapon_base, magazine))
4742 if (ammo_pile_count > 0)
4744 if (last_ammo_pile_count == 0)
4746 ammo_pile = magazine;
4747 last_ammo_pile_count = ammo_pile_count;
4751 if (last_ammo_pile_count > ammo_pile_count)
4753 ammo_pile = magazine;
4754 last_ammo_pile_count = ammo_pile_count;
4767 return ammo_magazine;
4776 void OnSpawnedFromConsole()
4780 GetGame().GetMission().AddDummyPlayerToScheduler(
this);
4787 bool GetLiquidTendencyDrain()
4789 return m_LiquidTendencyDrain;
4793 void SetLiquidTendencyDrain(
bool state)
4795 m_LiquidTendencyDrain = state;
4800 bool GetFlagTendencyRaise()
4802 return m_FlagRaisingTendency;
4806 void SetFlagTendencyRaise(
bool state)
4808 m_FlagRaisingTendency = state;
4811 override SoundOnVehicle
PlaySound(
string sound_name,
float range,
bool create_local =
false)
4813 return BetaSound.SaySound(
this, sound_name, range,
false);
4816 float GetPlayerLoad()
4818 return GetWeightEx();
4823 return GetWeightEx() >= OVERLOAD_LIMIT;
4826 void SetPlayerLoad(
float load)
4834 void AddPlayerLoad(
float addedload)
4836 float newload = GetPlayerLoad() + addedload;
4837 SetPlayerLoad(newload);
4843 bool IsItemInInventory(
EntityAI entity)
4845 return GetInventory().HasEntityInInventory(entity);
4850 if (
GetGame().IsMultiplayer())
4864 if (
LogManager.IsSyncLogEnable())
syncDebugPrint(
"[syncinv] " +
GetDebugName(
this) +
" STS=" + GetSimulationTimeStamp() +
" NeedInventoryJunctureFromServer item=" +
Object.GetDebugName(item) +
" currPar=" + currParent +
" newPar=" + newParent);
4866 bool i_owned = GetHumanInventory().HasEntityInInventory(item);
4868 bool cp_owned =
false;
4870 cp_owned = GetHumanInventory().HasEntityInInventory(currParent);
4872 bool np_owned =
false;
4874 np_owned = GetHumanInventory().HasEntityInInventory(newParent);
4876 bool all_owned = i_owned && cp_owned && (np_owned || (newParent ==
null));
4877 if (
LogManager.IsSyncLogEnable())
syncDebugPrint(
"[syncinv] " +
GetDebugName(
this) +
" STS=" + GetSimulationTimeStamp() +
" NeedInventoryJunctureFromServer=" + !all_owned +
" i_pwn=" + i_owned +
" cp_pwn=" + cp_owned +
" np_pwn=" + np_owned);
4881 Error(
"[syncinv] unsupported instance type t=" + t);
4891 float totalWeight = super.GetWeightSpecialized(forceRecalc);
4893 ItemBase itemHands = GetItemInHands();
4896 totalWeight += itemHands.GetWeightEx(forceRecalc);
4899 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
4901 float itemInHandsWeight = totalWeight - super.GetWeightSpecialized(forceRecalc);
4903 dta.SetCalcDetails(
"TMan: " + (super.GetWeightSpecialized(forceRecalc)+ itemInHandsWeight) +
"(contents weight[includes item in hands])");
4909 void CalculateVisibilityForAI()
4911 const int VISIBILITY_SLOTS_COUNT = 10;
4913 int attcount = GetInventory().AttachmentCount();
4914 float sumVisibility = 0;
4915 float countVisibility = 0;
4916 float visibilityMean = 0;
4920 for (
int att = 0; att < attcount; att++)
4922 EntityAI attachment = GetInventory().GetAttachmentFromIndex(att);
4923 if (attachment.IsClothing())
4926 Class.CastTo(clothing, attachment);
4927 sumVisibility += clothing.GetItemVisibility();
4932 visibilityMean = (sumVisibility + (VISIBILITY_SLOTS_COUNT - countVisibility)) / VISIBILITY_SLOTS_COUNT;
4933 SetVisibilityCoef(visibilityMean);
4938 SetVisibilityCoef(visibilityMean);
4942 void SetVisibilityCoef(
float pVisibility)
4944 m_VisibilityCoef = pVisibility;
4947 float GetVisibilityCoef()
4949 return m_VisibilityCoef;
4961 float health = GetHealth(
"",
"");
4967 float toxicity = GetStatToxicity().Get();
4973 float blood = GetHealth(
"",
"Blood");
4979 float energy = GetStatEnergy().Get();
4985 float water = GetStatWater().Get();
5027 float immunity = GetImmunity();
5028 if (m_ImmunityBoosted)
5034 float GetBordersImmunity()
5036 float immunity = GetImmunity();
5037 float immmunity_max = 1;
5042 float GetStatBordersHealth()
5044 float health = GetHealth(
"",
"");
5045 float health_max = GetMaxHealth(
"",
"");
5049 float GetStatBordersToxicity()
5051 float toxicity = GetStatToxicity().Get();
5052 float toxicity_max = GetStatToxicity().GetMax();
5056 float GetStatBordersBlood()
5058 float blood = GetHealth(
"",
"Blood");
5059 float blood_max = GetMaxHealth(
"",
"Blood");
5063 float GetStatBordersEnergy()
5065 float energy = GetStatEnergy().Get();
5066 float energy_max = GetStatEnergy().GetMax();
5070 float GetStatBordersWater()
5072 float water = GetStatWater().Get();
5073 float water_max = GetStatWater().GetMax();
5079 float GetStatLevelBorders(
float stat_value,
float critical,
float low,
float normal,
float high,
float max)
5081 if (stat_value <= critical)
5083 return Math.InverseLerp(0, critical, stat_value);
5085 if (stat_value <= low)
5087 return Math.InverseLerp(critical, low, stat_value);
5089 if (stat_value <= normal)
5091 return Math.InverseLerp(low, normal, stat_value);
5093 if (stat_value <= high)
5095 return Math.InverseLerp(normal, high, stat_value);
5097 return Math.InverseLerp(high, max, stat_value);
5100 EStatLevels GetStatLevel(
float stat_value,
float critical,
float low,
float normal,
float high)
5102 if (stat_value <= critical)
5106 if (stat_value <= low)
5110 if (stat_value <= normal)
5114 if (stat_value <= high)
5121 void SetImmunityBoosted(
bool boosted)
5123 m_ImmunityBoosted = boosted;
5132 if (GetPlayerStats())
5134 float max_health = GetMaxHealth(
"GlobalHealth",
"Health") + 0.01;
5135 float max_blood = GetMaxHealth(
"GlobalHealth",
"Blood") + 0.01;
5136 float energy_normalized = GetStatEnergy().Get() /
PlayerConstants.SL_ENERGY_MAX;
5137 float water_normalized = GetStatWater().Get() /
PlayerConstants.SL_WATER_MAX;
5138 float health_normalized = GetHealth(
"GlobalHealth",
"Health") / max_health;
5139 float blood_normalized = GetHealth(
"GlobalHealth",
"Blood") / max_blood;
5140 immunity = energy_normalized + water_normalized + health_normalized + blood_normalized;
5141 immunity = immunity / 4;
5142 immunity =
Math.Clamp(immunity,0,1);
5155 if (
IsRaised() || (item && item.IsHeavyBehaviour()))
5158 if (item && GetThrowing() && GetThrowing().IsThrowingModeEnabled())
5161 if (GetBrokenLegs() !=
eBrokenLegs.NO_BROKEN_LEGS)
5172 bool IsInRasedProne()
5206 override bool IsFighting()
5208 return m_IsFighting;
5215 return m_EmoteManager.IsEmotePlaying();
5234 return m_AnimCommandStarting & mask;
5237 void RunFightBlendTimer()
5239 if (!m_FightEndBlendTimer)
5240 m_FightEndBlendTimer =
new Timer();
5241 if (!m_FightEndBlendTimer.IsRunning())
5243 m_FightEndBlendTimer.Run(
PlayerConstants.MELEE2_MOVEMENT_BLEND_DELAY,
this,
"EndFighting");
5249 m_IsFighting =
false;
5252 bool CheckMeleeItemDamage(
ItemBase item)
5256 if (item && item.GetHierarchyParent() && item.GetHierarchyParent().IsWeapon() && item.IsRuined())
5258 PlayAttachmentDropSound();
5259 return DropItem(item);
5262 if (item && item == GetItemInHands() && item.IsRuined())
5264 return PredictiveDropEntity(item);
5269 void PlayAttachmentDropSound()
5277 super.RPC(rpc_type, params, guaranteed, recipient);
5283 super.OnRPC(sender, rpc_type, ctx);
5289 case ERPCs.RPC_SYNC_DISPLAY_STATUS:
5296 case ERPCs.RPC_PLAYER_SYMPTOM_ON:
5297 if (GetSymptomManager())
5299 GetSymptomManager().OnRPC(
ERPCs.RPC_PLAYER_SYMPTOM_ON, ctx);
5303 case ERPCs.RPC_PLAYER_SYMPTOM_OFF:
5304 if (GetSymptomManager())
5306 GetSymptomManager().OnRPC(
ERPCs.RPC_PLAYER_SYMPTOM_OFF, ctx);
5310 case ERPCs.RPC_DAMAGE_VALUE_SYNC:
5311 if (m_TrasferValues)
5312 m_TrasferValues.OnRPC(ctx);
5315 case ERPCs.RPC_USER_ACTION_MESSAGE:
5320 if (ctx.Read(m_UAParamMessage))
5322 string actiontext = m_UAParamMessage.param1;
5323 MessageAction(actiontext);
5327 case ERPCs.RPC_SOFT_SKILLS_SPECIALTY_SYNC:
5328 ref Param1<float> p_synch =
new Param1<float>(0);
5330 float specialty_level = p_synch.param1;
5331 GetSoftSkillsManager().SetSpecialtyLevel(specialty_level);
5334 case ERPCs.RPC_SOFT_SKILLS_STATS_SYNC:
5335 ref Param5<float, float, float, float, bool> p_debug_synch =
new Param5<float, float ,float, float, bool>(0, 0, 0, 0,
false);
5336 ctx.Read(p_debug_synch);
5337 float general_bonus_before = p_debug_synch.param1;
5338 float general_bonus_after = p_debug_synch.param2;
5339 float last_UA_value = p_debug_synch.param3;
5340 float cooldown_value = p_debug_synch.param4;
5341 float cooldown_active = p_debug_synch.param5;
5342 GetSoftSkillsManager().SetGeneralBonusBefore(general_bonus_before);
5343 GetSoftSkillsManager().SetGeneralBonusAfter(general_bonus_after);
5344 GetSoftSkillsManager().SetLastUAValue(last_UA_value);
5345 GetSoftSkillsManager().SetCoolDownValue(cooldown_value);
5346 GetSoftSkillsManager().SetCoolDown(cooldown_active);
5349 case ERPCs.RPC_WARNING_ITEMDROP:
5354 GetGame().GetMission().AddActiveInputExcludes({
"menu"});
5359 case ERPCs.RPC_WARNING_TELEPORT:
5364 GetGame().GetMission().AddActiveInputExcludes({
"menu"});
5368 case ERPCs.RPC_INIT_SET_QUICKBAR:
5369 ref Param1<int> count =
new Param1<int>(0);
5370 if (ctx.Read(count));
5372 for (
int i = 0; i < count.param1 ; i++)
5374 m_QuickBarBase.OnSetEntityRPC(ctx);
5379 case ERPCs.RPC_SYNC_THERMOMETER:
5382 if (ctx.Read(value))
5383 m_Hud.SetTemperature(value.ToString() +
"#degrees_celsius");
5388 case ERPCs.RPC_CHECK_PULSE:
5401 if (m_CheckPulseLastTarget)
5403 m_CheckPulseLastTarget.SetLastUAMessage(
ActionCheckPulse.GetPulseMessage(pulse, blood_level));
5409 case PlantType.TREE_HARD:
5410 SoundHardTreeFallingPlay();
5413 case PlantType.TREE_SOFT:
5414 SoundSoftTreeFallingPlay();
5417 case PlantType.BUSH_HARD:
5418 SoundHardBushFallingPlay();
5421 case PlantType.BUSH_SOFT:
5422 SoundSoftBushFallingPlay();
5425 case ERPCs.RPC_DEBUG_MONITOR_FLT:
5426 if (m_DebugMonitorValues)
5428 m_DebugMonitorValues.OnRPCFloat(ctx);
5432 case ERPCs.RPC_DEBUG_MONITOR_STR:
5433 if (m_DebugMonitorValues)
5435 m_DebugMonitorValues.OnRPCString(ctx);
5453 #ifdef DIAG_DEVELOPER
5454 case ERPCs.DEV_RPC_AGENT_RESET:
5458 m_AgentPool.RemoveAllAgents();
5462 case ERPCs.DEV_PLAYER_DEBUG_REQUEST:
5464 PluginRemotePlayerDebugServer plugin_remote_server = PluginRemotePlayerDebugServer.Cast(
GetPlugin(PluginRemotePlayerDebugServer));
5465 plugin_remote_server.OnRPC(ctx,
this);
5469 case ERPCs.DEV_PLAYER_DEBUG_DATA:
5471 PluginRemotePlayerDebugClient plugin_remote_client = PluginRemotePlayerDebugClient.Cast(
GetPlugin(PluginRemotePlayerDebugClient));
5472 PluginDeveloper plugin_dev = PluginDeveloper.Cast(
GetPlugin(PluginDeveloper));
5473 if (plugin_dev.m_ScriptConsole)
5474 plugin_dev.m_ScriptConsole.OnRPCEx(rpc_type, ctx);
5476 plugin_remote_client.OnRPC(ctx);
5480 case ERPCs.DEV_AGENT_GROW:
5482 m_AgentPool.RemoteGrowRequestDebug(ctx);
5486 case ERPCs.RPC_ITEM_DIAG_CLOSE:
5489 mid.StopWatchRequest(
this);
5494 case ERPCs.DEV_REQUEST_UTS_DEBUG:
5496 PluginUniversalTemperatureSourceServer plugin_uts_server = PluginUniversalTemperatureSourceServer.Cast(
GetPlugin(PluginUniversalTemperatureSourceServer));
5497 plugin_uts_server.OnRPC(ctx,
this);
5501 case ERPCs.DEV_UTS_DEBUG_DATA:
5503 PluginUniversalTemperatureSourceClient plugin_uts_client = PluginUniversalTemperatureSourceClient.Cast(
GetPlugin(PluginUniversalTemperatureSourceClient));
5504 plugin_uts_client.OnRPC(ctx);
5511 case ERPCs.DEV_RPC_SERVER_SCRIPT:
5520 bool success =
GetGame().ExecuteEnforceScript(
"void scConsMain() \n{\n" + code +
"\n}\n",
"scConsMain");
5527 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
5529 PluginDeveloper dev = PluginDeveloper.Cast(
GetPlugin(PluginDeveloper));
5530 if (dev.m_ScriptConsole)
5531 dev.m_ScriptConsole.OnRPCEx(rpc_type, ctx);
5535 case ERPCs.DEV_SET_DEV_ITEM:
5537 Param1<EntityAI> ent =
new Param1<EntityAI>(
null);
5538 if (ctx.Read(ent) && ent.param1)
5541 mid2.RegisterDebugItem(ent.param1,
this);
5547 case ERPCs.RPC_ITEM_DIAG:
5549 Param1<EntityAI> p1 =
new Param1<EntityAI>(
null);
5553 plgn.OnRPC(p1.param1, ctx);
5560 #ifdef DIAG_DEVELOPER
5561 PluginDeveloper module_rc = PluginDeveloper.Cast(
GetPlugin(PluginDeveloper));
5563 module_rc.OnRPC(
this, rpc_type, ctx);
5565 PluginDeveloperSync module_rcs = PluginDeveloperSync.Cast(
GetPlugin(PluginDeveloperSync));
5567 module_rcs.OnRPC(
this, rpc_type, ctx);
5575 if (plugin_diag_menu)
5576 plugin_diag_menu.OnRPC(
this, rpc_type, ctx);
5580 override void OnGameplayDataHandlerSync()
5582 super.OnGameplayDataHandlerSync();
5590 void UpdateLighting()
5601 void SetContaminatedEffectEx(
bool enable,
int ppeIdx = -1,
int aroundId =
ParticleList.CONTAMINATED_AREA_GAS_AROUND,
int tinyId =
ParticleList.CONTAMINATED_AREA_GAS_TINY,
string soundset =
"",
bool partDynaUpdate =
false,
int newBirthRate = 0)
5606 if (m_ContaminatedAreaEffectEnabled == enable)
5611 if (!m_ContaminatedAroundPlayer)
5618 m_ContaminatedAroundPlayer.SetParameter(0,
EmitorParam.BIRTH_RATE, newBirthRate);
5622 if (!m_ContaminatedAroundPlayerTiny && tinyId !=0)
5630 if (
Class.CastTo(ppeRequester, PPERequesterBank.GetRequester(ppeIdx)))
5631 ppeRequester.Start();
5635 if (!m_AmbientContamination && soundset !=
"")
5636 PlaySoundSetLoop(m_AmbientContamination, soundset, 0.1, 0.1);
5641 if (m_ContaminatedAroundPlayer)
5643 m_ContaminatedAroundPlayer.Stop();
5644 m_ContaminatedAroundPlayer =
null;
5647 if (m_ContaminatedAroundPlayerTiny)
5649 m_ContaminatedAroundPlayerTiny.Stop();
5650 m_ContaminatedAroundPlayerTiny =
null;
5653 PPERequesterBank.GetRequester(ppeIdx).Stop(
new Param1<bool>(
true));
5656 if (m_AmbientContamination)
5657 StopSoundSet(m_AmbientContamination);
5661 m_ContaminatedAreaEffectEnabled = enable;
5664 void SetContaminatedEffect(
bool enable,
int ppeIdx = -1,
int aroundId =
ParticleList.CONTAMINATED_AREA_GAS_AROUND,
int tinyId =
ParticleList.CONTAMINATED_AREA_GAS_TINY,
bool partDynaUpdate =
false,
int newBirthRate = 0)
5666 SetContaminatedEffectEx(enable, ppeIdx, aroundId, tinyId,
"", partDynaUpdate, newBirthRate);
5670 void UpdateCorpseState()
5672 UpdateCorpseStateVisual();
5673 if (m_CorpseState > 0)
5674 SetDecayEffects(
Math.AbsInt(m_CorpseState));
5675 else if (m_CorpseState < 0)
5677 m_CorpseStateLocal = m_CorpseState;
5683 super.EEHealthLevelChanged(oldLevel, newLevel, zone);
5684 if (!
GetGame().IsDedicatedServer())
5688 ClearLastUAMessage();
5690 if (m_CorpseState != 0)
5701 super.OnVariablesSynchronized();
5702 if (m_ModuleLifespan)
5704 m_ModuleLifespan.SynchLifespanVisual(
this, m_LifeSpanState, m_HasBloodyHandsVisible, m_HasBloodTypeVisible,
m_BloodType);
5706 if (m_LifespanLevelLocal != m_LifeSpanState)
5708 m_LifespanLevelLocal = m_LifeSpanState;
5709 UpdateHairSelectionVisibility();
5714 if (GetBleedingManagerRemote() && IsPlayerLoaded())
5716 GetBleedingManagerRemote().OnVariablesSynchronized(GetBleedingBits());
5719 if (m_CorpseStateLocal != m_CorpseState && (IsPlayerLoaded() || IsControlledPlayer()))
5721 UpdateCorpseState();
5724 if (m_RefreshAnimStateIdx != m_LocalRefreshAnimStateIdx)
5726 RefreshHandAnimationState(396);
5727 m_LocalRefreshAnimStateIdx = m_RefreshAnimStateIdx;
5729 if (m_InsideEffectArea != m_InsideEffectAreaPrev)
5731 if (m_InsideEffectArea)
5733 OnPlayerIsNowInsideEffectAreaBeginClient();
5737 OnPlayerIsNowInsideEffectAreaEndClient();
5739 m_InsideEffectAreaPrev = m_InsideEffectArea;
5743 if (m_SyncedModifiers != m_SyncedModifiersPrev)
5745 int diff = (m_SyncedModifiers & ~m_SyncedModifiersPrev) | (~m_SyncedModifiers & m_SyncedModifiersPrev);
5760 m_SyncedModifiersPrev = m_SyncedModifiers;
5764 HandleBrokenLegsSync();
5767 ItemBase itemHands = GetItemInHands();
5773 raib.OnVariableSynchronized();
5781 return (m_SyncedModifiers & m_SyncedModifiersPrev);
5784 void HandleBrokenLegsSync()
5786 if (m_BrokenLegState != m_LocalBrokenState)
5788 m_LocalBrokenState = m_BrokenLegState;
5789 bool initial = (m_BrokenLegState < 0);
5790 int state = GetBrokenLegs();
5808 void FixAllInventoryItems()
5814 item.SetHealthMax(
"",
"");
5819 void OnInventoryMenuOpen()
5824 void OnInventoryMenuClose()
5830 void OnSelectPlayer()
5833 m_PlayerSelected =
true;
5835 m_QuickBarBase.updateSlotsCount();
5837 m_WeaponManager.SortMagazineAfterLoad();
5845 m_CachedPlayerID = identity.GetId();
5846 m_CachedPlayerName = identity.GetName();
5853 if (m_aQuickBarLoad)
5855 int count = m_aQuickBarLoad.Count();
5856 Param1<int> paramCount =
new Param1<int>(count);
5857 params.Insert(paramCount);
5858 for (
int i = 0; i < count; i++)
5860 m_QuickBarBase.OnSetEntityNoSync(m_aQuickBarLoad.Get(i).param1,m_aQuickBarLoad.Get(i).param2);
5861 params.Insert(m_aQuickBarLoad.Get(i));
5864 if (count > 0 &&
GetGame().IsMultiplayer())
5866 GetGame().RPC(
this,
ERPCs.RPC_INIT_SET_QUICKBAR, params,
true, identity);
5868 m_aQuickBarLoad = NULL;
5871 GetSoftSkillsManager().InitSpecialty(GetStatSpecialty().
Get());
5872 GetModifiersManager().SetModifiers(
true);
5876 if (
GetGame().IsMultiplayer())
5879 if (m_ProcessUIWarning)
5881 GetGame().RPCSingleParam(
this,
ERPCs.RPC_WARNING_ITEMDROP,
null,
true, identity);
5882 m_ProcessUIWarning =
false;
5885 GetGame().GetMission().SyncRespawnModeInfo(identity);
5913 GetGame().GetMission().ResetGUI();
5918 m_DeathCheckTimer =
new Timer();
5919 m_DeathCheckTimer.Run(0.1,
this,
"CheckDeath",
null,
true);
5923 int characterCount =
GetGame().GetMenuData().GetCharactersCount() - 1;
5924 int idx =
GetGame().GetMenuData().GetLastPlayedCharacter();
5925 if (idx ==
GameConstants.DEFAULT_CHARACTER_MENU_ID || idx > characterCount)
5930 GetGame().GetMission().EnableAllInputs(
true);
5933 m_PresenceNotifier.Init(
this);
5934 OnGameplayDataHandlerSync();
5938 m_Bot =
new Bot(
this);
5943 override void SimulateDeath(
bool state)
5945 super.SimulateDeath(state);
5947 m_UndergroundHandler =
null;
5948 if (m_EffectWidgets)
5950 m_EffectWidgets.StopAllEffects();
5951 m_EffectWidgets.ClearSuspendRequests();
5955 void SetNewCharName()
5957 g_Game.GetMenuData().SaveCharacter(
false,
true);
5958 g_Game.GetMenuData().SetCharacterName(
g_Game.GetMenuData().GetLastPlayedCharacter(),
g_Game.GetMenuDefaultCharacterData(
false).GetCharacterName());
5959 g_Game.GetMenuData().SaveCharactersLocal();
5962 void CheckForBurlap()
5966 BurlapSackCover attachment;
5969 PPERequester_BurlapSackEffects req;
5970 if (
Class.CastTo(req,PPERequesterBank.GetRequester(PPERequesterBank.REQ_BURLAPSACK)))
5976 else if (req.IsRequesterRunning())
5978 PPERequesterBank.GetRequester(PPERequester_BurlapSackEffects).Stop();
5994 if (item && item.IsObstructingVoice())
5996 item.MutePlayer(
this,
true);
6000 GetGame().SetVoiceEffect(
this, VoiceEffectMumbling,
false);
6001 GetGame().SetVoiceEffect(
this, VoiceEffectObstruction,
false);
6006 void UpdateMaskBreathWidget(notnull
MaskBase mask,
bool is_start =
false)
6009 m_EffectWidgets.ResetMaskUpdateCount();
6010 float resistance = 0;
6011 if (mask.HasIntegratedFilter() || mask.IsExternalFilterAttached())
6012 resistance = 1 - mask.GetFilterQuantity01();
6015 m_EffectWidgets.OnVoiceEvent(resistance);
6016 m_EffectWidgets.IncreaseMaskUpdateCount();
6024 if (m_EffectWidgets)
6029 UpdateMaskBreathWidget(mask,
true);
6039 if (m_EffectWidgets)
6044 if (m_EffectWidgets.m_MaskWidgetUpdateCount < 2 && callback.GetLength() > 2 && playback_time > 0.5 )
6045 UpdateMaskBreathWidget(mask);
6054 if (super.OnInputUserDataProcess(userDataType, ctx))
6057 if (m_QuickBarBase.OnInputUserDataProcess(userDataType, ctx))
6060 if (m_WeaponManager.OnInputUserDataProcess(userDataType, ctx))
6063 if (HandleRemoteItemManipulation(userDataType, ctx))
6069 if (TogglePlacingServer(userDataType, ctx))
6072 if (ResetADSPlayerSync(userDataType, ctx))
6079 if (ctx.Read(uid) && ctx.Read(mute))
6081 GetGame().MutePlayer(uid, GetIdentity().GetPlainId(), mute);
6088 return m_EmoteManager.OnInputUserDataProcess(userDataType, ctx);
6091 return ReadLiftWeaponRequest(userDataType, ctx);
6093 if (m_ActionManager)
6094 return m_ActionManager.OnInputUserDataProcess(userDataType, ctx);
6098 float GetHealthRegenSpeed()
6100 float blood = GetHealth(
"GlobalHealth",
"Blood");
6101 float blood_scale_normalized =
Math.InverseLerp(
PlayerConstants.BLOOD_THRESHOLD_FATAL, GetMaxHealth(
"",
"Blood"), blood);
6102 blood_scale_normalized =
Math.Clamp(blood_scale_normalized,0,1);
6113 bool use_stack_max =
false;
6116 if (!ctx.Read(type))
6121 if (!ctx.Read(item1))
6124 if (dst.ReadFromContext(ctx))
6128 if (ctx.Read(dummy))
6129 item1.SplitItemToInventoryLocation(dst);
6131 item1.SplitIntoStackMaxToInventoryLocation(dst);
6137 if (!ctx.Read(item1))
6139 if (!ctx.Read(item2))
6141 if (!ctx.Read(use_stack_max))
6143 if (!ctx.Read(slot_id))
6146 if (type == -1 && item1 && item2)
6148 item1.CombineItems(item2, use_stack_max);
6150 else if (type == 1 && item1)
6153 item1.SplitIntoStackMax(item2, slot_id,
this);
6155 item1.SplitItem(
this);
6157 else if (type == 2 && item1)
6164 item1.SplitIntoStackMaxCargo(item2, slot_id, row, col);
6166 else if (type == 3 && item1)
6168 item1.SplitIntoStackMaxHands(
this);
6178 if (GetHumanInventory())
6180 return ItemBase.Cast(GetHumanInventory().GetEntityInHands());
6189 override EntityAI SpawnEntityOnGroundPos(
string object_name,
vector pos)
6193 bool is_AI =
GetGame().IsKindOf(object_name,
"DZ_LightAI");
6196 return SpawnAI(object_name, pos);
6202 Math3D.MatrixIdentity4(mtx);
6204 inv_loc.SetGround(NULL, mtx);
6212 EntityAI SpawnEntityOnGroundOnCursorDir(
string object_name,
float distance)
6215 return SpawnEntityOnGroundPos(object_name, position);
6220 bool is_ai =
GetGame().IsKindOf(object_name,
"DZ_LightAI");
6308 bool can_be_dropped = CanDropEntity(item);
6311 can_be_dropped = PredictiveDropEntity(item);
6315 pos_spawn[0] = pos_spawn[0] +
Math.RandomFloat(-0.2, 0.2);
6316 pos_spawn[2] = pos_spawn[2] +
Math.RandomFloat(-0.2, 0.2);
6318 item.SetPosition(pos_spawn);
6319 item.PlaceOnSurface();
6320 return can_be_dropped;
6334 EntityAI CreateInInventory(
string item_name,
string cargo_type =
"",
bool full_quantity =
false)
6374 string t = src.GetType();
6377 bool locked =
GetGame().HasInventoryJunctureDestination(
this, loc);
6380 Print(
"Warning: Split: CreateCopyOfItemInInventory - Cannot create entity at locked inventory at loc=" +
InventoryLocation.DumpToStringNullSafe(loc));
6386 MiscGameplayFunctions.TransferItemProperties(src, dst);
6388 GetGame().RemoteObjectTreeCreate(dst);
6390 Print(
"CreateCopyOfItemInInventory - created " + dst.GetName() +
" at loc=" +
InventoryLocation.DumpToStringNullSafe(loc));
6399 return CreateCopyOfItemInInventoryOrGroundEx(src,
false);
6402 ItemBase CreateCopyOfItemInInventoryOrGroundEx(
ItemBase src,
bool markItemAsSplitResult =
false)
6404 ItemBase dst = CreateCopyOfItemInInventory(src);
6407 dst =
ItemBase.Cast(SpawnEntityOnGroundPos(src.GetType(),
this.GetPosition()));
6408 dst.PlaceOnSurface();
6409 dst.SetResultOfSplit(markItemAsSplitResult);
6410 MiscGameplayFunctions.TransferItemProperties(src, dst);
6425 void Message(
string text,
string style)
6429 GetGame().ChatMP(
this, text, style);
6438 void MessageStatus(
string text)
6440 Message(text,
"colorStatusChannel");
6444 void MessageAction(
string text)
6446 Message(text,
"colorAction");
6450 void MessageFriendly(
string text)
6452 Message(text,
"colorFriendly");
6456 void MessageImportant(
string text)
6458 Message(text,
"colorImportant");
6461 void CloseInventoryMenu()
6469 GetGame().GetUIManager().CloseAll();
6470 GetGame().GetMission().RemoveActiveInputExcludes({
"inventory"},
false);
6471 GetGame().GetMission().RemoveActiveInputRestriction(EInputRestrictors.INVENTORY);
6488 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
6493 for (
int i = 0; i < items.Count(); i++)
6502 ItemBase item_in_hands =
ItemBase.Cast(GetHumanInventory().GetEntityInHands());
6506 LocalDestroyEntityInHands();
6517 int count = itemsArray.Count();
6519 for (
int i = 0; i < itemsArray.Count(); i++)
6521 Class.CastTo(item, itemsArray.Get(i));
6523 if (item && !item.IsInherited(SurvivorBase))
6525 ServerDropEntity(item);
6530 string GetPlayerClass()
6533 GetGame().ObjectGetType(
this, type);
6545 m_ModuleLifespan.UpdateLifespan(
this,
true);
6550 if (!HasCoveredFaceForShave() && GetLifeSpanState())
6561 override void OnParticleEvent(
string pEventType,
string pUserString,
int pUserInt)
6563 super.OnParticleEvent(pEventType ,pUserString, pUserInt);
6565 if (!
GetGame().IsDedicatedServer())
6567 if (pUserInt == 123456)
6570 int boneIdx = player.GetBoneIndexByName(
"Head");
6585 eff.SetDecalOwner(player);
6586 eff.SetAutodestroy(
true);
6589 player.AddChild(p, boneIdx);
6596 bool CanSpawnBreathVaporEffect()
6598 if (!ToDelete() && IsAlive() && !IsSwimming() && !m_IsDrowning)
6606 void ProcessADDModifier()
6608 if (m_AddModifier != -1)
6612 ad.StartModifier(m_AddModifier);
6618 void SpawnBreathVaporEffect()
6625 switch (m_BreathVapour)
6646 bool GetDrowningWaterLevelCheck()
6649 vector pos = GetBonePositionWS(index);
6650 float depth =
g_Game.GetWaterDepth(pos);
6656 else if (IsUnconscious())
6663 void SetLifeSpanStateVisible(
int show_state)
6666 if (show_state != m_LifeSpanState)
6667 state_changed =
true;
6668 m_LifeSpanState = show_state;
6675 UpdateHairSelectionVisibility();
6679 int GetLifeSpanState()
6681 return m_LifeSpanState;
6684 int GetLastShavedSeconds()
6686 return m_LastShavedSeconds;
6689 void SetLastShavedSeconds(
int last_shaved_seconds)
6691 m_LastShavedSeconds = last_shaved_seconds;
6694 bool HasCoveredFaceForShave()
6696 return IsExclusionFlagPresent(GetFaceCoverageShaveValues());
6700 static set<int> GetFaceCoverageShaveValues()
6702 set<int> ret =
new set<int>;
6703 ret.Insert(EAttExclusions.SHAVING_MASK_ATT_0);
6704 ret.Insert(EAttExclusions.SHAVING_HEADGEAR_ATT_0);
6712 return m_HasBloodyHandsVisible;
6715 bool HasBloodyHands()
6717 return m_HasBloodyHandsVisible;
6722 SetBloodyHandsBase(show);
6727 SetBloodyHandsBase(type);
6730 private void SetBloodyHandsBase(
int type)
6732 m_HasBloodyHandsVisible = type;
6735 #ifdef DIAG_DEVELOPER
6737 if (IsControlledPlayer())
6746 void SetBloodyHandsPenalty()
6751 bool HasBloodTypeVisible()
6753 return m_HasBloodTypeVisible;
6756 void SetBloodTypeVisible(
bool show)
6758 m_HasBloodTypeVisible = show;
6767 void SetBloodType(
int blood_type)
6779 return m_SoftSkillsManager;
6784 if (IsPlayerSelected() && !IsAlive())
6786 SimulateDeath(
true);
6787 m_DeathCheckTimer.Stop();
6798 int GetNoisePresenceInAI()
6800 if (m_PresenceNotifier)
6802 return m_PresenceNotifier.GetNoisePresence();
6811 return (m_PersistentFlags & bit);
6817 m_PersistentFlags = (m_PersistentFlags | bit);
6819 m_PersistentFlags = ((~bit) & m_PersistentFlags);
6826 int GetStoreLoadVersion()
6828 return m_StoreLoadVersion;
6834 if (
GetGame().SaveVersion() < 102)
6836 ctx.Write(ACT_STORE_SAVE_VERSION);
6839 super.OnStoreSave(ctx);
6841 GetHumanInventory().OnStoreSave(ctx);
6842 OnStoreSaveLifespan(ctx);
6846 GetPlayerStats().SaveStats(ctx);
6847 m_ModifiersManager.OnStoreSave(ctx);
6848 m_AgentPool.OnStoreSave(ctx);
6849 GetSymptomManager().OnStoreSave(ctx);
6850 if (GetBleedingManagerServer())
6852 GetBleedingManagerServer().OnStoreSave(ctx);
6854 m_PlayerStomach.OnStoreSave(ctx);
6855 ctx.Write(GetBrokenLegs());
6857 SaveAreaPersistenceFlag(ctx);
6863 ctx.Write(ladder.GetLogoutPosition());
6871 arrowManager.Save(ctx);
6878 if (GetModifiersManager())
6880 ctx.Write(m_PersistentFlags);
6892 if (!ctx.Read(m_StoreLoadVersion))
6896 if (!super.OnStoreLoad(ctx, version))
6900 if (!GetHumanInventory().
OnStoreLoad(ctx, version))
6903 if (!OnStoreLoadLifespan(ctx, version))
6908 if (!GetPlayerStats().LoadStats(ctx, version))
6910 Print(
"---- failed to load PlayerStats ----");
6914 if (version < m_ModifiersManager.GetStorageVersion())
6916 Print(
"---- failed to load ModifiersManager, unsupported version ----");
6921 if (!m_ModifiersManager.OnStoreLoad(ctx, version))
6923 Print(
"---- failed to load ModifiersManager, read fail ----");
6928 if (version < m_AgentPool.GetStorageVersion())
6930 Print(
"---- failed to load AgentPool, unsupported version ----");
6935 if (!m_AgentPool.OnStoreLoad(ctx, version))
6937 Print(
"---- failed to load AgentPool, read fail ----");
6945 Print(
"---- failed to load SymptomManager, unsupported version ----");
6950 if (!GetSymptomManager().
OnStoreLoad(ctx, version))
6952 Print(
"---- failed to load SymptomManager, read fail ----");
6959 Print(
"---- failed to load BleedingManagerServer, unsupported version ----");
6964 if (!GetBleedingManagerServer().
OnStoreLoad(ctx, version))
6966 Print(
"---- failed to load BleedingManagerServer, read fail ----");
6971 if (version < m_PlayerStomach.GetStorageVersion())
6973 Print(
"---- failed to load PlayerStomach, unsupported version ----");
6978 if (!m_PlayerStomach.OnStoreLoad(ctx, version))
6980 Print(
"---- failed to load PlayerStomach, read fail ----");
6988 if (!ctx.Read(m_BrokenLegState))
6994 if (!ctx.Read(m_LocalBrokenState))
7001 if (version >= 125 && (!ctx.Read(m_PersistentFlags)))
7003 Print(
"---- failed to load Persistent Flags, read fail ----");
7010 if (!ctx.Read(onLadder))
7018 if (!ctx.Read(position))
7024 if (!hive || !hive.CharacterIsLoginPositionChanged(
this))
7034 arrowManager.Load(ctx);
7038 Print(
"---- PlayerBase OnStoreLoad SUCCESS ----");
7044 GetHumanInventory().OnAfterStoreLoad();
7047 m_EmoteManager.AfterStoreLoad();
7053 ctx.Write(m_LifeSpanState);
7054 ctx.Write(m_LastShavedSeconds);
7055 ctx.Write(m_HasBloodyHandsVisible);
7056 ctx.Write(m_HasBloodTypeVisible);
7062 int lifespan_state = 0;
7063 if (!ctx.Read(lifespan_state))
7065 m_LifeSpanState = lifespan_state;
7067 int last_shaved = 0;
7068 if (!ctx.Read(last_shaved))
7070 m_LastShavedSeconds = last_shaved;
7074 bool bloody_hands_old;
7075 if (!ctx.Read(bloody_hands_old))
7077 m_HasBloodyHandsVisible = bloody_hands_old;
7081 int bloody_hands = 0;
7082 if (!ctx.Read(bloody_hands))
7084 m_HasBloodyHandsVisible = bloody_hands;
7088 bool blood_visible =
false;
7089 if (!ctx.Read(blood_visible))
7091 m_HasBloodTypeVisible = blood_visible;
7094 if (!ctx.Read(blood_type))
7102 void UpdatePlayerMeasures()
7104 int hour, minute, second;
7108 if (m_AnalyticsTimer)
7111 data.m_CharacterId =
g_Game.GetDatabaseID();
7112 data.m_TimeInterval = m_AnalyticsTimer.GetRemaining();
7113 data.m_DaytimeHour = hour;
7114 data.m_PositionStart = m_PlayerOldPos;
7116 data.m_DistanceOnFoot = distance;
7128 GetGame().GetAnalyticsServer().OnPlayerConnect(
this);
7131 if (m_AnalyticsTimer)
7132 m_AnalyticsTimer.Run(60,
this,
"UpdatePlayerMeasures",
null,
true);
7135 ResetConstructionActionData();
7140 Debug.Log(
"Player reconnected:"+this.
ToString(),
"Reconnect");
7144 ResetConstructionActionData();
7149 Debug.Log(
"Player disconnected:"+this.
ToString(),
"Connect");
7154 GetGame().GetAnalyticsServer().OnPlayerDisconnect(
this);
7157 data.m_CharacterId =
g_Game.GetDatabaseID();
7158 data.m_Reason =
"Disconnected";
7161 if (m_AnalyticsTimer)
7162 m_AnalyticsTimer.Stop();
7163 UpdatePlayerMeasures();
7165 SetPlayerDisconnected(
true);
7170 GetModifiersManager().SetModifiers(enable);
7175 PluginTransmissionAgents plugin = PluginTransmissionAgents.Cast(
GetPlugin(PluginTransmissionAgents));
7181 agents = agents |
eAgents.CHOLERA;
7184 m_PlayerStomach.AddToStomach(
Liquid.GetLiquidClassname(
LIQUID_WATER), amount, 0 , agents);
7195 agents = edible_item.GetAgents();
7208 if (edible_item.IsLiquidContainer())
7210 int liquid_type = edible_item.GetLiquidType();
7211 string liquidClassName =
Liquid.GetLiquidClassname(liquid_type);
7212 if (liquidClassName.Length() == 0)
7213 Error(
"Error! Trying to add unknown liquid to stomach with item=" +
Object.GetDebugName(edible_item) +
" consume_type=" + consume_type +
" liquid_type=" + liquid_type);
7214 m_PlayerStomach.AddToStomach(liquidClassName, amount, 0, agents);
7218 int food_stage_type;
7219 if (edible_item.GetFoodStage())
7221 food_stage_type = edible_item.GetFoodStage().GetFoodStageType();
7223 m_PlayerStomach.AddToStomach(source.GetType(), amount, food_stage_type, agents);
7225 edible_item.Consume(amount,
this);
7270 void ShowUnconsciousScreen(
bool show)
7275 GetGame().GetUIManager().ScreenFadeIn(0,
"You are Unconscious", FadeColors.BLACK, FadeColors.WHITE);
7280 GetGame().GetUIManager().ScreenFadeOut(0);
7286 override void RequestSoundEventEx(
EPlayerSoundEventID id,
bool from_server_and_client =
false,
int param = 0)
7290 PlaySoundEventEx(
id,
false,
false, param);
7293 SendSoundEventEx(
id, param);
7296 override void RequestSoundEvent(
EPlayerSoundEventID id,
bool from_server_and_client =
false)
7298 RequestSoundEventEx(
id, from_server_and_client);
7303 SendSoundEventEx(
id);
7313 m_SoundEventParam = param;
7316 if (!
GetGame().IsMultiplayer())
7324 void CheckZeroSoundEvent()
7326 if (m_SoundEvent != 0 && m_SoundEventSent)
7329 m_SoundEventParam = 0;
7330 m_SoundEventSent =
false;
7335 void CheckSendSoundEvent()
7337 if (m_SoundEvent!= 0 && !m_SoundEventSent)
7339 m_SoundEventSent =
true;
7343 override bool PlaySoundEvent(
EPlayerSoundEventID id,
bool from_anim_system =
false,
bool is_from_server =
false)
7345 return PlaySoundEventEx(
id, from_anim_system, is_from_server);
7348 override bool PlaySoundEventEx(
EPlayerSoundEventID id,
bool from_anim_system =
false,
bool is_from_server =
false,
int param = 0)
7350 if (!m_PlayerSoundEventHandler)
7353 return m_PlayerSoundEventHandler.PlayRequestEx(
id, is_from_server, param);
7358 return m_PlayerSoundEventHandler;
7361 void OnBleedingBegin();
7362 void OnBleedingEnd();
7364 void OnBleedingSourceAdded()
7366 m_BleedingSourceCount++;
7367 if (IsControlledPlayer())
7369 if (!
GetGame().IsDedicatedServer())
7374 dis_elm.SetValue(GetBleedingSourceCount());
7384 void OnBleedingSourceRemoved()
7386 m_BleedingSourceCount--;
7390 if (GetBleedingSourceCount() > 0)
7392 arrowManager.DropFirstArrow();
7396 arrowManager.DropAllArrows();
7400 if (IsControlledPlayer())
7402 if (!
GetGame().IsDedicatedServer())
7408 dis_elm.SetValue(GetBleedingSourceCount());
7415 void OnBleedingSourceRemovedEx(
ItemBase item)
7417 OnBleedingSourceRemoved();
7420 int GetBleedingSourceCount()
7422 return m_BleedingSourceCount;
7426 void ResetPlayer(
bool set_max)
7428 #ifdef DIAG_DEVELOPER
7431 GetStomach().ClearContents();
7433 DamageSystem.ResetAllZones(
this);
7434 GetModifiersManager().ResetAll();
7437 if (m_BleedingManagerServer)
7438 m_BleedingManagerServer.RemoveAllSources();
7441 if (GetPlayerStats())
7443 int bloodType = GetStatBloodType().Get();
7444 GetPlayerStats().ResetAllStats();
7445 GetStatBloodType().Set(bloodType);
7450 m_AgentPool.RemoveAllAgents();
7456 if (IsUnconscious())
7462 GetStatWater().Set(GetStatWater().
GetMax());
7463 GetStatEnergy().Set(GetStatEnergy().
GetMax());
7467 FixAllInventoryItems();
7491 void CheckSoundEvent()
7493 if (m_SoundEvent != 0)
7495 PlaySoundEventEx(m_SoundEvent,
false,
true,m_SoundEventParam);
7497 m_SoundEventParam = 0;
7503 if (
GetGame().IsClient())
return;
7504 RequestSoundEvent(1234);
7508 void SetStaminaState(eStaminaState state)
7510 if (state != m_StaminaState)
7512 m_StaminaState = state;
7518 int GetStaminaState()
7520 return m_StaminaState;
7523 void UpdateQuickBarExtraSlots()
7525 m_QuickBarBase.updateSlotsCount();
7531 if (GetPlayerState() ==
EPlayerStates.ALIVE && !IsRestrained())
7533 GetHive().CharacterSave(
this);
7548 void SpreadAgentsEx(
float distance = 3,
float chance = 0.25)
7550 if (
Math.RandomFloat01() > chance)
7553 GetGame().GetPlayers(m_ServerPlayers);
7554 float dist_check = distance * distance;
7555 PluginTransmissionAgents plugin = PluginTransmissionAgents.Cast(
GetPlugin(PluginTransmissionAgents));
7557 foreach (Man target: m_ServerPlayers)
7559 if (
vector.DistanceSq(GetWorldPosition(), target.GetWorldPosition()) < dist_check && target !=
this)
7568 SpreadAgentsEx(3,1);
7574 return m_AgentPool.GetAgents();
7580 m_AgentPool.RemoveAgent(agent_id);
7586 m_AgentPool.RemoveAllAgents();
7591 override void InsertAgent(
int agent,
float count = 1)
7593 m_AgentPool.AddAgent(agent,count);
7597 int GetSingleAgentCount(
int agent_id)
7599 return m_AgentPool.GetSingleAgentCount(agent_id);
7603 float GetSingleAgentCountNormalized(
int agent_id)
7605 int max_count = PluginTransmissionAgents.GetAgentMaxCount(agent_id);
7606 return m_AgentPool.GetSingleAgentCount(agent_id) / max_count;
7609 float GetTotalAgentCount()
7611 return m_AgentPool.GetTotalAgentCount();
7616 m_AgentPool.PrintAgents();
7619 void ImmuneSystemTick(
float value,
float deltaT)
7621 m_AgentPool.ImmuneSystemTick(value, deltaT);
7624 void AntibioticsAttack(
float value)
7626 m_AgentPool.AntibioticsAttack(value);
7632 float min_distance = 0.5;
7635 vector to = from + (
GetGame().GetCurrentCameraDirection() * min_distance);
7638 int contactComponent;
7640 DayZPhysics.RaycastRV(from, to, contactPos, contactDir, contactComponent, NULL, NULL, NULL,
false,
true);
7646 bool CanEatAndDrink()
7649 return (!mask || (mask && mask.AllowFoodConsumption()));
7655 return m_ModifiersManager;
7658 PlayerStat<float> GetStatWater()
7660 if (!m_StatWater && GetPlayerStats())
7667 PlayerStat<float> GetStatToxicity()
7669 if (!m_StatToxicity && GetPlayerStats())
7673 return m_StatToxicity;
7676 PlayerStat<float> GetStatEnergy()
7678 if (!m_StatEnergy && GetPlayerStats())
7682 return m_StatEnergy;
7685 PlayerStat<float> GetStatHeatComfort()
7687 if (!m_StatHeatComfort && GetPlayerStats())
7691 return m_StatHeatComfort;
7694 PlayerStat<float> GetStatTremor()
7696 if (!m_StatTremor && GetPlayerStats())
7700 return m_StatTremor;
7703 PlayerStat<int> GetStatWet()
7705 if (!m_StatWet && GetPlayerStats())
7712 PlayerStat<float> GetStatDiet()
7714 if (!m_StatDiet && GetPlayerStats())
7721 PlayerStat<float> GetStatStamina()
7723 if (!m_StatStamina && GetPlayerStats())
7727 return m_StatStamina;
7730 PlayerStat<float> GetStatSpecialty()
7732 if (!m_StatSpecialty && GetPlayerStats())
7736 return m_StatSpecialty;
7739 PlayerStat<int> GetStatBloodType()
7741 if (!m_StatBloodType && GetPlayerStats())
7745 return m_StatBloodType;
7748 PlayerStat<float> GetStatHeatBuffer()
7750 if (!m_StatHeatBuffer && GetPlayerStats())
7754 return m_StatHeatBuffer;
7757 void ToggleHeatBufferVisibility(
bool show)
7759 m_HasHeatBuffer = show;
7764 string GetLastUAMessage()
7766 return m_UALastMessage;
7769 void SetLastUAMessage(
string pMsg)
7771 m_UALastMessage = pMsg;
7773 if (m_UALastMessageTimer.IsRunning())
7775 m_UALastMessageTimer.Stop();
7778 m_UALastMessageTimer.Run(
PlayerConstants.LAST_UA_MSG_LIFETIME,
this,
"ClearLastUAMessage",
null);
7781 protected void ClearLastUAMessage()
7783 if (m_UALastMessageTimer.IsRunning())
7785 m_UALastMessageTimer.Stop();
7788 m_UALastMessage =
"";
7795 void ForceUpdateInjuredState()
7797 m_InjuryHandler.CheckValue(
true);
7801 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7803 PluginTransmissionAgents pluginTransmissionAgents = PluginTransmissionAgents.Cast(
GetPlugin(PluginTransmissionAgents));
7807 map<int,string> agentList = pluginTransmissionAgents.GetSimpleAgentList();
7809 for (
int i = 0; i < agentList.Count(); i++)
7811 name = agentList.GetElement(i);
7812 id = agentList.GetKey(i);
7826 super.OnSyncJuncture(pJunctureID, pCtx);
7834 m_InjuryHandler.SetInjuryCommandParams(enable, level);
7837 GetSymptomManager().SetAnimation(pCtx);
7840 OnQuickbarSetEntityRequest(pCtx);
7843 GetInventory().OnInventoryJunctureFromServer(pCtx);
7846 GetInventory().OnInventoryJunctureRepairFromServer(pCtx);
7849 GetInventory().OnInventoryJunctureFailureFromServer(pCtx);
7854 m_ActionManager.OnSyncJuncture(pJunctureID,pCtx);
7859 m_WeaponManager.OnSyncJuncture(pJunctureID,pCtx);
7865 GetSymptomManager().SetAnimation(pCtx);
7871 if (GetAimingModel() && IsFireWeaponRaised())
7873 GetAimingModel().RequestKuruShake(amount);
7878 m_EmoteManager.OnSyncJuncture(pJunctureID, pCtx);
7881 SetLiftWeapon(pJunctureID, pCtx);
7890 m_BrokenLegsJunctureReceived =
true;
7906 SetGetInVehicleDebug(car);
7912 bool IsItemsToDelete()
7914 return m_ItemsToDelete.Count() > 0;
7921 AddItemToDelete(item);
7924 override void AddItemToDelete(
EntityAI item)
7928 item.SetPrepareToDelete();
7929 m_ItemsToDelete.Insert(item);
7933 bool CanDeleteItems()
7938 override void JunctureDeleteItem(
EntityAI item)
7945 int count = m_ItemsToDelete.Count();
7948 if (CanDeleteItems())
7955 for (
int i = count - 1; i >= 0 ; i--)
7957 itemToDelete = m_ItemsToDelete.Get(i);
7958 if (itemToDelete !=
null)
7960 itemToDelete.GetInventory().GetCurrentInventoryLocation(il);
7963 if (itemToDelete ==
null || (GetItemInHands() ==
null && il.GetType() ==
InventoryLocationType.UNKNOWN))
7965 m_ItemsToDelete.Remove(i);
7971 for (
int j = count - 1; j >= 0 ; j--)
7973 itemToDelete = m_ItemsToDelete.Get(j);
7974 if (itemToDelete ==
null)
7976 m_ItemsToDelete.Remove(j);
7980 itemToDelete.Delete();
7981 m_ItemsToDelete.Remove(j);
8002 m_fLastHeadingDiff = 0;
8007 return super.HeadingModel(pDt, pModel);
8010 override bool IsInventorySoftLocked()
8012 return m_InventorySoftLockCount > 0;
8016 override void SetInventorySoftLock(
bool status)
8019 m_InventorySoftLockCount++;
8021 m_InventorySoftLockCount--;
8023 if (m_InventorySoftLockCount < 0)
8024 m_InventorySoftLockCount = 0;
8026 m_InventorySoftLocked = IsInventorySoftLocked();
8029 void SetLoadedQuickBarItemBind(
EntityAI entity,
int index)
8031 if (m_aQuickBarLoad)
8035 override bool IsLiftWeapon()
8037 return m_LiftWeapon_player;
8059 m_ProcessLiftWeaponState = state;
8060 m_ProcessLiftWeapon =
true;
8066 void SendLiftWeaponSync(
bool state)
8070 if (!
GetGame().IsMultiplayer())
8072 m_LiftWeapon_player = state;
8076 hcw.LiftWeapon(state);
8078 GetWeaponManager().OnLiftWeapon();
8085 if (
GetGame().IsMultiplayer() &&
GetGame().IsClient() && !ctx.CanStoreInputUserData())
8090 else if (
GetGame().IsMultiplayer() &&
GetGame().IsClient() && ctx.CanStoreInputUserData())
8099 override void CheckLiftWeapon()
8107 bool limited = weap.LiftWeaponCheck(
this);
8109 if (limited && !m_LiftWeapon_player)
8110 SendLiftWeaponSync(
true);
8111 else if (!limited && m_LiftWeapon_player)
8112 SendLiftWeaponSync(
false);
8114 else if (m_LiftWeapon_player)
8116 SendLiftWeaponSync(
false);
8121 override void ProcessLiftWeapon()
8123 if (m_ProcessLiftWeapon)
8127 hcw.LiftWeapon(m_ProcessLiftWeaponState);
8129 GetWeaponManager().OnLiftWeapon();
8130 m_LiftWeapon_player = m_ProcessLiftWeaponState;
8131 m_ProcessLiftWeapon =
false;
8138 override void HideClothing(
ItemOptics optic,
bool state)
8140 super.HideClothing(optic, state);
8151 if (optic && optic.GetCurrentStepFOV() <
GameConstants.DZPLAYER_CAMERA_FOV_IRONSIGHTS)
8157 SetInvisibleRecursive(
true,
this,clothingArray);
8167 SetInvisibleRecursive(
false,
this,clothingArray);
8172 void RequestUnconsciousness(
bool enable)
8177 override void SetDeathDarknessLevel(
float duration,
float tick_time)
8179 super.SetDeathDarknessLevel(duration, tick_time);
8181 if (IsControlledPlayer())
8183 float actual_tick = tick_time;
8184 if (GetDamageDealtEffect())
8185 m_DamageDealtEffect =
null;
8187 if (GetFlashbangEffect())
8188 m_FlashbangEffect =
null;
8192 progress = 1 - ((duration - m_DeathDarkeningCurrentTime) / duration);
8194 m_DeathDarkeningCurrentTime += actual_tick;
8196 if (!IsAlive() && IsPlayerSelected())
8198 m_DeathDarkeningParam.param1 = progress;
8199 PPERequesterBank.GetRequester(PPERequester_DeathDarkening).Start(m_DeathDarkeningParam);
8202 if (m_DeathDarkeningCurrentTime >= duration)
8204 StopDeathDarkeningEffect();
8209 StopDeathDarkeningEffect();
8213 override bool IsInFBEmoteState()
8217 if ((m_EmoteManager.m_Callback && m_EmoteManager.m_Callback.m_IsFullbody) || m_EmoteManager.m_IsSurrendered)
8228 m_EmoteManager.EndSurrenderRequest(data);
8231 bool IsSurrendered()
8234 return m_EmoteManager.m_IsSurrendered;
8239 bool IsPlayerLoaded()
8241 return m_PlayerLoaded;
8245 override void CheckAnimationOverrides()
8248 if (IsInFBEmoteState() && IsControlledPlayer() && IsPlayerSelected())
8250 OverrideSlidePoseAngle(
Math.PI2);
8252 else if (!IsInFBEmoteState() && IsControlledPlayer() && IsPlayerSelected())
8254 OverrideSlidePoseAngle(m_OriginalSlidePoseAngle);
8264 bool CanRedirectToWeaponManager (notnull
EntityAI item, out
bool isActionPossible)
8266 isActionPossible =
false;
8267 Magazine mag = Magazine.Cast(item);
8271 if (GetWeaponManager().CanDetachMagazine(wpn, mag))
8274 isActionPossible =
true;
8289 if (CanRedirectToWeaponManager(item,can_detach))
8292 if (can_detach && target.GetInventory().FindFreeLocationFor(item, flags, il))
8294 return GetWeaponManager().DetachMagazine(il);
8298 return super.PredictiveTakeEntityToTargetInventory(target, flags, item);
8304 if (CanRedirectToWeaponManager(item,can_detach))
8307 if (can_detach && GetInventory().FindFreeLocationFor(item, flags, il))
8309 return GetWeaponManager().DetachMagazine(il);
8313 return super.PredictiveTakeEntityToInventory(flags, item);
8316 override bool PredictiveTakeEntityToTargetAttachment (notnull
EntityAI target, notnull
EntityAI item)
8319 Magazine mag = Magazine.Cast(item);
8320 if (parentWpn && mag)
8322 if (GetWeaponManager().CanAttachMagazine(parentWpn, mag))
8323 return GetWeaponManager().AttachMagazine(mag);
8327 return super.PredictiveTakeEntityToTargetAttachment(target, item);
8330 override bool PredictiveTakeEntityToTargetAttachmentEx (notnull
EntityAI target, notnull
EntityAI item,
int slot)
8333 Magazine mag = Magazine.Cast(item);
8334 if (parentWpn && mag)
8336 if (target.CanReceiveAttachment(item,slot) && GetWeaponManager().CanAttachMagazine(parentWpn, mag))
8337 return GetWeaponManager().AttachMagazine(mag);
8341 return super.PredictiveTakeEntityToTargetAttachmentEx(target, item,slot);
8344 override bool PredictiveTakeEntityToTargetCargo (notnull
EntityAI target, notnull
EntityAI item)
8347 if (CanRedirectToWeaponManager(item,can_detach))
8352 return GetWeaponManager().DetachMagazine(il);
8356 return super.PredictiveTakeEntityToTargetCargo(target,item);
8359 override bool PredictiveTakeEntityToTargetCargoEx (notnull
CargoBase cargo, notnull
EntityAI item,
int row,
int col)
8362 if (CanRedirectToWeaponManager(item, can_detach))
8367 dst.SetCargoAuto(cargo, item, row, col, item.GetInventory().GetFlipCargo());
8369 return GetWeaponManager().DetachMagazine(dst);
8373 return super.PredictiveTakeEntityToTargetCargoEx (cargo, item, row, col);
8376 override bool PredictiveDropEntity (notnull
EntityAI item)
8379 if (CanRedirectToWeaponManager(item,can_detach))
8384 Math3D.MatrixIdentity4(m4);
8389 il.SetGround(item, m4);
8390 return GetWeaponManager().DetachMagazine(il);
8394 return super.PredictiveDropEntity(item);
8397 override bool PredictiveSwapEntities (notnull
EntityAI item1, notnull
EntityAI item2)
8401 Magazine swapmag1 = Magazine.Cast(item1);
8402 Magazine swapmag2 = Magazine.Cast(item2);
8404 if (swapmag1 && swapmag2)
8408 if (
Class.CastTo(parentWpn, swapmag1.GetHierarchyParent()))
8410 if (GetWeaponManager().CanSwapMagazine(parentWpn, swapmag2))
8412 Print(
"[inv] PlayerBase.PredictiveSwapEntities: swapping mag1=" + swapmag1 +
" to parent wpn=" + parentWpn +
" of mag1=" + swapmag1);
8413 return GetWeaponManager().SwapMagazine(swapmag2);
8417 Print(
"[inv] PlayerBase.PredictiveSwapEntities: can not swap magazines");
8422 if (
Class.CastTo(parentWpn, swapmag2.GetHierarchyParent()))
8424 if (GetWeaponManager().CanSwapMagazine(parentWpn, swapmag1))
8426 Print(
"[inv] PlayerBase.PredictiveSwapEntities: swapping mag1=" + swapmag1 +
" to parent wpn=" + parentWpn +
" of mag2=" + swapmag2);
8427 return GetWeaponManager().SwapMagazine(swapmag1);
8431 Print(
"[inv] PlayerBase.PredictiveSwapEntities: can not swap magazines");
8439 if (IsSwapBetweenHandsAndGroundLargeItem(item1,item2,item_hands,item_ground) && !m_ActionManager.GetRunningAction())
8442 CastTo(mngr_client,m_ActionManager);
8445 if (mngr_client.GetAction(ActionSwapItemToHands).Can(
this,atrg,
ItemBase.Cast(item_hands)))
8447 mngr_client.PerformActionStart(mngr_client.GetAction(ActionSwapItemToHands),atrg,
ItemBase.Cast(item_hands));
8450 return super.PredictiveSwapEntities(item1, item2);
8453 return super.PredictiveSwapEntities(item1, item2);
8461 if (item1.IsHeavyBehaviour() && item1.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() ==
InventoryLocationType.GROUND && !m_ActionManager.GetRunningAction())
8465 CastTo(mngr_client,m_ActionManager);
8468 if (mngr_client.GetAction(ActionSwapItemToHands).Can(
this,atrg,
ItemBase.Cast(item2)))
8470 mngr_client.PerformActionStart(mngr_client.GetAction(ActionSwapItemToHands),atrg,
ItemBase.Cast(item2));
8475 return super.PredictiveForceSwapEntities(item1, item2, item2_dst);
8478 override void PredictiveTakeEntityToHands(
EntityAI item)
8480 if (item.IsHeavyBehaviour() && !m_ActionManager.GetRunningAction() && !item.GetHierarchyParent())
8483 if (CastTo(mngr_client,m_ActionManager))
8497 super.PredictiveTakeEntityToHands(item);
8507 if (CanRedirectToWeaponManager(item,can_detach))
8511 return GetWeaponManager().DetachMagazine(dst);
8515 return super.PredictiveTakeToDst(src,dst);
8523 if (item1.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() ==
InventoryLocationType.HANDS)
8525 if (item2.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() ==
InventoryLocationType.HANDS)
8527 if (item1.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() ==
InventoryLocationType.GROUND)
8528 item_ground = item1;
8529 if (item2.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() ==
InventoryLocationType.GROUND)
8530 item_ground = item2;
8532 return item_hands && item_ground && item_ground.IsHeavyBehaviour();
8536 void SetHairLevelToHide(
int level,
bool state,
bool was_debug =
false)
8541 if (!m_CharactersHead)
8543 ErrorEx(
"No valid head detected on character!");
8549 m_HideHairAnimated = !m_HideHairAnimated;
8550 for (
int i = 0; i < m_CharactersHead.m_HeadHairSelectionArray.Count(); ++i)
8554 stt.SetSelectionState(m_HideHairAnimated);
8555 m_CharactersHead.m_HeadHairHidingStateMap.Set(i, stt);
8556 #ifdef DIAG_DEVELOPER
8559 diagmenu.m_HairHidingStateMap.Set(i, m_HideHairAnimated);
8569 #ifdef DIAG_DEVELOPER
8572 switchState = !diagmenuu.m_HairHidingStateMap.Get(level);
8573 diagmenuu.m_HairHidingStateMap.Set(level, switchState);
8579 switchState = !state;
8583 stt.SetSelectionState(switchState);
8584 m_CharactersHead.m_HeadHairHidingStateMap.Set(level, stt);
8588 void HideHairSelections(
ItemBase item,
bool state)
8590 if (!item || !item.GetHeadHidingSelection() || !m_CharactersHead)
8599 item.GetInventory().GetCurrentAttachmentSlotInfo(slot_id,slot_name);
8601 if (item.HidesSelectionBySlot())
8603 count = item.GetInventory().GetSlotIdCount();
8604 for (i = 0; i < count; i++)
8606 if (item.GetInventory().GetSlotId(i) == slot_id)
8608 str = item.GetHeadHidingSelection().Get(i);
8609 idx = m_CharactersHead.m_HeadHairSelectionArray.Find(str);
8611 SetHairLevelToHide(idx,state);
8614 Debug.Log(
"No valid selection '" + str +
"' found on head of " +
GetType() +
". Verify the p3d, model config, and the 'HAIR_HIDING_SELECTIONS' macro in basicDefines.");
8621 count = item.GetHeadHidingSelection().Count();
8622 for (i = 0; i < count; i++)
8624 str = item.GetHeadHidingSelection().Get(i);
8625 idx = m_CharactersHead.m_HeadHairSelectionArray.Find(str);
8627 SetHairLevelToHide(idx,state);
8630 Debug.Log(
"No valid selection '" + str +
"' found on head of " +
GetType() +
". Verify the p3d, model config, and the 'HAIR_HIDING_SELECTIONS' macro in basicDefines.");
8634 UpdateHairSelectionVisibility();
8637 void UpdateHairSelectionVisibility(
bool was_debug =
false)
8639 if (!m_CharactersHead)
8642 bool exception_hidden =
false;
8644 int count = m_CharactersHead.m_HeadHairHidingStateMap.Count();
8648 if (IsMale() && m_CharactersHead.GetBeardIndex() > -1 && !was_debug)
8650 SetHairLevelToHide(m_CharactersHead.GetBeardIndex(),GetLifeSpanState() != LifeSpanState.BEARD_EXTRA);
8654 for (i = 0; i < count; i++)
8656 m_CharactersHead.SetSimpleHiddenSelectionState(i,
true);
8659 for (i = 0; i < count; i++)
8661 stt = m_CharactersHead.m_HeadHairHidingStateMap.Get(i);
8662 shown = stt.GetSelectionState();
8665 if (!m_CharactersHead.IsHandlingException())
8667 m_CharactersHead.SetSimpleHiddenSelectionState(i,shown);
8668 UpdateTranslatedSelections(stt);
8673 exception_hidden =
true;
8679 if (exception_hidden)
8681 m_CharactersHead.SetSimpleHiddenSelectionState(m_CharactersHead.GetHairIndex(),
false);
8683 m_CharactersHead.SetSimpleHiddenSelectionState(m_CharactersHead.GetBeardIndex(),
false);
8690 array<int> translatedSelectinosArray = stt.GetTranslatedSelections();
8691 for (
int i = 0; i < translatedSelectinosArray.Count(); i++)
8693 index = translatedSelectinosArray.Get(i);
8695 m_CharactersHead.SetSimpleHiddenSelectionState(index,
false);
8700 void CheckHairClippingOnCharacterLoad()
8705 HideHairSelections(headgear,
true);
8706 HideHairSelections(mask,
true);
8711 return m_ActiveNVTypes && m_ActiveNVTypes.Count() > 0;
8716 return m_LoweredNVGHeadset;
8721 if (!m_ActiveNVTypes || m_ActiveNVTypes.Count() == 0)
8727 return m_ActiveNVTypes[m_ActiveNVTypes.Count() - 1];
8733 return m_ActiveNVTypes;
8737 void SetNVGWorking(
bool state)
8740 AddActiveNV(
NVTypes.NV_GOGGLES);
8743 void SetNVGLowered(
bool state)
8745 m_LoweredNVGHeadset = state;
8748 void AddActiveNV(
int type)
8750 if (!m_ActiveNVTypes || (
GetGame().IsMultiplayer() &&
GetGame().IsServer()))
8753 Error(
"AddActiveNV | illegal server-side call!");
8759 if (m_ActiveNVTypes.Find(type) == -1)
8760 m_ActiveNVTypes.Insert(type);
8763 void RemoveActiveNV(
int type)
8765 if (!m_ActiveNVTypes || (
GetGame().IsMultiplayer() &&
GetGame().IsServer()))
8768 Error(
"RemoveActiveNV | illegal server-side call!");
8774 if (m_ActiveNVTypes.Find(type) != -1)
8775 m_ActiveNVTypes.RemoveItem(type);
8778 void ResetActiveNV()
8780 m_ActiveNVTypes.Clear();
8786 string text = super.GetDebugText();
8803 void DEBUGRotateNVG()
8807 if (FindAttachmentBySlotName(
"Eyewear"))
8809 nvg = NVGoggles.Cast(FindAttachmentBySlotName(
"Eyewear").FindAttachmentBySlotName(
"NVG"));
8811 else if (FindAttachmentBySlotName(
"Headgear"))
8813 nvg = NVGoggles.Cast(FindAttachmentBySlotName(
"Headgear").FindAttachmentBySlotName(
"NVG"));
8818 nvg.RotateGoggles(nvg.m_IsLowered);
8823 void AdjustBandana(
EntityAI item,
string slot_name)
8827 if (slot_name ==
"Headgear")
8829 item.SetSimpleHiddenSelectionState(0,1);
8830 item.SetSimpleHiddenSelectionState(1,0);
8832 else if (slot_name ==
"Mask")
8834 item.SetSimpleHiddenSelectionState(0,0);
8835 item.SetSimpleHiddenSelectionState(1,1);
8841 void UpdateCorpseStateVisual()
8845 int state =
Math.AbsInt(m_CorpseState);
8856 for (
int i = 0; i < bodyparts.Count(); i++)
8859 bodypart = GetInventory().FindPlaceholderForSlot(slot_id);
8860 item =
ItemBase.Cast(GetInventory().FindAttachment(slot_id));
8864 path =
"cfgVehicles " + bodypart.GetType();
8865 idx = bodypart.GetHiddenSelectionIndex(
"personality");
8868 bodypart.SetObjectTexture(idx,m_DecayedTexture);
8873 path =
"cfgVehicles " + item.GetType();
8874 idx = item.GetHiddenSelectionIndex(
"personality");
8877 item.SetObjectTexture(idx,m_DecayedTexture);
8882 SetFaceTexture(m_DecayedTexture);
8886 void SetDecayEffects(
int effect = -1)
8900 m_FliesEff.SetDecalOwner(
this);
8901 m_FliesIndex =
SEffectManager.PlayOnObject(m_FliesEff,
this,
"0 0.25 0");
8902 p = m_FliesEff.GetParticle();
8904 if (!m_SoundFliesEffect)
8906 PlaySoundSetLoop(m_SoundFliesEffect,
"Flies_SoundSet", 1.0, 1.0);
8918 m_FliesEff.SetDecalOwner(
this);
8919 m_FliesIndex =
SEffectManager.PlayOnObject(m_FliesEff,
this,
"0 0.25 0");
8920 p = m_FliesEff.GetParticle();
8922 if (!m_SoundFliesEffect)
8924 PlaySoundSetLoop(m_SoundFliesEffect,
"Flies_SoundSet", 1.0, 1.0);
8933 StopSoundSet(m_SoundFliesEffect);
8938 void PreloadDecayTexture()
8943 idx = GetHiddenSelectionIndex(
"decay_preload");
8946 SetObjectTexture(idx,m_DecayedTexture);
8955 void SetLastMapInfo(
float scale,
vector pos)
8957 m_LastMapScale = scale;
8961 bool GetLastMapInfo(out
float scale, out
vector pos)
8963 scale = m_LastMapScale;
8966 return m_LastMapScale != -1.0;
8969 override bool PhysicalPredictiveDropItem(
EntityAI entity,
bool heavy_item_only =
true)
8974 if (GetItemInHands() == item)
8977 return PredictiveDropEntity(item);
8979 if (entity.ConfigGetString(
"physLayer") !=
"item_large" && heavy_item_only)
8981 return PredictiveDropEntity(item);
8987 return GetHumanInventory().ThrowEntity(item,dir,0);
8993 if (CastTo(mngr_client,m_ActionManager))
9010 override void SetProcessUIWarning(
bool state)
9012 m_ProcessUIWarning = state;
9025 void DamageAllLegs(
float inputDmg)
9028 legZones.Insert(
"LeftLeg");
9029 legZones.Insert(
"RightLeg");
9030 legZones.Insert(
"RightFoot");
9031 legZones.Insert(
"LeftFoot");
9033 for (
int i = 0; i < legZones.Count(); i++)
9035 DecreaseHealth(legZones[i],
"",inputDmg);
9040 void TryHideItemInHands(
bool hide,
bool force =
false)
9055 float stackable = item.GetTargetQuantityMax();
9056 if (!(stackable == 0 || stackable >= item.GetQuantity()))
9059 if (target && target.GetInventory().FindFreeLocationFor(item, flags, il))
9062 if (CastTo(itemB, item))
9064 itemB.SplitIntoStackMaxToInventoryLocationClient(il);
9074 float stackable = item.GetTargetQuantityMax();
9075 if (!(stackable == 0 || stackable >= item.GetQuantity()))
9078 if (CastTo(itemB, item))
9080 itemB.SplitIntoStackMaxToInventoryLocationClient(il);
9089 if (CheckAndExecuteStackSplit(flags, item,
this))
9095 return super.TakeEntityToInventoryImpl(mode, flags, item);
9106 return super.TakeEntityToCargoImpl(mode, item);
9117 return super.TakeEntityAsAttachmentImpl(mode, item);
9128 super.TakeEntityToHandsImpl(mode, item);
9133 if (CheckAndExecuteStackSplit(flags, item, target))
9139 return super.TakeEntityToTargetInventoryImpl(mode, target, flags, item);
9150 return super.TakeEntityToTargetCargoImpl(mode, target, item);
9161 return super.TakeEntityToTargetAttachmentImpl(mode, target, item);
9166 if (CheckAndExecuteStackSplitToInventoryLocation(dst, dst.GetItem()))
9172 return super.TakeToDstImpl(mode, src, dst);
9175 override vector GetCenter()
9182 void ContaminatedParticleAdjustment()
9184 if (
GetCommand_Move() && m_ContaminatedAroundPlayer && m_ContaminatedAroundPlayerTiny)
9192 float particleLifetime = 5.25;
9193 float particleSpeed = 0.25;
9194 if (playerSpeed >= 1)
9196 particleLifetime = 3.5;
9197 particleSpeed = 3.25;
9199 if (playerSpeed >= 2)
9201 particleLifetime = 2.5;
9202 particleSpeed = 5.25;
9204 if (playerSpeed >= 3)
9206 particleLifetime = 1.5;
9207 particleSpeed = 8.25;
9209 m_ContaminatedAroundPlayer.SetParameter(0,
EmitorParam.LIFETIME, particleLifetime);
9210 m_ContaminatedAroundPlayer.SetParameter(1,
EmitorParam.LIFETIME, particleLifetime);
9211 m_ContaminatedAroundPlayer.SetParameter(2,
EmitorParam.LIFETIME, particleLifetime);
9212 m_ContaminatedAroundPlayer.SetParameter(3,
EmitorParam.LIFETIME, particleLifetime);
9214 m_ContaminatedAroundPlayerTiny.SetParameter(0,
EmitorParam.VELOCITY, particleSpeed);
9216 GetTransform(transform);
9217 m_ContaminatedAroundPlayer.SetTransform(transform);
9218 m_ContaminatedAroundPlayerTiny.SetTransform(transform);
9222 void HandleGlassesEffect()
9224 if (!IsControlledPlayer())
9228 if (m_ProcessRemoveGlassesEffects)
9230 for (i = 0; i < m_ProcessRemoveGlassesEffects.Count(); i++)
9232 PPERequesterBank.GetRequester(m_ProcessRemoveGlassesEffects[i]).Stop();
9234 m_ProcessRemoveGlassesEffects.Clear();
9237 if (m_ProcessAddGlassesEffects)
9239 for (i = 0; i < m_ProcessAddGlassesEffects.Count(); i++)
9241 PPERequesterBank.GetRequester(m_ProcessAddGlassesEffects[i]).Start();
9243 m_ProcessAddGlassesEffects.Clear();
9252 int pivot = componentIndex;
9268 vector parentTransMat[4];
9271 arrow.GetTransform(arrowTransMat);
9280 Math3D.YawPitchRollMatrix(closeBoneRotWS *
Math.RAD2DEG,rotMatrix);
9282 parentTransMat[0] = rotMatrix[0];
9283 parentTransMat[1] = rotMatrix[1];
9284 parentTransMat[2] = rotMatrix[2];
9285 parentTransMat[3] = closeBonePosWS;
9288 Math3D.MatrixInvMultiply4(parentTransMat, arrowTransMat, arrowTransMat);
9289 Math3D.MatrixOrthogonalize4(arrowTransMat);
9290 arrow.SetTransform(arrowTransMat);
9296 BleedingSourcesManagerServer bleedingManager = GetBleedingManagerServer();
9297 if (bleedingManager)
9299 if (!bleedingManager.AttemptAddBleedingSourceBySelection(compName))
9300 bleedingManager.AttemptAddBleedingSourceBySelection(
"Pelvis");
9310 string GetCachedName()
9312 return m_CachedPlayerName;
9315 string GetCachedID()
9317 return m_CachedPlayerID;