Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
playerbase.c
Go to the documentation of this file.
5
6#ifdef FEATURE_NETWORK_RECONCILIATION
7class PlayerBaseOwnerState : DayZPlayerImplementOwnerState
8{
9 protected override event void Write(PawnStateWriter ctx)
10 {
11 super.Write(ctx);
12 }
13
14 protected override event void Read(PawnStateReader ctx)
15 {
16 super.Read(ctx);
17 }
18};
19
20class PlayerBaseMove : DayZPlayerImplementMove
21{
24 float m_fStaminaValue;
25 float m_fStaminaCapacity;
26 float m_fStaminaDepletion;
27
28 bool m_bStaminaSynced;
29 float m_fStaminaSyncedValue;
30 float m_fStaminaSyncedCapacity;
31
32 protected void PlayerBaseMove()
33 {
34 m_bStaminaSynced = false;
35 }
36
37 protected override event void Write(PawnMoveWriter ctx, PawnMove prev)
38 {
39 super.Write(ctx, prev);
40 }
41
42 protected override event void Read(PawnMoveReader ctx, PawnMove prev)
43 {
44 super.Read(ctx, prev);
45 }
46};
47#endif
48
49class PlayerBase extends ManBase
50{
51 const int SIMPLIFIED_SHOCK_CAP = 63;
52 const int SHAKE_LEVEL_MAX = 7;
53 private int m_LifeSpanState;
55 private int m_BloodType;
57 private bool m_LiquidTendencyDrain; //client-side only - Obsolete
60
61 protected bool m_HasHeatBuffer;
62 protected int m_HeatBufferStage;
63 protected float m_HeatBufferDynamicMax;
64
65 protected bool m_IsInColdArea;
66 protected bool m_PlayerLoaded;
68 protected bool m_ProcessUIWarning;
70 protected int m_RefreshAnimStateIdx;
71 private int m_StoreLoadVersion;
73 protected int m_LifespanLevelLocal; //control variable for change calls
74 protected int m_AnimCommandStarting; //signals the command that is about to start the next frame (e.g. Swim, Fall...)
76
77 private PluginPlayerStatus m_ModulePlayerStatus;
78 PluginConfigEmotesProfile m_ConfigEmotesProfile;
81
84 PluginRecipesManager m_ModuleRecipesManager;
85 ref BleedingSourcesManagerServer m_BleedingManagerServer;
86 ref BleedingSourcesManagerRemote m_BleedingManagerRemote;
87
99 ref ShockHandler m_ShockHandler; //New shock handler
102 ref TransferValues m_TrasferValues;
104 const int OVERLOAD_LIMIT = 30000;
115 ref Param1<string> m_UAParamMessage;
116 ref Param1<float> m_UnconParam;
117 ref Param1<float> m_DeathDarkeningParam;
123 ref TInputActionMap m_InputActionMap; // Backwards compatibility
127 //ref CraftingMeta m_CraftingMeta;
134 ref PlayerSoundManagerServer m_PlayerSoundManagerServer;
139 bool m_QuickBarFT = false;
141 protected int m_RecipePick;
142 protected bool m_IsHoldingBreath;
143 protected bool m_IsInWater;
145 //AbstractWave m_SaySoundWave;
149 protected int m_CorpseStateLocal;
150 protected bool m_IsHeadingRestricted;
151 protected ref HeadingRestrictData m_HeadingRestrictData;
152
157 float m_CurrentShock; //Used to synchronize shock between server and client, utilized by ShockHandler
164 bool m_AreHandsLocked; //Currently only used to block quickbar usage after canceling placement
174 protected bool m_AllowQuickRestrain;
175 protected bool m_AllowQuickFishing;
176 protected int m_Shakes;
177 protected int m_ShakesForced;
185 Head_Default m_CharactersHead;
192 int m_BrokenLegState = eBrokenLegs.NO_BROKEN_LEGS; //Describe the current leg state, can go bellow 0, cannot be used directly to obtain broken legs state, use GetBrokenLegs() instead
193 int m_LocalBrokenState = eBrokenLegs.NO_BROKEN_LEGS;
196 const string SOUND_BREAK_LEG = "broken_leg_SoundSet";
197 bool m_CanPlayBrokenLegSound; //Used to check if sound has already been played
198 static bool DEBUG_INVENTORY_ACCESS = false;
199 static ref array<string> m_BleedingSourcesLow; //Stores all LOWER body part bleeding sources
200 static ref array<string> m_BleedingSourcesUp; //Stores all UPPER body part bleeding sources EXCLUDING HEAD
203
204
205 // CONTAMINATED AREA RELATED
207 const string CONTAMINATED_AREA_AMBIENT = "ContaminatedArea_SoundSet";//obsolete, use EffectTrigger::GetAmbientSoundsetName() instead
210 protected int m_EffectAreaCount;
211 protected bool m_InsideEffectArea;
214
215 // effect areas
216 protected EEffectAreaType m_InEffectAreaType; // flags for identifying which area the player is in, synchronized by EffectTriggers
217 protected ref map<EEffectAreaType, int> m_EffectAreaOverlap = new map<EEffectAreaType, int>(); // type -> how many of such areas is player currently in
218 protected ref map<EEffectAreaType, float> m_EffectAreaTimeToTick = new map<EEffectAreaType, float>(); // type -> how long has player spent in an area since last effect tick
221
222 protected string m_CachedPlayerName;//cached from player identity
223 protected string m_CachedPlayerID;//cached from player identity
224
225 #ifdef DIAG_DEVELOPER
226 int m_IsInsideTrigger;
227 bool m_CanBeTargetedDebug; //server-side only
228 ref array<EntityAI> m_PresetItems = new array<EntityAI>;
229 bool m_PresetSpawned;
230 ref CameraToolsMenuClient m_CameraToolsMenuClient;
231 protected PluginTargetTemperature m_TargetTemperatureDiag;
232 #endif
233
234 #ifdef DEVELOPER
235 Transport m_GetInVehicleTransportDebug;
236 #endif
237
238 #ifdef DIAG_DEVELOPER
239 ref Bot m_Bot;
240 #endif
241
242 //Temp QuickBar load
244
245 //hologram
250
251 //Sheduler
252 float m_LastTick = -1;
254 //crafting start
255 int m_RecipeID = -1;
262 //crafting end
267 //input control
269
270 //Action data for base building actions
272 //Action data for fireplace (indoor)
276
278 bool m_IsFighting = false;
279 bool m_IsDrowning;//Set only via the setter SetDrowning
280
281 // debug monitor
283
284 //map
287 bool m_MapCloseRequestProcessed; //DEPRECATED
288 protected bool m_MapClosingSyncSent;
289 protected float m_LastMapScale = -1.0;
292
293 //inventory soft locking
294 protected bool m_InventorySoftLocked; //obsolete, count should be checked instead. Left in here for legacy's sake.
295 protected int m_InventorySoftLockCount = 0;
297
298 //Analytics
301
303 protected bool m_MeleeDebug;
304 //protected bool m_CheckMeleeItem;
306
308 protected string m_UALastMessage;
310 protected int m_PerformedAnimActionID = -1; // animated action being performed, -1 if none
311 protected int m_ActivePrimarySymptomID = 0; // active primary symptom, 0 if none, symptom has to be overriden to allow sync
312
313 bool m_WorkingNVGHeadset; //Deprecated
316 //bool m_PreviousNVGState;
319 PluginAdminLog m_AdminLog;
321
324
330 protected PlayerStat<int> m_StatWet
331 protected PlayerStat<int> m_StatBloodType
332 protected PlayerStat<float> m_StatDiet
333 protected PlayerStat<float> m_StatStamina
334 protected PlayerStat<float> m_StatSpecialty
335 protected PlayerStat<float> m_StatHeatBuffer
336
341
342 //postprocess processing
345
347
351
353
355 {
356 Init();
357 }
358
359 void Init()
360 {
361 SetEventMask(EntityEvent.INIT|EntityEvent.POSTFRAME|EntityEvent.FRAME);
363 m_IsCraftingReady = false;
364 m_Recipes = new array<int>;
366 m_BloodType = 0;
367 m_HasBloodTypeVisible = false;
368 m_LifeSpanState = 0;
370 m_CorpseState = 0;
373 m_PlayerLoaded = false;
374 m_PlayerSelected = false;
375 m_ProcessUIWarning = false;
377 m_LiquidTendencyDrain = false;
378 m_UAParamMessage = new Param1<string>("");
379 m_UnconParam = new Param1<float>(0);
380 m_DeathDarkeningParam = new Param1<float>(0);
381 m_UAParam = new Param2<int,int>(0,0);
383 m_QuickBarBase = new QuickBarBase(this);
384 m_QuickBarBonus = Math.Max(ConfigGetInt("quickBarBonus"), 0);
385 m_CargoLoad = 0;
386 m_VisibilityCoef = 1.0;
387 m_Hud = g_Game.GetMission().GetHud();
388 m_RecipePick = 0;
389 m_ActionQBControl = false;
390 m_QuickBarHold = false;
391 m_HideHairAnimated = true;
392 m_WorkingNVGHeadset = false;
393 m_LoweredNVGHeadset = false;
394 m_AreHandsLocked = false;
396 m_AnimCommandStarting = HumanMoveCommandID.None;
397 m_EmptyGloves = new HiddenSelectionsData(ConfigGetString("emptyGloves"));
399 m_HeadingRestrictData = new HeadingRestrictData();
400
401 #ifdef DIAG_DEVELOPER
402 m_CanBeTargetedDebug = true;
403 //RegisterNetSyncVariableBool("m_CanBeTargetedDebug");
404 #endif
405
407
408 m_StaminaHandler = new StaminaHandler(this);//current stamina calculation
410 m_ShockHandler = new ShockHandler(this); //New shock handler
412 m_PlayerStats = new PlayerStats(this);//player stats
414
415 if (g_Game.IsServer())
416 {
417 m_PlayerStomach = new PlayerStomach(this);
418 m_NotifiersManager = new NotifiersManager(this); // player notifiers
419 m_AgentPool = new PlayerAgentPool(this); // agent pool manager
420 m_BleedingManagerServer = new BleedingSourcesManagerServer(this);
421 m_Environment = new Environment(this);//environment effects on player
422
423 m_ModifiersManager = new ModifiersManager(this); // player modifiers
424 m_PlayerSoundManagerServer = new PlayerSoundManagerServer(this);
426
427 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
428 }
429
430 m_SymptomManager = new SymptomManager(this); // state manager
431 m_ModuleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
432
433 m_TrasferValues = new TransferValues(this);
434 m_EmoteManager = new EmoteManager(this);
435 m_SoftSkillsManager = new SoftSkillsManager(this);//Soft Skills calculation
436
437 m_WeaponManager = new WeaponManager(this);
440
441 if (!g_Game.IsDedicatedServer())
442 {
443 m_MeleeDebug = false;
444 m_UALastMessage = "";
447 m_BleedingManagerRemote = new BleedingSourcesManagerRemote(this);
450 m_ActionsInitialize = false;
452
458 }
459
460 m_ActionManager = NULL;
461
462 m_ConfigEmotesProfile = PluginConfigEmotesProfile.Cast(GetPlugin(PluginConfigEmotesProfile));
463
464 if (GetDayZGame().IsDebug())
465 {
466 PluginConfigDebugProfileFixed m_ConfigDebugProfileFixed = PluginConfigDebugProfileFixed.Cast(GetPlugin(PluginConfigDebugProfileFixed));
468 PluginDeveloper m_Developer = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
469
470 PlayerBase player = this;
471
473 {
474 string default_preset = m_ConfigDebugProfile.GetDefaultPreset();
475 if (player && default_preset != "")
476 {
477 TStringArray preset_array = new TStringArray;
478 m_ConfigDebugProfileFixed.GetPresetItems(default_preset, preset_array);
479
480 bool is_preset_fixed = true;
481 if (preset_array.Count() == 0)
482 {
483 m_ConfigDebugProfile.GetPresetItems(default_preset, preset_array);
484 is_preset_fixed = false;
485 }
486
487 if (preset_array.Count() > 0)
488 {
489 m_Developer.ClearInventory(player);
490
491 for (int i = 0; i < preset_array.Count(); i++)
492 {
493 float health = -1;
494 int quantity = -1;
495 if (is_preset_fixed)
496 {
497 health = m_ConfigDebugProfileFixed.GetItemHealth(default_preset, i);
498 quantity = m_ConfigDebugProfileFixed.GetItemQuantity(default_preset, i);
499 }
500 else
501 {
502 health = m_ConfigDebugProfile.GetItemHealth(default_preset, i);
503 quantity = m_ConfigDebugProfile.GetItemQuantity(default_preset, i);
504 }
505 m_Developer.SpawnEntityInPlayerInventory(player, preset_array.Get(i), health, quantity);
506 }
507 }
508 }
509 }
510 }
511
513
515
516 m_ModulePlayerStatus = PluginPlayerStatus.Cast(GetPlugin(PluginPlayerStatus));
518
520 m_BleedingSourcesLow.Insert("RightToeBase");
521 m_BleedingSourcesLow.Insert("RightFoot");
522 m_BleedingSourcesLow.Insert("LeftToeBase");
523 m_BleedingSourcesLow.Insert("LeftFoot");
524 m_BleedingSourcesLow.Insert("RightUpLegRoll");
525 m_BleedingSourcesLow.Insert("RightUpLeg");
526 m_BleedingSourcesLow.Insert("RightLegRoll");
527 m_BleedingSourcesLow.Insert("RightLeg");
528 m_BleedingSourcesLow.Insert("LeftUpLegRoll");
529 m_BleedingSourcesLow.Insert("LeftUpLeg");
530 m_BleedingSourcesLow.Insert("LeftLegRoll");
531 m_BleedingSourcesLow.Insert("LeftLeg");
532
534 m_BleedingSourcesUp.Insert("RightForeArmRoll");
535 m_BleedingSourcesUp.Insert("LeftForeArmRoll");
536 m_BleedingSourcesUp.Insert("RightForeArm");
537 m_BleedingSourcesUp.Insert("RightArmRoll");
538 m_BleedingSourcesUp.Insert("RightArm");
539 m_BleedingSourcesUp.Insert("RightShoulder");
540 m_BleedingSourcesUp.Insert("LeftForeArm");
541 m_BleedingSourcesUp.Insert("LeftArmRoll");
542 m_BleedingSourcesUp.Insert("LeftArm");
543 m_BleedingSourcesUp.Insert("LeftShoulder");
544 m_BleedingSourcesUp.Insert("Spine3");
545 m_BleedingSourcesUp.Insert("Spine2");
546 m_BleedingSourcesUp.Insert("Spine1");
547 m_BleedingSourcesUp.Insert("Spine");
548 m_BleedingSourcesUp.Insert("Pelvis");
549 m_BleedingSourcesUp.Insert("Neck");
550
551 RegisterNetSyncVariableInt("m_PersistentFlags", 0, 1<<(EnumTools.GetEnumSize(PersistentFlag) + 1));
552 RegisterNetSyncVariableInt("m_LifeSpanState", LifeSpanState.BEARD_NONE, LifeSpanState.COUNT);
553 RegisterNetSyncVariableInt("m_BloodType", 0, 128);
554 RegisterNetSyncVariableInt("m_ShockSimplified",0, SIMPLIFIED_SHOCK_CAP);
555 RegisterNetSyncVariableInt("m_SoundEvent",0, EPlayerSoundEventID.ENUM_COUNT - 1);
556 RegisterNetSyncVariableInt("m_SoundEventParam", 0, ((EPlayerSoundEventParam.ENUM_COUNT - 1) * 2) - 1);
557 RegisterNetSyncVariableInt("m_StaminaState",0, eStaminaState.COUNT - 1);
558 RegisterNetSyncVariableInt("m_BleedingBits");
559 RegisterNetSyncVariableInt("m_Shakes", 0, SHAKE_LEVEL_MAX);
560 RegisterNetSyncVariableInt("m_BreathVapour", 0, BREATH_VAPOUR_LEVEL_MAX);
561 RegisterNetSyncVariableInt("m_HealthLevel", eInjuryHandlerLevels.PRISTINE, eInjuryHandlerLevels.RUINED);
562 RegisterNetSyncVariableInt("m_MixedSoundStates", 0, eMixedSoundStates.COUNT - 1);
563 RegisterNetSyncVariableInt("m_CorpseState",-PlayerConstants.CORPSE_STATE_DECAYED,PlayerConstants.CORPSE_STATE_DECAYED);//do note the negative min, negative sign denotes a special meaning
564 RegisterNetSyncVariableInt("m_RefreshAnimStateIdx",0,3);
565 RegisterNetSyncVariableInt("m_BrokenLegState", -eBrokenLegs.BROKEN_LEGS_SPLINT, eBrokenLegs.BROKEN_LEGS_SPLINT);
566 RegisterNetSyncVariableInt("m_SyncedModifiers", 0, ((eModifierSyncIDs.LAST_INDEX - 1) * 2) - 1);
567 RegisterNetSyncVariableInt("m_HasBloodyHandsVisible", 0, eBloodyHandsTypes.LAST_INDEX - 1);
568 RegisterNetSyncVariableInt("m_ActionSoundCategoryHash");
569 RegisterNetSyncVariableInt("m_PerformedAnimActionID", -1, 2048); // generous upper limit for modding reasons
570 RegisterNetSyncVariableInt("m_ActivePrimarySymptomID", 0, SymptomIDs.LAST_INDEX);
571
572 RegisterNetSyncVariableInt("m_HeatBufferStage", 0, HeatBufferMdfr.NUMBER_OF_STAGES - 1);
573 RegisterNetSyncVariableFloat("m_HeatBufferDynamicMax", 0.0, 1.0, 2);
574
575 RegisterNetSyncVariableBool("m_IsUnconscious");
576 RegisterNetSyncVariableBool("m_IsRestrained");
577 RegisterNetSyncVariableBool("m_IsInWater");
578 RegisterNetSyncVariableBool("m_InsideEffectArea");
579
580 RegisterNetSyncVariableBool("m_HasBloodTypeVisible");
581 RegisterNetSyncVariableBool("m_IsRestrainStarted");
582 RegisterNetSyncVariableBool("m_IsRestrainPrelocked");
583 RegisterNetSyncVariableBool("m_HasHeatBuffer");
584 RegisterNetSyncVariableBool("m_IsInColdArea");
585
586 RegisterNetSyncVariableFloat("m_CurrentShock"); //Register shock synchronized variable
587
588 m_OriginalSlidePoseAngle = GetSlidePoseAngle();
589
592
593 m_DecayedTexture = ConfigGetString("decayedTexture");
594 m_FliesIndex = -1;
595
597
598 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).Call(this.OnPlayerLoaded);
599 }
600
602 {
603 if (g_Game && (!g_Game.IsDedicatedServer()))
604 {
607 }
608
610 StopSoundSet(m_SoundFliesEffect);
611 }
612
613 // Toggles an energy manager on or off based on the given state.
614 // If state is true, the energy manager is switched on.
615 // If state is false, the energy manager is switched off.
616 void SetEnergyManagerState(ItemBase itemInHands, bool state)
617 {
618 if(!itemInHands)
619 return;
620 //checking if the item in hands has an attached light source with an Energy Manager
621 if(itemInHands.m_LightSourceItem && itemInHands.m_LightSourceItem.GetCompEM())
622 {
623 if(state && itemInHands.m_LightSourceItem.GetCompEM().GetPreviousSwitchState())
624 itemInHands.m_LightSourceItem.GetCompEM().SwitchOn();
625 else if (!state)
626 itemInHands.m_LightSourceItem.GetCompEM().SwitchOff();
627
628 return;
629 }
630 //checking if the item in hands itself has an Energy Manager
631 else if(itemInHands.GetCompEM())
632 {
633 if(state && itemInHands.GetCompEM().GetPreviousSwitchState())
634 itemInHands.GetCompEM().SwitchOn();
635 else if (!state)
636 itemInHands.GetCompEM().SwitchOff();
637
638 return;
639 }
640 }
641
642#ifdef FEATURE_NETWORK_RECONCILIATION
643 protected override event typename GetOwnerStateType()
644 {
645 return PlayerBaseOwnerState;
646 }
647
648 protected override event typename GetMoveType()
649 {
650 return PlayerBaseMove;
651 }
652
653 protected override event void ObtainMove(/*inout*/ PawnMove pMove)
654 {
655 super.ObtainMove(pMove);
656
657 PlayerBaseMove move = PlayerBaseMove.Cast(pMove);
658 GetStaminaHandler().ObtainMove(move);
659 }
660
661 protected override event bool ReplayMove(PawnMove pMove)
662 {
663 if (!super.ReplayMove(pMove))
664 return false;
665
666 PlayerBaseMove move = PlayerBaseMove.Cast(pMove);
667 GetStaminaHandler().ReplayMove(move);
668 UpdateMovementInertia();
669
670 return true;
671 }
672
673 protected override event void ObtainState(/*inout*/ PawnOwnerState pState)
674 {
675 super.ObtainState(pState);
676
677 PlayerBaseOwnerState state = PlayerBaseOwnerState.Cast(pState);
678
679 GetStaminaHandler().ObtainState(state);
680 }
681
682 protected override event void RewindState(PawnOwnerState pState, /*inout*/ PawnMove pMove, inout NetworkRewindType pRewindType)
683 {
684 super.RewindState(pState, pMove, pRewindType);
685
686 PlayerBaseOwnerState state = PlayerBaseOwnerState.Cast(pState);
687 PlayerBaseMove move = PlayerBaseMove.Cast(pMove);
688 GetStaminaHandler().RewindState(state, move);
689 }
690#endif
691
699
707
709 {
710 if ((m_MedicalDrugsActive & drugType) != drugType)
712 }
713
715 {
716 if ((m_MedicalDrugsActive & drugType) == drugType)
717 m_MedicalDrugsActive &= ~drugType;
718 }
719
721 {
722 return (m_MedicalDrugsActive & EMedicalDrugsType.CHELATION) == EMedicalDrugsType.CHELATION;
723 }
724
726 {
727 return (m_MedicalDrugsActive & EMedicalDrugsType.ANTIBIOTICS) == EMedicalDrugsType.ANTIBIOTICS;
728 }
729
730 void SetSoundCategoryHash(int hash)
731 {
732 m_ActionSoundCategoryHash = hash;
733 SetSynchDirty();
734 }
735
737 {
739 SetSynchDirty();
740 }
741
743 {
745 }
746
747 void SetActivePrimarySymptomID(SymptomIDs id)
748 {
750 SetSynchDirty();
751 }
752
754 {
756 }
757
758 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)
759 {
760 //do note multiple triggers can be calling this method within a single frame depending on the contaminated area setup and dynamic gameplay events(such as gas grenades being deployed)
761
763 return;
764 bool allow = false;
766 {
767 allow = true;
768 }
769 else if (trigger == m_CurrentEffectTrigger && forceUpdate)
770 {
771 allow = true;
772 //Print("ON Enabling effect FORCED " + trigger);
773 }
774 else if (trigger.GetEffectsPriority() > m_CurrentEffectTrigger.GetEffectsPriority())
775 {
777 allow = true;
778 }
779 if (allow)
780 {
781 /*
782 Print("--------------------------------------------------");
783 Print("ON Enabling effect " + trigger);
784 Print("------------> soundset " + soundset);
785 Print("--------------------------------------------------");
786 */
787 m_CurrentEffectTrigger = trigger;
788 SetContaminatedEffectEx( true, ppeIdx, aroundId, tinyId, soundset,partDynaUpdate, newBirthRate );
789 }
790 }
791
792
794 {
796 {
797 /*
798 Print("--------------------------------------------------");
799 Print("OFF Disabling effect");
800 Print("--------------------------------------------------");
801 */
802 SetContaminatedEffectEx( false, m_CurrentEffectTrigger.m_PPERequester );
804 }
805 }
806
813
824 {
825 if (m_EffectAreaCount == 0)
826 {
827 m_InsideEffectArea = true;
828 SetSynchDirty();
830 }
832 }
833
835 {
837 if (m_EffectAreaCount <= 0)
838 {
840 m_InsideEffectArea = false;
841 SetSynchDirty();
843 }
844 }
845
846 void SetInEffectAreaTypeFlag(EEffectAreaType flag)
847 {
848 int areaCount = m_EffectAreaOverlap.Get(flag);
849
850 if (areaCount > 0)
851 m_EffectAreaOverlap.Set(flag, m_EffectAreaOverlap.Get(flag) + 1);
852 else
853 m_EffectAreaOverlap.Set(flag, 1);
854
855 m_InEffectAreaType |= flag;
856 }
857
858 void UnsetInEffectAreaTypeFlag(EEffectAreaType flag)
859 {
860 int areaCount = m_EffectAreaOverlap.Get(flag);
861
862 if (areaCount > 1)
863 m_EffectAreaOverlap.Set(flag, m_EffectAreaOverlap.Get(flag) - 1);
864 else
865 {
866 m_EffectAreaOverlap.Set(flag, 0);
867 m_InEffectAreaType &= ~flag;
868 }
869 }
870
871 bool IsInEffectArea(EEffectAreaType area)
872 {
873 if (m_InEffectAreaType & area)
874 return true;
875
876 return false;
877 }
878
879 // Server side update when player is present in any effect area
880 protected void OnUpdateEffectAreaServer(float timeSlice)
881 {
882 float timeSpent;
883
884 if (IsInEffectArea(EEffectAreaType.HOT_SPRING))
885 {
886 float waterLevel = GetCurrentWaterLevel();
887 if (waterLevel > 0.5)
888 {
889 timeSpent = m_EffectAreaTimeToTick.Get(EEffectAreaType.HOT_SPRING);
890 timeSpent += timeSlice;
892 {
893 m_EffectAreaTimeToTick.Set(EEffectAreaType.HOT_SPRING, 0);
895 }
896 else
897 m_EffectAreaTimeToTick.Set(EEffectAreaType.HOT_SPRING, timeSpent);
898 }
899 }
900
901 if (IsInEffectArea(EEffectAreaType.VOLCANIC))
902 {
903 timeSpent = m_EffectAreaTimeToTick.Get(EEffectAreaType.VOLCANIC);
904 timeSpent += timeSlice;
906 {
907 m_EffectAreaTimeToTick.Set(EEffectAreaType.VOLCANIC, 0);
909 }
910 else
911 m_EffectAreaTimeToTick.Set(EEffectAreaType.VOLCANIC, timeSpent);
912 }
913 }
914
916 {
917 GetModifiersManager().ActivateModifier( eModifiers.MDF_AREAEXPOSURE );
918 //Print("Contaminated ENTERED <------------------------------------------------------------- FINAL");
919 }
920
922 {
923 GetModifiersManager().DeactivateModifier( eModifiers.MDF_AREAEXPOSURE );
924 //Print("Contaminated LEFT <------------------------------------------------------------- FINAL");
925 }
926
928 {
929 //Print("ANY EFFECT AREA ENTERED <------------------------------------------------------------- FINAL");
930 }
931
933 {
934 //Print("ANY EFFECT AREA LEFT <------------------------------------------------------------- FINAL");
935 }
936
938 {
939 //Print("ANY EFFECT AREA ENTERED CLIENT <------------------------------------------------------------- FINAL");
940 }
941
943 {
945 //Print("ANY EFFECT AREA LEFT CLIENT <------------------------------------------------------------- FINAL");
946 }
947
949 ItemBase GetItemOnSlot(string slot_type)
950 {
951 int slot_id = InventorySlots.GetSlotIdFromString(slot_type);
952 EntityAI item_EAI = this.GetInventory().FindAttachment(slot_id);
953 ItemBase item_IB = ItemBase.Cast(item_EAI);
954
955 if (item_EAI && !item_IB)
956 {
957 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() + "!";
958 Error(str);
959 return null;
960 }
961
962 return item_IB;
963 }
964
967 {
968 return GetItemOnSlot("Headgear");
969 }
970
971 override int GetQuickBarBonus()
972 {
973 return m_QuickBarBonus;
974 }
975
976 //--------------------------------------------------------------------------
977 // Inventory overrides
978 //--------------------------------------------------------------------------
979 override bool CanDropEntity (notnull EntityAI item)
980 {
981 if (GetInventory().HasInventoryReservation(item, null))
982 {
983 return false;
984 }
985
986 if (IsRestrained())
987 {
988 if (GetEntityInHands() == item)
989 return false;
990 }
991
992 return true;
993 }
994
995 //--------------------------------------------------------------------------
996 // PLAYER DAMAGE EVENT HANDLING
997 //--------------------------------------------------------------------------
998
1000 {
1001 return m_BreathVapour;
1002 }
1003
1004 // adds state to and syncs sound states variable which is used to generate sound client-side
1006 {
1007 int bit_mask_remove = ~state;
1008
1009 eMixedSoundStates new_states = m_MixedSoundStates & bit_mask_remove;
1010
1011 if (new_states != m_MixedSoundStates)
1012 {
1013 m_MixedSoundStates = new_states;
1014 SetSynchDirty();
1015 }
1016 }
1017
1018 // adds state to and syncs sound states variable which is used to generate sound client-side
1020 {
1021 eMixedSoundStates new_states = m_MixedSoundStates | state;
1022
1023 if (new_states != m_MixedSoundStates)
1024 {
1025 m_MixedSoundStates = new_states;
1026 SetSynchDirty();
1027 }
1028 }
1029
1030 override bool IsPlayer()
1031 {
1032 return true;
1033 }
1034
1036 {
1037 return (m_BleedingBits != 0);
1038 }
1039
1040 void SetBleedingBits(int bits)
1041 {
1042 if (m_BleedingBits != bits)
1043 {
1044 if (m_BleedingBits == 0)
1045 {
1047 }
1048 else if (bits == 0)
1049 {
1050 OnBleedingEnd();
1051 }
1052 }
1053 m_BleedingBits = bits;
1054 SetSynchDirty();
1055 }
1056
1058 {
1059 return m_BleedingBits;
1060 }
1061
1063 {
1065 }
1066
1068 {
1070 }
1071
1073 {
1075 }
1076
1078 {
1080 }
1081
1082
1084 {
1085 return m_HealingsCount;//0 for no healings, 1+ for healings, gets truncated to 1
1086 }
1087
1089 {
1090 return m_DiseaseCount;//0 for no disease, 1+ for disease, gets truncated to 1
1091 }
1092
1093
1095 {
1096 return m_PulseType;
1097 }
1098
1099 void SetPulseType(EPulseType pulse_type)
1100 {
1101 m_PulseType = pulse_type;
1102 }
1103
1105 {
1106 m_ProcessAddEffectWidgets.InsertArray(effects);
1107 }
1108
1110 {
1111 m_ProcessRemoveEffectWidgets.InsertArray(effects);
1112 }
1113
1115 {
1116 m_ProcessAddGlassesEffects.Insert(id);
1117 }
1118
1120 {
1122 }
1123
1128
1130 {
1132 {
1133 delete m_DamageDealtEffect;
1134 }
1135
1137 {
1139 }
1140 }
1141
1142 void SpawnDamageDealtEffect2(Param param1 = null, Param param2 = null)
1143 {
1144 if (m_EffectRadial)
1145 {
1146 delete m_EffectRadial;
1147 }
1148
1149 m_EffectRadial = new EffectRadial(param1,param2);
1150 }
1151
1156
1157 void SpawnFlashbangEffect(PlayerBase player, bool visual)
1158 {
1160 {
1161 m_FlashbangEffect.Stop();
1162 delete m_FlashbangEffect;
1163 }
1164
1165 m_FlashbangEffect = new FlashbangEffect(player, visual);
1166 }
1167
1172
1173 void SpawnShockEffect(float intensity_max)
1174 {
1176 {
1177 delete m_ShockDealtEffect;
1178 }
1179
1180 m_ShockDealtEffect = new ShockDealtEffect(intensity_max);
1181 }
1182
1183 override void EEKilled(Object killer)
1184 {
1185 //Print(Object.GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " event EEKilled, player has died at STS=" + GetSimulationTimeStamp());
1186
1187 if (m_AdminLog)
1188 {
1189 m_AdminLog.PlayerKilled(this, killer);
1190 }
1191
1193 delete GetBleedingManagerServer();
1194
1195 // kill character in database
1196 if (GetHive())
1197 {
1198 GetHive().CharacterKill(this);
1199 }
1200
1201 // disable voice communication
1202 g_Game.EnableVoN(this, false);
1203 if (!g_Game.IsDedicatedServer())
1205 GetSymptomManager().OnPlayerKilled();
1206
1207 if (GetEconomyProfile() && !m_CorpseProcessing && m_CorpseState == 0 && g_Game.GetMission().InsertCorpse(this))
1208 {
1209 m_CorpseProcessing = true;
1210 //Print("EEKilled - processing corpse");
1211 }
1212
1213 if (g_Game.IsMultiplayer() && g_Game.IsServer())
1214 {
1215 if (g_Game.GetMission())
1216 {
1217 g_Game.GetMission().SyncRespawnModeInfo(GetIdentity());
1218 }
1219 }
1220
1221 super.EEKilled(killer);
1222 }
1223
1224 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
1225 {
1226 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
1227
1228 if (m_AdminLog)
1229 {
1230 m_AdminLog.PlayerHitBy(damageResult, damageType, this, source, component, dmgZone, ammo);
1231 }
1232
1233 if (damageResult != null && damageResult.GetDamage(dmgZone, "Shock") > 0)
1234 {
1235 m_LastShockHitTime = g_Game.GetTime();
1236
1237 if (!IsUnconscious())
1238 {
1239 if (g_Game.ConfigIsExisting("cfgAmmo " + ammo + " unconRefillModifier"))
1240 {
1241 m_UnconRefillModifier = g_Game.ConfigGetInt("cfgAmmo " + ammo + " unconRefillModifier");
1242 }
1243 else
1244 {
1246 }
1247 }
1248 }
1249
1251 if (damageType == DamageType.EXPLOSION && ammo == "FlashGrenade_Ammo")
1252 {
1253 GetStaminaHandler().DepleteStaminaEx(EStaminaModifiers.OVERALL_DRAIN);
1254 }
1255
1256 //new bleeding computation
1257 //---------------------------------------
1258 if (damageResult != null && GetBleedingManagerServer())
1259 {
1260 float dmg = damageResult.GetDamage(dmgZone, "Blood");
1261 GetBleedingManagerServer().ProcessHit(dmg, source, component, dmgZone, ammo, modelPos);
1262 }
1263 //---------------------------------------
1264
1265 #ifdef DIAG_DEVELOPER
1266 if (DiagMenu.GetBool(DiagMenuIDs.MELEE_DEBUG))
1267 Print("EEHitBy() | " + GetDisplayName() + " hit by " + source.GetDisplayName() + " to " + dmgZone);
1268
1269 PluginRemotePlayerDebugServer plugin_remote_server = PluginRemotePlayerDebugServer.Cast(GetPlugin(PluginRemotePlayerDebugServer));
1270 if (plugin_remote_server)
1271 {
1272 plugin_remote_server.OnDamageEvent(this, damageResult);
1273 }
1274 #endif
1275
1276 if (g_Game.IsDebugMonitor())
1277 m_DebugMonitorValues.SetLastDamage(source.GetDisplayName());
1278
1279 if (m_ActionManager)
1280 m_ActionManager.Interrupt();
1281
1282 int transferShockToDamageCoef = g_Game.ConfigGetInt(string.Format("%1 %2 DamageApplied transferShockToDamage", CFG_AMMO, ammo));
1283 if (transferShockToDamageCoef == 1)
1284 {
1285 //Print("PlayerBase | EEHitBy | nonlethal hit");
1286 AddHealth("", "Health", -ConvertNonlethalDamage(damageResult.GetDamage(dmgZone, "Shock"), damageType));
1287 if (dmgZone != "Head")
1288 AddHealth(dmgZone, "Health", -damageResult.GetDamage(dmgZone, "Shock")); //Also deal damage to zone health, no dmg reduction
1289 }
1290
1291 if (g_Game.IsServer())
1292 {
1293 if (GetHealth("RightLeg", "Health") <= 1 || GetHealth("LeftLeg", "Health") <= 1 || GetHealth("RightFoot", "Health") <= 1 || GetHealth("LeftFoot", "Health") <= 1)
1294 {
1295 if (GetModifiersManager().IsModifierActive(eModifiers.MDF_BROKEN_LEGS))//effectively resets the modifier
1296 {
1297 GetModifiersManager().DeactivateModifier(eModifiers.MDF_BROKEN_LEGS);
1298 }
1299 GetModifiersManager().ActivateModifier(eModifiers.MDF_BROKEN_LEGS);
1300 }
1301
1302 if (ammo == "Bullet_CupidsBolt" && IsAlive())
1303 {
1304 DamageSystem.ResetAllZones(this);
1305 m_ModifiersManager.ResetAll();
1306 m_ModifiersManager.ActivateModifier(eModifiers.MDF_IMMUNITYBOOST);
1307
1308 // bleeding sources
1310 m_BleedingManagerServer.RemoveAllSources();
1311
1312 // Stats
1313 if (GetPlayerStats())
1314 {
1315 int bloodType = GetStatBloodType().Get();
1316 float energyValue = GetStatEnergy().Get();
1317 float waterValue = GetStatWater().Get();
1318 float heatBuffer = GetStatHeatBuffer().Get();
1319 float heatComfort = GetStatHeatComfort().Get();
1320
1321 GetPlayerStats().ResetAllStats();
1322
1323 GetStatBloodType().Set(bloodType);
1324 GetStatWater().Set(waterValue);
1325 GetStatEnergy().Set(energyValue);
1326 GetStatHeatBuffer().Set(heatBuffer);
1327 GetStatHeatComfort().Set(heatComfort);
1328 }
1329
1330 // Agents
1331 if (m_AgentPool)
1332 m_AgentPool.RemoveAllAgents();
1333
1334 if (m_StaminaHandler)
1336
1337 // uncon
1338 if (IsUnconscious())
1340 }
1341 }
1342
1343 m_ShockHandler.CheckValue(true);
1344
1345 //analytics
1346 g_Game.GetAnalyticsServer().OnEntityHit(source, this);
1347 }
1348
1349 override void EEHitByRemote(int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos)
1350 {
1351 super.EEHitByRemote(damageType, source, component, dmgZone, ammo, modelPos);
1352
1353 if (m_MeleeFightLogic.IsInBlock())
1354 {
1355 EffectSound sound = SEffectManager.PlaySoundOnObject("BlockingAttack_SoundSet", this);
1356 sound.SetAutodestroy(true);
1357 }
1358 }
1359
1360 override void EEDelete(EntityAI parent)
1361 {
1363 StopSoundSet(m_SoundFliesEffect);
1364
1365 if (GetArrowManager())
1367 }
1368
1369 override protected float ConvertNonlethalDamage(float damage, DamageType damageType)
1370 {
1371 if (damageType == DamageType.FIRE_ARM)
1373
1374 return super.ConvertNonlethalDamage(damage, damageType);
1375 }
1376
1380 override void OnReceivedHit(ImpactEffectsData hitData)
1381 {
1382 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
1383 {
1384 float shakeStrength = Math.InverseLerp(0, 500, hitData.m_InSpeed.Length());
1385 GetCurrentCamera().SpawnCameraShake(shakeStrength);
1387 }
1388
1389 if (hitData.m_AmmoType == "Bullet_CupidsBolt")
1390 Ammo_CupidsBolt.PlayOnHitParticle(hitData.m_Position);
1391 }
1392
1393 // DEPRECATED by method OnReceivedHit
1394 override void OnPlayerRecievedHit()
1395 {
1396 #ifndef NO_GUI
1397 if (m_MeleeFightLogic.IsInBlock())
1398 {
1399 EffectSound sound = SEffectManager.PlaySoundOnObject("BlockingAttack_SoundSet", this);
1400 sound.SetAutodestroy(true);
1401 return;
1402 }
1403
1408
1409 CloseMapEx(true);
1410 #endif
1411 }
1412
1414 {
1415 SpawnFlashbangEffect(this, visual);
1416 }
1417
1419
1420 //--------------------------------------------------------------------------
1422 //--------------------------------------------------------------------------
1423
1425 override string GetHitComponentForAI()
1426 {
1427 return GetDayZPlayerType().GetHitComponentForAI();
1428 }
1429
1431 override string GetDefaultHitComponent()
1432 {
1433 return GetDayZPlayerType().GetDefaultHitComponent();
1434 }
1435
1437 {
1438 return m_DefaultHitPosition;
1439 }
1440
1443 {
1444 return GetDayZPlayerType().GetSuitableFinisherHitComponents();
1445 }
1446
1447 protected vector SetDefaultHitPosition(string pSelection)
1448 {
1449 return GetSelectionPositionMS(pSelection);
1450 }
1451
1452 //--------------------------------------------------------------------------
1458
1463 //--------------------------------------------------------------------------
1464 override void EEItemAttached(EntityAI item, string slot_name)
1465 {
1466 super.EEItemAttached(item, slot_name);
1467
1468 ItemBase itemIB = ItemBase.Cast(item);
1469 SwitchItemSelectionTexture(item, slot_name);
1470 Param1<PlayerBase> p = new Param1<PlayerBase>(this);
1471 item.SwitchItemSelectionTextureEx(EItemManipulationContext.ATTACHING, p);
1472 m_QuickBarBase.updateSlotsCount();
1474 UpdateShoulderProxyVisibility(item, slot_name);
1475
1476 HideHairSelections(itemIB,true);
1477
1478 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(item, slot_name);
1479 Clothing clothing = Clothing.Cast(item);
1480 if (clothing)
1481 {
1482 if (!g_Game.IsDedicatedServer())
1483 {
1484 if (clothing.GetEffectWidgetTypes())
1485 {
1486 QueueAddEffectWidget(clothing.GetEffectWidgetTypes());
1487 }
1488
1489 if (clothing.GetGlassesEffectID() > -1)
1490 {
1491 QueueAddGlassesEffect(clothing.GetGlassesEffectID());
1492 }
1493
1494 g_Game.GetCallQueue(CALL_CATEGORY_GUI).CallLater(UpdateCorpseStateVisual, 200, false);//sometimes it takes a while to load in
1495 UpdateCorpseStateVisual();//....but if possible, we don't want a delay
1496 }
1497 else if (g_Game.IsServer())
1498 {
1499 if (clothing.IsGasMask())
1500 {
1501 GetModifiersManager().ActivateModifier(eModifiers.MDF_MASK);
1502 }
1503 }
1504
1505 clothing.UpdateNVGStatus(this,true);
1506 }
1507
1508 AdjustBandana(item,slot_name);
1509 AdjustShemag(item,slot_name);
1510 }
1511
1512 override void EEItemDetached(EntityAI item, string slot_name)
1513 {
1514 super.EEItemDetached(item, slot_name);
1515 ItemBase item_base = ItemBase.Cast(item);
1516 SwitchItemSelectionTexture(item, slot_name);
1517 item.SwitchItemSelectionTextureEx(EItemManipulationContext.DETACHING);
1518 m_QuickBarBase.updateSlotsCount();
1520
1521 HideHairSelections(item_base,false);
1522
1523 Clothing clothing = Clothing.Cast(item);
1524
1525 if (clothing)
1526 {
1527 if (!g_Game.IsDedicatedServer())
1528 {
1529 if (clothing.GetEffectWidgetTypes())
1530 {
1531 QueueRemoveEffectWidget(clothing.GetEffectWidgetTypes());
1532 }
1533
1534 if (clothing.GetGlassesEffectID() > -1)
1535 {
1536 QueueRemoveGlassesEffect(clothing.GetGlassesEffectID());
1537 }
1538 }
1539
1540 if (g_Game.IsServer())
1541 {
1542 if (clothing.IsGasMask())
1543 {
1544 GetModifiersManager().DeactivateModifier(eModifiers.MDF_MASK);
1545 }
1546 }
1547
1548 clothing.UpdateNVGStatus(this, false, true);
1549 g_Game.GetCallQueue(CALL_CATEGORY_GUI).CallLater(UpdateCorpseStateVisual, 200, false);//sometimes it takes a while to load in
1550 UpdateCorpseStateVisual();//....but if possible, we don't want a delay
1551 }
1552 }
1553
1554 void UpdateShoulderProxyVisibility(EntityAI item, string slot_name)
1555 {
1556 string slot = slot_name;
1557 bool boo;
1558 boo = item.IsWeapon();
1559
1560 if (slot == "Melee")
1561 {
1562 SetSimpleHiddenSelectionState(SIMPLE_SELECTION_MELEE_RIFLE,boo);
1563 SetSimpleHiddenSelectionState(SIMPLE_SELECTION_MELEE_MELEE,!boo);
1564 }
1565 else if (slot == "Shoulder")
1566 {
1567 SetSimpleHiddenSelectionState(SIMPLE_SELECTION_SHOULDER_RIFLE,boo);
1568 SetSimpleHiddenSelectionState(SIMPLE_SELECTION_SHOULDER_MELEE,!boo);
1569 }
1570 }
1571
1572 override void SwitchItemSelectionTexture(EntityAI item, string slot_name)
1573 {
1574 super.SwitchItemSelectionTexture(item,slot_name);
1575
1576 //shirt + armband
1577 EntityAI armband = FindAttachmentBySlotName("Armband");
1578 if (slot_name == "Body" && armband)
1579 {
1580 Param1<PlayerBase> p = new Param1<PlayerBase>(this);
1581 armband.SwitchItemSelectionTextureEx(EItemManipulationContext.UPDATE,p);
1582 }
1583 }
1584
1586 {
1587 array<EntityAI> itemsArray = new array<EntityAI>;
1588 ItemBase item;
1589 GameInventory inventory = GetInventory();
1590 inventory.EnumerateInventory(InventoryTraversalType.PREORDER, itemsArray);
1591
1592 for (int i = 0; i < itemsArray.Count(); i++)
1593 {
1594 Class.CastTo(item, itemsArray.Get(i));
1595 if (item && !item.IsInherited(SurvivorBase))
1596 inventory.LocalDestroyEntity(item);
1597 }
1598 }
1599
1601 {
1603 }
1604
1605 void SetHitPPEEnabled(bool enabled)
1606 {
1607 m_CanDisplayHitEffectPPE = enabled;
1608 }
1609
1610 bool IsMale()
1611 {
1612 if (ConfigGetBool("woman") != 1)
1613 {
1614 return true;
1615 }
1616 return false;
1617 }
1618
1620 {
1621 int voice_type = ConfigGetInt("voiceType");
1622
1623 if (voice_type == 0)
1624 {
1625 voice_type = 1;
1626 }
1627
1628 return voice_type;
1629 }
1630
1631 PlayerSoundManagerServer GetPlayerSoundManagerServer()
1632 {
1634 }
1635
1636
1638 {
1639 if (!m_UndergroundHandler && IsAlive())
1640 {
1642 }
1643
1644 return m_UndergroundHandler;
1645 }
1646
1648 {
1649 m_UndergroundHandler = null;
1651 }
1652 // --------------------------------------------------
1653 // User Actions
1654 //---------------------------------------------------
1655 void SetActions(out TInputActionMap InputActionMap)
1656 {
1657 AddAction(ActionOpenDoors, InputActionMap);
1658 AddAction(ActionCloseDoors, InputActionMap);
1659 AddAction(ActionLockedDoors, InputActionMap);
1660 AddAction(ActionEnterLadder, InputActionMap);
1661 AddAction(ActionExitLadder, InputActionMap);
1662
1663 //-----------CheckIfCanMOveToTarget----------
1664 AddAction(ActionStartEngine, InputActionMap);
1665 AddAction(ActionStartEngineBoat, InputActionMap);
1666 AddAction(ActionStopEngine, InputActionMap);
1667 AddAction(ActionStopEngineBoat, InputActionMap);
1668 AddAction(ActionSwitchSeats, InputActionMap);
1669 AddAction(ActionOpenCarDoors,InputActionMap);
1670 AddAction(ActionCloseCarDoors,InputActionMap);
1671 AddAction(ActionUncoverHeadSelf, InputActionMap);
1672 AddAction(ActionDrinkPondContinuous, InputActionMap);
1673 AddAction(ActionEatSnowContinuous, InputActionMap);
1674
1675 AddAction(ActionIgniteFireplaceByAir, InputActionMap);
1676 AddAction(ActionMineBushByHand, InputActionMap);
1677
1678 AddAction(ActionUngagSelf, InputActionMap);
1679 AddAction(ActionWashHandsWater, InputActionMap);
1680 AddAction(ActionWashHandsSnow, InputActionMap);
1681 AddAction(ActionGetOutTransport, InputActionMap);
1682
1683 AddAction(ActionUnrestrainTargetHands, InputActionMap);
1684 AddAction(ActionTakeArrow, InputActionMap);
1685 AddAction(ActionTakeArrowToHands, InputActionMap);
1687 }
1688
1689 void SetActions() // Backwards compatibility, not recommended to use
1690 {
1691 }
1692
1694 {
1695 AddAction(ActionCPR, InputActionMap);
1696 AddAction(ActionUncoverHeadTarget, InputActionMap);
1697 AddAction(ActionUngagTarget, InputActionMap);
1698 AddAction(ActionPullBodyFromTransport, InputActionMap);
1699 AddAction(ActionCheckPulseTarget, InputActionMap);
1700 }
1701
1702 void SetActionsRemoteTarget() // Backwards compatibility, not recommended to use
1703 {
1704 }
1705
1707 {
1708 // Backwards compatibility
1709 if (IsControlledPlayer())
1710 {
1712 SetActions();
1713 }
1714 else
1715 {
1718 }
1720
1723
1726 }
1727
1728 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
1729 {
1731 {
1732 m_ActionsInitialize = true;
1734 }
1735
1736 // Backwards compatibility
1737 array<ActionBase_Basic> bcActions = m_InputActionMap.Get(action_input_type);
1738 if (!bcActions)
1739 {
1740 if (IsControlledPlayer())
1741 actions = m_InputActionMapControled.Get(action_input_type);
1742 else
1743 actions = m_InputActionMapAsTarget.Get(action_input_type);
1744 }
1745 else
1746 {
1747 if (!actions)
1748 actions = new array<ActionBase_Basic>();
1749
1750 if (IsControlledPlayer())
1751 actions.InsertAll(m_InputActionMapControled.Get(action_input_type));
1752 else
1753 actions.InsertAll(m_InputActionMapAsTarget.Get(action_input_type));
1754
1755 actions.InsertAll(bcActions);
1756 }
1757 }
1758
1759 void AddAction(typename actionName, out TInputActionMap InputActionMap)
1760 {
1761 ActionBase action = GetActionManager().GetAction(actionName);
1762
1763 typename ai = action.GetInputType();
1764 if (!ai)
1765 {
1766 m_ActionsInitialize = false;
1767 return;
1768 }
1769
1770 ref array<ActionBase_Basic> action_array = InputActionMap.Get(ai);
1771
1772 if (!action_array)
1773 {
1774 action_array = new array<ActionBase_Basic>;
1775 InputActionMap.Insert(ai, action_array);
1776 }
1777 action_array.Insert(action);
1778 }
1779
1780 void AddAction(typename actionName) // Backwards compatibility, not recommended to use
1781 {
1782 AddAction(actionName, m_InputActionMap);
1783 }
1784
1785 void RemoveAction(typename actionName, out TInputActionMap InputActionMap)
1786 {
1787 ActionBase action = GetActionManager().GetAction(actionName);
1788 typename ai = action.GetInputType();
1789 ref array<ActionBase_Basic> action_array = InputActionMap.Get(ai);
1790
1791 if (action_array)
1792 {
1793 for (int i = 0; i < action_array.Count(); i++)
1794 {
1795 if (action == action_array.Get(i))
1796 {
1797 action_array.Remove(i);
1798 }
1799 }
1800 action_array = new array<ActionBase_Basic>;
1801 InputActionMap.Insert(ai, action_array);
1802 }
1803 action_array.Insert(action);
1804 }
1805
1806 void RemoveAction(typename actionName) // Backwards compatibility, not recommended to use
1807 {
1808 RemoveAction(actionName, m_InputActionMap);
1809 }
1810
1812 {
1813 return m_RecipePick;
1814 }
1815
1817 {
1818 m_RecipePick++;
1819 }
1820
1822 {
1823 m_RecipePick = 0;
1824 }
1825
1826 //---------------------------------------------------
1827
1828
1833
1835 {
1836 return m_EmoteManager;
1837 }
1838
1843
1845 override void OnLadder(float delta_time, HumanMovementState pState)
1846 {
1847 ProcessHandDamage(delta_time, pState);
1848 }
1849
1850 void ProcessHandDamage(float delta_time, HumanMovementState pState)
1851 {
1852 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !g_Game.IsMultiplayer())
1853 {
1854 if (pState.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_SLIDE)
1855 {
1856 //Print("sliding down");
1857 EntityAI gloves = GetInventory().FindAttachment(InventorySlots.GLOVES);
1858
1859 if (gloves && gloves.GetHealthLevel() < 4)
1860 {
1861 gloves.AddHealth("","", PlayerConstants.GLOVES_DAMAGE_SLIDING_LADDER_PER_SEC * delta_time);
1862 return;
1863 }
1864
1866 {
1867 if (Math.RandomFloat01() < 0.5)
1868 {
1869 if (GetBleedingManagerServer().AttemptAddBleedingSourceBySelection("LeftForeArmRoll"))
1870 {
1871 SendSoundEvent(EPlayerSoundEventID.INJURED_LIGHT);
1872 }
1873 }
1874 else
1875 {
1876 if (GetBleedingManagerServer().AttemptAddBleedingSourceBySelection("RightForeArmRoll"))
1877 {
1878 SendSoundEvent(EPlayerSoundEventID.INJURED_LIGHT);
1879 }
1880 }
1881 }
1882
1883 }
1884 }
1885 }
1886
1887 override void ProcessFeetDamageServer(int pUserInt)
1888 {
1889 //InventorySlots.HEADGEAR
1890 EntityAI shoes = GetInventory().FindAttachment(InventorySlots.FEET);
1891
1892 string surface; int liquid;
1893 g_Game.SurfaceUnderObject(this, surface, liquid);
1894 float modifier_surface = Surface.GetParamFloat(surface, "footDamage");
1895
1896 if (shoes && shoes.GetHealthLevel() < 4)
1897 {
1898 shoes.AddHealth("", "", -1 * modifier_surface * PlayerConstants.SHOES_MOVEMENT_DAMAGE_PER_STEP * (float)PlayerConstants.CHECK_EVERY_N_STEP);
1899
1900 return;
1901 }
1902
1903 float rnd = Math.RandomFloat01();
1904 float modifier_movement = GetFeetDamageMoveModifier();
1905 float chance = modifier_movement * modifier_surface * PlayerConstants.BAREFOOT_MOVEMENT_BLEED_MODIFIER * (float)PlayerConstants.CHECK_EVERY_N_STEP;
1906 if (rnd < chance)
1907 {
1908 if (pUserInt % 2 == 0)
1909 {
1910 if (GetBleedingManagerServer().AttemptAddBleedingSourceBySelection("RightFoot"))
1911 SendSoundEvent(EPlayerSoundEventID.INJURED_LIGHT);
1912
1913 }
1914 else
1915 {
1916 if (GetBleedingManagerServer().AttemptAddBleedingSourceBySelection("LeftFoot"))
1917 SendSoundEvent(EPlayerSoundEventID.INJURED_LIGHT);
1918 }
1919 }
1920 }
1921
1923 {
1924 float modifier;
1925 switch(m_MovementState.m_iMovement)
1926 {
1927 case DayZPlayerConstants.MOVEMENTIDX_SPRINT:
1928 modifier = 1;
1929 break
1930 case DayZPlayerConstants.MOVEMENTIDX_RUN:
1931 modifier = 0.5;
1932 break
1933 case DayZPlayerConstants.MOVEMENTIDX_WALK:
1934 modifier = 0;
1935 break
1936 }
1937 return modifier;
1938 }
1939
1940 void SetStamina(int value, int range)
1941 {
1943 m_ModulePlayerStatus.SetStamina(value, range);
1944 }
1945
1946 #ifdef DIAG_DEVELOPER
1947 void SetStaminaDisabled(bool value)
1948 {
1949 if (m_StaminaHandler)
1950 m_StaminaHandler.SetStaminaDisabled(value);
1951 }
1952 #endif
1953
1954 void SetQuickRestrain(bool enable)
1955 {
1956 m_AllowQuickRestrain = enable;
1957 }
1958
1959 void SetQuickFishing(bool enable)
1960 {
1961 m_AllowQuickFishing = enable;
1962 }
1963
1965 {
1966 return m_AllowQuickRestrain;
1967 }
1968
1970 {
1971 return m_AllowQuickFishing;
1972 }
1973
1975 {
1976 return m_PlayerStats;
1977 }
1978
1983
1988
1990 {
1991 return m_WeaponManager;
1992 }
1993
1995 {
1996 return m_ArrowManager;
1997 }
1998
2000 {
2001 if (IsInVehicle() || IsRaised() || IsSwimming() || IsClimbing() || IsClimbingLadder() || IsRestrained() || !GetWeaponManager() || GetWeaponManager().IsRunning() || !GetActionManager() || GetActionManager().GetRunningAction() != null || IsMapOpen())
2002 {
2003 return false;
2004 }
2005 if (GetThrowing() && GetThrowing().IsThrowingModeEnabled())
2006 {
2007 return false;
2008 }
2009 return true;
2010 }
2011
2012 void SetRestrainStarted(bool restrain_started)
2013 {
2014 m_IsRestrainStarted = restrain_started;
2015 SetSynchDirty();
2016 }
2017
2019 {
2020 return m_IsRestrainStarted;
2021 }
2022
2023 void SetRestrainPrelocked(bool restrain_prelock)
2024 {
2025 m_IsRestrainPrelocked = restrain_prelock;
2026 SetSynchDirty();
2027 }
2028
2030 {
2031 return m_IsRestrainPrelocked;
2032 }
2033
2034 void SetRestrained(bool is_restrained)
2035 {
2036 m_IsRestrained = is_restrained;
2037 SetSynchDirty();
2038 }
2039
2040 override bool IsRestrained()
2041 {
2042 return m_IsRestrained;
2043 }
2044
2046 {
2047 if (m_IsRestrainStarted && IsControlledPlayer())
2048 {
2049 UIManager uiManager = g_Game.GetUIManager();
2050 if (uiManager.IsMenuOpen(MENU_RADIAL_QUICKBAR))
2051 uiManager.FindMenu(MENU_RADIAL_QUICKBAR).Close();
2052 if (uiManager.IsMenuOpen(MENU_INVENTORY))
2053 g_Game.GetMission().HideInventory();
2054 }
2055 }
2056
2058 {
2059 if (m_IsRestrained && IsControlledPlayer())
2060 {
2061 UIManager uiManager = g_Game.GetUIManager();
2062 if (uiManager.IsMenuOpen(MENU_RADIAL_QUICKBAR))
2063 uiManager.FindMenu(MENU_RADIAL_QUICKBAR).Close();
2064 if (uiManager.IsMenuOpen(MENU_INVENTORY))
2065 g_Game.GetMission().HideInventory();
2066 }
2067 }
2068
2069 override bool IsInventoryVisible()
2070 {
2071 return true;
2072 }
2073
2075 {
2076 if (IsControlledPlayer())
2077 {
2079 }
2080 return true;
2081 }
2082
2083 override bool CanReleaseAttachment (EntityAI attachment)
2084 {
2085 return super.CanReleaseAttachment(attachment);
2086 }
2087
2088 override bool CanReleaseCargo (EntityAI cargo)
2089 {
2090 return super.CanReleaseCargo(cargo);
2091 }
2092
2094 {
2095 return super.CanReceiveItemIntoCargo(item);
2096 }
2097
2098 override bool CanSwapItemInCargo (EntityAI child_entity, EntityAI new_entity)
2099 {
2100 return super.CanSwapItemInCargo(child_entity, new_entity);
2101 }
2102
2103 override bool CanReceiveItemIntoHands(EntityAI item_to_hands)
2104 {
2105 if (IsInVehicle())
2106 return false;
2107
2108 if (!CanPickupHeavyItem(item_to_hands))
2109 return false;
2110
2111 return super.CanReceiveItemIntoHands(item_to_hands);
2112 }
2113
2114
2116 {
2117 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
2118 {
2119 return GetCraftingManager().GetRecipeID();
2120 }
2121 else
2122 {
2123 return m_RecipeID;
2124 }
2125 }
2126
2127 void SetCraftingRecipeID(int recipeID)
2128 {
2129 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
2130 {
2131 GetCraftingManager().SetRecipeID(recipeID);
2132 }
2133 else
2134 {
2135 m_RecipeID = recipeID;
2136 }
2137 }
2138
2139 // --------------------------------------------------
2140 // Action data for base building actions
2141 //---------------------------------------------------
2146
2148 {
2150 {
2151 m_ConstructionActionData.ResetActionIndexes();
2152 }
2153 }
2154
2155 // --------------------------------------------------
2156 // Action data for fireplace (indoor)
2157 //---------------------------------------------------
2159 {
2160 return m_LastFirePoint;
2161 }
2163 {
2164 return m_LastFirePointRot;
2165 }
2167 {
2168 return m_LastFirePointIndex;
2169 }
2170
2171 void SetLastFirePoint(vector last_fire_point)
2172 {
2173 m_LastFirePoint = last_fire_point;
2174 }
2175 void SetLastFirePointRot(float last_fire_point_rot)
2176 {
2177 m_LastFirePointRot = last_fire_point_rot;
2178 }
2179 void SetLastFirePointIndex(int last_fire_point_index)
2180 {
2181 m_LastFirePointIndex = last_fire_point_index;
2182 }
2183
2184 // --------------------------------------------------
2185 // QuickBar
2186 //---------------------------------------------------
2187
2189 {
2190 int index = m_QuickBarBase.FindEntityIndex(entity);
2191 if (index != -1)
2192 m_QuickBarBase.SetEntityShortcut(entity,-1);
2193 }
2194 //---------------------------------------------------
2196 {
2197 int index = m_QuickBarBase.FindEntityIndex(entity);
2198 if (index != -1)
2199 m_QuickBarBase.SetShotcutEnable(index,value);
2200
2201 }
2202 //---------------------------------------------------
2204 {
2205 int index;
2206 index = m_QuickBarBase.FindEntityIndex(entity);
2207
2208 if (m_QuickBarBase.GetEntity(index) == NULL)
2209 return -1;
2210
2211 return index;
2212 }
2213 //---------------------------------------------------
2214
2216 {
2217 return m_QuickBarBase.GetSize();
2218 }
2219 //---------------------------------------------------
2221 {
2222 return m_QuickBarBase.GetEntity(index);
2223 }
2224 //---------------------------------------------------
2226 {
2227 int i = FindQuickBarEntityIndex(entity);
2228 if (i >= 0)
2229 m_QuickBarBase.UpdateShotcutVisibility(i);
2230 }
2231 //---------------------------------------------------
2232 void SetQuickBarEntityShortcut(EntityAI entity, int index, bool force = false)
2233 {
2234 m_QuickBarBase.SetEntityShortcut(entity, index, force);
2235 }
2236 //---------------------------------------------------
2238 {
2239 m_QuickBarBase.OnSetEntityRequest(ctx);
2240 }
2241 //---------------------------------------------------
2242
2243 // Applies splint on all limbs.
2245 {
2246 float add_health_coef = 0.33;
2247 // The idea is to slightly increase health of broken limb so the player is still limping. Using more splints will help but each time less. 100% recovery can be achieved only through long term healing.
2248 if (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
2249 {
2250 AddHealth("LeftLeg", "Health", (GetMaxHealth("LeftLeg", "Health") - GetHealth("LeftLeg", "Health") ) * add_health_coef );
2251 AddHealth("RightLeg", "Health", (GetMaxHealth("RightLeg", "Health") - GetHealth("RightLeg", "Health")) * add_health_coef );
2252 AddHealth("RightFoot", "Health", (GetMaxHealth("RightFoot", "Health") - GetHealth("RightFoot", "Health")) * add_health_coef );
2253 AddHealth("LeftFoot", "Health", (GetMaxHealth("LeftFoot", "Health") - GetHealth("LeftFoot", "Health")) * add_health_coef );
2254 }
2255 }
2256
2257 void ProcessDrowning(float dT)
2258 {
2259 GetStaminaHandler().DepleteStaminaEx(EStaminaModifiers.DROWN,dT);
2260
2261 #ifndef SERVER
2262 //PP EFFECTS
2263 PPERequester_Drowning req = PPERequester_Drowning.Cast(PPERequesterBank.GetRequester(PPERequesterBank.REQ_DROWNING));
2264 req.SetStamina01(GetStaminaHandler().GetStaminaNormalized());
2265 #endif
2266 }
2267
2269 {
2271 return;
2273 int boneIdx = GetBoneIndexByName("Head");
2274
2275 if (boneIdx != -1)
2276 {
2277 Particle p = ParticleManager.GetInstance().PlayInWorld(ParticleList.DROWNING_BUBBLES, "-0.03 0.15 0");
2278 if (p)
2279 AddChild(p, boneIdx);
2280 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(SpawnDrowningBubbles, bubbleFrequency);
2281 }
2282 }
2283
2284 void ProcessHoldBreath(float dT)
2285 {
2286 if (IsTryingHoldBreath() && CanStartConsumingStamina(EStaminaConsumers.HOLD_BREATH))
2287 {
2288 if (!m_IsHoldingBreath)
2289 {
2291 m_IsHoldingBreath = true;
2292 }
2293 }
2294 else if (!IsTryingHoldBreath() || !CanConsumeStamina(EStaminaConsumers.HOLD_BREATH))
2295 {
2297 m_IsHoldingBreath = false;
2298 }
2299 }
2300
2302 {
2303 //SendSoundEvent(SoundSetMap.GetSoundSetID("holdBreath_male_Char_SoundSet"));
2304 RequestSoundEventEx(EPlayerSoundEventID.HOLD_BREATH, true, EPlayerSoundEventParam.SKIP_CONTROLLED_PLAYER);
2305 }
2306
2308 {
2309 RequestSoundEventEx(EPlayerSoundEventID.EXHAUSTED_BREATH, true, EPlayerSoundEventParam.SKIP_CONTROLLED_PLAYER);
2310 }
2311
2313 {
2314 //SendSoundEvent(SoundSetMap.GetSoundSetID("releaseBreath_male_Char_SoundSet"));
2315 RequestSoundEventEx(EPlayerSoundEventID.RELEASE_BREATH, true, EPlayerSoundEventParam.SKIP_CONTROLLED_PLAYER);
2316 }
2317
2318 override bool IsHoldingBreath()
2319 {
2320 return m_IsHoldingBreath;
2321 }
2322
2324 {
2325 return false;
2326 }
2327
2329 {
2330 return IsAlive();
2331 }
2332
2337
2339 {
2341 {
2344
2346 }
2347
2348 m_SaySoundObject = m_SaySoundBuilder.BuildSoundObject();
2349 m_SaySoundObject.SetPosition(GetPosition());
2350 return g_Game.GetSoundScene().Play3D(m_SaySoundObject, m_SaySoundBuilder);
2351 }
2352
2353 EntityAI FindCargoByBaseType(string searched_item)
2354 {
2355 EntityAI attachment;
2356 string item_name;
2357 GameInventory inventory = GetInventory();
2358 int attcount = inventory.AttachmentCount();
2359
2360 for (int att = 0; att < attcount; ++att)
2361 {
2362 attachment = inventory.GetAttachmentFromIndex(att);
2363 if (attachment.IsItemBase())
2364 {
2365 item_name = attachment.GetType();
2366 if (g_Game.IsKindOf(item_name, searched_item))
2367 {
2368 return attachment;
2369 }
2370 }
2371 }
2372 return NULL;
2373 }
2374
2376 {
2377 if (g_Game.IsDebug())
2378 {
2379 if (!g_Game.IsMultiplayer() && g_Game.GetPlayer() && g_Game.GetPlayer().GetID() == this.GetID())
2380 {
2381 PluginSceneManager scene_editor = PluginSceneManager.Cast(GetPlugin(PluginSceneManager));
2382 scene_editor.InitLoad();
2383 }
2384 }
2385 }
2386
2387 //---------------------------------------------------------------------------------------------------------------------------
2389 {
2390 InitEditor();
2391
2393 if (m_Environment)
2394 m_Environment.Init();
2395
2396 if (g_Game.IsMultiplayer() || g_Game.IsServer())
2397 {
2398 if (m_ModuleLifespan)
2399 {
2401 }
2402 }
2403
2404 if (IsControlledPlayer())//true only on client for the controlled character
2405 {
2407
2408 Mission mission = g_Game.GetMission();
2409 if (m_Hud)
2410 {
2411 m_Hud.UpdateBloodName();
2412 PPEManagerStatic.GetPPEManager().StopAllEffects(PPERequesterCategory.GAMEPLAY_EFFECTS);
2413 g_Game.GetUIManager().CloseAll();
2414 mission.SetPlayerRespawning(false);
2415 mission.OnPlayerRespawned(this);
2416
2417 m_Hud.ShowQuickbarUI(true);
2418 m_Hud.UpdateQuickbarGlobalVisibility();
2419 m_Hud.InitHeatBufferUI(this);
2420 m_Hud.OnPlayerLoaded();
2421 }
2422 m_EffectWidgets = mission.GetEffectWidgets();
2423 }
2424 if (!g_Game.IsDedicatedServer())
2425 {
2426 g_Game.GetCallQueue(CALL_CATEGORY_GUI).CallLater(UpdateCorpseStateVisual, 2000, false);//sometimes it takes a while to load in
2427 m_PlayerSoundEventHandler = new PlayerSoundEventHandler(this);
2428 m_ReplaceSoundEventHandler = new ReplaceSoundEventHandler(this);
2429 }
2430 int slotId = InventorySlots.GetSlotIdFromString("Head");
2431 m_CharactersHead = Head_Default.Cast(GetInventory().FindPlaceholderForSlot(slotId));
2435
2437 if (wpn)
2438 {
2439 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_REMOTE)
2440 {
2441 wpn.DelayedValidateAndRepair();
2442 }
2443 else
2444 {
2445 wpn.ValidateAndRepair();
2446 }
2447 }
2448
2449 m_PlayerLoaded = true;
2450 }
2451
2452 void SetPlayerDisconnected(bool state)
2453 {
2455 }
2456
2458 {
2460 }
2461
2462 // --------------------------------------------------
2463 // Advanced placement
2464 //---------------------------------------------------
2465
2466 //get hologram
2468 {
2469 return m_HologramServer;
2470 }
2471
2473 {
2474 return m_HologramLocal;
2475 }
2476
2478 {
2479 if (item)
2480 {
2482 m_HologramServer.SetProjectionPosition(GetLocalProjectionPosition());
2483 m_HologramServer.SetProjectionOrientation(GetLocalProjectionOrientation());
2484 m_HologramServer.GetProjectionEntity().OnPlacementStarted(this);
2485 m_HologramServer.CheckPowerSource();
2486 m_HologramServer.RefreshVisual();
2487 }
2488 }
2489
2491 {
2492 if (g_Game.IsMultiplayer() && g_Game.IsServer())
2493 return;
2494
2495 if (item)
2496 {
2498 m_HologramLocal.GetProjectionEntity().OnPlacementStarted(this);
2499 }
2500 }
2501
2503 {
2504 EntityAI entityInHands = GetEntityInHands();
2505
2506 if (IsPlacingServer())
2507 {
2508 m_HologramServer.CheckPowerSource();
2509 m_HologramServer.GetParentEntity().OnPlacementCancelled(this);
2510
2511 delete m_HologramServer;
2512
2513 return;
2514 }
2515 else if (entityInHands && entityInHands.HasEnergyManager())
2516 {
2517 if (entityInHands.GetCompEM().IsPlugged())
2518 entityInHands.OnPlacementCancelled(this);
2519 }
2520 }
2521
2522 //Called when item placement is canceled, will prevent quickbar usage until the item the player was placing is back in hands
2524 {
2525 m_AreHandsLocked = true;
2526 }
2527
2529 {
2530 EntityAI entityInHands = GetEntityInHands();
2531 if (entityInHands && entityInHands.HasEnergyManager())
2532 {
2533 if (entityInHands.GetCompEM().IsPlugged())
2534 entityInHands.OnPlacementCancelled(this);
2535 }
2536
2537 delete m_HologramLocal;
2538 }
2539
2545
2551
2553 {
2554 return m_HologramServer != null;
2555 }
2556
2558 {
2559 return m_HologramLocal != null;
2560 }
2561
2562 void SetDrowning(bool enable)
2563 {
2564 if (enable != m_IsDrowning)
2565 {
2566 if (enable)
2568 else
2569 OnDrowningEnd();
2570 }
2571
2572 m_IsDrowning = enable;
2573 }
2574
2576 {
2577 #ifndef SERVER
2578 if (IsControlledPlayer())
2579 {
2580 PPERequester_Drowning req = PPERequester_Drowning.Cast(PPERequesterBank.GetRequester(PPERequesterBank.REQ_DROWNING));
2581 req.Start();
2582 }
2583 //Particles
2585 #endif
2586 }
2587
2589 {
2590 #ifndef SERVER
2591 if (IsControlledPlayer())
2592 {
2593 PPERequester_Drowning req = PPERequester_Drowning.Cast(PPERequesterBank.GetRequester(PPERequesterBank.REQ_DROWNING));
2594 req.Stop();
2595 }
2596 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(SpawnDrowningBubbles);
2597 #endif
2598 }
2599
2600 bool TogglePlacingServer(int userDataType, ParamsReadContext ctx)
2601 {
2602 if (userDataType == INPUT_UDT_ADVANCED_PLACEMENT)
2603 {
2605 return true;
2606 }
2607
2608 return false;
2609 }
2610
2612 {
2613 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT && g_Game.IsMultiplayer())
2614 {
2615 m_ProcessResetADS = true;
2617 }
2618 else if (!g_Game.IsMultiplayer())
2619 {
2620 m_ResetADS = true;
2621 }
2622 }
2623
2625 {
2627 {
2630 ctx.Send();
2631
2632 m_ProcessResetADS = false;
2633 }
2634 }
2635
2637 bool ResetADSPlayerSync(int userDataType, ParamsReadContext ctx)
2638 {
2639 if (userDataType == INPUT_UDT_RESET_ADS)
2640 {
2643 return true;
2644 }
2645
2646 return false;
2647 }
2648
2649 override bool CanPlaceItem(EntityAI item)
2650 {
2652 {
2653 TStringSet disallowedUndergroundTypes = CfgGameplayHandler.GetDisallowedTypesInUnderground();
2654 foreach (string t: disallowedUndergroundTypes)
2655 {
2656 if (item.IsKindOf(t))
2657 return false;
2658 }
2659 }
2660 return true;
2661 }
2662
2664 {
2665 m_UndergroundPresence = presence;
2666 }
2667
2669 {
2670 if (IsPlacingLocal())
2671 {
2672 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT && g_Game.IsMultiplayer())
2673 {
2675 {
2678 ctx.Send();
2679
2681 }
2682 }
2683 else
2685 }
2686 else if (!item)
2687 {
2689 }
2690 else
2691 {
2692 PlacingStartLocal(item);
2693 }
2694 }
2695
2697 {
2698 m_LocalProjectionPosition = local_position;
2699
2700 #ifdef DEVELOPER
2701 if (IsCLIParam("hologramLogs"))
2702 {
2703 Debug.Log(string.Format("SetLocalProjectionPosition | pos: %1", m_LocalProjectionPosition), "hologramLogs");
2704 }
2705 #endif
2706 }
2707
2709 {
2710 m_LocalProjectionOrientation = local_orientation;
2711 }
2712
2717
2722
2723 void SetInColdArea(bool state)
2724 {
2725 if (m_IsInColdArea != state)
2726 {
2727 m_IsInColdArea = state;
2728 SetSynchDirty();
2729 }
2730 }
2731
2733 {
2734 return m_IsInColdArea;
2735 }
2736
2737 // ------------------------------------------------------------------------
2738
2740 void SetInWater(bool pState)
2741 {
2742 m_IsInWater = pState;
2743 SetSynchDirty();
2744 }
2745
2747 {
2748 return m_IsInWater;
2749 }
2750
2751 // -------------------------------------------------------------------------
2752
2754 {
2755 m_CameraSwayModifier = new_camera.GetWeaponSwayModifier();
2756 m_CurrentCamera = new_camera;
2757 }
2758
2763
2765 {
2766 if (!m_CurrentCamera)
2767 return false;
2768
2769 return m_CurrentCamera.GetCurrentPitch() < PlayerConstants.CAMERA_THRESHOLD_PITCH;
2770 }
2771
2772 BleedingSourcesManagerServer GetBleedingManagerServer()
2773 {
2775 }
2776
2777 BleedingSourcesManagerRemote GetBleedingManagerRemote()
2778 {
2780 }
2781
2787 {
2788 if (!m_VirtualHud)
2789 {
2790 m_VirtualHud = new VirtualHud(this);
2791 }
2792 return m_VirtualHud;
2793 }
2794
2795 TransferValues GetTransferValues()
2796 {
2797 return m_TrasferValues;
2798 }
2799
2804
2805 //--------------------------------------------------------------------------
2806 void OnScheduledTick(float deltaTime)
2807 {
2808 if (!IsPlayerSelected() || !IsAlive())
2809 return;
2811 m_ModifiersManager.OnScheduledTick(deltaTime);
2812 if (m_NotifiersManager)
2813 m_NotifiersManager.OnScheduledTick();
2814 if (m_TrasferValues)
2815 m_TrasferValues.OnScheduledTick(deltaTime);
2816 if (m_VirtualHud)
2817 m_VirtualHud.OnScheduledTick();
2819 GetBleedingManagerServer().OnTick(deltaTime);
2820 if (m_Environment)
2821 m_Environment.Update(deltaTime);
2822
2823 // Check if electric device needs to be unplugged
2824 EntityAI heldEntity = GetEntityInHands();
2825 if (heldEntity && heldEntity.HasEnergyManager() && heldEntity.GetCompEM().IsPlugged())
2826 {
2827 // Now we know we are working with an electric device which is plugged into a power source.
2828 EntityAI placed_entity = heldEntity;
2829
2830 // Unplug the device when the player is too far from the power source.
2831 placed_entity.GetCompEM().UpdatePlugState();
2832 }
2833 }
2834
2835 void OnCommandHandlerTick(float delta_time, int pCurrentCommandID)
2836 {
2837 if (!IsAlive())
2838 {
2839 if (!m_DeathSyncSent && m_KillerData)
2840 {
2841 SyncEvents.SendEntityKilled(this, m_KillerData.m_Killer, m_KillerData.m_MurderWeapon, m_KillerData.m_KillerHiTheBrain);
2842 m_DeathSyncSent = true;
2843 }
2844 return;
2845 }
2847 m_DebugMonitorValues.OnScheduledTick(delta_time);
2848 if (GetSymptomManager())
2849 GetSymptomManager().OnTick(delta_time, pCurrentCommandID, m_MovementState);//needs to stay in command handler tick as it's playing animations
2850 //if (GetBleedingManagerServer()) GetBleedingManagerServer().OnTick(delta_time);
2851
2853 if (instType == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
2854 {
2855 if (m_PlayerSoundEventHandler)
2856 m_PlayerSoundEventHandler.OnTick(delta_time);
2857
2859 {
2860 m_EffectWidgets.RemoveActiveEffects(m_ProcessRemoveEffectWidgets);
2861 }
2862
2864 {
2866 }
2867
2869
2872
2873 #ifdef DIAG_DEVELOPER
2874 if (m_WeaponDebug)
2875 {
2876 m_WeaponDebug.OnCommandHandlerUpdate();
2877 }
2878 #endif
2879
2880 m_ProcessAddEffectWidgets.Clear(); //clears array for remotes as well
2881 m_ProcessRemoveEffectWidgets.Clear(); //clears array for remotes as well
2882 }
2883
2884 m_AnimCommandStarting = HumanMoveCommandID.None;
2885
2888
2889 if (m_ProcessResetADS)
2891 }
2892
2895 {
2896 HumanCommandMove hcm = GetCommand_Move();
2897 if (hcm)
2898 {
2899 float staminaPercentage = GetStaminaHandler().GetSyncedStaminaNormalized();
2900 hcm.SetTurnSpanSprintModifier(2 - staminaPercentage);
2901 hcm.SetRunSprintFilterModifier((2 - staminaPercentage) * 0.5);
2902 hcm.SetDirectionSprintFilterModifier(2 - staminaPercentage);
2903 }
2904 }
2905
2906 bool m_ShowDbgUI = true;
2908 float m_DbgSliderValue = 0.0;
2909 ref array<string> m_DbgOptions = {"jedna", "dva", "tri"};
2910
2915
2916 //--------------------------------------------------------------------------
2917 void OnTick()
2918 {
2919 int currentTime = g_Game.GetTime();
2920 float deltaT = (currentTime - m_LastTick) * 0.001;
2921 if (m_LastTick < 0)
2922 deltaT = 0; //first tick protection
2923
2924 m_LastTick = currentTime;
2925
2926 OnScheduledTick(deltaT);
2927 }
2928
2929 // -------------------------------------------------------------------------
2930 override void EEItemIntoHands(EntityAI item)
2931 {
2932 super.EEItemIntoHands(item);
2933
2934 if (item)
2935 {
2936 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(item, {Bolt_Base});
2937
2938 Weapon_Base w;
2939 if (Class.CastTo(w, item))
2940 {
2941 w.ResetWeaponAnimState();
2942
2943 HumanCommandMove cm = GetCommand_Move();
2944 if (cm)
2945 {
2946 cm.SetMeleeBlock(false);
2947 GetMeleeFightLogic().SetBlock(false);
2948 }
2949 }
2950
2952 if (item.IsHeavyBehaviour() && IsRaised())
2953 {
2954 HumanCommandMove cm2 = GetCommand_Move();
2955 if (cm2)
2956 {
2957 cm2.ForceStance(DayZPlayerConstants.STANCEIDX_ERECT);
2958 }
2959 }
2960
2961 SurrenderDummyItem dummyItem;
2962 if (Class.CastTo(dummyItem, item) && GetEmoteManager())
2963 GetEmoteManager().ForceSurrenderState(true);
2964
2966 }
2967 }
2968
2969 override void EEItemOutOfHands(EntityAI item)
2970 {
2971 super.EEItemOutOfHands(item);
2972
2973 if (IsPlacingLocal())
2974 {
2975 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).Call(TogglePlacingLocal, item);
2976 }
2977
2978 SurrenderDummyItem dummyItem;
2979 if (Class.CastTo(dummyItem, item) && GetEmoteManager())
2980 GetEmoteManager().ForceSurrenderState(false);
2981
2983 }
2984
2986 {
2987 return m_PlayerStomach;
2988 }
2989
2990 override void CommandHandler(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
2991 {
2992 EvaluateDamageHit(pCurrentCommandID);
2993
2994 // lower implement
2995 super.CommandHandler(pDt,pCurrentCommandID,pCurrentCommandFinished);
2996
2997 vector playerPosition = PhysicsGetPositionWS();
2998
2999 HumanInputController hic = GetInputController();
3000
3003
3005
3006 if (m_BrokenLegsJunctureReceived)//was there a change in broken legs state ?
3007 {
3009 bool initial = m_BrokenLegState < 0;//negative values indicate initial activation
3010
3011 if (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
3012 {
3013 DropHeavyItem();
3014 if (initial)
3015 {
3017 hic.ResetADS();
3018 GetUApi().GetInputByID(UATempRaiseWeapon).Supress();
3019 ExitSights();
3020 }
3021 }
3022 }
3023
3024 if (IsFireWeaponRaised() || m_IsHoldingBreath)
3025 {
3026 ProcessHoldBreath(pDt);
3027 }
3028
3030
3031 if (m_AreHandsLocked && GetEntityInHands())
3032 {
3033 m_AreHandsLocked = false;
3034 }
3035
3036 // freelook camera memory for weapon raycast
3038 {
3039 if (hic.CameraIsFreeLook())
3040 {
3041 m_DirectionToCursor = g_Game.GetCurrentCameraDirection();
3042 }
3043 }
3044 else
3045 {
3046 if (!hic.CameraIsFreeLook())
3047 {
3049 }
3050 }
3051
3052 if (m_WeaponManager)
3053 {
3054 m_WeaponManager.Update(pDt);
3055 }
3056 if (m_EmoteManager && IsPlayerSelected())
3057 {
3058 m_EmoteManager.Update(pDt);
3059 }
3060 if (m_RGSManager)
3061 {
3062 m_RGSManager.Update();
3063 }
3064 if (m_StanceIndicator)
3065 {
3066 m_StanceIndicator.Update();
3067 }
3068 if (m_StaminaHandler)
3069 {
3070 m_StaminaHandler.Update(pDt, pCurrentCommandID);
3071 }
3072 if (m_InjuryHandler)
3073 {
3074 m_InjuryHandler.Update(pDt);
3075 }
3076 if (m_HCAnimHandler)
3077 {
3078 m_HCAnimHandler.Update(pDt, m_MovementState);
3079 }
3080 if (m_ShockHandler)
3081 {
3082 m_ShockHandler.Update(pDt);
3083 }
3084
3085 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !g_Game.IsMultiplayer())
3086 {
3087 GetPlayerSoundManagerServer().Update();
3088 ShockRefill(pDt);
3089 FreezeCheck();
3090 }
3091
3092 if (m_IsDrowning)
3093 {
3094 ProcessDrowning(pDt);
3095 }
3096 UpdateDelete();
3097
3098 HandleDamageHit(pCurrentCommandID);
3099
3100 if (mngr && hic)
3101 {
3102 mngr.Update(pCurrentCommandID);
3103
3104 HumanCommandUnconscious hcu = GetCommand_Unconscious();
3105 HumanCommandVehicle hcv = GetCommand_Vehicle();
3106
3107 if (!m_UnconsciousDebug)
3108 {
3110 if (m_ShouldBeUnconscious && m_IsUnconscious)
3111 {
3112 if (hcu)
3113 {
3115 m_Swimming.m_bWasSwimming |= hcu.IsInWater();
3116 }
3117
3118 if (m_Swimming.m_bWasSwimming)
3119 {
3120 m_LastCommandBeforeUnconscious = DayZPlayerConstants.COMMANDID_SWIM;
3121 }
3122
3123 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
3124 }
3126 else if (m_ShouldBeUnconscious)
3127 {
3129 bool isTransitioning = hcv && (hcv.IsGettingIn() || hcv.IsGettingOut() || hcv.IsSwitchSeat());
3130
3131 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
3132 {
3133 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
3134
3135 m_IsUnconscious = true;
3137 }
3141 else if (pCurrentCommandID != DayZPlayerConstants.COMMANDID_DEATH && pCurrentCommandID != DayZPlayerConstants.COMMANDID_FALL && !isTransitioning)
3142 {
3143 m_LastCommandBeforeUnconscious = pCurrentCommandID;
3144
3145 if (hcv)
3146 {
3147 m_TransportCache = hcv.GetTransport();
3148 }
3149 else
3150 {
3151 m_TransportCache = null;
3152 }
3153
3155 m_JumpClimb.CheckAndFinishJump();
3156 StartCommand_Unconscious(0);
3157 SetFallYDiff(playerPosition[1]);
3158 }
3159 }
3161 else if (m_IsUnconscious)
3162 {
3164 if (hcu && pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
3165 {
3166 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
3167
3169 if (m_UnconsciousTime > 2)
3170 {
3171 int wakeUpStance = DayZPlayerConstants.STANCEIDX_PRONE;
3172
3174 if (m_Swimming.m_bWasSwimming || m_LastCommandBeforeUnconscious == DayZPlayerConstants.COMMANDID_VEHICLE)
3175 wakeUpStance = -1;
3176
3177 hcu.WakeUp(wakeUpStance);
3178
3179 m_IsUnconscious = false;
3180 OnUnconsciousStop(pCurrentCommandID);
3181 }
3182 }
3183 else
3184 {
3186 if (IsAlive())
3187 {
3188 m_IsUnconscious = false;
3189 OnUnconsciousStop(pCurrentCommandID);
3190 }
3191 }
3192 }
3193 }
3194
3195 // quickbar use
3196 int quickBarSlot = hic.IsQuickBarSlot();
3197 if (quickBarSlot && IsAlive())
3198 {
3199 if (hic.IsQuickBarSingleUse())
3200 {
3201 OnQuickBarSingleUse(quickBarSlot);
3202 //Print("PlayerBase.c IsQuickBarSingleUse - slot: " + quickBarSlot.ToString());
3203 }
3204 if (hic.IsQuickBarContinuousUseStart() && ((!g_Game.IsDedicatedServer()) && !g_Game.GetUIManager().GetMenu()))
3205 {
3206 OnQuickBarContinuousUseStart(quickBarSlot);
3207 //Print("PlayerBase.c IsQuickBarContinuousUseStart - slot: " + quickBarSlot.ToString());
3208 }
3209 if (hic.IsQuickBarContinuousUseEnd() && ((!g_Game.IsDedicatedServer())))
3210 {
3211 OnQuickBarContinuousUseEnd(quickBarSlot);
3212 //Print("PlayerBase.c IsQuickBarContinuousUseEnd - slot: " + quickBarSlot.ToString());
3213 }
3214 }
3215
3216 /*if ((pCurrentCommandID == DayZPlayerConstants.COMMANDID_ACTION || pCurrentCommandID == DayZPlayerConstants.COMMANDID_MOVE || pCurrentCommandID == DayZPlayerConstants.COMMANDID_LADDER || pCurrentCommandID == DayZPlayerConstants.COMMANDID_SWIM))
3217 {
3218 mngr.Update(); // checks for suitable action and sets it
3219 }*/
3220 }
3221
3222 if (m_StaminaHandler && hic)
3223 {
3224 HumanCommandMove hcm = GetCommand_Move();
3225 bool isSwimmingOrClimbing = GetCommand_Swim() || GetCommand_Climb() || GetCommand_Ladder();
3226 bool isStaminaLimitAppliable = hcm || isSwimmingOrClimbing;
3227
3228 if (isStaminaLimitAppliable)
3229 {
3231 }
3232 }
3233
3234 //map closing - feel free to move to different "update" if it does not belong here
3235 if (IsMapOpen())
3236 {
3237 if (!g_Game.IsDedicatedServer())
3238 {
3239 if (!CfgGameplayHandler.GetUse3DMap() && !g_Game.GetUIManager().IsMenuOpen(MENU_MAP))
3240 {
3241 CloseMapEx(false);
3242 }
3244 {
3246 {
3247 CloseMapEx(true);
3248 }
3249 else if (IsMapCallbackEndInput())
3250 {
3251 CloseMapEx(false);
3252 }
3253 }
3254 }
3255 }
3256
3257
3258 #ifdef DIAG_DEVELOPER
3259 if (m_Bot)
3260 m_Bot.OnUpdate(pDt);
3261 #endif
3262
3263 if (m_CheckMeleeItem && (!g_Game.IsDedicatedServer()))
3264 {
3267 }
3268
3269 #ifdef DEVELOPER
3270 TryGetInVehicleDebug();
3271 #endif
3272
3273 OnCommandHandlerTick(pDt, pCurrentCommandID);
3274 }
3275
3276 #ifdef DEVELOPER
3277 void SetGetInVehicleDebug(EntityAI ent)
3278 {
3279 m_GetInVehicleTransportDebug = Transport.Cast(ent);
3280 }
3281
3282 void TryGetInVehicleDebug()
3283 {
3284 if (m_GetInVehicleTransportDebug)
3285 {
3286 HumanCommandVehicle vehCommand = StartCommand_Vehicle(m_GetInVehicleTransportDebug, 0, 0);
3287 if (vehCommand)
3288 {
3289 vehCommand.SetVehicleType(m_GetInVehicleTransportDebug.GetAnimInstance());
3290 }
3291 m_GetInVehicleTransportDebug = null;
3292 }
3293 }
3294 #endif
3295
3296 //MAP handling
3299 {
3300 CloseMapEx(false);
3301 }
3302
3303 void CloseMapEx(bool cancelled)
3304 {
3305 if (m_hac && !GetMapClosingSyncSent())
3306 {
3307 Mission mission = g_Game.GetMission();
3309 {
3310 if (g_Game.IsMultiplayer() && g_Game.IsClient())
3311 {
3312 ActionManagerClient mngr_client;
3313 CastTo(mngr_client, GetActionManager());
3314
3315 if (cancelled)
3316 {
3317 mngr_client.RequestInterruptAction();
3318 }
3319 else
3320 {
3321 mngr_client.RequestEndAction();
3322 }
3323
3324 mission.RemoveActiveInputExcludes({"map"});
3325 mission.RemoveActiveInputRestriction(EInputRestrictors.MAP);
3326 }
3327 else if (!g_Game.IsMultiplayer())
3328 {
3329 int command_ID = DayZPlayerConstants.CMD_ACTIONINT_END;
3330 if (cancelled)
3331 {
3332 command_ID = DayZPlayerConstants.CMD_ACTIONINT_INTERRUPT;
3333 }
3334 m_hac.InternalCommand(command_ID);
3335 }
3337 }
3338 }
3339
3340 if (!g_Game.IsDedicatedServer())
3341 {
3342 UIManager uiManager = g_Game.GetUIManager();
3343 if (uiManager.IsMenuOpen(MENU_MAP))
3344 {
3345 uiManager.FindMenu(MENU_MAP).Close();
3346 if (m_Hud)
3347 {
3348 m_Hud.ShowQuickbarPlayer(true);
3349 }
3350
3351 mission.RemoveActiveInputExcludes({"map"});
3352 mission.RemoveActiveInputRestriction(EInputRestrictors.MAP);
3353 }
3354 }
3355 }
3356
3357 void SetMapOpen(bool state)
3358 {
3359 m_MapOpen = state;
3360 }
3361
3363 {
3364 return m_MapOpen;
3365 }
3366
3367 void SetMapClosingSyncSet(bool state)
3368 {
3369 m_MapClosingSyncSent = state;
3370 }
3371
3373 {
3374 return m_MapClosingSyncSent;
3375 }
3376
3378 {
3379 if (IsRaised())
3380 {
3381 return true;
3382 }
3383
3384 return false;
3385 }
3386
3388 {
3389 if (GetUApi().GetInputByID(UADefaultAction).LocalPress() || GetUApi().GetInputByID(UAUIMenu).LocalPress() || GetUApi().GetInputByID(UAGear).LocalPress())
3390 {
3391 return true;
3392 }
3393
3394 return false;
3395 }
3396
3401
3403 {
3405 {
3406 GetMapNavigationBehaviour().OnItemInPlayerPossession(item);
3407 }
3408 }
3409
3411 {
3413 {
3414 GetMapNavigationBehaviour().OnItemNotInPlayerPossession(item);
3415 }
3416 }
3417
3418 void SetCheckMeleeItem(ItemBase item = null)
3419 {
3420 m_CheckMeleeItem = item;
3421 }
3422
3423 void SetShakesForced(int value)
3424 {
3425 m_ShakesForced = value;
3426 }
3427
3429 {
3430 int level;
3431 if (m_ShakesForced > 0)
3432 {
3433 level = m_ShakesForced;
3434 }
3435 else
3436 {
3437 float heat_comfort = GetStatHeatComfort().Get();
3439 {
3441 level = Math.Lerp(1,7,value);
3442 level = Math.Clamp(value,1,7);
3443 /*
3444 value = Math.Clamp(value,0,1);
3445 level = Math.Round(value * SHAKE_LEVEL_MAX);//translate from normalized value to levels
3446 */
3447 }
3448 }
3449 if (level != m_Shakes)
3450 {
3451 m_Shakes = level;
3452 SetSynchDirty();
3453 }
3454 }
3455
3456 override bool IsLanded(int pCurrentCommandID)
3457 {
3458 if (super.IsLanded(pCurrentCommandID))
3459 {
3460 return true;
3461 }
3462
3464 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
3465 {
3466 bool wasFalling = m_IsUnconsciousFalling;
3467 m_IsUnconsciousFalling = PhysicsIsFalling(false);
3468 return wasFalling && !m_IsUnconsciousFalling;
3469 }
3470
3472
3473 return false;
3474 }
3475
3476 override bool OnLand(int pCurrentCommandID, FallDamageData fallDamageData)
3477 {
3478 if (super.OnLand(pCurrentCommandID, fallDamageData))
3479 {
3480 return true;
3481 }
3482
3485
3486 return false;
3487 }
3488
3489 override bool IsAlreadyInFallingCommand(int pCurrentCommandID)
3490 {
3491 if (super.IsAlreadyInFallingCommand(pCurrentCommandID))
3492 {
3493 return true;
3494 }
3495
3498 return pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS || pCurrentCommandID == DayZPlayerConstants.COMMANDID_DAMAGE;
3499 }
3500
3502 {
3504
3506
3507 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
3508 {
3509 g_Game.GetMission().GetHud().ShowHudUI(false);
3511 if (m_LastCommandBeforeUnconscious != DayZPlayerConstants.COMMANDID_VEHICLE)
3512 {
3513 EntityAI entity_in_hands = GetEntityInHands();
3514 if (entity_in_hands && CanDropEntity(entity_in_hands) && !IsRestrained() && !IsSurrendered())
3515 {
3516 DropItem(ItemBase.Cast(entity_in_hands));
3517 }
3518 }
3519 g_Game.GetSoundScene().SetSoundVolume(0,2);
3520 m_EffectWidgets.AddSuspendRequest(EffectWidgetSuspends.UNCON);
3521 }
3522
3523 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || (!g_Game.IsMultiplayer() && GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT))
3524 {
3525 SetSynchDirty();
3526
3527 if (m_LastCommandBeforeUnconscious == DayZPlayerConstants.COMMANDID_VEHICLE)
3528 {
3529 if (m_TransportCache)
3530 m_TransportCache.MarkCrewMemberUnconscious(m_TransportCache.CrewMemberIndex(this));
3531 }
3532
3533 // disable voice communication
3534 g_Game.EnableVoN(this, false);
3535
3536 if (m_AdminLog)
3537 {
3538 m_AdminLog.UnconStart(this);
3539 }
3540
3541 // When we fall uncon we force out of block
3542 if (GetMeleeFightLogic())
3543 {
3544 GetMeleeFightLogic().SetBlock(false);
3545 }
3546 }
3547
3548 SetMasterAttenuation("UnconsciousAttenuation");
3549
3551 m_OnUnconsciousStart.Invoke(this);
3552 }
3553
3554 void OnUnconsciousStop(int pCurrentCommandID)
3555 {
3557 SetSynchDirty();
3560 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
3561 {
3562 Hud hud = g_Game.GetMission().GetHud();
3563 hud.ShowHudUI(true);
3564 if (pCurrentCommandID != DayZPlayerConstants.COMMANDID_DEATH)
3565 {
3566 g_Game.GetSoundScene().SetSoundVolume(g_Game.m_volume_sound,1);
3567 PPERequester_UnconEffects requester = PPERequester_UnconEffects.Cast(PPERequesterBank.GetRequester(PPERequester_UnconEffects));
3568 requester.FadeOutEffect(); //fading
3569 hud.ShowQuickbarUI(true);
3570 UIManager uiManager = g_Game.GetUIManager();
3571 if (uiManager.IsDialogVisible())
3572 {
3573 uiManager.CloseDialog();
3574 }
3575 if (uiManager.IsMenuOpen(MENU_RESPAWN_DIALOGUE))
3576 {
3577 uiManager.FindMenu(MENU_RESPAWN_DIALOGUE).Close();
3578 }
3579 }
3580 SetInventorySoftLock(false);
3581 m_EffectWidgets.RemoveSuspendRequest(EffectWidgetSuspends.UNCON);
3582 }
3583 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
3584 {
3585 // enable voice communication
3586 if (IsAlive())
3587 g_Game.EnableVoN(this, true);
3588
3589 if (m_AdminLog)
3590 {
3591 m_AdminLog.UnconStop(this);
3592 }
3593 }
3594
3595 SetMasterAttenuation("");
3596
3598 m_OnUnconsciousStop.Invoke(this);
3599 }
3600
3601 void OnUnconsciousUpdate(float pDt, int last_command)
3602 {
3603 m_UnconsciousTime += pDt;
3604 if (g_Game.IsServer())
3605 {
3606 int shock_simplified = SimplifyShock();
3607
3608 if (m_ShockSimplified != shock_simplified)
3609 {
3610 m_ShockSimplified = shock_simplified;
3611 SetSynchDirty();
3612 }
3613
3615 {
3616 PluginAdminLog adm = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
3617 adm.PlayerKilledByDrowningUncon(this);
3618
3619 SetHealth("","",-100);
3620 }
3621 }
3622 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
3623 {
3624 g_Game.GetMission().GetHud().ShowQuickbarUI(false);
3625 if (GetPulseType() == EPulseType.REGULAR)
3626 {
3627 float shock_simple_normalized = GetSimplifiedShockNormalized();
3628
3629 float sin = Math.Sin(m_UnconsciousTime * 0.35);
3630 float sin_normalized = (sin + 1) / 2;
3631 if (sin_normalized < 0.05)
3632 {
3633 m_UnconsciousVignetteTarget = (1 - shock_simple_normalized / 3) * 2/*vignette max*/;
3634 }
3635 float vignette = Math.Lerp(2,m_UnconsciousVignetteTarget, sin_normalized);
3636 m_UnconParam.param1 = vignette;
3637 PPERequesterBank.GetRequester(PPERequester_UnconEffects).Start(m_UnconParam);
3638 }
3639 }
3640 }
3641
3643 {
3644 int shock = Math.Lerp(0, SIMPLIFIED_SHOCK_CAP, GetHealth("","Shock") / GetMaxHealth("","Shock"));
3645 shock = Math.Clamp(shock, 0, SIMPLIFIED_SHOCK_CAP);
3646 return shock;
3647 }
3648
3653
3654 override bool IsUnconscious()
3655 {
3656 return m_MovementState.m_CommandTypeId == DayZPlayerConstants.COMMANDID_UNCONSCIOUS || m_IsUnconscious;
3657 }
3658
3660 {
3661 return m_IsUnconscious;
3662 }
3663
3664 override bool CanBeTargetedByAI(EntityAI ai)
3665 {
3666 #ifdef DIAG_DEVELOPER
3667 if (!m_CanBeTargetedDebug)
3668 {
3669 return false;
3670 }
3671 #endif
3672
3673 return super.CanBeTargetedByAI(ai) && !IsUnconscious() && !IsInVehicle();
3674 }
3675
3676 void GiveShock(float shock)
3677 {
3678 AddHealth("","Shock",shock);
3679 }
3680
3681
3683 {
3685 g_Game.GetMission().RemoveActiveInputExcludes({"inventory"},true);
3686 g_Game.GetMission().RemoveActiveInputRestriction(EInputRestrictors.INVENTORY);
3687 }
3688
3690 void ShockRefill(float pDt);
3691
3692 //BrokenLegs
3693 // -----------------------
3694
3696 {
3697 return Math.AbsInt(m_BrokenLegState);//negative value denotes first time activation
3698 }
3699
3700 //Server side
3701 void SetBrokenLegs(int stateId)
3702 {
3703 m_BrokenLegState = stateId;
3704
3706 eBrokenLegs state = GetBrokenLegs();//m_BrokenLegState can go bellow 0, cannot be used directly
3707
3708 if (state == eBrokenLegs.NO_BROKEN_LEGS)
3709 {
3710 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS;
3711 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS_SPLINT;
3712 }
3713 else if (state == eBrokenLegs.BROKEN_LEGS)
3714 {
3715 SetLegHealth();
3716 }
3717 else if (state == eBrokenLegs.BROKEN_LEGS_SPLINT)
3718 {
3719 // handle splint here
3720 }
3721
3722 SetSynchDirty();
3723 }
3724
3725 //Update of state
3726 void UpdateBrokenLegs(int stateId)
3727 {
3728 eBrokenLegs state = GetBrokenLegs();
3729 //Raise broken legs flag and force to prone
3730 if (state != eBrokenLegs.NO_BROKEN_LEGS)
3731 {
3732 if (state == eBrokenLegs.BROKEN_LEGS_SPLINT)
3733 {
3734 if (m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_PRONE)
3735 {
3736 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.PRONE_ANIM_OVERRIDE;
3737 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS;
3738 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask | eInjuryOverrides.BROKEN_LEGS_SPLINT;
3739 }
3740 m_InjuryHandler.CheckValue(false);
3741
3742 }
3743 else if (state == eBrokenLegs.BROKEN_LEGS)
3744 {
3745
3746 if (m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_PRONE)
3747 {
3748 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.PRONE_ANIM_OVERRIDE;
3749 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS_SPLINT;
3750 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask | eInjuryOverrides.BROKEN_LEGS;
3751 }
3752
3754 m_InjuryHandler.CheckValue(false);
3755
3756 }
3757 }
3758 else if (state == eBrokenLegs.NO_BROKEN_LEGS)
3759 {
3760 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS;
3761 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS_SPLINT;
3762 }
3763
3764 }
3765
3767 {
3768 PlaySoundSet(m_BrokenLegSound, SOUND_BREAK_LEG, 0.1, 0.1);
3769 }
3770 void BrokenLegForceProne(bool forceOverride = false)
3771 {
3772 if (!IsInWater() && !IsSwimming() && !IsClimbingLadder() && !IsInVehicle() && !IsClimbing() && DayZPlayerUtils.PlayerCanChangeStance(this, DayZPlayerConstants.STANCEIDX_PRONE))
3773 {
3774 if (m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_PRONE && m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
3775 {
3776 EntityAI attachment;
3777 Class.CastTo(attachment, GetItemOnSlot("Splint_Right"));
3778 if (attachment && attachment.GetType() == "Splint_Applied")
3779 {
3780 attachment.Delete();
3781 }
3782
3784 m_ShockHandler.CheckValue(true);
3785
3786
3787 if (m_ShockHandler.GetCurrentShock() >= 25) //Prevent conflict with unconsciousness by not forcing prone when going uncon (25 shock or less left)
3788 {
3789
3790 //calcels user action
3791 HumanCommandActionCallback cmd = GetCommand_Action();
3792 if (cmd)
3793 {
3794 cmd.Cancel();
3795 }
3796
3797 StopHandEvent();
3798 //Get command move and verify not null
3799 HumanCommandMove hcm = StartCommand_Move();//not sure why this is here
3800 hcm = GetCommand_Move();
3801 if (hcm)
3802 {
3803 hcm.ForceStance(DayZPlayerConstants.STANCEIDX_PRONE);
3804 }
3805 }
3806 }
3807 }
3808
3809 m_JumpClimb.CheckAndFinishJump();
3810 }
3811
3812 //Used to inflict shock when player is walking (only inflicted on Update timer)
3814 {
3815 //No need to pursue here if player is prone as the following logic is not applied
3816 if (m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_PRONE && m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
3817 {
3818 float avgLegHealth = GetHealth("RightLeg","") + GetHealth("LeftLeg","") + GetHealth("RightFoot","") + GetHealth("LeftFoot","");
3819 avgLegHealth *= 0.25; //divide by 4 to make the average leg health;
3820
3821 if (IsSwimming())
3822 {
3823 //swimming other than forward is not detectable in script other than through velocity check
3824 vector v;
3825 PhysicsGetVelocity(v);
3826
3827 if (v.LengthSq() > 0)
3828 {
3830 }
3831 }
3832 else if (m_MovementState.m_iMovement != 0)
3833 {
3834 if (IsClimbingLadder())
3835 {
3837 }
3838 else if (m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_ERECT || m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDERECT)
3839 {
3840 if (m_MovementState.m_iMovement > 1)//only jog and faster
3841 {
3843 }
3844 }
3845 else if (m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_CROUCH || m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDCROUCH)
3846 {
3847 //any speed other than idle
3849 }
3850 }
3851 else
3852 {
3853 //Here apply shock if player is standing or crouched and STANDING STILL
3855 }
3856
3857 m_ShockHandler.CheckValue(true);
3858 }
3859 }
3860
3861 //Always use the same thresholds but allow passing of different shock values
3862 void MovingShock(float legHealth, float highShock, float midShock, float lowShock)
3863 {
3865 {
3866 //Inflict "high shock"
3867 m_ShockHandler.SetShock(highShock);
3868 }
3870 {
3871 //Inflict "low shock"
3872 m_ShockHandler.SetShock(lowShock);
3873 }
3874 else
3875 {
3876 //If neither high nore low, inflict "mid shock"
3877 m_ShockHandler.SetShock(midShock);
3878 }
3879 }
3880
3881 void DealShock(float dmg)
3882 {
3883 Param1<float> damage = new Param1<float>(0);
3884 damage.param1 = dmg;
3885 g_Game.RPCSingleParam(this, ERPCs.RPC_SHOCK, damage, true, GetIdentity());
3886 }
3887
3888 //Prevent player from picking up heavy items when legs are broken
3889 override bool CanPickupHeavyItem(notnull EntityAI item)
3890 {
3891 if (item.IsHeavyBehaviour() && (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS || GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS_SPLINT))
3892 return false;
3893
3894 return super.CanPickupHeavyItem(item);
3895 }
3896
3897 //Set all leg zones' health to 0 in order to limit emergent behaviour and prevent confusion as to how broken legs really work
3899 {
3900 SetHealth("RightLeg", "", 0);
3901 SetHealth("RightFoot", "", 0);
3902 SetHealth("LeftLeg", "", 0);
3903 SetHealth("LeftFoot", "", 0);
3904 }
3905
3907 {
3908 ItemBase itemInHands = GetItemInHands();
3909 if (itemInHands && itemInHands.IsHeavyBehaviour())
3910 DropItem(itemInHands);
3911 }
3912
3914 {
3915 EntityAI attachment;
3916 Class.CastTo(attachment, GetItemOnSlot("Splint_Right"));
3917 if (attachment && attachment.GetType() == "Splint_Applied")
3918 {
3919 return true;
3920 }
3921 return false;
3922 }
3923
3924 // -----------------------
3925
3926
3927 override void OnCommandSwimStart()
3928 {
3929 ItemBase itemInHands = GetItemInHands();
3930 if (itemInHands)
3931 {
3932 if (itemInHands.IsHeavyBehaviour())
3933 {
3934 TryHideItemInHands(false);
3935 #ifdef SERVER
3936 ServerDropEntity(itemInHands); // Let server handle the hand item drop
3937 #endif
3938 }
3939 else
3940 {
3941 TryHideItemInHands(true);
3942 }
3943 itemInHands.OnItemInHandsPlayerSwimStart(this);
3944 }
3945 m_AnimCommandStarting = HumanMoveCommandID.CommandSwim;
3946
3947 GameInventory inventory = GetInventory();
3948 if (inventory)
3949 inventory.LockInventory(LOCK_FROM_SCRIPT);
3950
3952 GetDayZGame().GetBacklit().OnSwimmingStart();
3953
3955 GetWeaponManager().DelayedRefreshAnimationState(10);
3957
3958 g_Game.GetMission().AddActiveInputExcludes({"swimming"});
3959 }
3960
3961 override void OnCommandSwimFinish()
3962 {
3963 TryHideItemInHands(false, true);
3964
3965 GameInventory inventory = GetInventory();
3966 if (inventory)
3967 inventory.UnlockInventory(LOCK_FROM_SCRIPT);
3968
3969 GetDayZGame().GetBacklit().OnSwimmingStop();
3970
3971 GetWeaponManager().RefreshAnimationState();
3972
3973 g_Game.GetMission().RemoveActiveInputExcludes({"swimming"});
3974 }
3975
3976 override void OnCommandLadderStart()
3977 {
3978 m_AnimCommandStarting = HumanMoveCommandID.CommandLadder;
3979 TryHideItemInHands(true);
3980
3981 GameInventory inventory = GetInventory();
3982 if (inventory)
3983 inventory.LockInventory(LOCK_FROM_SCRIPT);
3984
3986
3987 g_Game.GetMission().AddActiveInputExcludes({"ladderclimbing"});
3988 }
3989
3991 {
3992 TryHideItemInHands(false, true);
3993
3994 GameInventory inventory = GetInventory();
3995 if (inventory)
3996 inventory.UnlockInventory(LOCK_FROM_SCRIPT);
3997
3998 g_Game.GetMission().RemoveActiveInputExcludes({"ladderclimbing"});
3999 }
4000
4001 override void OnCommandFallStart()
4002 {
4003 m_AnimCommandStarting = HumanMoveCommandID.CommandFall;
4004
4005 GameInventory inventory = GetInventory();
4006 if (inventory)
4007 inventory.LockInventory(LOCK_FROM_SCRIPT);
4008
4010
4012 GetWeaponManager().DelayedRefreshAnimationState(10);
4014 }
4015
4016 override void OnCommandFallFinish()
4017 {
4018 GameInventory inventory = GetInventory();
4019 if (inventory)
4020 inventory.UnlockInventory(LOCK_FROM_SCRIPT);
4021
4022 // properly finish jump in case it was interrupted by smth (heavy hit for example in the FOV expoit)
4023 m_JumpClimb.CheckAndFinishJump();
4024
4025 GetWeaponManager().RefreshAnimationState();
4026 }
4027
4028 override void OnCommandClimbStart()
4029 {
4030 m_AnimCommandStarting = HumanMoveCommandID.CommandClimb;
4031
4032 GameInventory inventory = GetInventory();
4033 if (inventory)
4034 inventory.LockInventory(LOCK_FROM_SCRIPT);
4035
4037
4039 GetWeaponManager().DelayedRefreshAnimationState(10);
4041 }
4042
4043 override void OnCommandClimbFinish()
4044 {
4045 GameInventory inventory = GetInventory();
4046 if (inventory)
4047 inventory.UnlockInventory(LOCK_FROM_SCRIPT);
4048
4049 GetWeaponManager().RefreshAnimationState();
4050 }
4051
4053 {
4054 m_AnimCommandStarting = HumanMoveCommandID.CommandVehicle;
4055
4056 if (m_EmoteManager && (m_EmoteManager.m_IsSurrendered || m_EmoteManager.IsEmotePlaying()))
4057 {
4058 m_EmoteManager.ForceSurrenderState(false);
4059
4060 #ifdef SERVER
4061 m_EmoteManager.ServerRequestEmoteCancel();
4062 #endif
4063 }
4064
4065 GameInventory inventory = GetInventory();
4066 if (inventory)
4067 inventory.LockInventory(LOCK_FROM_SCRIPT);
4068
4070
4071 ItemBase itemInHand = GetItemInHands();
4072 EntityAI itemOnHead = FindAttachmentBySlotName("Headgear");
4073
4074 if (itemInHand && itemInHand.GetCompEM())
4075 itemInHand.GetCompEM().SwitchOff();
4076
4077 TryHideItemInHands(true);
4078
4079 if (itemOnHead && itemOnHead.GetCompEM())
4080 itemOnHead.GetCompEM().SwitchOff();
4081
4082 g_Game.GetMission().AddActiveInputExcludes({"vehicledriving"});
4083 }
4084
4086 {
4087 GameInventory inventory = GetInventory();
4088 if (inventory)
4089 inventory.UnlockInventory(LOCK_FROM_SCRIPT);
4090
4091 if (!m_ShouldBeUnconscious)
4092 TryHideItemInHands(false, true);
4093
4094 g_Game.GetMission().RemoveActiveInputExcludes({"vehicledriving"});
4095 }
4096
4097 override void OnCommandMelee2Start()
4098 {
4099 m_AnimCommandStarting = HumanMoveCommandID.CommandMelee2;
4100 m_IsFighting = true;
4101
4103 GetWeaponManager().DelayedRefreshAnimationState(10);
4105 }
4106
4108 {
4110
4111 GetWeaponManager().RefreshAnimationState();
4112
4113 }
4114
4115 override void OnCommandDeathStart()
4116 {
4117 m_AnimCommandStarting = HumanMoveCommandID.CommandDeath;
4118
4120 GetWeaponManager().DelayedRefreshAnimationState(10);
4122
4123 super.OnCommandDeathStart();
4124 }
4125
4126 override void OnJumpStart()
4127 {
4128 m_ActionManager.OnJumpStart();
4129
4131 GetWeaponManager().DelayedRefreshAnimationState(10);
4133 CloseMapEx(true);
4134 }
4135
4136 override void OnJumpEnd(int pLandType = 0)
4137 {
4139 {
4140 switch (pLandType)
4141 {
4142 case HumanCommandFall.LANDTYPE_NONE:
4143 case HumanCommandFall.LANDTYPE_LIGHT:
4144 m_PresenceNotifier.ProcessEvent(EPresenceNotifierNoiseEventType.LAND_LIGHT);
4145 break;
4146 case HumanCommandFall.LANDTYPE_MEDIUM:
4147 case HumanCommandFall.LANDTYPE_HEAVY:
4148 m_PresenceNotifier.ProcessEvent(EPresenceNotifierNoiseEventType.LAND_HEAVY);
4149 break;
4150 }
4151 }
4152
4153 GetWeaponManager().RefreshAnimationState();
4154 }
4155
4156 bool IsStance(int stance, int stanceMask)
4157 {
4158 return ((1 << stance) & stanceMask) != 0;
4159 }
4160
4161 override void OnStanceChange(int previousStance, int newStance)
4162 {
4163 int prone = DayZPlayerConstants.STANCEMASK_PRONE | DayZPlayerConstants.STANCEMASK_RAISEDPRONE;
4164 int notProne = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_RAISEDERECT | DayZPlayerConstants.STANCEMASK_RAISEDCROUCH;
4165
4166 if (IsStance(previousStance, DayZPlayerConstants.STANCEMASK_PRONE) && IsStance(newStance, DayZPlayerConstants.STANCEMASK_ERECT))
4167 m_SprintedTimePerStanceMin = PlayerConstants.FULL_SPRINT_DELAY_FROM_PRONE;
4168
4169 if (IsStance(previousStance, DayZPlayerConstants.STANCEMASK_PRONE) && IsStance(previousStance, DayZPlayerConstants.STANCEMASK_CROUCH) || (IsStance(previousStance, DayZPlayerConstants.STANCEMASK_CROUCH) && IsStance(newStance, DayZPlayerConstants.STANCEMASK_ERECT)))
4170 m_SprintedTimePerStanceMin = PlayerConstants.FULL_SPRINT_DELAY_FROM_CROUCH;
4171
4172 if ((IsStance(previousStance, prone) && IsStance(newStance, notProne)) || (IsStance(previousStance, notProne) && IsStance(newStance, prone)))
4173 {
4175 GetWeaponManager().RefreshAnimationState();
4176 }
4177 }
4178
4179 override bool CanChangeStance(int previousStance, int newStance)
4180 {
4181 // Check if the player is trying to perform restricted action while changing stance
4183 return false;
4184
4185 // Allow stance changes in plain throwing mode, but not once the actual throw wind-up / release animation has started
4186 if (GetThrowing().IsThrowingInProgress() || GetThrowing().IsThrowingAnimationPlaying())
4187 return false;
4188
4189 // don't allow base stance change, only raised hands change
4190 if (IsRolling())
4191 {
4192 if (Math.AbsInt(previousStance - newStance) == 3)
4193 return true;
4194
4195 return false;
4196 }
4197
4198 // Check if the player tries to drop or throw an item in hands while changing stance
4199 UAInterface inputInterface = GetInputInterface();
4200 if (inputInterface.SyncedValue_ID(UAThrowitem) > 0 || inputInterface.SyncedValue_ID(UADropitem) > 0)
4201 return false;
4202
4203 // Check if the player is going to crouch or raised crouch
4204 if (newStance == DayZPlayerConstants.STANCEIDX_CROUCH || newStance == DayZPlayerConstants.STANCEIDX_RAISEDCROUCH)
4205 {
4206 return GetCurrentWaterLevel() <= GetDayZPlayerType().CommandSwimSettingsW().m_fToErectLevel;
4207 }
4208
4209 // Check if the player is going to prone
4210 if (newStance == DayZPlayerConstants.STANCEIDX_PRONE || newStance == DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
4211 {
4212 return GetCurrentWaterLevel() <= GetDayZPlayerType().CommandSwimSettingsW().m_fToCrouchLevel;
4213 }
4214
4215 // The player can change stance if none of the conditions above are met
4216 return true;
4217 }
4218
4219
4220 override void OnCommandMoveStart()
4221 {
4222 if (g_Game.IsServer())
4223 {
4224 //In case player changes stance through a different command, we refresh the anim overrides
4225 int prone = DayZPlayerConstants.STANCEMASK_PRONE | DayZPlayerConstants.STANCEMASK_RAISEDPRONE;
4226 if (!IsPlayerInStance(prone))
4227 {
4228 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.PRONE_ANIM_OVERRIDE;
4230 }
4231 }
4232 }
4233
4234 override bool CanRoll()
4235 {
4237 return false;
4238
4239 if (IsInFBEmoteState() || m_EmoteManager.m_MenuEmote)
4240 {
4241 return false;
4242 }
4243
4244 return IsPlayerInStance(DayZPlayerConstants.STANCEMASK_PRONE | DayZPlayerConstants.STANCEMASK_RAISEDPRONE) && GetCommand_Move() && !GetCommand_Move().IsOnBack();
4245 }
4246
4247 override void OnRollStart(bool isToTheRight)
4248 {
4250
4251 if (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
4253 }
4254
4255 override void OnRollFinish()
4256 {
4257 }
4258
4259 void OnJumpOutVehicleFinish(float carSpeed)
4260 {
4261 string surfaceType;
4262 int liquidType;
4263 g_Game.SurfaceUnderObject(this, surfaceType, liquidType);
4264 }
4265
4266 void OnVehicleSwitchSeat(int seatIndex)
4267 {
4268 }
4269
4271 {
4272 m_IsVehicleSeatDriver = true;
4273 if (m_Hud)
4274 m_Hud.ShowVehicleInfo();
4275
4276#ifdef FEATURE_NETWORK_RECONCILIATION
4277 PlayerIdentity identity = GetIdentity();
4278 if (identity)
4279 {
4280 Pawn pawn = Pawn.Cast(GetParent());
4281
4283 identity.Possess(pawn);
4284 }
4285#endif
4286 }
4287
4289 {
4290#ifdef FEATURE_NETWORK_RECONCILIATION
4291 PlayerIdentity identity = GetIdentity();
4292
4294 if (identity && !m_ShouldBeUnconscious)
4295 {
4297 identity.Possess(this);
4298 }
4299#endif
4300
4301 m_IsVehicleSeatDriver = false;
4302 if (m_Hud)
4303 m_Hud.HideVehicleInfo();
4304 }
4305
4306 override void OnThrowingModeChange(bool change_to_enabled)
4307 {
4308 if (change_to_enabled)
4309 {
4312 }
4313 }
4314
4315 override void EOnFrame(IEntity other, float timeSlice)
4316 {
4317 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
4318 {
4319 #ifndef NO_GUI
4320 if (IsControlledPlayer() && m_EffectWidgets && m_EffectWidgets.IsAnyEffectRunning())
4321 {
4322 m_EffectWidgets.Update(timeSlice);
4323 }
4324 #endif
4325
4327 m_UndergroundHandler.Tick(timeSlice);
4328
4330 m_UndergroundBunkerHandler.Tick(timeSlice);
4331 }
4332
4333 if (m_InEffectAreaType != 0 && g_Game.IsServer())
4334 OnUpdateEffectAreaServer(timeSlice);
4335 }
4336
4337 override void EOnPostFrame(IEntity other, int extra)
4338 {
4339 int currentTime = g_Game.GetTime();
4340 float delta_time = (currentTime - m_LastPostFrameTickTime) / 1000;
4341 m_LastPostFrameTickTime = currentTime;
4342 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
4343 {
4345 {
4346 if (IsAlive())
4347 GetDamageDealtEffect().Update(delta_time);
4348 else
4349 delete GetDamageDealtEffect();
4350 }
4351
4352 if (m_EffectRadial)
4353 {
4354 if (IsAlive())
4355 {
4356 m_EffectRadial.Update(delta_time);
4357 }
4358 else
4359 m_EffectRadial = null;
4360 }
4361
4362
4363 if (GetFlashbangEffect())
4364 {
4365 if (IsAlive())
4366 {
4367 GetFlashbangEffect().Update(delta_time);
4368 }
4369 else
4370 {
4371 GetFlashbangEffect().Stop();
4372 delete GetFlashbangEffect();
4373 }
4374 }
4375
4376 if (GetShockEffect())
4377 {
4378 if (IsAlive())
4379 GetShockEffect().Update(delta_time);
4380 else
4381 delete GetShockEffect();
4382 }
4383
4384 m_InventoryActionHandler.OnUpdate();
4385 }
4386
4387 #ifdef DIAG_DEVELOPER
4388 DiagOnPostFrame(other, extra);
4389 #endif
4390 }
4391
4392#ifdef DIAG_DEVELOPER
4393 protected void DiagOnPostFrame(IEntity other, int extra)
4394 {
4395 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
4396 {
4397 if (m_WeaponDebug)
4398 {
4399 m_WeaponDebug.OnPostFrameUpdate();
4400 }
4401
4402 if (GetBleedingManagerRemote())
4403 {
4404 GetBleedingManagerRemote().OnUpdate();
4405 }
4406
4407 if (m_MeleeCombat)
4408 {
4409 if (DiagMenu.GetBool(DiagMenuIDs.MELEE_DEBUG))
4410 {
4411 m_MeleeDebug = true;
4412 m_MeleeCombat.Debug(GetItemInHands(), m_MeleeCombat.GetHitType());
4413 }
4414 else if (!DiagMenu.GetBool(DiagMenuIDs.MELEE_DEBUG) && m_MeleeDebug)
4415 {
4416 m_MeleeDebug = false;
4417 m_MeleeCombat.Debug(GetItemInHands(), m_MeleeCombat.GetHitType());
4418 }
4419 }
4420
4421 if (DiagMenu.GetBool(DiagMenuIDs.SOUNDS_ITEM_IMPACT_SOUNDS))
4422 InventoryItem.DrawImpacts();
4423
4424 if (GetPluginManager())
4425 {
4426 PluginDrawCheckerboard drawCheckerboard = PluginDrawCheckerboard.Cast(GetPluginManager().GetPluginByType(PluginDrawCheckerboard));
4427 if (drawCheckerboard && !drawCheckerboard.IsActive())
4428 {
4429 drawCheckerboard.ShowWidgets(DiagMenu.GetBool(DiagMenuIDs.MISC_DRAW_CHECKERBOARD));
4430 }
4431 }
4432
4433 if (m_PresenceNotifier)
4434 {
4435 m_PresenceNotifier.EnableDebug(DiagMenu.GetBool(DiagMenuIDs.MISC_PRESENCE_NOTIFIER_DBG));
4436 }
4437
4438 if (m_TargetTemperatureDiag)
4439 {
4440 m_TargetTemperatureDiag.ShowDebug(DiagMenu.GetBool(DiagMenuIDs.MISC_TARGET_TEMPERATURE));
4441 }
4442
4443 if (DiagMenu.GetBool(DiagMenuIDs.TRIGGER_PLAYER_DEBUG))
4444 {
4445 vector minmax[2];
4446 GetCollisionBox(minmax);
4447
4448 int color = COLOR_RED_A;
4449 if (m_IsInsideTrigger)
4450 color = COLOR_GREEN_A;
4451
4452 Shape dbgShape = Debug.DrawBoxEx(minmax[0], minmax[1], color, ShapeFlags.TRANSP|ShapeFlags.NOZWRITE|ShapeFlags.ONCE);
4453
4454 vector mat[4];
4455 GetTransform(mat);
4456 dbgShape.CreateMatrix(mat);
4457 dbgShape.SetMatrix(mat);
4458 }
4459 }
4460
4461 if (m_Environment && m_Environment.m_Debug)
4462 {
4463 #ifdef SERVER
4464 EnvDebugData envDebugData = m_Environment.GetEnvDebugData();
4465 g_Game.RPCSingleParam(this, ERPCs.DIAG_MISC_ENVIRONMENT_DEBUG_DATA, envDebugData, false, GetIdentity());
4466 #else
4467 m_Environment.ShowEnvDebugPlayerInfo(DiagMenu.GetBool(DiagMenuIDs.MISC_ENVIRONMENT_DEBUG));
4468 #endif
4469 }
4470
4471 if (m_FallDamage && m_FallDamage.m_Debug)
4472 {
4473 #ifdef SERVER
4474 FallDamageDebugData fallDamageDebugData = m_FallDamage.GetFallDamageDebugData();
4475 g_Game.RPCSingleParam(this, ERPCs.DIAG_MISC_FALLDAMAGE_DEBUG_DATA, fallDamageDebugData, false, GetIdentity());
4476 #else
4477 m_FallDamage.ShowFallDamageDebugInfo(DiagMenu.GetBool(DiagMenuIDs.MISC_FALLDAMAGE_DEBUG));
4478 #endif
4479 }
4480 }
4481
4482 override void OnEnterTrigger(ScriptedEntity trigger)
4483 {
4484 super.OnEnterTrigger(trigger);
4485
4486 ++m_IsInsideTrigger;
4487 }
4488
4489 override void OnLeaveTrigger(ScriptedEntity trigger)
4490 {
4491 super.OnLeaveTrigger(trigger);
4492
4493 --m_IsInsideTrigger;
4494 }
4495#endif
4496
4497 void StaminaHUDNotifier(bool show)
4498 {
4499 if (m_Hud)
4500 m_Hud.SetStaminaBarVisibility(show);
4501 }
4502
4503 override void DepleteStaminaEx(EStaminaModifiers modifier, float dT = -1, float coef = 1.0)
4504 {
4505 if (GetStaminaHandler())
4506 GetStaminaHandler().DepleteStaminaEx(modifier,dT,coef);
4507 }
4508
4509 override bool CanConsumeStamina(EStaminaConsumers consumer)
4510 {
4511 if (!GetStaminaHandler())
4512 return false;
4513
4514 bool val = (GetStaminaHandler().HasEnoughStaminaFor(consumer) && !IsRestrained() && !IsInFBEmoteState());
4515
4516 if (!val)
4517 StaminaHUDNotifier(false);
4518
4519 return val;
4520 }
4521
4523 {
4524 if (!GetStaminaHandler())
4525 return false;
4526
4527 bool val = (GetStaminaHandler().HasEnoughStaminaToStart(consumer) && !IsRestrained() && !IsInFBEmoteState());
4528
4529 if (!val)
4530 StaminaHUDNotifier(false);
4531
4532 return val;
4533 }
4534
4535 override bool CanClimb(int climbType, SHumanCommandClimbResult climbRes)
4536 {
4537 if (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
4538 return false;
4539
4540 if (climbType == 1 && !CanConsumeStamina(EStaminaConsumers.VAULT))
4541 return false;
4542
4544 if (IsSwimming())
4545 return true;
4546
4547 if (climbType == 2 && (!CanConsumeStamina(EStaminaConsumers.CLIMB) || GetBrokenLegs() != eBrokenLegs.NO_BROKEN_LEGS))
4548 return false;
4549
4550 if (climbType > 0 && m_InjuryHandler && m_InjuryHandler.GetInjuryAnimValue() >= InjuryAnimValues.LVL3)
4551 return false;
4552
4553 return super.CanClimb(climbType,climbRes);
4554 }
4555
4556 override bool CanJump()
4557 {
4558 if (GetBrokenLegs() != eBrokenLegs.NO_BROKEN_LEGS)
4559 {
4560 return false;
4561 }
4562
4564 return false;
4565
4567 if (m_InjuryHandler && m_InjuryHandler.GetInjuryAnimValue() >= InjuryAnimValues.LVL3)
4568 return false;
4569
4570 if (IsInFBEmoteState() || m_EmoteManager.m_MenuEmote)
4571 {
4572 return false;
4573 }
4574
4575 return super.CanJump();
4576 }
4577
4579 {
4580 return m_JumpClimb.m_bIsJumpInProgress;
4581 }
4582
4584 {
4585 array<vector> temp = new array<vector>;
4586 temp = g_Game.GetMission().GetActiveRefresherLocations();
4587 int count = temp.Count();
4588 if (count > 0)
4589 {
4590 vector pos = target.GetPosition();
4591 for (int i = 0; i < count; i++)
4592 {
4593 if (vector.Distance(pos,temp.Get(i)) < GameConstants.REFRESHER_RADIUS)
4594 return true;
4595 }
4596
4597 return false;
4598 }
4599 else
4600 {
4601 return false;
4602 }
4603 }
4604
4606 {
4607 if ((g_Game.IsMultiplayer() && g_Game.IsServer()))
4608 {
4610 if (m_RefreshAnimStateIdx > 3)
4612 SetSynchDirty();
4613 }
4614 }
4615
4616 void RefreshHandAnimationState(int delay = 0)
4617 {
4618 if (delay == 0)
4619 {
4620 GetItemAccessor().OnItemInHandsChanged(true);
4621 GetItemAccessor().ResetWeaponInHands();
4622 }
4623 else
4624 {
4625 g_Game.GetCallQueue(CALL_CATEGORY_GUI).CallLater(RefreshHandAnimationState,delay,false,0);
4626 }
4627 }
4628
4629 // -------------------------------------------------------------------------
4630 // USER ACTIONS
4631 // -------------------------------------------------------------------------
4632
4634 {
4635 vector pdir = GetDirection();
4636 vector ptv = target.GetPosition() - GetPosition();
4637 pdir.Normalize();
4638 ptv.Normalize();
4639
4640 if (Math.AbsFloat(pdir[0]-ptv[0]) < 0.5 && Math.AbsFloat(pdir[2]-ptv[2]) < 0.5)
4641 {
4642 return true;
4643 }
4644 return false;
4645 }
4646
4647 //---------------------------------------------------------
4648 void OnQuickBarSingleUse(int slotClicked)
4649 {
4650 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
4651 return;
4652
4653 if (m_AreHandsLocked)
4654 return; //Player is in the short window of time after interrupting placement of an item and before getting it back in hands
4655
4656 GameInventory inventory = GetInventory();
4657 if (inventory.IsInventoryLocked() || IsEmotePlaying())
4658 return;
4659
4660 if (GetThrowing().IsThrowingModeEnabled() || GetThrowing().IsThrowingAnimationPlaying())
4661 return;
4662
4663 if (IsRaised() || GetCommand_Melee() || IsSwimming() || IsClimbingLadder() || IsClimbing() || IsRestrained() || IsRestrainPrelocked())
4664 return;
4665
4666 if (GetDayZPlayerInventory().IsProcessing() || IsItemsToDelete())
4667 return;
4668
4669 if (GetActionManager().GetRunningAction() != null)
4670 return;
4671
4673 return;
4674
4676 return;
4677
4678 //TODO MW change locking method
4679 //if (GetDayZPlayerInventory().HasLockedHands())
4680 // return;
4681
4682 EntityAI quickBarEntity = GetQuickBarEntity(slotClicked - 1);//GetEntityInQuickBar(slotClicked - 1);
4683
4684 if (!quickBarEntity)
4685 return;
4686
4687 Magazine mag;
4688 Weapon_Base wpn;
4689
4690 if (Class.CastTo(mag, quickBarEntity) && Class.CastTo(wpn, mag.GetHierarchyParent()))
4691 return;
4692
4693 EntityAI inHandEntity = GetEntityInHands();
4694
4695 if (!GetDayZPlayerInventory().IsIdle())
4696 return; // player is already performing some animation
4697
4698 InventoryLocation handInventoryLocation = new InventoryLocation;
4699 handInventoryLocation.SetHands(this,quickBarEntity);
4700 if (inventory.HasInventoryReservation(quickBarEntity, handInventoryLocation))
4701 return;
4702
4703 if (inHandEntity == quickBarEntity)
4704 {
4705 if (GetHumanInventory().CanRemoveEntityInHands())
4706 {
4707 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Stash - PredictiveMoveItemFromHandsToInventory HND=" + Object.GetDebugName(inHandEntity));
4708 PredictiveMoveItemFromHandsToInventory();
4709 }
4710 }
4711 else
4712 {
4713 InventoryLocation invLocQBItem = new InventoryLocation;
4714 quickBarEntity.GetInventory().GetCurrentInventoryLocation(invLocQBItem);
4715 if (inventory.HasInventoryReservation(quickBarEntity,invLocQBItem))
4716 return;
4717
4718 if (inHandEntity)
4719 {
4720 InventoryLocation inHandEntityFSwapDst = new InventoryLocation;
4721
4722 int index = GetHumanInventory().FindUserReservedLocationIndex(inHandEntity);
4723 if (index >= 0)
4724 GetHumanInventory().GetUserReservedLocation(index, inHandEntityFSwapDst);
4725
4726
4727 if (index < 0 && GameInventory.CanSwapEntitiesEx(quickBarEntity, inHandEntity))
4728 {
4729 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] PredictiveSwapEntities QB=" + Object.GetDebugName(quickBarEntity) + " HND=" + Object.GetDebugName(inHandEntity));
4730 PredictiveSwapEntities(quickBarEntity, inHandEntity);
4731 }
4732 else if (GameInventory.CanForceSwapEntitiesEx(quickBarEntity, handInventoryLocation, inHandEntity, inHandEntityFSwapDst))
4733 {
4734 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Swap - PredictiveForceSwapEntities HND=" + Object.GetDebugName(inHandEntity) + " QB=" + Object.GetDebugName(quickBarEntity) + " fswap_dst=" + InventoryLocation.DumpToStringNullSafe(inHandEntityFSwapDst));
4735 PredictiveForceSwapEntities(quickBarEntity, inHandEntity, inHandEntityFSwapDst);
4736 }
4737 }
4738 else
4739 {
4740 if (inventory.HasInventoryReservation(quickBarEntity,handInventoryLocation))
4741 return;
4742
4743 if (inventory.CanAddEntityIntoHands(quickBarEntity))
4744 {
4745 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Stash - PredictiveTakeEntityToHands QB=" + Object.GetDebugName(quickBarEntity));
4746 PredictiveTakeEntityToHands(quickBarEntity);
4747 }
4748 }
4749 }
4750 }
4751 //---------------------------------------------------------
4752 void OnQuickBarContinuousUseStart(int slotClicked)
4753 {
4754 if (GetInventory().IsInventoryLocked())
4755 return;
4756
4757 if (IsSwimming() || IsClimbingLadder() || GetCommand_Melee() || IsClimbing() || IsRestrained() || IsRestrainPrelocked())
4758 return;
4759
4760 ItemBase quickBarItem = ItemBase.Cast(GetQuickBarEntity(slotClicked - 1));
4761
4762 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
4763 {
4764 ItemBase itemInHands = GetItemInHands();
4765
4766 if (itemInHands != quickBarItem)
4767 {
4769
4770 if (amc.CanPerformActionFromQuickbar(itemInHands, quickBarItem))
4771 {
4772 amc.PerformActionFromQuickbar(itemInHands, quickBarItem);
4773 }
4774 else
4775 {
4776 if (IsRaised() || GetCommand_Melee())
4777 return;
4778
4779 amc.ForceTarget(quickBarItem);
4780 m_QuickBarFT = true;
4781 }
4782 }
4783 }
4784 m_QuickBarHold = true;
4785 }
4786 //---------------------------------------------------------
4787 void OnQuickBarContinuousUseEnd(int slotClicked)
4788 {
4789 if (m_QuickBarHold)
4790 {
4791 if ( GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
4792 {
4794
4796 {
4797 ActionBase action = am.GetRunningAction();
4798 if (action)
4799 {
4800 if (!action.GetInput().IsActive())
4801 {
4802 am.EndActionInput();
4803 }
4804
4805 }
4806 }
4807
4808 if (m_QuickBarFT)
4809 {
4810 am.ClearForceTarget();
4811 m_QuickBarFT = false;
4812 }
4813 }
4814 }
4815 m_QuickBarHold = false;
4816 }
4818 {
4819 m_ActionQBControl = !action.GetInput().IsActive();
4820 }
4821
4823 {
4824 return m_ActionQBControl;
4825 }
4827 {
4828 m_ActionQBControl = false;
4829 }
4830
4831 //---------------------------------------------------------
4832 // RADIAL QUICKBAR AND RELOAD ACTIONS
4833 //---------------------------------------------------------
4834 //the same functionality as normal quick bar slot key press
4835 void RadialQuickBarSingleUse(int slotClicked)
4836 {
4837 OnQuickBarSingleUse(slotClicked);
4838 }
4839
4840 //removed the need for holding down quick bar slot key
4841 void RadialQuickBarCombine(int slotClicked)
4842 {
4843 EntityAI quickBarEntity = GetQuickBarEntity(slotClicked - 1);
4844 EntityAI entity_in_hands = GetEntityInHands();
4845
4846 ReloadWeapon(entity_in_hands, quickBarEntity);
4847 }
4848
4849 //removed the need for holding down quick bar slot key
4851 {
4852 EntityAI magazine = GetMagazineToReload(weapon);
4853 ReloadWeapon(weapon, magazine);
4854 }
4855
4856 //Reload weapon with given magazine
4857 void ReloadWeapon(EntityAI weapon, EntityAI magazine)
4858 {
4859 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
4860 {
4861 ActionManagerClient mngr_client;
4862 CastTo(mngr_client, GetActionManager());
4863
4864 if (mngr_client && FirearmActionLoadMultiBulletRadial.Cast(mngr_client.GetRunningAction()))
4865 {
4866 mngr_client.Interrupt();
4867 }
4868 else if (GetEntityInHands()!= magazine)
4869 {
4870 Weapon_Base wpn;
4871 Magazine mag;
4872 Class.CastTo(wpn, weapon);
4873 Class.CastTo(mag, magazine);
4874 if (GetWeaponManager().CanUnjam(wpn))
4875 {
4876 GetWeaponManager().Unjam();
4877 }
4878 else if (GetWeaponManager().CanAttachMagazine(wpn, mag))
4879 {
4880 GetWeaponManager().AttachMagazine(mag);
4881 }
4882 else if (GetWeaponManager().CanSwapMagazine(wpn, mag))
4883 {
4884 GetWeaponManager().SwapMagazine(mag);
4885 }
4886 else if (GetWeaponManager().CanLoadBullet(wpn, mag))
4887 {
4888 //GetWeaponManager().LoadMultiBullet(mag);
4889
4890 ActionTarget atrg = new ActionTarget(mag, this, -1, vector.Zero, -1.0);
4891 if (mngr_client && !mngr_client.GetRunningAction() && mngr_client.GetAction(FirearmActionLoadMultiBulletRadial).Can(this, atrg, wpn))
4892 mngr_client.PerformActionStart(mngr_client.GetAction(FirearmActionLoadMultiBulletRadial), atrg, wpn);
4893 }
4894 }
4895 }
4896 }
4897
4898 //returns compatible magazine from player inventory with highest ammo count
4900 {
4901 Weapon_Base weapon_base = Weapon_Base.Cast(weapon);
4902 WeaponManager weapon_manager = GetWeaponManager();
4903 EntityAI magazine_to_reload;
4904
4905 EntityAI ammo_magazine; //magazine
4906 int last_ammo_magazine_count;
4907 int ammo_magazine_count;
4908
4909 EntityAI ammo_pile; //ammo pile
4910 int last_ammo_pile_count;
4911 int ammo_pile_count;
4912
4913 //Get all magazines in (player) inventory
4914 GameInventory inventory = GetInventory();
4915 int nAttachment = inventory.AttachmentCount();
4916 for (int att_i = 0; att_i < nAttachment; ++att_i)
4917 {
4918 EntityAI attachment = inventory.GetAttachmentFromIndex(att_i);
4919 ref CargoBase attachment_cargo = attachment.GetInventory().GetCargo();
4920
4921 if (attachment_cargo)
4922 {
4923 int nAttachmentCargoItem = attachment_cargo.GetItemCount();
4924 for (int cgo_i = 0; cgo_i < nAttachmentCargoItem; ++cgo_i)
4925 {
4926 EntityAI cargo_item = attachment_cargo.GetItem(cgo_i);
4927
4928 //check for proper magazine
4929 if (cargo_item.IsMagazine())
4930 {
4931 Magazine magazine = Magazine.Cast(cargo_item);
4932 ammo_pile_count = magazine.GetAmmoCount();
4933
4934 //magazines (get magazine with max ammo count)
4935 if (weapon_manager.CanAttachMagazine(weapon_base, magazine) || weapon_manager.CanSwapMagazine(weapon_base, magazine))
4936 {
4937 if (ammo_pile_count > 0)
4938 {
4939 if (last_ammo_magazine_count == 0)
4940 {
4941 ammo_magazine = magazine;
4942 last_ammo_magazine_count = ammo_pile_count;
4943 }
4944 else
4945 {
4946 if (last_ammo_magazine_count < ammo_pile_count)
4947 {
4948 ammo_magazine = magazine;
4949 last_ammo_magazine_count = ammo_pile_count;
4950 }
4951 }
4952 }
4953 }
4954 //bullets (get ammo pile with min ammo count)
4955 else if (weapon_manager.CanLoadBullet(weapon_base, magazine))
4956 {
4957 if (ammo_pile_count > 0)
4958 {
4959 if (last_ammo_pile_count == 0)
4960 {
4961 ammo_pile = magazine;
4962 last_ammo_pile_count = ammo_pile_count;
4963 }
4964 else
4965 {
4966 if (last_ammo_pile_count > ammo_pile_count)
4967 {
4968 ammo_pile = magazine;
4969 last_ammo_pile_count = ammo_pile_count;
4970 }
4971 }
4972 }
4973 }
4974 }
4975 }
4976 }
4977 }
4978
4979 //prioritize magazine
4980 if (ammo_magazine)
4981 {
4982 return ammo_magazine;
4983 }
4984
4985 return ammo_pile;
4986 }
4987 //---------------------------------------------------------
4988
4989
4990 //---------------------------------------------------------
4992 {
4993 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !g_Game.IsMultiplayer())
4994 {
4995 g_Game.GetMission().AddDummyPlayerToScheduler(this);
4997 }
4998
4999#ifdef DIAG_DEVELOPER
5000 if (!m_Bot)
5001 {
5002 m_Bot = new Bot(this);
5003 m_Bot.Start();
5004 }
5005#endif
5006 }
5007
5008 //---------------------------------------------------------
5009 //Obsolete
5011 {
5012 return m_LiquidTendencyDrain;
5013 }
5014 //---------------------------------------------------------
5015 //Obsolete
5016 void SetLiquidTendencyDrain(bool state)
5017 {
5018 m_LiquidTendencyDrain = state;
5019 }
5020
5021 //---------------------------------------------------------
5024 {
5025 return m_FlagRaisingTendency;
5026 }
5027 //---------------------------------------------------------
5029 void SetFlagTendencyRaise(bool state)
5030 {
5031 m_FlagRaisingTendency = state;
5032 }
5033
5034 override SoundOnVehicle PlaySound(string sound_name, float range, bool create_local = false)
5035 {
5036 return BetaSound.SaySound(this, sound_name, range, false);
5037 }
5038
5040 {
5041 return GetWeightEx();
5042 }
5043
5045 {
5046 return GetWeightEx() >= OVERLOAD_LIMIT;
5047 }
5048
5049 void SetPlayerLoad(float load)//Deprecated
5050 {
5051 m_CargoLoad = load;
5052 //Print("m_CargoLoad: " + m_CargoLoad);
5053 //Log(ToString(this) + "'s load weight is " + ftoa(m_CargoLoad) + " g.", LogTemplates.TEMPLATE_PLAYER_WEIGHT);
5054 }
5055
5056 //Deprecated, will be overrid by other method calls (in order to ensure stamina calculation is properly set)
5057 void AddPlayerLoad(float addedload)//Deprecated
5058 {
5059 float newload = GetPlayerLoad() + addedload;
5060 SetPlayerLoad(newload);
5061
5062 // Do not need -> Log is in SetPlayerLoad
5063 //PrintString(ToString(this) + "'s load weight is " + ToString(m_CargoLoad) + " g.");
5064 }
5065
5067 {
5068 return GetInventory().HasEntityInInventory(entity);
5069 }
5070
5071 override bool NeedInventoryJunctureFromServer(notnull EntityAI item, EntityAI currParent, EntityAI newParent)
5072 {
5073 if (g_Game.IsMultiplayer())
5074 {
5076 switch (t)
5077 {
5078 case DayZPlayerInstanceType.INSTANCETYPE_AI_SINGLEPLAYER:
5079 return false;
5080 case DayZPlayerInstanceType.INSTANCETYPE_CLIENT:
5081 case DayZPlayerInstanceType.INSTANCETYPE_SERVER:
5082 case DayZPlayerInstanceType.INSTANCETYPE_AI_SERVER:
5083 case DayZPlayerInstanceType.INSTANCETYPE_AI_REMOTE:
5084 case DayZPlayerInstanceType.INSTANCETYPE_REMOTE:
5085 return true; // Might help mitigate "megabugged" (desync)
5086
5087 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " NeedInventoryJunctureFromServer item=" + Object.GetDebugName(item) + " currPar=" + currParent + " newPar=" + newParent);
5088
5089 bool i_owned = GetHumanInventory().HasEntityInInventory(item);
5090
5091 bool cp_owned = false;
5092 if (currParent)
5093 cp_owned = GetHumanInventory().HasEntityInInventory(currParent);
5094
5095 bool np_owned = false;
5096 if (newParent)
5097 np_owned = GetHumanInventory().HasEntityInInventory(newParent);
5098
5099 bool all_owned = i_owned && cp_owned && (np_owned || (newParent == null));
5100 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " NeedInventoryJunctureFromServer=" + !all_owned + " i_pwn=" + i_owned + " cp_pwn=" + cp_owned + " np_pwn=" + np_owned);
5101
5102 return !all_owned;
5103 default:
5104 Error("[syncinv] unsupported instance type t=" + t);
5105 break;
5106 }
5107 }
5108 return false;
5109 }
5110
5111
5112 override protected float GetWeightSpecialized(bool forceRecalc = false)
5113 {
5114 float totalWeight = super.GetWeightSpecialized(forceRecalc);
5115
5116 ItemBase itemHands = GetItemInHands();
5117 if (itemHands) // adds weight of item carried in hands
5118 {
5119 totalWeight += itemHands.GetWeightEx(forceRecalc);
5120 }
5121 #ifdef DEVELOPER
5122 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
5123 {
5124 float itemInHandsWeight = totalWeight - super.GetWeightSpecialized(forceRecalc);
5125 WeightDebugData dta = WeightDebug.GetWeightDebug(this);
5126 dta.SetCalcDetails("TMan: " + (super.GetWeightSpecialized(forceRecalc)+ itemInHandsWeight) +"(contents weight[includes item in hands])");
5127 }
5128 #endif
5129 return totalWeight;
5130 }
5131
5133 {
5134 const int VISIBILITY_SLOTS_COUNT = 10;
5135
5136 int attcount = GetInventory().AttachmentCount();
5137 float sumVisibility = 0;
5138 float countVisibility = 0;
5139 float visibilityMean = 0;
5140
5141 if (attcount > 0)
5142 {
5143 for (int att = 0; att < attcount; att++)
5144 {
5145 EntityAI attachment = GetInventory().GetAttachmentFromIndex(att);
5146 if (attachment.IsClothing())
5147 {
5148 ClothingBase clothing;
5149 Class.CastTo(clothing, attachment);
5150 sumVisibility += clothing.GetItemVisibility();
5151 countVisibility++;
5152 }
5153 }
5154
5155 visibilityMean = (sumVisibility + (VISIBILITY_SLOTS_COUNT - countVisibility)) / VISIBILITY_SLOTS_COUNT;
5156 SetVisibilityCoef(visibilityMean);
5157 }
5158 else
5159 {
5160 visibilityMean = 1;
5161 SetVisibilityCoef(visibilityMean);
5162 }
5163 }
5164
5165 void SetVisibilityCoef(float pVisibility)
5166 {
5167 m_VisibilityCoef = pVisibility;
5168 }
5169
5171 {
5172 return m_VisibilityCoef;
5173 }
5174
5175
5177 {
5178 return m_Shakes;
5179 }
5180
5181
5187
5193
5199
5205
5211
5219
5220 //-------------------------------------
5227
5228
5230 {
5231 float health = GetHealth("","");
5232 float health_max = GetMaxHealth("","");
5234 }
5235
5237 {
5238 float toxicity = GetStatToxicity().Get();
5239 float toxicity_max = GetStatToxicity().GetMax();
5241 }
5242
5244 {
5245 float blood = GetHealth("","Blood");
5246 float blood_max = GetMaxHealth("","Blood");
5248 }
5249
5251 {
5252 float energy = GetStatEnergy().Get();
5253 float energy_max = GetStatEnergy().GetMax();
5255 }
5256
5258 {
5259 float water = GetStatWater().Get();
5260 float water_max = GetStatWater().GetMax();
5262 }
5263
5264 //------------------------------------
5265
5266 float GetStatLevelBorders(float stat_value, float critical, float low, float normal, float high, float max)
5267 {
5268 if (stat_value <= critical)
5269 {
5270 return Math.InverseLerp(0, critical, stat_value);
5271 }
5272 if (stat_value <= low)
5273 {
5274 return Math.InverseLerp(critical, low, stat_value);
5275 }
5276 if (stat_value <= normal)
5277 {
5278 return Math.InverseLerp(low, normal, stat_value);
5279 }
5280 if (stat_value <= high)
5281 {
5282 return Math.InverseLerp(normal, high, stat_value);
5283 }
5284 return Math.InverseLerp(high, max, stat_value);
5285 }
5286
5287 EStatLevels GetStatLevel(float stat_value, float critical, float low, float normal, float high)
5288 {
5289 if (stat_value <= critical)
5290 {
5291 return EStatLevels.CRITICAL;
5292 }
5293 if (stat_value <= low)
5294 {
5295 return EStatLevels.LOW;
5296 }
5297 if (stat_value <= normal)
5298 {
5299 return EStatLevels.MEDIUM;
5300 }
5301 if (stat_value <= high)
5302 {
5303 return EStatLevels.HIGH;
5304 }
5305 return EStatLevels.GREAT;
5306 }
5307
5308 void SetImmunityBoosted(bool boosted)
5309 {
5310 m_ImmunityBoosted = boosted;
5311 }
5312
5313
5314
5317 {
5318 float immunity;
5319 if (GetPlayerStats())
5320 {
5321 float max_health = GetMaxHealth("GlobalHealth", "Health") + 0.01;//addition to prevent divisioin by zero in case of some messup
5322 float max_blood = GetMaxHealth("GlobalHealth", "Blood") + 0.01;//addition to prevent divisioin by zero in case of some messup
5323 float energy_normalized = GetStatEnergy().Get() / PlayerConstants.SL_ENERGY_MAX;
5324 float water_normalized = GetStatWater().Get() / PlayerConstants.SL_WATER_MAX;
5325 float health_normalized = GetHealth("GlobalHealth", "Health") / max_health;
5326 float blood_normalized = GetHealth("GlobalHealth", "Blood") / max_blood;
5327 immunity = energy_normalized + water_normalized + health_normalized + blood_normalized;
5328 immunity = immunity / 4;//avg
5329 immunity = Math.Clamp(immunity,0,1);
5330 }
5331 return immunity;
5332 }
5333
5335 {
5336 return m_MovementState.m_iMovement == DayZPlayerConstants.MOVEMENT_SPRINT;
5337 }
5338
5340 {
5341 ItemBase item = GetItemInHands();
5342 if (IsRaised() || (item && item.IsHeavyBehaviour()))
5343 return false;
5344
5345 if(m_InjuryHandler.GetInjuryAnimValue() >= InjuryAnimValues.LVL3)
5346 return false;
5347
5348 if (item && GetThrowing() && GetThrowing().IsThrowingModeEnabled())
5349 return false;
5350
5351 if (GetBrokenLegs() != eBrokenLegs.NO_BROKEN_LEGS)
5352 return false;
5353
5354 return true;
5355 }
5356
5358 {
5359 return m_MovementState.IsInProne();
5360 }
5361
5363 {
5364 return m_MovementState.IsInRaisedProne();
5365 }
5366
5368 {
5369 return m_MovementState.IsLeaning();
5370 }
5371
5373 {
5374 return GetCommand_Move() && GetCommand_Move().IsInRoll();
5375 }
5376
5378 {
5379 return m_MovementState.m_CommandTypeId == DayZPlayerConstants.COMMANDID_CLIMB;
5380 }
5381
5383 {
5384 return m_MovementState.m_CommandTypeId == DayZPlayerConstants.COMMANDID_FALL;
5385 }
5386 override bool IsFighting()
5387 {
5388 return m_IsFighting;
5389 }
5390
5392 {
5393 return m_EmoteManager && m_EmoteManager.IsEmotePlaying();
5394 }
5395
5397 {
5398 return IsRuined();
5399 }
5400
5405 bool AnimCommandCheck(HumanMoveCommandID mask)
5406 {
5407 return m_AnimCommandStarting & mask;
5408 }
5409
5411 {
5412 if (!m_FightEndBlendTimer)
5413 m_FightEndBlendTimer = new Timer();
5414 if (!m_FightEndBlendTimer.IsRunning())
5415 {
5416 m_FightEndBlendTimer.Run(PlayerConstants.MELEE2_MOVEMENT_BLEND_DELAY,this,"EndFighting");
5417 }
5418 }
5419
5421 {
5422 m_IsFighting = false;
5423 }
5424
5426 {
5427 //on-hit drop of melee weapons
5428 //bayonets & buttstocks
5429 if (item && item.GetHierarchyParent() && item.GetHierarchyParent().IsWeapon() && item.IsRuined()/*&& item.FindAttachmentBySlotName()*/)
5430 {
5432 return DropItem(item);
5433 }
5434 //handheld items themselves
5435 if (item && item == GetItemInHands() && item.IsRuined())
5436 {
5437 return PredictiveDropEntity(item);
5438 }
5439 return false;
5440 }
5441
5443 {
5444 //TODO
5445 }
5446
5447 // -------------------------------------------------------------------------
5448 override void RPC(int rpc_type, array<ref Param> params, bool guaranteed, PlayerIdentity recipient = NULL)
5449 {
5450 super.RPC(rpc_type, params, guaranteed, recipient);
5451 }
5452
5453 // -------------------------------------------------------------------------
5454 override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
5455 {
5456 super.OnRPC(sender, rpc_type, ctx);
5457
5458 switch (rpc_type)
5459 {
5460 #ifndef SERVER
5461
5462 case ERPCs.RPC_PLAYER_STAT:
5463 if (GetPlayerStats())
5464 GetPlayerStats().OnRPC(ctx);
5465 break;
5466
5467 case ERPCs.RPC_SYNC_DISPLAY_STATUS:
5468 if (GetVirtualHud())
5469 {
5470 GetVirtualHud().OnRPC(ctx);
5471 }
5472 break;
5473
5474 case ERPCs.RPC_PLAYER_SYMPTOM_ON:
5475 if (GetSymptomManager())
5476 {
5477 GetSymptomManager().OnRPC(ERPCs.RPC_PLAYER_SYMPTOM_ON, ctx);
5478 }
5479 break;
5480
5481 case ERPCs.RPC_PLAYER_SYMPTOM_OFF:
5482 if (GetSymptomManager())
5483 {
5484 GetSymptomManager().OnRPC(ERPCs.RPC_PLAYER_SYMPTOM_OFF, ctx);
5485 }
5486 break;
5487
5488 case ERPCs.RPC_DAMAGE_VALUE_SYNC:
5489 if (m_TrasferValues)
5490 m_TrasferValues.OnRPC(ctx);
5491 break;
5492
5493 case ERPCs.RPC_USER_ACTION_MESSAGE:
5494 if (!GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
5495 {
5496 break;
5497 }
5498 if (ctx.Read(m_UAParamMessage))
5499 {
5500 string actiontext = m_UAParamMessage.param1;
5501 MessageAction(actiontext);
5502 }
5503 break;
5504
5505 case ERPCs.RPC_SOFT_SKILLS_SPECIALTY_SYNC:
5506 ref Param1<float> p_synch = new Param1<float>(0);
5507 ctx.Read(p_synch);
5508 float specialty_level = p_synch.param1;
5509 GetSoftSkillsManager().SetSpecialtyLevel(specialty_level);
5510 break;
5511
5512 case ERPCs.RPC_SOFT_SKILLS_STATS_SYNC:
5513 ref Param5<float, float, float, float, bool> p_debug_synch = new Param5<float, float ,float, float, bool>(0, 0, 0, 0, false);
5514 ctx.Read(p_debug_synch);
5515 float general_bonus_before = p_debug_synch.param1;
5516 float general_bonus_after = p_debug_synch.param2;
5517 float last_UA_value = p_debug_synch.param3;
5518 float cooldown_value = p_debug_synch.param4;
5519 float cooldown_active = p_debug_synch.param5;
5520 GetSoftSkillsManager().SetGeneralBonusBefore(general_bonus_before);
5521 GetSoftSkillsManager().SetGeneralBonusAfter(general_bonus_after);
5522 GetSoftSkillsManager().SetLastUAValue(last_UA_value);
5523 GetSoftSkillsManager().SetCoolDownValue(cooldown_value);
5524 GetSoftSkillsManager().SetCoolDown(cooldown_active);
5525 break;
5526
5527 case ERPCs.RPC_WARNING_ITEMDROP:
5528 {
5529 if (g_Game.IsClient() && g_Game.GetUIManager() && !g_Game.GetUIManager().FindMenu(MENU_WARNING_ITEMDROP))
5530 {
5531 g_Game.GetCallQueue(CALL_CATEGORY_GAMEPLAY).Call(g_Game.GetUIManager().EnterScriptedMenu,MENU_WARNING_ITEMDROP,null);
5532 g_Game.GetMission().AddActiveInputExcludes({"menu"});
5533 }
5534 break;
5535 }
5536
5537 case ERPCs.RPC_WARNING_TELEPORT:
5538 {
5539 if (g_Game.IsClient() && g_Game.GetUIManager() && !g_Game.GetUIManager().FindMenu(MENU_WARNING_TELEPORT))
5540 {
5541 g_Game.GetCallQueue(CALL_CATEGORY_GAMEPLAY).Call(g_Game.GetUIManager().EnterScriptedMenu,MENU_WARNING_TELEPORT,null);
5542 g_Game.GetMission().AddActiveInputExcludes({"menu"});
5543 }
5544 break;
5545 }
5546 case ERPCs.RPC_INIT_SET_QUICKBAR:
5547 ref Param1<int> count = new Param1<int>(0);
5548 if (ctx.Read(count))
5549 {
5550 for (int i = 0; i < count.param1 ; i++)
5551 {
5552 m_QuickBarBase.OnSetEntityRPC(ctx);
5553 }
5554 }
5555 break;
5556
5557 case ERPCs.RPC_SYNC_THERMOMETER:
5558 {
5559 float value;
5560 if (ctx.Read(value))
5561 m_Hud.SetTemperature(value.ToString() + "#degrees_celsius");
5562 break;
5563 }
5564
5565
5566 case ERPCs.RPC_CHECK_PULSE:
5568 EPulseType pulse;
5570 {
5571 pulse = EPulseType.REGULAR;
5572 }
5573 else
5574 {
5575 pulse = EPulseType.IRREGULAR;
5576 }
5577
5580 {
5581 m_CheckPulseLastTarget.SetLastUAMessage(ActionCheckPulse.GetPulseMessage(pulse, blood_level));
5582 }
5583 break;
5584
5586 //woodcutting
5587 case PlantType.TREE_HARD:
5588 SoundHardTreeFallingPlay();
5589 break;
5590
5591 case PlantType.TREE_SOFT:
5592 SoundSoftTreeFallingPlay();
5593 break;
5594
5595 case PlantType.BUSH_HARD:
5596 SoundHardBushFallingPlay();
5597 break;
5598
5599 case PlantType.BUSH_SOFT:
5600 SoundSoftBushFallingPlay();
5601 break;
5602
5603 case ERPCs.RPC_DEBUG_MONITOR_FLT:
5605 {
5606 m_DebugMonitorValues.OnRPCFloat(ctx);
5607 }
5608 break;
5609
5610 case ERPCs.RPC_DEBUG_MONITOR_STR:
5612 {
5613 m_DebugMonitorValues.OnRPCString(ctx);
5614 }
5615 break;
5616
5617 case ERPCs.RPC_ITEM_REPAIR:
5618 PluginInventoryRepair repairPlugin = PluginInventoryRepair.Cast(GetPlugin(PluginInventoryRepair));
5619 repairPlugin.OnRPC(ctx);
5620 #endif
5621
5622
5623 /*
5624 case ERPCs.RPC_CRAFTING_INVENTORY_INSTANT:
5625 ref Param3<int, ItemBase, ItemBase> craftParam = new Param3<int, ItemBase, ItemBase>(-1, NULL, NULL);
5626 if (ctx.Read(craftParam))
5627 {
5628 m_ModuleRecipesManager.PerformRecipeServer(craftParam.param1, craftParam.param2, craftParam.param3, this);
5629 }
5630 break;
5631 */
5632
5633
5634
5635 #ifdef DIAG_DEVELOPER
5636 case ERPCs.DEV_RPC_AGENT_RESET:
5637 {
5638 bool val;
5639 if (ctx.Read(val))
5640 m_AgentPool.RemoveAllAgents();
5641 break;
5642 }
5643
5644 case ERPCs.DEV_PLAYER_DEBUG_REQUEST:
5645 {
5646 PluginRemotePlayerDebugServer plugin_remote_server = PluginRemotePlayerDebugServer.Cast(GetPlugin(PluginRemotePlayerDebugServer));
5647 plugin_remote_server.OnRPC(ctx, this);
5648 break;
5649 }
5650
5651 case ERPCs.DEV_PLAYER_DEBUG_DATA:
5652 {
5653 PluginRemotePlayerDebugClient plugin_remote_client = PluginRemotePlayerDebugClient.Cast(GetPlugin(PluginRemotePlayerDebugClient));
5654 PluginDeveloper plugin_dev = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
5655 if (plugin_dev.m_ScriptConsole)
5656 plugin_dev.m_ScriptConsole.OnRPCEx(rpc_type, ctx);
5657 else
5658 plugin_remote_client.OnRPC(ctx);
5659 break;
5660 }
5661
5662 case ERPCs.DEV_AGENT_GROW:
5663 {
5664 m_AgentPool.RemoteGrowRequestDebug(ctx);
5665 break;
5666 }
5667
5668 case ERPCs.RPC_ITEM_DIAG_CLOSE:
5669 {
5671 mid.StopWatchRequest(this);
5672 break;
5673 }
5674
5676 case ERPCs.DEV_REQUEST_UTS_DEBUG:
5677 {
5678 PluginUniversalTemperatureSourceServer plugin_uts_server = PluginUniversalTemperatureSourceServer.Cast(GetPlugin(PluginUniversalTemperatureSourceServer));
5679 plugin_uts_server.OnRPC(ctx, this);
5680 break;
5681 }
5682
5683 case ERPCs.DEV_UTS_DEBUG_DATA:
5684 {
5685 PluginUniversalTemperatureSourceClient plugin_uts_client = PluginUniversalTemperatureSourceClient.Cast(GetPlugin(PluginUniversalTemperatureSourceClient));
5686 plugin_uts_client.OnRPC(ctx);
5687 break;
5688 }
5690 #endif
5691
5692 #ifdef DEVELOPER
5693 case ERPCs.DEV_RPC_SERVER_SCRIPT:
5694 {
5695 //PluginItemDiagnostic plugin = PluginItemDiagnostic.Cast(GetPlugin(PluginItemDiagnostic));
5696 //SetDebugDeveloper_item(plugin.GetWatchedItem(this));//!! needs to be inside DEVELOPER ifdef
5697
5699 {
5700 _player = this;
5701 string code = CachedObjectsParams.PARAM1_STRING.param1;
5702 bool success = g_Game.ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
5703 CachedObjectsParams.PARAM1_BOOL.param1 = success;
5704 RPCSingleParam(ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT, CachedObjectsParams.PARAM1_BOOL,true, GetIdentity());
5705 }
5706 break;
5707 }
5708
5709 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
5710 {
5711 PluginDeveloper dev = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
5712 if (dev.m_ScriptConsole)
5713 dev.m_ScriptConsole.OnRPCEx(rpc_type, ctx);
5714 break;
5715 }
5716
5717 case ERPCs.DEV_SET_DEV_ITEM:
5718 {
5719 Param1<EntityAI> ent = new Param1<EntityAI>(null);
5720 if (ctx.Read(ent) && ent.param1)
5721 {
5723 mid2.RegisterDebugItem(ent.param1, this);
5724 }
5725 //SetDebugDeveloper_item(this);
5726 break;
5727 }
5728
5729 case ERPCs.RPC_ITEM_DIAG:
5730 {
5731 Param1<EntityAI> p1 = new Param1<EntityAI>(null);
5732 if (ctx.Read(p1))
5733 {
5735 plgn.OnRPC(p1.param1, ctx);
5736 }
5737 break;
5738 }
5739 #endif
5740 }
5741
5742 #ifdef DIAG_DEVELOPER
5743 PluginDeveloper module_rc = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
5744 if (module_rc)
5745 module_rc.OnRPC(this, rpc_type, ctx);
5746
5747 PluginDeveloperSync module_rcs = PluginDeveloperSync.Cast(GetPlugin(PluginDeveloperSync));
5748 if (module_rcs)
5749 module_rcs.OnRPC(this, rpc_type, ctx);
5750
5751 #ifdef SERVER
5753 #else
5755 #endif
5756
5757 if (plugin_diag_menu)
5758 plugin_diag_menu.OnRPC(this, rpc_type, ctx);
5759 #endif
5760 }
5761
5763 {
5764 super.OnGameplayDataHandlerSync();
5765
5767 g_Game.GetMission().SetRespawnModeClient(CfgGameplayHandler.GetDisableRespawnDialog());
5769 }
5770
5772 {
5773 Mission mission = g_Game.GetMission();
5774 if (mission)
5775 {
5776 WorldLighting wLighting = mission.GetWorldLighting();
5777 if (wLighting)
5779 }
5780 }
5781
5782 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)
5783 {
5784 if (enable) // enable
5785 {
5786 // We assume that if this is set to true the PPE is already active
5787 if (m_ContaminatedAreaEffectEnabled == enable)
5788 return;
5789
5790 if (aroundId !=0)
5791 {
5793 {
5794 m_ContaminatedAroundPlayer = ParticleManager.GetInstance().PlayInWorld(aroundId, GetPosition());
5795 }
5796 // First entry in an area with dynamic tweaks to particles
5797 if (partDynaUpdate)
5798 {
5799 m_ContaminatedAroundPlayer.SetParameter(0, EmitorParam.BIRTH_RATE, newBirthRate);
5800 }
5801 }
5802
5803 if (!m_ContaminatedAroundPlayerTiny && tinyId !=0)
5804 {
5805 m_ContaminatedAroundPlayerTiny = ParticleManager.GetInstance().PlayInWorld(tinyId, GetPosition());
5806 }
5807
5808 if (ppeIdx != -1)
5809 {
5810 PPERequesterBase ppeRequester;
5811 if (Class.CastTo(ppeRequester, PPERequesterBank.GetRequester(ppeIdx)))
5812 ppeRequester.Start();
5813 }
5814
5815 // We start playing the ambient sound
5816 if (!m_AmbientContamination && soundset != "")
5817 PlaySoundSetLoop(m_AmbientContamination, soundset, 0.1, 0.1);
5818
5819 SetSoundControllerOverride("contamination",1,SoundControllerAction.Overwrite);
5820 }
5821 else // disable
5822 {
5824 {
5827 }
5828
5830 {
5833 }
5834 if (ppeIdx != -1)
5835 PPERequesterBank.GetRequester(ppeIdx).Stop(new Param1<bool>(true)); //fade out
5836
5837 // We stop the ambient sound
5839 StopSoundSet(m_AmbientContamination);
5840
5841 SetSoundControllerOverride("contamination",0,SoundControllerAction.None);
5842 // We make sure to reset the state
5843 }
5845 }
5846
5847 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)
5848 {
5849 SetContaminatedEffectEx(enable, ppeIdx, aroundId, tinyId, "", partDynaUpdate, newBirthRate);
5850 }
5851
5852 // -------------------------------------------------------------------------
5854 {
5856 if (m_CorpseState > 0 && !GetIsFrozen() && AllowDecayEffects())
5858 else
5859 SetDecayEffects();//no params means remove the effects
5861 }
5862
5863 protected bool AllowDecayEffects()
5864 {
5865 float min,max;
5866 g_Game.GetWeather().GetSnowfall().GetLimits(min,max);
5867
5868 return max <= 0;
5869 }
5870
5871 // -------------------------------------------------------------------------
5872 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
5873 {
5874 super.EEHealthLevelChanged(oldLevel, newLevel, zone);
5875 if (!g_Game.IsDedicatedServer())
5876 {
5877 if (newLevel == GameConstants.STATE_RUINED)
5878 {
5880 }
5881 if (m_CorpseState != 0)
5882 {
5883 g_Game.GetCallQueue(CALL_CATEGORY_GUI).CallLater(UpdateCorpseState, 0, false);
5884 }
5885 }
5886 }
5887
5888
5889 // -------------------------------------------------------------------------
5891 {
5892 super.OnVariablesSynchronized();
5893
5894 if (m_ModuleLifespan)
5895 {
5897
5898 if (m_LifespanLevelLocal != m_LifeSpanState) //client solution, lifespan level changed
5899 {
5902 }
5903 }
5904
5906
5908 {
5909 GetBleedingManagerRemote().OnVariablesSynchronized(GetBleedingBits());
5910 }
5911
5912 if (m_CorpseStateLocal != m_CorpseState && (IsPlayerLoaded() || IsControlledPlayer()))
5913 {
5915 }
5916
5918 {
5919 RefreshHandAnimationState(396); //mean animation blend time
5921 }
5923 {
5925 {
5927 }
5928 else
5929 {
5931 }
5933 }
5934
5935 //-------MODIFIERS START--------
5937 {
5938 int diff = (m_SyncedModifiers & ~m_SyncedModifiersPrev) | (~m_SyncedModifiers & m_SyncedModifiersPrev);//XOR gets us a mask for modifiers that changed by either deactivating, or activating
5939
5940 if (eModifierSyncIDs.MODIFIER_SYNC_DROWNING & diff)//has this modifier's status as active/inactive changed ?
5941 {
5942 if (eModifierSyncIDs.MODIFIER_SYNC_DROWNING & m_SyncedModifiers)//is this modifier currently active ? if so, it means it's been just activated
5943 {
5944 SetDrowning(true);
5945 }
5946 else
5947 {
5948 SetDrowning(false);
5949 }
5950
5951 }
5952
5954 }
5955 //-------MODIFIERS END--------
5956
5958
5960 ItemBase itemHands = GetItemInHands();
5961 if (itemHands)
5962 {
5963 RemotelyActivatedItemBehaviour raib = itemHands.GetRemotelyActivatedItemBehaviour();
5964 if (raib)
5966 }
5967
5968 //restrain events
5970 {
5973 }
5974
5976 {
5979 }
5980 }
5981
5987
5989 {
5991 {
5993 if (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
5994 {
5995 if (m_BrokenLegState < 0)
5996 BreakLegSound();
5997 }
5998 }
5999 }
6000
6002 {
6003 array<EntityAI> items = new array<EntityAI>();
6004 GetInventory().EnumerateInventory(InventoryTraversalType.INORDER, items);
6005 foreach (EntityAI item : items)
6006 {
6007 item.SetHealthMax("", "");
6008 item.SetWet(item.GetWetInit());
6009 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
6010 item.SetFrozen(false);
6011 }
6012 }
6013
6016
6017 //--------------------------------------------------------------------------
6019 {
6020 //Print("PlayerBase | OnSelectPlayer()");
6021 m_PlayerSelected = true;
6022
6023 m_QuickBarBase.updateSlotsCount();
6024
6025 m_WeaponManager.SortMagazineAfterLoad();
6026
6027 PlayerIdentity identity = GetIdentity();
6028
6029#ifdef FEATURE_NETWORK_RECONCILIATION
6030 if (identity)
6031 {
6033 identity.Possess(this);
6034 }
6035#endif
6036
6037 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !g_Game.IsMultiplayer())
6038 {
6039 if (identity)
6040 {
6041 m_CachedPlayerID = identity.GetId();
6042 m_CachedPlayerName = identity.GetName();
6043 }
6044
6046 SetAITargetCallbacks(new AITargetCallbacksPlayer(this));
6047
6048 array<ref Param> params = new array<ref Param>;
6049 if (m_aQuickBarLoad)
6050 {
6051 int count = m_aQuickBarLoad.Count();
6052 Param1<int> paramCount = new Param1<int>(count);
6053 params.Insert(paramCount);
6054 for (int i = 0; i < count; i++)
6055 {
6056 m_QuickBarBase.OnSetEntityNoSync(m_aQuickBarLoad.Get(i).param1,m_aQuickBarLoad.Get(i).param2);
6057 params.Insert(m_aQuickBarLoad.Get(i));
6058 }
6059
6060 if (count > 0 && g_Game.IsMultiplayer())
6061 {
6062 g_Game.RPC(this, ERPCs.RPC_INIT_SET_QUICKBAR, params, true, identity);
6063 }
6064 m_aQuickBarLoad = NULL;
6065 }
6066
6067 GetSoftSkillsManager().InitSpecialty(GetStatSpecialty().Get());
6068 GetModifiersManager().SetModifiers(true);
6069
6070 SetSynchDirty();
6071
6072 if (g_Game.IsMultiplayer())
6073 {
6074 //Drop item warning
6076 {
6077 g_Game.RPCSingleParam(this, ERPCs.RPC_WARNING_ITEMDROP, null, true, identity);
6078 m_ProcessUIWarning = false;
6079 }
6080
6081 g_Game.GetMission().SyncRespawnModeInfo(identity);
6082 }
6083 }
6084
6085 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
6086 {
6089
6090 CheckForGag();
6091 }
6092 else if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
6093 {
6097
6098 }
6099 else if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_AI_SINGLEPLAYER)
6100 {
6102 }
6103
6104 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
6105 {
6106 if (g_Game.GetMission())
6107 {
6108 g_Game.GetMission().ResetGUI();
6109 // force update player
6110 GetDayZGame().GetBacklit().UpdatePlayer(true);
6111 }
6112
6113 m_DeathCheckTimer = new Timer();
6114 m_DeathCheckTimer.Run(0.1, this, "CheckDeath", null, true);
6117
6118 int characterCount = g_Game.GetMenuData().GetCharactersCount() - 1;
6119 int idx = g_Game.GetMenuData().GetLastPlayedCharacter();
6120 if (idx == GameConstants.DEFAULT_CHARACTER_MENU_ID || idx > characterCount)
6121 {
6122 g_Game.GetCallQueue(CALL_CATEGORY_GUI).Call(SetNewCharName);
6123 }
6124
6125 g_Game.GetMission().EnableAllInputs(true);
6126
6128 m_PresenceNotifier.Init(this);
6129 #ifdef DIAG_DEVELOPER
6130 m_TargetTemperatureDiag = PluginTargetTemperature.Cast(GetPlugin(PluginTargetTemperature));
6131 m_TargetTemperatureDiag.Init(this);
6132 #endif
6133 OnGameplayDataHandlerSync();//only here for legacy reasons
6134 }
6135
6136#ifdef BOT
6137 m_Bot = new Bot(this);
6138 m_Bot.Start(true, new MyBotTrigger(this));
6139#endif
6140 }
6141
6142 override void SimulateDeath(bool state)
6143 {
6144 super.SimulateDeath(state);
6145
6146 m_UndergroundHandler = null;
6148 if (m_EffectWidgets)
6149 {
6150 m_EffectWidgets.StopAllEffects();
6151 m_EffectWidgets.ClearSuspendRequests();
6152 }
6153 }
6154
6156 {
6157 MenuData menuData = g_Game.GetMenuData();
6158 menuData.SaveCharacter(false, true);
6159 menuData.SetCharacterName(menuData.GetLastPlayedCharacter(), g_Game.GetMenuDefaultCharacterData(false).GetCharacterName());
6160 menuData.SaveCharactersLocal();
6161 }
6162
6164 {
6165 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
6166 {
6167 BurlapSackCover attachment;
6168 Class.CastTo(attachment, GetInventory().FindAttachment(InventorySlots.HEADGEAR));
6169
6170 PPERequester_BurlapSackEffects req;
6171 if (Class.CastTo(req,PPERequesterBank.GetRequester(PPERequesterBank.REQ_BURLAPSACK)))
6172 {
6173 if (attachment)
6174 {
6175 req.Start();
6176 }
6177 else if (req.IsRequesterRunning())
6178 {
6179 PPERequesterBank.GetRequester(PPERequester_BurlapSackEffects).Stop();
6180 }
6181 }
6182 }
6183 }
6184
6186 {
6187 #ifdef SERVER
6188 Clothing item;
6189 GameInventory inventory = GetInventory();
6190 Class.CastTo(item, inventory.FindAttachment(InventorySlots.MASK));
6191 if (!item)
6192 {
6193 Class.CastTo(item, inventory.FindAttachment(InventorySlots.HEADGEAR));
6194 }
6195
6196 if (item && item.IsObstructingVoice())
6197 {
6198 item.MutePlayer(this,true);
6199 }
6200 else //should probably check for relevant types before removing mumbling and obstruction specifically..
6201 {
6202 g_Game.SetVoiceEffect(this, VoiceEffectMumbling, false);
6203 g_Game.SetVoiceEffect(this, VoiceEffectObstruction, false);
6204 }
6205 #endif
6206 }
6207
6208 void UpdateMaskBreathWidget(notnull MaskBase mask, bool is_start = false)
6209 {
6210 if (is_start)
6211 m_EffectWidgets.ResetMaskUpdateCount();
6212 float resistance = 0;
6213 if (mask.HasIntegratedFilter() || mask.IsExternalFilterAttached())
6214 resistance = 1 - mask.GetFilterQuantity01();
6215
6216
6217 m_EffectWidgets.OnVoiceEvent(resistance);
6218 m_EffectWidgets.IncreaseMaskUpdateCount();
6219
6220 }
6221
6222
6223 // -------------------------------------------------------------------------
6225 {
6226 if (m_EffectWidgets)
6227 {
6228 MaskBase mask = MaskBase.Cast(GetInventory().FindAttachment(InventorySlots.MASK));
6229 if (mask)
6230 {
6231 UpdateMaskBreathWidget(mask, true);
6232 //m_EffectWidgets.SetBreathIntensityStamina(GetStaminaHandler().GetStaminaCap(),GetStaminaHandler().GetStamina());
6233 }
6234 }
6235 }
6236
6237 // -------------------------------------------------------------------------
6239 void OnVoiceEventPlayback(PlayerSoundEventBase voice_event, AbstractWave callback, float playback_time)
6240 {
6241 if (m_EffectWidgets)
6242 {
6243 MaskBase mask = MaskBase.Cast(GetInventory().FindAttachment(InventorySlots.MASK));
6244 if (mask)
6245 {
6246 if (m_EffectWidgets.m_MaskWidgetUpdateCount < 2 && callback.GetLength() > 2 && playback_time > 0.5 )
6248 }
6249 }
6250 }
6251
6252
6253 // -------------------------------------------------------------------------
6254 override bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
6255 {
6256 if (super.OnInputUserDataProcess(userDataType, ctx))
6257 return true;
6258
6259 if (m_QuickBarBase.OnInputUserDataProcess(userDataType, ctx))
6260 return true;
6261
6262 if (m_WeaponManager.OnInputUserDataProcess(userDataType, ctx))
6263 return true;
6264
6265 if (HandleRemoteItemManipulation(userDataType, ctx))
6266 return true;
6267
6268 if (userDataType == INPUT_UDT_INVENTORY && GetHumanInventory().OnInputUserDataProcess(ctx))
6269 return true;
6270
6271 if (GetHumanInventory().OnInventoryCheck(userDataType, ctx))
6272 return true;
6273
6274 if (TogglePlacingServer(userDataType, ctx))
6275 return true;
6276
6277 if (ResetADSPlayerSync(userDataType, ctx))
6278 return true;
6279
6280 string uid;
6281 bool mute;
6282 if (userDataType == INPUT_UDT_USER_MUTE_XBOX)
6283 {
6284 if (ctx.Read(uid) && ctx.Read(mute))
6285 {
6286 g_Game.MutePlayer(uid, GetIdentity().GetPlainId(), mute);
6287 // commented because plainID should not be present in logs
6288 //Print("Player: " + GetIdentity().GetId() + " set mute for " + uid + " to " + mute);
6289 }
6290 }
6291
6292 if (m_EmoteManager && userDataType == INPUT_UDT_GESTURE)
6293 return m_EmoteManager.OnInputUserDataProcess(userDataType, ctx);
6294
6295 if (userDataType == INPUT_UDT_WEAPON_LIFT_EVENT)
6296 return ReadLiftWeaponRequest(userDataType, ctx);
6297
6298 if (m_ActionManager)
6299 return m_ActionManager.OnInputUserDataProcess(userDataType, ctx);
6300 return false;
6301 }
6302
6304 {
6305 float blood = GetHealth("GlobalHealth", "Blood");
6306 float blood_scale_normalized = Math.InverseLerp(PlayerConstants.BLOOD_THRESHOLD_FATAL, GetMaxHealth("", "Blood"), blood);
6307 blood_scale_normalized = Math.Clamp(blood_scale_normalized,0,1);
6309 }
6310
6312 {
6313 if (userDataType == INPUT_UDT_ITEM_MANIPULATION)
6314 {
6315 int type = -1;
6316 ItemBase item1 = null;
6317 ItemBase item2 = null;
6320 bool use_stack_max = false;
6321 int slot_id = -1;
6322
6323 DayZPlayerInventory inventory = GetDayZPlayerInventory();
6324
6325 if (!ctx.Read(type))
6326 return false;
6327
6328 if (type == 4)
6329 {
6330 if (!ctx.Read(item1))
6331 return false;
6332
6333 if (!dstIL.ReadFromContext(ctx))
6334 return false;
6335
6336 bool dummy;
6337 if (!ctx.Read(dummy))
6338 return false;
6339
6340 if (item1 && dstIL.IsValid())
6341 {
6342 item1.GetInventory().GetCurrentInventoryLocation(srcIL);
6343
6344 if (!inventory.PlayerCheckRequestSrc(srcIL, GameInventory.c_MaxItemDistanceRadius))
6345 return false;
6346
6347 if (!inventory.PlayerCheckRequestDst(srcIL, dstIL, GameInventory.c_MaxItemDistanceRadius))
6348 return false;
6349
6350 if (dummy)
6351 item1.SplitItemToInventoryLocation(dstIL);
6352 else
6353 item1.SplitIntoStackMaxToInventoryLocation(dstIL);
6354 return true;
6355 }
6356 return false;
6357 }
6358
6359 if (!ctx.Read(item1))
6360 return false;
6361 if (!ctx.Read(item2))
6362 return false;
6363 if (!ctx.Read(use_stack_max))
6364 return false;
6365 if (!ctx.Read(slot_id))
6366 return false;
6367
6368 item1.GetInventory().GetCurrentInventoryLocation(srcIL);
6369
6370 if (!inventory.PlayerCheckRequestSrc(srcIL, GameInventory.c_MaxItemDistanceRadius))
6371 return false;
6372
6373 if (type == -1 && item1 && item2)//combine
6374 {
6375 item2.GetInventory().GetCurrentInventoryLocation(dstIL);
6376 if (!inventory.PlayerCheckRequestSrc(dstIL, GameInventory.c_MaxItemDistanceRadius))
6377 return false;
6378 item1.CombineItems(item2, use_stack_max);
6379 }
6380 else if (type == 1 && item1)
6381 {
6382 if (use_stack_max)
6383 {
6384 if (item2)
6385 {
6386 if(slot_id == -1)
6387 {
6388 GameInventory destinationInventory = item2.GetInventory();
6389 destinationInventory.FindFreeLocationFor(item1, FindInventoryLocationType.ANY, dstIL);
6390 }
6391 else
6392 {
6393 dstIL.SetAttachment(item2, item1, slot_id);
6394 }
6395
6396 if (!inventory.PlayerCheckRequestDst(srcIL, dstIL, GameInventory.c_MaxItemDistanceRadius))
6397 return false;
6398
6399
6400 }
6401
6402
6403 item1.SplitIntoStackMax(item2, slot_id, this);
6404 }
6405 else
6406 {
6407 GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, dstIL);
6408 if (!inventory.PlayerCheckRequestDst(srcIL, dstIL, GameInventory.c_MaxItemDistanceRadius))
6409 return false;
6410
6411 item1.SplitItem(this);
6412 }
6413 }
6414 else if (type == 2 && item1 && item2)
6415 {
6416 int row, col;
6417 if (!ctx.Read(row))
6418 return false;
6419 if (!ctx.Read(col))
6420 return false;
6421
6422 dstIL.SetCargo(item2, item1, slot_id, row, col, false);
6423 if (!inventory.PlayerCheckRequestDst(srcIL, dstIL, GameInventory.c_MaxItemDistanceRadius))
6424 return false;
6425
6426 item1.SplitIntoStackMaxCargo(item2, slot_id, row, col);
6427 }
6428 else if (type == 3 && item1)
6429 {
6430 dstIL.SetHands(this, item1);
6431 if (!inventory.PlayerCheckRequestDst(srcIL, dstIL, GameInventory.c_MaxItemDistanceRadius))
6432 return false;
6433 item1.SplitIntoStackMaxHands(this);
6434 }
6435 return true;
6436 }
6437 return false;
6438 }
6439
6440 // --------------------------------------------------------------------------
6442 {
6443 return ItemBase.Cast(GetEntityInHands());
6444 }
6445
6446 //--------------------------------------------------------------------------
6447
6448
6449 override EntityAI SpawnEntityOnGroundPos(string object_name, vector pos)
6450 {
6451 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !g_Game.IsMultiplayer())
6452 {
6453 bool is_AI = g_Game.IsKindOf(object_name, "DZ_LightAI");
6454 if (is_AI)
6455 {
6456 return SpawnAI(object_name, pos);
6457 }
6458 else
6459 {
6461 vector mtx[4];
6463 mtx[3] = pos;
6464 inv_loc.SetGround(null, mtx);
6465
6466 int flags = ECE_PLACE_ON_SURFACE;
6467 #ifdef DEVELOPER
6468 if (g_Game.IsKindOf(object_name, "Boat"))
6469 flags = ECE_KEEPHEIGHT;
6470 #endif
6471
6472 return EntityAI.Cast(g_Game.CreateObjectEx(object_name, inv_loc.GetPos(), flags));
6473 }
6474 }
6475 return null;
6476 }
6477
6478 EntityAI SpawnEntityOnGroundRaycastDispersed(string object_name, float raycastDistance = DEFAULT_SPAWN_DISTANCE, float radius = UAItemsSpreadRadius.DEFAULT)
6479 {
6480 vector posRandom = MiscGameplayFunctions.GetRandomizedPositionVerifiedPlayer(this,raycastDistance,radius,this);
6481 return SpawnEntityOnGroundPos(object_name,posRandom);
6482 }
6483
6484 EntityAI SpawnEntityOnGroundOnCursorDir(string object_name, float distance)
6485 {
6486 vector position = GetPosition() + (GetDirection() * distance);
6487 return SpawnEntityOnGroundPos(object_name, position);
6488 }
6489
6490 EntityAI SpawnAI(string object_name, vector pos)
6491 {
6492 bool is_ai = g_Game.IsKindOf(object_name, "DZ_LightAI");
6493 if (is_ai)
6494 {
6495 return EntityAI.Cast(g_Game.CreateObjectEx(object_name, pos, ECE_PLACE_ON_SURFACE|ECE_INITAI|ECE_EQUIP_ATTACHMENTS));
6496 }
6497 return NULL;
6498 }
6499
6500 //--------------------------------------------------------------------------
6502 {
6503 bool can_be_dropped = CanDropEntity(item);
6504 if (can_be_dropped)
6505 {
6506 can_be_dropped = PredictiveDropEntity(item);
6507 }
6508
6509 vector pos_spawn = GetPosition() + GetDirection();
6510 pos_spawn[0] = pos_spawn[0] + Math.RandomFloat(-0.2, 0.2);
6511 pos_spawn[2] = pos_spawn[2] + Math.RandomFloat(-0.2, 0.2);
6512
6513 item.SetPosition(pos_spawn);
6514 item.PlaceOnSurface();
6515 return can_be_dropped;
6516 }
6517
6518 // -------------------------------------------------------------------------
6527
6528
6529 EntityAI CreateInInventory(string item_name, string cargo_type = "", bool full_quantity = false)
6530 {
6532 if (GetInventory().FindFirstFreeLocationForNewEntity(item_name, FindInventoryLocationType.ANY, inv_loc))
6533 {
6534 return SpawnItemOnLocation(item_name, inv_loc, full_quantity);
6535 }
6536 return NULL;
6537 }
6538
6540 {
6542 string t = src.GetType();
6543 GameInventory inventory = GetInventory();
6545 {
6546 bool locked = g_Game.HasInventoryJunctureDestination(this, loc);
6547 if (locked)
6548 {
6549 Print("Warning: Split: CreateCopyOfItemInInventory - Cannot create entity at locked inventory at loc=" + InventoryLocation.DumpToStringNullSafe(loc));
6550 return null;
6551 }
6553 if (dst)
6554 {
6555 MiscGameplayFunctions.TransferItemProperties(src, dst);
6556
6557 g_Game.RemoteObjectTreeCreate(dst);
6558
6559 Print("CreateCopyOfItemInInventory - created " + dst.GetName() + " at loc=" + InventoryLocation.DumpToStringNullSafe(loc));
6560 }
6561 return dst;
6562 }
6563 return NULL;
6564 }
6565
6570
6571 ItemBase CreateCopyOfItemInInventoryOrGroundEx(ItemBase src, bool markItemAsSplitResult = false)
6572 {
6574 if (!dst)
6575 {
6576 dst = ItemBase.Cast(SpawnEntityOnGroundPos(src.GetType(), this.GetPosition()));
6577 dst.PlaceOnSurface();
6578 dst.SetResultOfSplit(markItemAsSplitResult);
6579 MiscGameplayFunctions.TransferItemProperties(src, dst);
6580 }
6581
6582 return dst;
6583 }
6584
6585
6586
6587 // -------------------------------------------------------------------------
6594 void Message(string text, string style)
6595 {
6596 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
6597 {
6598 g_Game.ChatMP(this, text, style);
6599 }
6600 else
6601 {
6602 g_Game.Chat(text, style);
6603 }
6604 }
6605
6606 // -------------------------------------------------------------------------
6607 void MessageStatus(string text)
6608 {
6609 Message(text, "colorStatusChannel");
6610 }
6611
6612 // -------------------------------------------------------------------------
6613 void MessageAction(string text)
6614 {
6615 Message(text, "colorAction");
6616 }
6617
6618 // -------------------------------------------------------------------------
6619 void MessageFriendly(string text)
6620 {
6621 Message(text, "colorFriendly");
6622 }
6623
6624 // -------------------------------------------------------------------------
6625 void MessageImportant(string text)
6626 {
6627 Message(text, "colorImportant");
6628 }
6629
6631 {
6632 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
6633 {
6634#ifndef NO_GUI
6635 UIScriptedMenu menu = g_Game.GetUIManager().GetMenu();
6636 if (menu && (menu.GetID() == MENU_INVENTORY || menu.GetID() == MENU_INSPECT))
6637 {
6638 Mission mission = g_Game.GetMission();
6639 g_Game.GetUIManager().CloseAll();
6640 mission.RemoveActiveInputExcludes({"inventory"},false);
6641 mission.RemoveActiveInputRestriction(EInputRestrictors.INVENTORY);
6642 }
6643#endif
6644 }
6645 }
6646
6647 // -------------------------------------------------------------------------
6656 override void ClearInventory()
6657 {
6658 GameInventory inventory = GetInventory();
6659 if ((g_Game.IsServer() || !g_Game.IsMultiplayer()) && inventory)
6660 {
6661 array<EntityAI> items = new array<EntityAI>;
6662 inventory.EnumerateInventory(InventoryTraversalType.INORDER, items);
6663 int nItems = items.Count();
6664 for (int i = 0; i < nItems; ++i)
6665 {
6666 ItemBase item = ItemBase.Cast(items.Get(i));
6667 if (item)
6668 {
6669 g_Game.ObjectDelete(item);
6670 }
6671 }
6672
6673 ItemBase item_in_hands = GetItemInHands();
6674
6675 if (item_in_hands)
6676 {
6677 LocalDestroyEntityInHands();
6678 }
6679 }
6680 }
6681
6684 {
6685 array<EntityAI> itemsArray = new array<EntityAI>;
6686 ItemBase item;
6687 GetInventory().EnumerateInventory(InventoryTraversalType.LEVELORDER, itemsArray);
6688 int count = itemsArray.Count();
6689
6690 for (int i = 0; i < count; ++i)
6691 {
6692 Class.CastTo(item, itemsArray.Get(i));
6693
6694 if (item && !item.IsInherited(SurvivorBase))
6695 {
6696 ServerDropEntity(item);
6697 }
6698 }
6699 }
6700
6702 {
6703 string type;
6704 g_Game.ObjectGetType(this, type);
6705 return type;
6706 }
6707
6708 // --------------------------------------------------
6709 // Lifespan
6710 //---------------------------------------------------
6711
6713 {
6715
6716 m_ModuleLifespan.UpdateLifespan(this, true);
6717 }
6718
6720 {
6722 {
6723 return true;
6724 }
6725 else
6726 {
6727 return false;
6728 }
6729 }
6730
6731
6732 override void OnParticleEvent(string pEventType, string pUserString, int pUserInt)
6733 {
6734 super.OnParticleEvent(pEventType ,pUserString, pUserInt);
6735
6736 if (!g_Game.IsDedicatedServer())
6737 {
6738 if (pUserInt == 123456) // 123456 is ID for vomiting effect. The current implementation is WIP.
6739 {
6740 PlayerBase player = PlayerBase.Cast(this);
6741 int boneIdx = player.GetBoneIndexByName("Head");
6742
6743 if (boneIdx != -1)
6744 {
6745 EffectParticle eff;
6746
6747 if (m_SyncedModifiers & eModifierSyncIDs.MODIFIER_SYNC_CONTAMINATION2)
6748 {
6749 eff = new EffVomitBlood();
6750 }
6751 else
6752 {
6753 eff = new EffVomit();
6754 }
6755
6756 eff.SetDecalOwner(player);
6757 eff.SetAutodestroy(true);
6759 Particle p = eff.GetParticle();
6760 player.AddChild(p, boneIdx);
6761 }
6762 }
6763 }
6764 }
6765
6766
6768 {
6769 if (!ToDelete() && IsAlive() && !IsSwimming() && !m_IsDrowning)
6770 {
6771 return true;
6772 }
6773 return false;
6774 }
6775
6776
6778 {
6779 if (m_AddModifier != -1)
6780 {
6781 HumanCommandAdditives ad = GetCommandModifier_Additives();
6782 if (ad)
6783 ad.StartModifier(m_AddModifier);
6784
6785 m_AddModifier = -1;
6786 }
6787 }
6788
6790 {
6791 //Print("SpawnBreathVaporEffect:"+g_Game.GetTime());
6792 int boneIdx = GetBoneIndexByName("Head");
6793 if (boneIdx != -1)
6794 {
6795 Particle p;
6796 switch (m_BreathVapour)
6797 {
6798 case 1:
6799 p = ParticleManager.GetInstance().PlayInWorld(ParticleList.BREATH_VAPOUR_LIGHT, "-0.03 0.15 0");
6800 break;
6801 case 2:
6802 p = ParticleManager.GetInstance().PlayInWorld(ParticleList.BREATH_VAPOUR_MEDIUM, "-0.03 0.15 0");
6803 break;
6804 case 3:
6805 p = ParticleManager.GetInstance().PlayInWorld(ParticleList.BREATH_VAPOUR_HEAVY, "-0.03 0.15 0");
6806 break;
6807 default:
6808 break;
6809 }
6810
6811 if (p)
6812 AddChild(p, boneIdx);
6813 }
6814 }
6815
6816 // returns 'true' if the player is submerged under water deep enough so that we consider him/her to be eligible for drowning, do note some other conditions may apply for actual drowning to be turned on
6818 {
6819 int index = GetBoneIndexByName("head");
6820 vector pos = GetBonePositionWS(index);
6821 float depth = g_Game.GetWaterDepth(pos);
6822
6823 if (IsSwimming())
6824 {
6826 }
6827 else if (IsUnconscious())
6828 {
6830 }
6832 }
6833
6834 void SetLifeSpanStateVisible(int show_state)
6835 {
6836 bool state_changed;
6837 if (show_state != m_LifeSpanState)
6838 state_changed = true;
6839 m_LifeSpanState = show_state;
6840 SetSynchDirty();
6841
6842 if (state_changed) //server only, client solution in OnVariablesSynchronized()
6843 {
6844 //SendLifespanSyncEvent(m_LifeSpanState);
6845
6847 }
6848 }
6849
6851 {
6852 return m_LifeSpanState;
6853 }
6854
6856 {
6857 return m_LastShavedSeconds;
6858 }
6859
6860 void SetLastShavedSeconds(int last_shaved_seconds)
6861 {
6862 m_LastShavedSeconds = last_shaved_seconds;
6863 }
6864
6866 {
6867 return IsExclusionFlagPresent(GetFaceCoverageShaveValues());
6868 }
6869
6872 {
6873 set<int> ret = new set<int>;
6874 ret.Insert(EAttExclusions.SHAVING_MASK_ATT_0);
6875 ret.Insert(EAttExclusions.SHAVING_HEADGEAR_ATT_0);
6876 //ret.Insert(EAttExclusions.SHAVING_EYEWEAR_ATT_0);
6877
6878 return ret;
6879 }
6880
6885
6887 {
6889 }
6890
6891 void SetBloodyHands(bool show)
6892 {
6893 SetBloodyHandsBase(show);
6894 }
6895
6897 {
6898 SetBloodyHandsBase(type);
6899 }
6900
6901 private void SetBloodyHandsBase(int type)
6902 {
6904 SetSynchDirty();
6905
6906 #ifdef DIAG_DEVELOPER
6907 #ifndef SERVER
6908 if (IsControlledPlayer())
6909 {
6910 bool enable = type;
6911 DiagMenu.SetValue(DiagMenuIDs.LIFESPAN_BLOODY_HANDS, enable);
6912 }
6913 #endif
6914 #endif
6915 }
6916
6918 {
6919 if (HasBloodyHands())
6920 {
6921 if (GetInventory().FindAttachment(InventorySlots.GLOVES))
6922 return 0;
6923
6924 float randomValue = Math.RandomFloat01();
6925 if (GetBloodyHandsPenaltyChancePerAgent(eAgents.SALMONELLA) >= randomValue)
6926 return eAgents.SALMONELLA;
6927
6928 return eAgents.FOOD_POISON;
6929 }
6930
6931 return 0;
6932 }
6933
6935 {
6936 float value = 0.0;
6937 if (m_BloodyHandsPenaltyChancePerAgent.Find(type, value))
6938 return value;
6939
6940 return value;
6941 }
6942
6945 {
6946 float storedValue = GetBloodyHandsPenaltyChancePerAgent(type);
6947 if (amount > storedValue)
6948 m_BloodyHandsPenaltyChancePerAgent.Set(type, Math.Clamp(amount, 0.0, 1.0));
6949 }
6950
6955
6957 {
6958 return m_HasBloodTypeVisible;
6959 }
6960
6961 void SetBloodTypeVisible(bool show)
6962 {
6963 m_HasBloodTypeVisible = show;
6964 SetSynchDirty();
6965 }
6966
6968 {
6969 return m_BloodType;
6970 }
6971
6972 void SetBloodType(int blood_type)
6973 {
6974 m_BloodType = blood_type;
6975 SetSynchDirty();
6976 }
6977
6978 // --------------------------------------------------
6979 // Soft Skills
6980 //---------------------------------------------------
6981
6986
6988 {
6989 if (IsPlayerSelected() && !IsAlive())
6990 {
6991 SimulateDeath(true);
6992 m_DeathCheckTimer.Stop();
6993 }
6994 }
6995
6996 // -------------------------------------------------------------------------
6997
6998 // --------------------------------------------------
6999 // AI Presence
7000 //---------------------------------------------------
7001
7004 {
7006 {
7007 return m_PresenceNotifier.GetNoisePresence();
7008 }
7009
7010 return 0;
7011 }
7012
7013 // is a bit on in the persistent flags
7015 {
7016 return (m_PersistentFlags & bit);
7017 }
7018 // turn on/off a bit in the persistent flag
7019 void SetPersistentFlag(PersistentFlag bit, bool enable)
7020 {
7021 if (enable)//turn on bit
7023 else//turn off bit
7025
7026 }
7027
7028
7029 // -------------------------------------------------------------------------
7030
7032 {
7033 return m_StoreLoadVersion;
7034 }
7035
7037 {
7038 //Print("OnStoreSave");
7039 if (g_Game.SaveVersion() < 102)
7040 {
7041 ctx.Write(ACT_STORE_SAVE_VERSION);//to be removed after we push 102+
7042 }
7043
7044 super.OnStoreSave(ctx);
7045
7046 GetHumanInventory().OnStoreSave(ctx); // FSM of hands
7048
7049 if (GetDayZGame().IsServer() && GetDayZGame().IsMultiplayer())
7050 {
7051 GetPlayerStats().SaveStats(ctx);// save stats
7052 m_ModifiersManager.OnStoreSave(ctx);// save modifiers
7053 m_AgentPool.OnStoreSave(ctx);//save agents
7054 GetSymptomManager().OnStoreSave(ctx);//save states
7056 {
7057 GetBleedingManagerServer().OnStoreSave(ctx);//save bleeding sources
7058 }
7059 m_PlayerStomach.OnStoreSave(ctx);
7060 ctx.Write(GetBrokenLegs());
7061 //ctx.Write(m_LocalBrokenState);
7063
7064 HumanCommandLadder ladder = GetCommand_Ladder();
7065 if (ladder)
7066 {
7067 ctx.Write(true);
7068 ctx.Write(ladder.GetLogoutPosition());
7069 }
7070 else
7071 {
7072 ctx.Write(false);
7073 }
7074
7076 arrowManager.Save(ctx);
7077 }
7078 }
7079
7080
7082 {
7083 if (GetModifiersManager())
7084 SetPersistentFlag(PersistentFlag.AREA_PRESENCE, GetModifiersManager().IsModifierActive(eModifiers.MDF_AREAEXPOSURE));//set the flag for player's presence in contaminated area
7086 }
7087
7088
7089 override bool OnStoreLoad(ParamsReadContext ctx, int version)
7090 {
7091 //Print("---- PlayerBase OnStoreLoad START ----, version: "+version);
7093
7094 // todo :: this should be after base call !!!!
7095 if (version < 102)//write removed in v. 102
7096 {
7097 if (!ctx.Read(m_StoreLoadVersion))
7098 return false;
7099 }
7100
7101 if (!super.OnStoreLoad(ctx, version))
7102 return false;
7103
7104 // FSM of hands
7105 if (!GetHumanInventory().OnStoreLoad(ctx, version))
7106 return false;
7107
7108 if (!OnStoreLoadLifespan(ctx, version))
7109 return false;
7110
7111 if (GetDayZGame().IsServer() && GetDayZGame().IsMultiplayer())
7112 {
7113 if (!GetPlayerStats().LoadStats(ctx, version)) // load stats
7114 {
7115 Print("---- failed to load PlayerStats ----");
7116 return false;
7117 }
7118
7119 if (!m_ModifiersManager.OnStoreLoad(ctx, version))
7120 {
7121 Print("---- failed to load ModifiersManager, read fail ----");
7122 return false;
7123 }
7124
7125 if (!m_AgentPool.OnStoreLoad(ctx, version))
7126 {
7127 Print("---- failed to load AgentPool, read fail ----");
7128 return false;
7129 }
7130
7131 if (!GetSymptomManager().OnStoreLoad(ctx, version))
7132 {
7133 Print("---- failed to load SymptomManager, read fail ----");
7134 return false;
7135 }
7136
7137 if (!GetBleedingManagerServer().OnStoreLoad(ctx, version))
7138 {
7139 Print("---- failed to load BleedingManagerServer, read fail ----");
7140 return false;
7141 }
7142
7143 if (!m_PlayerStomach.OnStoreLoad(ctx, version))
7144 {
7145 Print("---- failed to load PlayerStomach, read fail ----");
7146 return false;
7147 }
7148
7149 //Check for broken leg value
7150 if (version >= 116)
7151 {
7152 if (!ctx.Read(m_BrokenLegState))
7153 {
7154 return false;
7155 }
7156 if (version <= 126)// WHILE >= 116
7157 {
7158 if (!ctx.Read(m_LocalBrokenState))
7159 {
7160 return false;
7161 }
7162 }
7163 }
7164 //Load persistent flags value
7165 if (version >= 125 && (!ctx.Read(m_PersistentFlags)))
7166 {
7167 Print("---- failed to load Persistent Flags, read fail ----");
7168 return false;
7169 }
7170
7171 if (version >= 131)
7172 {
7173 bool onLadder;
7174 if (!ctx.Read(onLadder))
7175 {
7176 return false;
7177 }
7178
7179 if (onLadder)
7180 {
7181 vector position;
7182 if (!ctx.Read(position))
7183 {
7184 return false;
7185 }
7186
7187 Hive hive = GetHive();
7188 if (!hive || !hive.CharacterIsLoginPositionChanged(this))
7189 {
7190 SetPosition(position);
7191 }
7192 }
7193 }
7194
7195 if (version >= 134)
7196 {
7198 arrowManager.Load(ctx);
7199 }
7200 }
7201
7202 Print("---- PlayerBase OnStoreLoad SUCCESS ----");
7203 return true;
7204 }
7205
7206 override void AfterStoreLoad()
7207 {
7208 GetHumanInventory().OnAfterStoreLoad();
7209 if (m_EmoteManager)
7210 m_EmoteManager.AfterStoreLoad();
7211
7212 if (GetPlayerStats())
7213 GetPlayerStats().OnAfterStoreLoad();
7214
7216 vector currentPos = GetPosition();
7217 if (g_Game.GetGameState() != DayZGameState.MAIN_MENU && CfgPlayerRestrictedAreaHandler.IsInitialized() && CfgPlayerRestrictedAreaHandler.IsPointInPlayerRestrictedArea(currentPos,pra))
7218 {
7219 //vector safePos = pra.GetClosestSafePos3D(currentPos);
7220 vector safePos = pra.GetRandomSafePos3D(currentPos);
7221 if (MiscGameplayFunctions.TeleportPlayerToSafeLocation3D(this,safePos) && m_AdminLog)
7222 m_AdminLog.PlayerTeleportedLog(this,currentPos,safePos,"Spawning in Player Restricted Area: " + pra.areaName);
7223 }
7224 }
7225
7234
7236 {
7237 int lifespan_state = 0;
7238 if (!ctx.Read(lifespan_state))
7239 return false;
7240 m_LifeSpanState = lifespan_state;
7241
7242 int last_shaved = 0;
7243 if (!ctx.Read(last_shaved))
7244 return false;
7245 m_LastShavedSeconds = last_shaved;
7246
7247 if (version < 122)
7248 {
7249 bool bloody_hands_old;
7250 if (!ctx.Read(bloody_hands_old))
7251 return false;
7252 m_HasBloodyHandsVisible = bloody_hands_old;
7253 }
7254 else
7255 {
7256 int bloody_hands = 0;
7257 if (!ctx.Read(bloody_hands))
7258 return false;
7259 m_HasBloodyHandsVisible = bloody_hands;
7260 }
7261
7262
7263 bool blood_visible = false;
7264 if (!ctx.Read(blood_visible))
7265 return false;
7266 m_HasBloodTypeVisible = blood_visible;
7267
7268 int blood_type = 0;
7269 if (!ctx.Read(blood_type))
7270 return false;
7271 m_BloodType = blood_type;
7272
7273 return true;
7274 }
7275
7278 {
7279 int hour, minute, second;
7280 GetHourMinuteSecond(hour, minute, second);
7281 float distance;
7282 distance = StatGet(AnalyticsManagerServer.STAT_DISTANCE);
7283 if (m_AnalyticsTimer)
7284 {
7286 data.m_CharacterId = g_Game.GetDatabaseID();
7287 data.m_TimeInterval = m_AnalyticsTimer.GetRemaining();
7288 data.m_DaytimeHour = hour;
7290 data.m_PositionEnd = GetPosition();
7291 data.m_DistanceOnFoot = distance;
7293 }
7294
7296 }
7297
7299 {
7300 Debug.Log("Player connected:"+this.ToString(),"Connect");
7301
7302 // analytics
7303 g_Game.GetAnalyticsServer().OnPlayerConnect(this);
7304
7306 if (m_AnalyticsTimer)
7307 m_AnalyticsTimer.Run(60, this, "UpdatePlayerMeasures", null, true);
7308
7309 //construction action data
7311 }
7312
7314 {
7315 Debug.Log("Player reconnected:"+this.ToString(),"Reconnect");
7316
7317 //construction action data
7318
7320 }
7321
7323 {
7324 Debug.Log("Player disconnected:"+this.ToString(),"Connect");
7325
7326 // analytics
7327 // force update of the stats
7328 // if player disconnect too soon, UpdatePlayersStats() is not called
7329 g_Game.GetAnalyticsServer().OnPlayerDisconnect(this);
7330
7332 data.m_CharacterId = g_Game.GetDatabaseID();
7333 data.m_Reason = "Disconnected";
7335
7336 if (m_AnalyticsTimer)
7337 m_AnalyticsTimer.Stop();
7339
7341 }
7342
7343 void SetModifiers(bool enable)
7344 {
7345 GetModifiersManager().SetModifiers(enable);
7346 }
7347
7349 {
7350 PluginTransmissionAgents plugin = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
7351 WorldData worldData = g_Game.GetMission().GetWorldData();
7352 int pollution = worldData.GetPollution();
7353 float temperature = 0;
7354
7355 if (data.m_Type == EConsumeType.ENVIRO_POND || data.m_Type == EConsumeType.ENVIRO_WELL || data.m_Type == EConsumeType.ENVIRO_SNOW)
7356 {
7357 if (data.m_Type != EConsumeType.ENVIRO_WELL)
7358 {
7359 if (pollution & EPollution.HEAVYMETAL)
7360 data.m_Agents = data.m_Agents | eAgents.HEAVYMETAL;
7361
7362 if (data.m_Type == EConsumeType.ENVIRO_POND)
7363 data.m_Agents = data.m_Agents | eAgents.CHOLERA;
7364 }
7365
7366 temperature = worldData.GetLiquidTypeEnviroTemperature(data.m_LiquidType);
7367 m_PlayerStomach.AddToStomach(Liquid.GetLiquidClassname(LIQUID_WATER), data.m_Amount, 0 , data.m_Agents, temperature);
7368
7369 return true;
7370 }
7371
7372 Edible_Base edibleItem = Edible_Base.Cast(data.m_Source);
7373 if (!edibleItem || !edibleItem.CanBeConsumed())
7374 return false;
7375
7376 if (data.m_Type == EConsumeType.ITEM_SINGLE_TIME || data.m_Type == EConsumeType.ITEM_CONTINUOUS)
7377 {
7378 data.m_Agents = edibleItem.FilterAgents(data.m_Agents | edibleItem.GetAgents());
7379 temperature = edibleItem.GetTemperature();
7380
7381 if (data.m_Type == EConsumeType.ITEM_SINGLE_TIME)
7382 plugin.TransmitAgents(edibleItem, this, AGT_UACTION_CONSUME, data.m_Amount);
7383
7384 if (edibleItem.IsLiquidContainer())
7385 {
7386 int liquidType = edibleItem.GetLiquidType();
7387 string liquidClassName = Liquid.GetLiquidClassname(liquidType);
7388 if (liquidClassName.Length() == 0)
7389 Error("Error! Trying to add unknown liquid to stomach with item=" + Object.GetDebugName(edibleItem) + " data.m_Type=" + data.m_Type + " liquid_type=" + liquidType);
7390
7391 m_PlayerStomach.AddToStomach(liquidClassName, data.m_Amount, 0, data.m_Agents, temperature);
7392 }
7393 else
7394 {
7395 int foodStageType;
7396 if (edibleItem.GetFoodStage())
7397 foodStageType = edibleItem.GetFoodStage().GetFoodStageType();
7398
7399 m_PlayerStomach.AddToStomach(data.m_Source.GetType(), data.m_Amount, foodStageType, data.m_Agents, temperature);
7400 }
7401
7402 edibleItem.Consume(data.m_Amount, this);
7403
7404 return true;
7405
7406 }
7407
7408 return false;
7409 }
7410
7412 {
7413 #ifndef NO_GUI
7414 if (show)
7415 {
7416 g_Game.GetUIManager().ScreenFadeIn(0, "You are Unconscious", FadeColors.BLACK, FadeColors.WHITE);
7417 PrintString("Fade in");
7418 }
7419 else
7420 {
7421 g_Game.GetUIManager().ScreenFadeOut(0);
7422 PrintString("Fade out");
7423 }
7424 #endif
7425 }
7426
7427 override void RequestSoundEventEx(EPlayerSoundEventID id, bool from_server_and_client = false, int param = 0)
7428 {
7429 if (from_server_and_client && GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
7430 {
7431 PlaySoundEventEx(id, false, false, param);
7432 return;
7433 }
7434
7435 SendSoundEventEx(id, param);
7436 }
7437
7438 override void RequestSoundEvent(EPlayerSoundEventID id, bool from_server_and_client = false)
7439 {
7440 RequestSoundEventEx(id, from_server_and_client);
7441 }
7442
7443 override void RequestSoundEventStop(EPlayerSoundEventID id, bool from_server_and_client = false, int param = EPlayerSoundEventParam.STOP_PLAYBACK)
7444 {
7445 if (from_server_and_client && GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
7446 {
7447 StopSoundEvent(id, false, param);
7448 return;
7449 }
7450
7451 SendSoundEventEx(id, param);
7452 }
7453
7454 override protected void SendSoundEvent(EPlayerSoundEventID id)
7455 {
7456 SendSoundEventEx(id);
7457 }
7458
7459 override protected void SendSoundEventEx(EPlayerSoundEventID id, int param = 0)
7460 {
7461 if (!g_Game.IsServer())
7462 {
7463 return;
7464 }
7465 m_SoundEvent = id;
7466 m_SoundEventParam = param;
7467 SetSynchDirty();
7468
7469 if (!g_Game.IsMultiplayer())
7470 {
7472 }
7473
7474 //PrintString(g_Game.GetTime().ToString() + " Set SoundEvent, id:" + id.ToString());
7475 }
7476
7478 {
7479 if (m_SoundEvent != 0 && m_SoundEventSent)
7480 {
7481 m_SoundEvent = 0;
7483 m_SoundEventSent = false;
7484 SetSynchDirty();
7485 }
7486 }
7487
7489 {
7490 if (m_SoundEvent!= 0 && !m_SoundEventSent)
7491 {
7492 m_SoundEventSent = true;
7493 }
7494 }
7495
7496 override bool PlaySoundEventType(ESoundEventType soundType, int soundEventID, int param = 0)
7497 {
7498 if (m_ReplaceSoundEventHandler)
7499 return m_ReplaceSoundEventHandler.PlayReplaceSound(soundEventID, soundType, param);
7500
7501 return false;
7502 }
7503
7504 override bool PlaySoundEvent(EPlayerSoundEventID id, bool from_anim_system = false, bool is_from_server = false)
7505 {
7506 return PlaySoundEventEx(id, from_anim_system, is_from_server);
7507 }
7508
7509 override bool PlaySoundEventEx(EPlayerSoundEventID id, bool from_anim_system = false, bool is_from_server = false, int param = 0)
7510 {
7511 if (!m_PlayerSoundEventHandler)
7512 return false;
7513
7514 return m_PlayerSoundEventHandler.PlayRequestEx(id, is_from_server, param);
7515 }
7516
7517 override bool StopSoundEvent(EPlayerSoundEventID id, bool is_from_server = false, int param = 0)
7518 {
7519 if (!m_PlayerSoundEventHandler)
7520 return false;
7521
7522 return m_PlayerSoundEventHandler.StopRequest(id, is_from_server, param);
7523 }
7524
7526 {
7527 return m_PlayerSoundEventHandler;
7528 }
7529
7532
7534 {
7536 if (IsControlledPlayer())
7537 {
7538 if (!g_Game.IsDedicatedServer())
7539 {
7540 DisplayElementBadge dis_elm = DisplayElementBadge.Cast(GetVirtualHud().GetElement(eDisplayElements.DELM_BADGE_BLEEDING));
7541 if (dis_elm)
7542 {
7543 dis_elm.SetValue(GetBleedingSourceCount());
7544 }
7545
7546
7547 //Print("----------bleeding_SoundSet----------");
7548 SEffectManager.PlaySoundOnObject("bleeding_SoundSet", this);
7549 }
7550 }
7551 }
7552
7554 {
7556 if (g_Game.IsServer())
7557 {
7558 ArrowManagerBase arrowManager = GetArrowManager();
7559 if (GetBleedingSourceCount() > 0)
7560 {
7561 arrowManager.DropFirstArrow();
7562 }
7563 else
7564 {
7565 arrowManager.DropAllArrows();
7566 }
7567 }
7568
7569 if (IsControlledPlayer())
7570 {
7571 if (!g_Game.IsDedicatedServer())
7572 {
7573 //Print("GetBleedingSourceCount() "+GetBleedingSourceCount());
7574 DisplayElementBadge dis_elm = DisplayElementBadge.Cast(GetVirtualHud().GetElement(eDisplayElements.DELM_BADGE_BLEEDING));
7575 if (dis_elm)
7576 {
7577 dis_elm.SetValue(GetBleedingSourceCount());
7578 }
7579 }
7580 }
7581 }
7582
7583
7588
7590 {
7591 return m_BleedingSourceCount;
7592 }
7593
7594 // for debug purposes, should reset some systems like Modifiers, Stats, Damage etc.....
7595 void ResetPlayer(bool set_max)
7596 {
7597 #ifdef DIAG_DEVELOPER
7598 if (g_Game.IsServer() || !g_Game.IsMultiplayer())
7599 {
7600 GetStomach().ClearContents();
7601
7602 DamageSystem.ResetAllZones(this);
7603 GetModifiersManager().ResetAll();
7604
7605 // bleeding sources
7607 m_BleedingManagerServer.RemoveAllSources();
7608
7609 // Stats
7610 if (GetPlayerStats())
7611 {
7612 int bloodType = GetStatBloodType().Get();
7613 GetPlayerStats().ResetAllStats();
7614 GetStatBloodType().Set(bloodType);
7615 }
7616
7617 // Agents
7618 if (m_AgentPool)
7619 m_AgentPool.RemoveAllAgents();
7620
7621 if (m_StaminaHandler)
7623
7624 // uncon
7625 if (IsUnconscious())
7627
7628 // set max
7629 if (set_max)
7630 {
7631 GetStatWater().Set(GetStatWater().GetMax());
7633 }
7634
7635 // fix up inventory
7637
7638 //remove bloody hands
7639 PluginLifespan moduleLifespan = PluginLifespan.Cast(GetPlugin(PluginLifespan));
7640 moduleLifespan.UpdateBloodyHandsVisibilityEx(this, eBloodyHandsTypes.CLEAN);
7642
7643 if (GetArrowManager())
7645
7646 }
7647
7648 // client + single + server
7649 HumanCommandVehicle vehCmd = GetCommand_Vehicle();
7650 if (vehCmd)
7651 {
7652 Transport transport = vehCmd.GetTransport();
7653 if (transport)
7654 transport.FixEntity();
7655 }
7656 #endif
7657 }
7658
7660 {
7661 if (m_SoundEvent != 0 && (m_SoundEventParam & EPlayerSoundEventParam.STOP_PLAYBACK) != EPlayerSoundEventParam.STOP_PLAYBACK)
7663 else if (m_SoundEventParam & EPlayerSoundEventParam.STOP_PLAYBACK)
7665
7666 m_SoundEvent = 0;
7668
7669 // cancelling marked interrupted sounds
7670 if (m_PerformedAnimActionID == -1)
7671 {
7672 if (m_PerformedActionSounds.Count() == 0)
7673 return;
7674
7675 foreach (AbstractWave sound : m_PerformedActionSounds)
7676 {
7677 if (sound)
7678 sound.Stop();
7679 }
7680
7681 m_PerformedActionSounds.Clear();
7682 }
7683 }
7684
7686 {
7687 if (g_Game.IsClient()) return;
7688 RequestSoundEvent(1234);
7689 //Math.RandomInt(1,4096)
7690 }
7691
7692 void SetStaminaState(eStaminaState state)
7693 {
7694 if (state != m_StaminaState)
7695 {
7696 m_StaminaState = state;
7697 //PrintString("m_StaminaState:"+m_StaminaState.ToString());
7698 SetSynchDirty();
7699 }
7700 }
7701
7703 {
7704 return m_StaminaState;
7705 }
7706
7708 {
7709 m_QuickBarBase.updateSlotsCount();
7710 }
7711
7712 bool Save()
7713 {
7714 // saved player must be alive and not captive
7715 if (GetPlayerState() == EPlayerStates.ALIVE && !IsRestrained())
7716 {
7717 GetHive().CharacterSave(this);
7718 Debug.Log("Player "+this.ToString()+ " saved as alive");
7719
7720 return true;
7721 }
7722 return false;
7723 }
7724
7725 // agent transfer
7727 void SpreadAgentsEx(float distance = 3,float chance = 0.25)
7728 {
7729 if (Math.RandomFloat01() > chance)
7730 return;
7731
7732 g_Game.GetPlayers(m_ServerPlayers);
7733 float dist_check = distance * distance;//make it sq
7734 PluginTransmissionAgents plugin = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
7735
7736 foreach (Man target: m_ServerPlayers)
7737 {
7738 if (vector.DistanceSq(GetWorldPosition(), target.GetWorldPosition()) < dist_check && target != this)
7739 {
7740 plugin.TransmitAgents(this, target, AGT_AIRBOURNE_BIOLOGICAL, 1);
7741 }
7742 }
7743 }
7744
7745 void SpreadAgents()//legacy method
7746 {
7747 SpreadAgentsEx(3,1);
7748 }
7749
7750 //--------------------------------------------------------------------------------------------
7751 override int GetAgents()
7752 {
7753 return m_AgentPool.GetAgents();
7754 }
7755
7756 //--------------------------------------------------------------------------------------------
7757 override void RemoveAgent(int agent_id) //removes a single agent type from the player agent pool
7758 {
7759 m_AgentPool.RemoveAgent(agent_id);
7760 }
7761
7762 //--------------------------------------------------------------------------------------------
7763 override void RemoveAllAgents()
7764 {
7765 m_AgentPool.RemoveAllAgents();
7766 }
7767
7768
7769 //--------------------------------------------------------------------------------------------
7770 override void InsertAgent(int agent, float count = 1) //adds a single agent type to the player agent pool
7771 {
7772 m_AgentPool.AddAgent(agent,count);
7773 }
7774
7775 //--------------------------------------------------------------------------------------------
7776 int GetSingleAgentCount(int agent_id)
7777 {
7778 return m_AgentPool.GetSingleAgentCount(agent_id);
7779 }
7780
7781 //--------------------------------------------------------------------------------------------
7783 {
7784 int max_count = PluginTransmissionAgents.GetAgentMaxCount(agent_id);
7785 return m_AgentPool.GetSingleAgentCount(agent_id) / max_count;
7786 }
7787
7789 {
7790 return m_AgentPool.GetTotalAgentCount();
7791 }
7792
7794 {
7795 m_AgentPool.PrintAgents();
7796 }
7797
7798 void ImmuneSystemTick(float value, float deltaT)
7799 {
7800 m_AgentPool.ImmuneSystemTick(value, deltaT);
7801 }
7802
7803 void SetTemporaryResistanceToAgent(int agent, float time)
7804 {
7805 m_AgentPool.SetTemporaryResistance(agent, time);
7806 }
7807
7809 {
7810 return m_AgentPool.GetTemporaryResistance(agent);
7811 }
7812
7813 //Get aim (player crosshair) position
7815 {
7816 float min_distance = 0.5; //min distance, default = 5m
7817
7818 vector from = g_Game.GetCurrentCameraPosition();
7819 vector to = from + (g_Game.GetCurrentCameraDirection() * min_distance);
7820 vector contactPos;
7821 vector contactDir;
7822 int contactComponent;
7823
7824 DayZPhysics.RaycastRV(from, to, contactPos, contactDir, contactComponent, NULL, NULL, NULL, false, true);
7825
7826 return contactPos;
7827 }
7828
7829
7831 {
7832 ItemBase mask = ItemBase.Cast(GetInventory().FindAttachment(InventorySlots.MASK));
7833 return (!mask || (mask && mask.AllowFoodConsumption()));
7834 }
7835
7837 {
7838 return true;
7839 }
7840
7841 //get modifier manager
7846
7848 {
7849 if (!m_StatWater && m_PlayerStats)
7850 {
7852 }
7853 return m_StatWater;
7854 }
7855
7857 {
7859 {
7861 }
7862 return m_StatToxicity;
7863 }
7864
7866 {
7867 if (!m_StatEnergy && m_PlayerStats)
7868 {
7870 }
7871 return m_StatEnergy;
7872 }
7873
7875 {
7877 {
7878 m_StatHeatComfort = PlayerStat<float>.Cast(m_PlayerStats.GetStatObject(EPlayerStats_current.HEATCOMFORT));
7879 }
7880 return m_StatHeatComfort;
7881 }
7882
7884 {
7885 if (!m_StatTremor && m_PlayerStats)
7886 {
7888 }
7889 return m_StatTremor;
7890 }
7891
7893 {
7894 if (!m_StatWet && m_PlayerStats)
7895 {
7896 m_StatWet = PlayerStat<int>.Cast(m_PlayerStats.GetStatObject(EPlayerStats_current.WET));
7897 }
7898 return m_StatWet;
7899 }
7900
7902 {
7903 if (!m_StatDiet && m_PlayerStats)
7904 {
7905 m_StatDiet = PlayerStat<float>.Cast(m_PlayerStats.GetStatObject(EPlayerStats_current.DIET));
7906 }
7907 return m_StatDiet;
7908 }
7909
7911 {
7912 if (!m_StatStamina && m_PlayerStats)
7913 {
7914 m_StatStamina = PlayerStat<float>.Cast(m_PlayerStats.GetStatObject(EPlayerStats_current.STAMINA));
7915 }
7916 return m_StatStamina;
7917 }
7918
7920 {
7921 if (!m_StatSpecialty && m_PlayerStats)
7922 {
7923 m_StatSpecialty = PlayerStat<float>.Cast(m_PlayerStats.GetStatObject(EPlayerStats_current.SPECIALTY));
7924 }
7925 return m_StatSpecialty;
7926 }
7927
7929 {
7930 if (!m_StatBloodType && m_PlayerStats)
7931 {
7932 m_StatBloodType = PlayerStat<int>.Cast(m_PlayerStats.GetStatObject(EPlayerStats_current.BLOODTYPE));
7933 }
7934 return m_StatBloodType;
7935 }
7936
7938 {
7939 if (!m_StatHeatBuffer && m_PlayerStats)
7940 {
7941 m_StatHeatBuffer = PlayerStat<float>.Cast(m_PlayerStats.GetStatObject(EPlayerStats_current.HEATBUFFER));
7942 }
7943 return m_StatHeatBuffer;
7944 }
7945
7946 void SetHeatBufferDynamicMax(float value)
7947 {
7948 m_HeatBufferDynamicMax = value;
7949 SetSynchDirty();
7950 }
7951
7953 {
7955 }
7956
7958 {
7959 m_HasHeatBuffer = show;
7960 SetSynchDirty();
7961 }
7962
7963 void ToggleHeatBufferVisibility(int heatbufferStage)
7964 {
7965 m_HeatBufferStage = heatbufferStage;
7966 SetSynchDirty();
7967 }
7968
7971 {
7972 return m_UALastMessage;
7973 }
7974
7975 void SetLastUAMessage(string pMsg)
7976 {
7977 m_UALastMessage = pMsg;
7978
7979 if (m_UALastMessageTimer.IsRunning())
7980 {
7981 m_UALastMessageTimer.Stop();
7982 }
7983
7984 m_UALastMessageTimer.Run(PlayerConstants.LAST_UA_MSG_LIFETIME, this, "ClearLastUAMessage", null);
7985 }
7986
7987 protected void ClearLastUAMessage()
7988 {
7989 if (m_UALastMessageTimer.IsRunning())
7990 {
7991 m_UALastMessageTimer.Stop();
7992 }
7993
7994 m_UALastMessage = "";
7995 }
7996
7999
8002 {
8003 m_InjuryHandler.CheckValue(true);
8004 }
8005
8006 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
8007 {
8008#ifdef DIAG_DEVELOPER
8009 if (m_Bot && action_id > EActions.PLAYER_BOT_INTERNAL_START && action_id < EActions.PLAYER_BOT_END)
8010 {
8011 m_Bot.StartAction(action_id);
8012 return true;
8013 }
8014#endif
8015
8016 if (super.OnAction(action_id, player, ctx))
8017 return true;
8018
8019 if (g_Game.IsClient() || !g_Game.IsMultiplayer())
8020 {
8021 switch (action_id)
8022 {
8023 case EActions.GIZMO_OBJECT:
8024 if (GetGizmoApi())
8025 GetGizmoApi().SelectObject(this);
8026 return true;
8027 case EActions.GIZMO_PHYSICS:
8028 if (GetGizmoApi())
8029 GetGizmoApi().SelectPhysics(GetPhysics());
8030 return true;
8031 }
8032 }
8033
8034 if (g_Game.IsServer())
8035 {
8036 switch (action_id)
8037 {
8038 case EActions.DELETE:
8039 Delete();
8040 return true;
8041 }
8042 }
8043
8044 return false;
8045 }
8046
8047 // -------------------------------------------------------------------------
8048 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8049 {
8050 int i;
8051
8052 PluginTransmissionAgents pluginTransmissionAgents = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
8053
8054#ifdef DIAG_DEVELOPER
8055 if (pluginTransmissionAgents && !(m_Bot || GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_AI_REMOTE))
8056#else
8057 if (pluginTransmissionAgents && !(GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_AI_REMOTE))
8058#endif
8059 {
8060 map<int, string> agentList = pluginTransmissionAgents.GetSimpleAgentList();
8061
8062 if (agentList)
8063 {
8064 foreach (int tid, string tname : agentList)
8065 {
8066 string injectName = "Inject " + tname;
8067 string removeName = "Remove " + tname;
8068
8069 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DEBUG_AGENTS_RANGE_INJECT_START + tid, injectName, Colors.WHITE));
8070 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DEBUG_AGENTS_RANGE_REMOVE_START + tid, removeName, Colors.WHITE));
8071 }
8072 }
8073
8074 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
8075 }
8076
8077#ifdef DIAG_DEVELOPER
8078 if (m_Bot || GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_AI_REMOTE)
8079 {
8080 typename e = EActions;
8081
8082 int cnt = e.GetVariableCount();
8083 int val;
8084
8085 for (i = 0; i < cnt; i++)
8086 {
8087 if (!e.GetVariableValue(null, i, val))
8088 continue;
8089
8090 if (val <= EActions.PLAYER_BOT_INTERNAL_START)
8091 continue;
8092
8093 if (val == EActions.PLAYER_BOT_START)
8094 {
8095 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
8096 continue;
8097 }
8098
8099 if (val >= EActions.PLAYER_BOT_END)
8100 break;
8101
8102 string name = e.GetVariableName(i);
8103
8104 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, val, name, FadeColors.LIGHT_GREY));
8105 }
8106
8107 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
8108 }
8109#endif
8110
8111 super.GetDebugActions(outputList);
8112
8113 if (Gizmo_IsSupported())
8114 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_OBJECT, "Gizmo Object", FadeColors.LIGHT_GREY));
8115 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_PHYSICS, "Gizmo Physics (SP Only)", FadeColors.LIGHT_GREY)); // intentionally allowed for testing physics desync
8116 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_AI_SINGLEPLAYER) // Prevent deleting ourselves
8117 {
8118 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
8119 }
8120 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
8121 }
8122
8123 //-------------------------------------------------------------
8127
8128 override void OnSyncJuncture(int pJunctureID, ParamsReadContext pCtx)
8129 {
8130 super.OnSyncJuncture(pJunctureID, pCtx);
8131
8132 switch(pJunctureID)
8133 {
8136 bool enable;
8137 DayZPlayerSyncJunctures.ReadInjuryParams(pCtx, enable, level);
8138 m_InjuryHandler.SetInjuryCommandParams(enable, level);
8139 break;
8141 GetSymptomManager().SetAnimation(pCtx);
8142 break;
8145 break;
8147 GetInventory().OnInventoryJunctureFromServer(pCtx);
8148 break;
8150 GetInventory().OnInventoryJunctureFailureFromServer(pCtx);
8151 break;
8155 m_ActionManager.OnSyncJuncture(pJunctureID,pCtx);
8156 break;
8160 m_WeaponManager.OnSyncJuncture(pJunctureID,pCtx);
8161 break;
8163 DayZPlayerSyncJunctures.ReadPlayerUnconsciousnessParams(pCtx, m_ShouldBeUnconscious);
8164 break;
8166 GetSymptomManager().SetAnimation(pCtx);
8167 break;
8169 float amount;
8170 if (DayZPlayerSyncJunctures.ReadKuruRequest(pCtx, amount))
8171 {
8172 if (GetAimingModel() && IsFireWeaponRaised())
8173 {
8174 GetAimingModel().RequestKuruShake(amount);
8175 }
8176 }
8177 break;
8179 m_EmoteManager.OnSyncJuncture(pJunctureID, pCtx);
8180 break;
8181 case DayZPlayerSyncJunctures.SJ_WEAPON_LIFT: // Obsolete
8182 SetLiftWeapon(pJunctureID, pCtx);
8183 break;
8185 m_ResetADS = true;
8186 break;
8188 SetToDelete(pCtx);
8189 break;
8193 break;
8196 break;
8198 m_StaminaHandler.OnSyncJuncture(pJunctureID, pCtx);
8199 break;
8201 m_StaminaHandler.OnSyncJuncture(pJunctureID, pCtx);
8202 break;
8203 #ifdef DEVELOPER
8204 case DayZPlayerSyncJunctures.SJ_DEBUG_GET_IN_VEHICLE:
8205 EntityAI vehicle;
8206 DayZPlayerSyncJunctures.ReadGetInVehicleParams(pCtx, vehicle);
8207 SetGetInVehicleDebug(vehicle);
8208 break;
8209 #endif
8210 }
8211 }
8212
8214 {
8215 return m_ItemsToDelete.Count() > 0;
8216 }
8217
8219 {
8220 EntityAI item;
8221 pCtx.Read(item);
8222 AddItemToDelete(item);
8223 }
8224
8225 override void AddItemToDelete(EntityAI item)
8226 {
8227 if (item)
8228 {
8229 item.SetPrepareToDelete();
8230 m_ItemsToDelete.Insert(item);
8231 }
8232 }
8233
8235 {
8236 return !(GetThrowing().IsThrowingAnimationPlaying() || GetDayZPlayerInventory().IsProcessing() || (GetActionManager() && GetActionManager().GetRunningAction()));
8237 }
8238
8239 override void JunctureDeleteItem(EntityAI item)
8240 {
8242 }
8243
8245 {
8246 int count = m_ItemsToDelete.Count();
8247 if (count > 0)
8248 {
8249 if (CanDeleteItems())
8250 {
8251 EntityAI itemToDelete;
8252
8253 if (g_Game.IsClient() && g_Game.IsMultiplayer())
8254 {
8256 for (int i = count - 1; i >= 0 ; i--)
8257 {
8258 itemToDelete = m_ItemsToDelete.Get(i);
8259 if (itemToDelete != null)
8260 {
8261 itemToDelete.GetInventory().GetCurrentInventoryLocation(il);
8262 }
8263
8264 if (itemToDelete == null || (GetItemInHands() == null && il.GetType() == InventoryLocationType.UNKNOWN))
8265 {
8266 m_ItemsToDelete.Remove(i);
8267 }
8268 }
8269 }
8270 else
8271 {
8272 for (int j = count - 1; j >= 0 ; j--)
8273 {
8274 itemToDelete = m_ItemsToDelete.Get(j);
8275 if (itemToDelete == null)
8276 {
8277 m_ItemsToDelete.Remove(j);
8278 }
8279 else
8280 {
8281 itemToDelete.Delete();
8282 m_ItemsToDelete.Remove(j);
8283 }
8284 }
8285 }
8286 }
8287 }
8288 }
8289
8290 override bool HeadingModel(float pDt, SDayZPlayerHeadingModel pModel)
8291 {
8292 if (GetActionManager()) // disable character turning while performing actions
8293 {
8295 if (action && action.IsFullBody(this) && action.IsCameraLockOnPerform())
8296 {
8298 {
8299 m_IsHeadingRestricted = true;
8300 m_HeadingRestrictData.InitData(pModel.m_fHeadingAngle, action.GetCameraLRAngle());
8301 }
8302
8303 return DayZPlayerImplementHeading.RestrictHeading(pDt, pModel, m_fLastHeadingDiff, m_HeadingRestrictData);
8304 }
8305 else
8306 m_IsHeadingRestricted = false;
8307 }
8308
8311 {
8312 HumanItemAccessor hia = GetItemAccessor();
8313 HumanItemBehaviorCfg hibcfg = hia.GetItemInHandsBehaviourCfg();
8314 if (hibcfg && hibcfg.m_StanceRotation[m_MovementState.m_iStanceIdx] == DayZPlayerConstants.ROTATION_DISABLE)
8315 {
8316 return DayZPlayerImplementHeading.NoHeading(pDt, pModel, m_fLastHeadingDiff);
8317 }
8318 else
8319 {
8320 m_fLastHeadingDiff = 0;
8321 return DayZPlayerImplementHeading.ClampHeading(pDt, pModel, m_fLastHeadingDiff);
8322 }
8323 }
8324
8325 return super.HeadingModel(pDt, pModel);
8326 }
8327
8329 {
8330 return m_InventorySoftLockCount > 0;
8331 }
8332
8334 override void SetInventorySoftLock(bool status)
8335 {
8336 if (status)
8338 else
8340
8343
8345 }
8346
8347 void SetLoadedQuickBarItemBind(EntityAI entity, int index)
8348 {
8349 if (m_aQuickBarLoad)
8350 m_aQuickBarLoad.Insert(new Param2<EntityAI, int>(entity,index));
8351 }
8352
8353 override bool IsLiftWeapon()
8354 {
8355 return m_LiftWeapon_player;
8356 }
8357
8358 override float GetWeaponObstruction()
8359 {
8360 return m_ObstructWeapon_player;
8361 }
8362
8364 {
8365 Weapon_Base weapon = Weapon_Base.Cast(GetItemInHands());
8366 if (!weapon)
8367 return false;
8368
8369 // Recompute the relative obstruction [0 ... 1] value into actual distance ...
8370 float obstruction = GetWeaponObstruction();
8371
8372 // ... unless there is no obstruction to begin with at which point the
8373 // additional checks are rendered competely irrelevant.
8374 if (obstruction <= 0.0)
8375 {
8376 return false;
8377 }
8378
8379 float penetration = weapon.GetObstructionPenetrationDistance(obstruction);
8380 bool inSights = m_CameraIronsight || m_CameraOptics;
8381 // Create a threshold that allows the user to remain in ADS for lesser obstruction
8382 // values, significantly reducing the continuous state changes near the edge.
8383 if (inSights)
8384 {
8385 return penetration > 0.040; // 4.0 cm
8386 }
8387 // Prevent the user from entering ADS if there is even a tiny fraction of obstruction,
8388 // further reinforcing the statement above.
8389 else
8390 {
8391 return penetration > 0.005; // 0.5 cm
8392 }
8393 }
8394
8395 //Server
8396 bool ReadLiftWeaponRequest(int userDataType, ParamsReadContext ctx)
8397 {
8398 bool state;
8399 float obstruct;
8400 ctx.Read(state);
8401 ctx.Read(obstruct);
8402 SetLiftWeapon(state, obstruct);
8403
8404 return true;
8405 }
8406
8407 void SetLiftWeapon(int pJunctureID, ParamsReadContext ctx) // Obsolete
8408 {
8409 bool state;
8410 float obstruct;
8411 ctx.Read(state);
8412 ctx.Read(obstruct);
8413
8414 SetLiftWeapon(state, obstruct);
8415
8416 //Print("SetLiftWeapon | STS: " + GetSimulationTimeStamp());
8417 }
8418
8419 void SetLiftWeapon(bool state, float obstruct = 0)
8420 {
8421 m_ProcessLiftWeaponState = state;
8422 m_ProcessLiftWeapon = true;
8423 m_ProcessObstructWeapon = obstruct;
8424 }
8425
8427 void SendLiftWeaponSync(bool state, float obstruct = 0)
8428 {
8430
8431 bool liftChange = m_LiftWeapon_player != state;
8432 bool obstructChange = Math.AbsFloat(m_ObstructWeapon_player-obstruct) > 0.03;
8433
8434 // Apply state immediately
8435 m_LiftWeapon_player = state;
8436 m_ObstructWeapon_player = obstruct;
8437
8438 if (liftChange)
8439 {
8440 GetWeaponManager().OnLiftWeapon();
8441 }
8442
8443 if (!liftChange && !obstructChange)
8444 {
8445 // insignificant difference
8446 return;
8447 }
8448
8449 // Notify server to apply same state
8450 if (g_Game.IsMultiplayer() && g_Game.IsClient())
8451 {
8453 if (!ctx.CanStoreInputUserData())
8454 {
8455 // ctx not available??
8456 return;
8457 }
8458
8460 ctx.Write(state);
8461 ctx.Write(obstruct);
8462 ctx.Send();
8463 }
8464 }
8465
8466 override void CheckLiftWeapon()
8467 {
8468 // lift weapon check
8469 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
8470 {
8471 Weapon_Base weap;
8472 if (Weapon_Base.CastTo(weap, GetItemInHands()))
8473 {
8474 Object hitObject;
8475 float obstruct;
8476 bool limited = weap.LiftWeaponCheckEx(this, obstruct, hitObject);
8477 if (weap.UseWeaponObstruction(this, obstruct, hitObject))
8478 {
8479 limited = false;
8480 }
8481 else
8482 {
8483 obstruct = 0.0;
8484 }
8485
8486 obstruct = Math.Clamp( obstruct, 0, 1 );
8487
8488 if (m_LiftWeapon_player != limited || m_ObstructWeapon_player != obstruct)
8489 {
8490 SendLiftWeaponSync(limited, obstruct);
8491 }
8492 }
8493 else if (m_LiftWeapon_player || m_ObstructWeapon_player > 0)
8494 {
8495 SendLiftWeaponSync(false);
8496 }
8497 }
8498 }
8499
8500 override void ProcessLiftWeapon()
8501 {
8502 if (m_ProcessLiftWeapon)
8503 {
8504 bool liftChange = m_LiftWeapon_player != m_ProcessLiftWeaponState;
8505 if (liftChange)
8506 {
8507 GetWeaponManager().OnLiftWeapon();
8508 }
8509 m_LiftWeapon_player = m_ProcessLiftWeaponState;
8510 m_ObstructWeapon_player = m_ProcessObstructWeapon;
8511 m_ProcessLiftWeapon = false;
8512
8513 //Debug.Log("SimulationStamp_server: " + this.GetSimulationTimeStamp());
8514 }
8515 }
8516
8518 override void HideClothing(ItemOptics optic, bool state)
8519 {
8520 super.HideClothing(optic, state);
8521 array<int> clothingArray = new array<int>;
8522 Clothing clothes;
8523
8524 if (state && DayZPlayerCameraOptics.Cast(m_CurrentCamera))
8525 {
8526 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
8527 {
8528 clothingArray.Insert(InventorySlots.BACK);
8529 clothingArray.Insert(InventorySlots.SHOULDER);
8530 clothingArray.Insert(InventorySlots.MELEE);
8532 {
8533 clothingArray.Insert(InventorySlots.BODY);
8534 clothingArray.Insert(InventorySlots.VEST);
8535 }
8536
8537 SetInvisibleRecursive(true,this,clothingArray);
8538 }
8539 }
8540 //showing should be instant (called directly, not via CallLater)
8541 else
8542 {
8543 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
8544 {
8545 clothingArray = {InventorySlots.BACK,InventorySlots.BODY,InventorySlots.VEST,InventorySlots.SHOULDER,InventorySlots.MELEE};
8546
8547 SetInvisibleRecursive(false,this,clothingArray);
8548 }
8549 }
8550 }
8551
8552 void RequestUnconsciousness(bool enable)
8553 {
8555 }
8556
8557 override void SetDeathDarknessLevel(float duration, float tick_time)
8558 {
8559 super.SetDeathDarknessLevel(duration, tick_time);
8560
8561 if (IsControlledPlayer())
8562 {
8563 float actual_tick = tick_time;
8565 m_DamageDealtEffect = null;
8566
8567 if (GetFlashbangEffect())
8568 m_FlashbangEffect = null;
8569
8570 float progress;
8571 if (duration > 0)
8572 progress = 1 - ((duration - m_DeathDarkeningCurrentTime) / duration);
8573
8574 m_DeathDarkeningCurrentTime += actual_tick;
8575
8576 if (!IsAlive() && IsPlayerSelected())
8577 {
8578 m_DeathDarkeningParam.param1 = progress;
8579 PPERequesterBank.GetRequester(PPERequester_DeathDarkening).Start(m_DeathDarkeningParam);
8580 }
8581
8582 if (m_DeathDarkeningCurrentTime >= duration)
8583 {
8584 StopDeathDarkeningEffect();
8585 }
8586 }
8587 else
8588 {
8589 StopDeathDarkeningEffect();
8590 }
8591 }
8592
8593 override bool IsInFBEmoteState()
8594 {
8595 if (!IsEmotePlaying())
8596 return false;
8597 if ((m_EmoteManager.m_Callback && m_EmoteManager.m_Callback.m_IsFullbody) || m_EmoteManager.m_IsSurrendered)
8598 {
8599 return true;
8600 }
8601 return false;
8602 }
8603
8606 {
8607 if (m_EmoteManager)
8608 m_EmoteManager.EndSurrenderRequest(data);
8609 }
8610
8612 {
8613 if (m_EmoteManager)
8614 return m_EmoteManager.m_IsSurrendered;
8615
8616 return false;
8617 }
8618
8620 {
8621 return m_PlayerLoaded;
8622 }
8623
8624 //disconnected, caused problems. Awaiting refactor
8626 {
8627 //FB gesture slideposeangle override
8628 if (IsInFBEmoteState() && IsControlledPlayer() && IsPlayerSelected())
8629 {
8630 OverrideSlidePoseAngle(Math.PI2);
8631 }
8632 else if (!IsInFBEmoteState() && IsControlledPlayer() && IsPlayerSelected())
8633 {
8634 OverrideSlidePoseAngle(m_OriginalSlidePoseAngle);
8635 }
8636
8637 //+add more, if needed
8638 }
8639
8640 /*void OnSurrenderEnd()
8641 {
8642 }*/
8643
8644 bool CanRedirectToWeaponManager (notnull EntityAI item, out bool isActionPossible)
8645 {
8646 isActionPossible = false;
8647 Magazine mag = Magazine.Cast(item);
8648 Weapon_Base wpn = Weapon_Base.Cast(item.GetHierarchyParent());
8649 if (mag && wpn)
8650 {
8651 if (GetWeaponManager().CanDetachMagazine(wpn, mag))
8652 {
8653 //Print("[inv] PlayerBase.CanRedirectToWeaponManager OK, can detach mag=" + mag + " from wpn=" + wpn);
8654 isActionPossible = true;
8655 }
8656 else
8657 {
8658 //Print("[inv] PlayerBase.CanRedirectToWeaponManager cannot detach mag=" + mag + " from wpn=" + wpn);
8659 }
8660 return true;
8661 }
8662 return false;
8663 }
8664
8665 // Inventory actions with redirection to weapon manager
8666 override bool PredictiveTakeEntityToTargetInventory (notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
8667 {
8668 bool can_detach;
8669 if (CanRedirectToWeaponManager(item,can_detach))
8670 {
8672 if (can_detach && target.GetInventory().FindFreeLocationFor(item, flags, il))
8673 {
8674 return GetWeaponManager().DetachMagazine(il);
8675 }
8676 return false;
8677 }
8678 return super.PredictiveTakeEntityToTargetInventory(target, flags, item);
8679 }
8680
8682 {
8683 bool can_detach;
8684 if (CanRedirectToWeaponManager(item,can_detach))
8685 {
8687 if (can_detach && GetInventory().FindFreeLocationFor(item, flags, il))
8688 {
8689 return GetWeaponManager().DetachMagazine(il);
8690 }
8691 return false;
8692 }
8693 return super.PredictiveTakeEntityToInventory(flags, item);
8694 }
8695
8696 override bool PredictiveTakeEntityToTargetAttachment (notnull EntityAI target, notnull EntityAI item)
8697 {
8698 Weapon_Base parentWpn = Weapon_Base.Cast(target);
8699 Magazine mag = Magazine.Cast(item);
8700 if (parentWpn && mag)
8701 {
8702 if (GetWeaponManager().CanAttachMagazine(parentWpn, mag))
8703 return GetWeaponManager().AttachMagazine(mag);
8704
8705 return false;
8706 }
8707 return super.PredictiveTakeEntityToTargetAttachment(target, item);
8708 }
8709
8710 override bool PredictiveTakeEntityToTargetAttachmentEx (notnull EntityAI target, notnull EntityAI item, int slot)
8711 {
8712 Weapon_Base parentWpn = Weapon_Base.Cast(target);
8713 Magazine mag = Magazine.Cast(item);
8714 if (parentWpn && mag)
8715 {
8716 if (target.CanReceiveAttachment(item,slot) && GetWeaponManager().CanAttachMagazine(parentWpn, mag))
8717 return GetWeaponManager().AttachMagazine(mag);
8718
8719 return false;
8720 }
8721 return super.PredictiveTakeEntityToTargetAttachmentEx(target, item,slot);
8722 }
8723
8724 override bool PredictiveTakeEntityToTargetCargo (notnull EntityAI target, notnull EntityAI item)
8725 {
8726 bool can_detach;
8727 if (CanRedirectToWeaponManager(item,can_detach))
8728 {
8730 if (can_detach && target.GetInventory().FindFreeLocationFor(item, FindInventoryLocationType.CARGO, il))
8731 {
8732 return GetWeaponManager().DetachMagazine(il);
8733 }
8734 return false;
8735 }
8736 return super.PredictiveTakeEntityToTargetCargo(target,item);
8737 }
8738
8739 override bool PredictiveTakeEntityToTargetCargoEx (notnull CargoBase cargo, notnull EntityAI item, int row, int col)
8740 {
8741 bool can_detach;
8742 if (CanRedirectToWeaponManager(item, can_detach))
8743 {
8744 if (can_detach)
8745 {
8747 dst.SetCargoAuto(cargo, item, row, col, item.GetInventory().GetFlipCargo());
8748
8749 return GetWeaponManager().DetachMagazine(dst);
8750 }
8751 return false;
8752 }
8753 return super.PredictiveTakeEntityToTargetCargoEx (cargo, item, row, col);
8754 }
8755
8756 override bool PredictiveDropEntity (notnull EntityAI item)
8757 {
8758 bool can_detach;
8759 if (CanRedirectToWeaponManager(item,can_detach))
8760 {
8761 if (can_detach)
8762 {
8763 vector m4[4];
8765
8769 il.SetGround(item, m4);
8770 return GetWeaponManager().DetachMagazine(il);
8771 }
8772 return false;
8773 }
8774 return super.PredictiveDropEntity(item);
8775 }
8776
8777 override bool PredictiveSwapEntities (notnull EntityAI item1, notnull EntityAI item2)
8778 {
8779 //Print("PlayerBase | PredictiveSwapEntities");
8780 Magazine swapmag1 = Magazine.Cast(item1);
8781 Magazine swapmag2 = Magazine.Cast(item2);
8782
8783 if (swapmag1 && swapmag2)
8784 {
8785 Weapon_Base parentWpn;
8786
8787 if (Class.CastTo(parentWpn, swapmag1.GetHierarchyParent()))
8788 {
8789 if (GetWeaponManager().CanSwapMagazine(parentWpn, swapmag2))
8790 {
8791 Print("[inv] PlayerBase.PredictiveSwapEntities: swapping mag1=" + swapmag1 + " to parent wpn=" + parentWpn + " of mag1=" + swapmag1);
8792 return GetWeaponManager().SwapMagazine(swapmag2);
8793 }
8794 else
8795 {
8796 Print("[inv] PlayerBase.PredictiveSwapEntities: can not swap magazines");
8797 return false;
8798 }
8799 }
8800
8801 if (Class.CastTo(parentWpn, swapmag2.GetHierarchyParent()))
8802 {
8803 if (GetWeaponManager().CanSwapMagazine(parentWpn, swapmag1))
8804 {
8805 Print("[inv] PlayerBase.PredictiveSwapEntities: swapping mag1=" + swapmag1 + " to parent wpn=" + parentWpn + " of mag2=" + swapmag2);
8806 return GetWeaponManager().SwapMagazine(swapmag1);
8807 }
8808 else
8809 {
8810 Print("[inv] PlayerBase.PredictiveSwapEntities: can not swap magazines");
8811 return false;
8812 }
8813 }
8814 }
8815
8816 EntityAI item_hands;
8817 EntityAI item_ground;
8818 if (IsSwapBetweenHandsAndGroundLargeItem(item1,item2,item_hands,item_ground) && !m_ActionManager.GetRunningAction())
8819 {
8820 ActionManagerClient mngr_client;
8821 CastTo(mngr_client,m_ActionManager);
8822
8823 ActionTarget atrg = new ActionTarget(item_ground,null,-1,vector.Zero,-1.0);
8824 if (mngr_client.GetAction(ActionSwapItemToHands).Can(this,atrg,ItemBase.Cast(item_hands)))
8825 {
8826 mngr_client.PerformActionStart(mngr_client.GetAction(ActionSwapItemToHands),atrg,ItemBase.Cast(item_hands));
8827 return true;
8828 }
8829 return super.PredictiveSwapEntities(item1, item2);
8830 }
8831 else
8832 return super.PredictiveSwapEntities(item1, item2);
8833 }
8834
8835 override bool PredictiveForceSwapEntities (notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
8836 {
8838 if (item1.IsHeavyBehaviour() && item1.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() == InventoryLocationType.GROUND && !m_ActionManager.GetRunningAction())
8839 {
8840 //Print("override bool PredictiveForceSwapEntities (notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)");
8841 ActionManagerClient mngr_client;
8842 CastTo(mngr_client,m_ActionManager);
8843
8844 ActionTarget atrg = new ActionTarget(item1,null,-1,vector.Zero,-1.0);
8845 if (mngr_client.GetAction(ActionSwapItemToHands).Can(this,atrg,ItemBase.Cast(item2)))
8846 {
8847 mngr_client.PerformActionStart(mngr_client.GetAction(ActionSwapItemToHands),atrg,ItemBase.Cast(item2));
8848 }
8849 return true;
8850 }
8851 else
8852 return super.PredictiveForceSwapEntities(item1, item2, item2_dst);
8853 }
8854
8856 {
8857 if (item.IsHeavyBehaviour() && !m_ActionManager.GetRunningAction() && !item.GetHierarchyParent())
8858 {
8859 ActionManagerClient mngr_client;
8860 if (CastTo(mngr_client,m_ActionManager))
8861 {
8862 ActionTarget atrg = new ActionTarget(item,null,-1,vector.Zero,-1.0);
8863
8864 if (mngr_client.GetAction(ActionTakeItemToHands).Can(this,atrg,null))
8865 {
8866 mngr_client.PerformActionStart(mngr_client.GetAction(ActionTakeItemToHands),atrg,null);
8867 }
8868 /*).Can(this,
8869 mngr_client.ActionStart(mngr_client.GetAction(ActionTakeItemToHands),mngr_client.FindActionTarget(),null);
8870 return;*/
8871 }
8872 }
8873 else
8874 super.PredictiveTakeEntityToHands(item);
8875 }
8876
8877 override bool PredictiveTakeToDst (notnull InventoryLocation src, notnull InventoryLocation dst)
8878 {
8879 EntityAI item = src.GetItem();
8880 if (item)
8881 {
8882 bool can_detach;
8883
8884 if (CanRedirectToWeaponManager(item,can_detach))
8885 {
8886 if (can_detach)
8887 {
8888 return GetWeaponManager().DetachMagazine(dst);
8889 }
8890 return false;
8891 }
8892 return super.PredictiveTakeToDst(src,dst);
8893 }
8894 return false;
8895 }
8896
8897 bool IsSwapBetweenHandsAndGroundLargeItem(notnull EntityAI item1, notnull EntityAI item2, out EntityAI item_hands, out EntityAI item_ground)
8898 {
8900 if (item1.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() == InventoryLocationType.HANDS)
8901 item_hands = item1;
8902 if (item2.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() == InventoryLocationType.HANDS)
8903 item_hands = item2;
8904 if (item1.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() == InventoryLocationType.GROUND)
8905 item_ground = item1;
8906 if (item2.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() == InventoryLocationType.GROUND)
8907 item_ground = item2;
8908
8909 return item_hands && item_ground && item_ground.IsHeavyBehaviour();
8910 }
8911
8913 void SetHairLevelToHide(int level, bool state, bool was_debug = false)
8914 {
8915 if (was_debug && GetInstanceType() != DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
8916 return;
8917
8918 if (!m_CharactersHead)
8919 {
8920 ErrorEx("No valid head detected on character!");
8921 return;
8922 }
8923
8924 if (level == -1) //hide/show ALL
8925 {
8927 for (int i = 0; i < m_CharactersHead.m_HeadHairSelectionArray.Count(); ++i)
8928 {
8929 //m_CharactersHead.SetSimpleHiddenSelectionState(i,m_HideHairAnimated);
8930 SelectionTranslation stt = SelectionTranslation.Cast(m_CharactersHead.m_HeadHairHidingStateMap.Get(i));
8932 m_CharactersHead.m_HeadHairHidingStateMap.Set(i, stt);
8933#ifdef DIAG_DEVELOPER
8934#ifndef SERVER
8936 diagmenu.m_HairHidingStateMap.Set(i, m_HideHairAnimated);
8937#endif
8938#endif
8939 }
8940 }
8941 else //hide/show selected level only
8942 {
8943 bool switchState;
8944 if (was_debug)
8945 {
8946#ifdef DIAG_DEVELOPER
8947#ifndef SERVER
8949 switchState = !diagmenuu.m_HairHidingStateMap.Get(level);
8950 diagmenuu.m_HairHidingStateMap.Set(level, switchState);
8951#endif
8952#endif
8953 }
8954 else
8955 {
8956 switchState = !state;
8957 }
8958 //m_CharactersHead.SetSimpleHiddenSelectionState(level,switchState);
8959 stt = SelectionTranslation.Cast(m_CharactersHead.m_HeadHairHidingStateMap.Get(level));
8960 stt.SetSelectionState(switchState);
8961 m_CharactersHead.m_HeadHairHidingStateMap.Set(level, stt); //nescessary?
8962 }
8963 }
8964
8965 void HideHairSelections(ItemBase item, bool state)
8966 {
8967 if (!item || !item.GetHeadHidingSelection() || !m_CharactersHead)
8968 return;
8969
8970 int slot_id; //item currently attached (or detaching from) here
8971 string slot_name; //item currently attached (or detaching from) here
8972 string str
8973 int idx = 0;
8974 int i;
8975 int count;
8976 GameInventory itemInventory = item.GetInventory();
8977 itemInventory.GetCurrentAttachmentSlotInfo(slot_id,slot_name);
8978
8979 if (item.HidesSelectionBySlot())
8980 {
8981 count = itemInventory.GetSlotIdCount();
8982 for (i = 0; i < count; ++i)
8983 {
8984 if (itemInventory.GetSlotId(i) == slot_id)
8985 {
8986 str = item.GetHeadHidingSelection().Get(i);
8987 idx = m_CharactersHead.m_HeadHairSelectionArray.Find(str);
8988 if (idx != -1)
8989 SetHairLevelToHide(idx,state);
8990 #ifdef DEVELOPER
8991 else
8992 Debug.Log("No valid selection '" + str + "' found on head of " + GetType() + ". Verify the p3d, model config, and the 'HAIR_HIDING_SELECTIONS' macro in basicDefines.");
8993 #endif
8994 }
8995 }
8996 }
8997 else
8998 {
8999 count = item.GetHeadHidingSelection().Count();
9000 for (i = 0; i < count; i++)
9001 {
9002 str = item.GetHeadHidingSelection().Get(i);
9003 idx = m_CharactersHead.m_HeadHairSelectionArray.Find(str);
9004 if (idx != -1)
9005 SetHairLevelToHide(idx,state);
9006 #ifdef DEVELOPER
9007 else
9008 Debug.Log("No valid selection '" + str + "' found on head of " + GetType() + ". Verify the p3d, model config, and the 'HAIR_HIDING_SELECTIONS' macro in basicDefines.");
9009 #endif
9010 }
9011 }
9013 }
9014
9015 void UpdateHairSelectionVisibility(bool was_debug = false)
9016 {
9017 if (!m_CharactersHead)
9018 return;
9019 bool shown;
9020 bool exception_hidden = false;
9021 int i;
9022 int count = m_CharactersHead.m_HeadHairHidingStateMap.Count();
9024
9025 //hide/show beard
9026 if (IsMale() && m_CharactersHead.GetBeardIndex() > -1 && !was_debug)
9027 {
9028 SetHairLevelToHide(m_CharactersHead.GetBeardIndex(),GetLifeSpanState() != LifeSpanState.BEARD_EXTRA);
9029 }
9030
9031 //show all first
9032 for (i = 0; i < count; i++)
9033 {
9034 m_CharactersHead.SetSimpleHiddenSelectionState(i,true);
9035 }
9036 //then carve it up
9037 for (i = 0; i < count; i++)
9038 {
9039 stt = m_CharactersHead.m_HeadHairHidingStateMap.Get(i);
9040 shown = stt.GetSelectionState();
9041 if (!shown)
9042 {
9043 if (/*IsMale() && */!m_CharactersHead.IsHandlingException())
9044 {
9045 m_CharactersHead.SetSimpleHiddenSelectionState(i,shown);
9047 //Print("hidden idx: " + i);
9048 }
9049 else
9050 {
9051 exception_hidden = true;
9052 }
9053 }
9054 }
9055
9056 //exceptions handled differently; hides hair
9057 if (exception_hidden)
9058 {
9059 m_CharactersHead.SetSimpleHiddenSelectionState(m_CharactersHead.GetHairIndex(),false);
9060 if (IsMale())
9061 m_CharactersHead.SetSimpleHiddenSelectionState(m_CharactersHead.GetBeardIndex(),false);
9062 }
9063 }
9064
9066 {
9067 int index;
9068 array<int> translatedSelectinosArray = stt.GetTranslatedSelections();
9069 for (int i = 0; i < translatedSelectinosArray.Count(); i++)
9070 {
9071 index = translatedSelectinosArray.Get(i);
9072 //if (index > -1)
9073 m_CharactersHead.SetSimpleHiddenSelectionState(index,false); //safe this way, only hiding/carving from shown parts
9074 }
9075 }
9076
9079 {
9080 ItemBase headgear = ItemBase.Cast(GetInventory().FindAttachment(InventorySlots.HEADGEAR));
9081 ItemBase mask = ItemBase.Cast(GetInventory().FindAttachment(InventorySlots.MASK));
9082
9083 HideHairSelections(headgear,true);
9084 HideHairSelections(mask,true);
9085 }
9086
9088 {
9089 return m_ActiveNVTypes && m_ActiveNVTypes.Count() > 0;
9090 }
9091
9093 {
9094 return m_LoweredNVGHeadset;
9095 }
9096
9098 {
9099 if (!m_ActiveNVTypes || m_ActiveNVTypes.Count() == 0)
9100 {
9101 return NVTypes.NONE;
9102 }
9103 else
9104 {
9105 return m_ActiveNVTypes[m_ActiveNVTypes.Count() - 1];
9106 }
9107 }
9108
9110 {
9111 return m_ActiveNVTypes;
9112 }
9113
9114 void SetNVGLowered(bool state)
9115 {
9116 m_LoweredNVGHeadset = state;
9117 }
9118
9119 void AddActiveNV(int type)
9120 {
9121 if (!m_ActiveNVTypes || (g_Game.IsMultiplayer() && g_Game.IsServer()))
9122 {
9123 #ifdef DEVELOPER
9124 Error("AddActiveNV | illegal server-side call!");
9125 #endif
9126
9127 return;
9128 }
9129
9130 if (m_ActiveNVTypes.Find(type) == -1)
9131 m_ActiveNVTypes.Insert(type);
9132 }
9133
9134 void RemoveActiveNV(int type)
9135 {
9136 if (!m_ActiveNVTypes || (g_Game.IsMultiplayer() && g_Game.IsServer()))
9137 {
9138 #ifdef DEVELOPER
9139 Error("RemoveActiveNV | illegal server-side call!");
9140 #endif
9141
9142 return;
9143 }
9144
9145 if (m_ActiveNVTypes.Find(type) != -1)
9146 m_ActiveNVTypes.RemoveItem(type);
9147 }
9148
9150 {
9151 m_ActiveNVTypes.Clear();
9152 }
9153
9154#ifdef DEVELOPER
9155 override string GetDebugText()
9156 {
9157 string text = super.GetDebugText();
9158 /*
9159 text += "GetMovementTimeToStrafeJog:" + CfgGameplayHandler.GetMovementTimeToStrafeJog() + "\n";
9160 text += "GetMovementTimeToStrafeSprint:" + CfgGameplayHandler.GetMovementTimeToStrafeSprint()+ "\n";
9161
9162 SHumanCommandMoveSettings moveSettings = GetDayZPlayerType().CommandMoveSettingsW();
9163 if (moveSettings)
9164 {
9165 text += "hmcs.m_fDirFilterTimeout:" + moveSettings.m_fDirFilterTimeout + "\n";
9166 text += "hmcs.m_fDirFilterSprintTimeout:" + moveSettings.m_fDirFilterSprintTimeout+ "\n";
9167 }*/
9168
9169 return text;
9170 }
9171
9172
9173
9174 void DEBUGRotateNVG()
9175 {
9176 NVGoggles nvg;
9177
9178 if (FindAttachmentBySlotName("Eyewear"))
9179 {
9180 nvg = NVGoggles.Cast(FindAttachmentBySlotName("Eyewear").FindAttachmentBySlotName("NVG"));
9181 }
9182 else if (FindAttachmentBySlotName("Headgear"))
9183 {
9184 nvg = NVGoggles.Cast(FindAttachmentBySlotName("Headgear").FindAttachmentBySlotName("NVG"));
9185 }
9186
9187 if (nvg)
9188 {
9189 nvg.RotateGoggles(nvg.m_IsLowered);
9190 }
9191 }
9192#endif
9193
9194 void AdjustBandana(EntityAI item, string slot_name)
9195 {
9196 if (Bandana_ColorBase.Cast(item))
9197 {
9198 if (slot_name == "Headgear")
9199 {
9200 item.SetSimpleHiddenSelectionState(0,1);
9201 item.SetSimpleHiddenSelectionState(1,0);
9202 }
9203 else if (slot_name == "Mask")
9204 {
9205 item.SetSimpleHiddenSelectionState(0,0);
9206 item.SetSimpleHiddenSelectionState(1,1);
9207 }
9208 }
9209 }
9210
9211 void AdjustShemag(EntityAI item, string slot_name)
9212 {
9213 if (Shemag_ColorBase.Cast(item))
9214 {
9215 if (slot_name == "Headgear")
9216 {
9217 item.SetSimpleHiddenSelectionState(0,1);
9218 item.SetSimpleHiddenSelectionState(1,0);
9219 }
9220 else if (slot_name == "Mask")
9221 {
9222 item.SetSimpleHiddenSelectionState(0,0);
9223 item.SetSimpleHiddenSelectionState(1,1);
9224 }
9225 }
9226 }
9227
9228 //client-side
9230 {
9231 //Print("---Prettying up corpses... | " + g_Game.GetTime() + " | " + this + " | " + GetType() + "---");
9232 //Print("m_DecayedTexture = " + m_DecayedTexture);
9233 int state = Math.AbsInt(m_CorpseState);//negative sign denotes a special meaning(state was forced to a live player), but we are only intetested in the positive value here
9235 {
9236 EntityAI bodypart;
9237 ItemBase item;
9238
9239 string path;
9240 int idx;
9241 int slot_id;
9242 array<string> bodyparts = {"Gloves","Body","Legs","Feet"};
9243
9244 GameInventory inventory = GetInventory();
9245 int nBodyparts = bodyparts.Count();
9246 for (int i = 0; i < nBodyparts; ++i)
9247 {
9248 slot_id = InventorySlots.GetSlotIdFromString(bodyparts.Get(i));
9249 bodypart = inventory.FindPlaceholderForSlot(slot_id);
9250 item = ItemBase.Cast(inventory.FindAttachment(slot_id));
9251
9252 if (bodypart)
9253 {
9254 path = "cfgVehicles " + bodypart.GetType();
9255 idx = bodypart.GetHiddenSelectionIndex("personality");
9256 if (idx > -1)
9257 {
9258 bodypart.SetObjectTexture(idx,m_DecayedTexture);
9259 }
9260 }
9261 if (item)
9262 {
9263 path = "cfgVehicles " + item.GetType();
9264 idx = item.GetHiddenSelectionIndex("personality");
9265 if (idx > -1)
9266 {
9267 item.SetObjectTexture(idx,m_DecayedTexture);
9268 }
9269 }
9270 }
9271
9272 SetFaceTexture(m_DecayedTexture);
9273 }
9274 }
9275
9276 void SetDecayEffects(int effect = -1)
9277 {
9278 int boneIdx = GetBoneIndexByName("Spine2");
9279 Particle p;
9280
9281 switch (effect)
9282 {
9284 //play medium sound/flies particle
9285 if (!m_FliesEff)
9287
9289 {
9290 m_FliesEff.SetDecalOwner(this);
9292 p = m_FliesEff.GetParticle();
9293 AddChild(p, boneIdx);
9294 if (!m_SoundFliesEffect)
9295 {
9296 PlaySoundSetLoop(m_SoundFliesEffect, "Flies_SoundSet", 1.0, 1.0);
9297 }
9298 }
9299 break;
9301 //play serious sound/flies particle
9302 if (!m_FliesEff)
9304
9306 {
9307 m_FliesEff.SetDecalOwner(this);
9309 p = m_FliesEff.GetParticle();
9310 AddChild(p, boneIdx);
9311 if (!m_SoundFliesEffect)
9312 {
9313 PlaySoundSetLoop(m_SoundFliesEffect, "Flies_SoundSet", 1.0, 1.0);
9314 }
9315 }
9316 break;
9317 //remove
9318 default:
9320 StopSoundSet(m_SoundFliesEffect);
9321 break;
9322 }
9323 }
9324
9326 {
9327 int idx = GetHiddenSelectionIndex("decay_preload");
9328 if (idx > -1)
9329 SetObjectTexture(idx, m_DecayedTexture);
9330 }
9331
9332 void SetLastMapInfo(float scale, vector pos)
9333 {
9334 m_LastMapScale = scale;
9335 m_LastMapPos = pos;
9336 }
9337
9338 bool GetLastMapInfo(out float scale, out vector pos)
9339 {
9340 scale = m_LastMapScale;
9341 pos = m_LastMapPos;
9342
9343 return m_LastMapScale != -1.0;
9344 }
9345
9346 override bool PhysicalPredictiveDropItem(EntityAI entity, bool heavy_item_only = true)
9347 {
9348 vector dir;
9349 ItemBase item = ItemBase.Cast(entity);
9350
9352 if (GetItemInHands() == item)
9353 {
9354 return PredictiveDropEntity(item);
9355 }
9356 else
9357 {
9359 if (actionManager)
9360 {
9361 ActionTarget actionTarget = new ActionTarget(null, null, -1, vector.Zero, -1);
9362 if (actionManager.GetAction(ActionDropItemSimple).Can(this, actionTarget, item))
9363 {
9364 actionManager.PerformActionStart(actionManager.GetAction(ActionDropItemSimple), actionTarget, item);
9365 return true;
9366 }
9367 }
9368 else
9369 return true;
9370 }
9371
9372 return false;
9373 }
9374
9375 override void SetProcessUIWarning(bool state)
9376 {
9377 m_ProcessUIWarning = state;
9378 }
9379
9380 void dmgDebugPrint(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
9381 {
9382 /*Print("ProjectileDebugging | Damage Health: " + damageResult.GetDamage(dmgZone,"Health") + " | Component: " + component + " | Zone: " + dmgZone + "| Timestamp: " + GetSimulationTimeStamp());
9383 Print("ProjectileDebugging | speedCoef: " + speedCoef);
9384 Print("ProjectileDebugging | GetWorldTime(): " + GetWorldTime());
9385 Print("-----------------------------------------------");*/
9386 }
9387
9388 //Use this method to process additionnal dmg to legs specifically (must use the dmg system to fire relevant events)
9389 //Legzone is a dummy to inflict damage once and NOT transfer damage to other zones. All leg zones will drop to 0 anyway
9390 void DamageAllLegs(float inputDmg)
9391 {
9392 array<string> legZones = new array<string>;
9393 legZones.Insert("LeftLeg");
9394 legZones.Insert("RightLeg");
9395 legZones.Insert("RightFoot");
9396 legZones.Insert("LeftFoot");
9397
9398 foreach (string legZone : legZones)
9399 DecreaseHealth(legZone, "", inputDmg);
9400 }
9401
9403 void TryHideItemInHands(bool hide, bool force = false)
9404 {
9405 ItemBase item = GetItemInHands();
9406
9407 if (!hide && ((!IsSwimming() && !IsClimbingLadder() && !IsInVehicle() && !AnimCommandCheck(HumanMoveCommandID.CommandSwim | HumanMoveCommandID.CommandLadder | HumanMoveCommandID.CommandVehicle)) || force))
9408 {
9409 SetEnergyManagerState(item, true);
9410 GetItemAccessor().HideItemInHands(false);
9411 }
9412 else
9413 {
9414 SetEnergyManagerState(item, false);
9415 GetItemAccessor().HideItemInHands(true);
9416 }
9417 }
9418
9421 {
9423 if (target.GetInventory().FindFreeLocationFor(item, flags, il))
9424 {
9426 }
9427 return false;
9428 }
9429
9431 {
9432 int slotID = il.GetSlot();
9433 float stackableTarget = item.GetTargetQuantityMax(slotID);
9434 if (stackableTarget > 0 && stackableTarget < item.GetQuantity())
9435 {
9436 ItemBase itemB;
9437 if (CastTo(itemB, item))
9438 {
9439 itemB.SplitIntoStackMaxToInventoryLocationClient(il);
9440 return true;
9441 }
9442 }
9443 return false;
9444 }
9445
9446 override protected bool TakeEntityToInventoryImpl(InventoryMode mode, FindInventoryLocationType flags, notnull EntityAI item)
9447 {
9448 if (CheckAndExecuteStackSplit(flags, item, this))
9449 {
9450 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2Inv(SPLIT) item=" + GetDebugName(item));
9451 return true;
9452 }
9453
9454 return super.TakeEntityToInventoryImpl(mode, flags, item);
9455 }
9456
9457 override protected bool TakeEntityToCargoImpl(InventoryMode mode, notnull EntityAI item)
9458 {
9460 {
9461 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2Cgo(SPLIT) item=" +GetDebugName(item));
9462 return true;
9463 }
9464
9465 return super.TakeEntityToCargoImpl(mode, item);
9466 }
9467
9468 override protected bool TakeEntityAsAttachmentImpl(InventoryMode mode, notnull EntityAI item)
9469 {
9470 if (CheckAndExecuteStackSplit(FindInventoryLocationType.ATTACHMENT, item, this))
9471 {
9472 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2Att(SPLIT) item=" + GetDebugName(item));
9473 return true;
9474 }
9475
9476 return super.TakeEntityAsAttachmentImpl(mode, item);
9477 }
9478
9480 {
9482 {
9483 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2Hands(SPLIT) item=" + GetDebugName(item));
9484 return;
9485 }
9486
9487 super.TakeEntityToHandsImpl(mode, item);
9488 }
9489
9490 override protected bool TakeEntityToTargetInventoryImpl(InventoryMode mode, notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
9491 {
9492 if (CheckAndExecuteStackSplit(flags, item, target))
9493 {
9494 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2TargetInv(SPLIT) item=" + GetDebugName(item));
9495 return true;
9496 }
9497
9498 return super.TakeEntityToTargetInventoryImpl(mode, target, flags, item);
9499 }
9500
9501 override protected bool TakeEntityToTargetCargoImpl(InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
9502 {
9504 {
9505 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2TargetCgo(SPLIT) item=" + GetDebugName(item));
9506 return true;
9507 }
9508
9509 return super.TakeEntityToTargetCargoImpl(mode, target, item);
9510 }
9511
9512 override protected bool TakeEntityToTargetAttachmentImpl(InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
9513 {
9514 if (CheckAndExecuteStackSplit(FindInventoryLocationType.ATTACHMENT, item, target))
9515 {
9516 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2TargetAtt(SPLIT) item=" + GetDebugName(item));
9517 return true;
9518 }
9519
9520 return super.TakeEntityToTargetAttachmentImpl(mode, target, item);
9521 }
9522
9523 override protected bool TakeToDstImpl(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
9524 {
9525 if (CheckAndExecuteStackSplitToInventoryLocation(dst, dst.GetItem()))
9526 {
9527 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2Dst(SPLIT) item=" + GetDebugName(dst.GetItem()));
9528 return true;
9529 }
9530
9531 return super.TakeToDstImpl(mode, src, dst);
9532 }
9533
9535 {
9536 return GetBonePositionWS(GetBoneIndexByName("spine3"));
9537 }
9538
9539
9540 // contaminated areas - temp stuff
9542 {
9544 {
9545 float playerSpeed = GetCommand_Move().GetCurrentMovementSpeed();
9546 //Print(playerSpeed);
9547
9548 // 1 - prone, crouch
9549 // 2 - jog
9550 // 3 - sprint
9551 float particleLifetime = 5.25;
9552 float particleSpeed = 0.25;
9553 if (playerSpeed >= 1)
9554 {
9555 particleLifetime = 3.5;
9556 particleSpeed = 3.25;
9557 }
9558 if (playerSpeed >= 2)
9559 {
9560 particleLifetime = 2.5;
9561 particleSpeed = 5.25;
9562 }
9563 if (playerSpeed >= 3)
9564 {
9565 particleLifetime = 1.5;
9566 particleSpeed = 8.25;
9567 }
9568 m_ContaminatedAroundPlayer.SetParameter(0, EmitorParam.LIFETIME, particleLifetime);
9569 m_ContaminatedAroundPlayer.SetParameter(1, EmitorParam.LIFETIME, particleLifetime);
9570 m_ContaminatedAroundPlayer.SetParameter(2, EmitorParam.LIFETIME, particleLifetime);
9571 m_ContaminatedAroundPlayer.SetParameter(3, EmitorParam.LIFETIME, particleLifetime);
9572
9573 m_ContaminatedAroundPlayerTiny.SetParameter(0, EmitorParam.VELOCITY, particleSpeed);
9574 vector transform[4];
9575 GetTransform(transform);
9576 m_ContaminatedAroundPlayer.SetTransform(transform);
9577 m_ContaminatedAroundPlayerTiny.SetTransform(transform);
9578 }
9579 }
9580
9582 {
9583 if (!IsControlledPlayer())
9584 return;
9585 int i;
9586
9588 {
9589 for (i = 0; i < m_ProcessRemoveGlassesEffects.Count(); i++)
9590 {
9591 PPERequesterBank.GetRequester(m_ProcessRemoveGlassesEffects[i]).Stop();
9592 }
9594 }
9595
9597 {
9598 for (i = 0; i < m_ProcessAddGlassesEffects.Count(); i++)
9599 {
9600 PPERequesterBank.GetRequester(m_ProcessAddGlassesEffects[i]).Start();
9601 }
9603 }
9604 }
9605
9606 override void AddArrow(Object arrow, int componentIndex, vector closeBonePosWS, vector closeBoneRotWS)
9607 {
9609 GetActionComponentNameList(componentIndex, CachedObjectsArrays.ARRAY_STRING, LOD.NAME_FIRE);
9610
9611 int pivot = componentIndex;
9612 int newPivot = -1;
9613 string compName;
9614 for (int i = 0; i < CachedObjectsArrays.ARRAY_STRING.Count() && newPivot == -1; i++)
9615 {
9616 compName = CachedObjectsArrays.ARRAY_STRING.Get(i);
9617 newPivot = GetBoneIndexByName(compName);
9618
9619 }
9620
9621 if (newPivot != -1)
9622 {
9623 pivot = newPivot;
9624
9625 }
9626
9627 vector parentTransMat[4];
9628 vector arrowTransMat[4];
9629
9630 arrow.GetTransform(arrowTransMat);
9631
9632 if (pivot == -1)
9633 {
9634 GetTransformWS(parentTransMat);
9635 }
9636 else
9637 {
9638 vector rotMatrix[3];
9639 Math3D.YawPitchRollMatrix(closeBoneRotWS * Math.RAD2DEG,rotMatrix);
9640
9641 parentTransMat[0] = rotMatrix[0];
9642 parentTransMat[1] = rotMatrix[1];
9643 parentTransMat[2] = rotMatrix[2];
9644 parentTransMat[3] = closeBonePosWS;
9645 }
9646
9647 Math3D.MatrixInvMultiply4(parentTransMat, arrowTransMat, arrowTransMat);
9648 Math3D.MatrixOrthogonalize4(arrowTransMat);
9649 arrow.SetTransform(arrowTransMat);
9650
9651 AddChild(arrow, pivot);
9652
9653 #ifdef SERVER
9654 // creating bleeding source
9655 BleedingSourcesManagerServer bleedingManager = GetBleedingManagerServer();
9656 if (bleedingManager)
9657 {
9658 if (!bleedingManager.AttemptAddBleedingSourceBySelection(compName))
9659 bleedingManager.AttemptAddBleedingSourceBySelection("Pelvis");//fallback, if we can't attach bleeding source to the fallback location because there already is another one, it's fine, we are just trying make sure there is at least one
9660 }
9661 #endif
9662 }
9663
9664 override bool IsManagingArrows()
9665 {
9666 return true;
9667 }
9668
9670 {
9671 return m_CachedPlayerName;
9672 }
9673
9675 {
9676 return m_CachedPlayerID;
9677 }
9678
9680 {
9681 super.OnFreezeStateChangeClient();
9682
9684 }
9685
9687 {
9688 return m_HasHeatBuffer;
9689 }
9690
9692 {
9693 return m_HeatBufferStage;
9694 }
9695
9699
9702
9704
9707
9708 void SwitchItemTypeAttach(EntityAI item, string slot)
9709 {
9710 if (!g_Game.IsServer())
9711 return;
9712 }
9713
9714 void SwitchItemTypeDetach(EntityAI item, string slot);
9715 void AddToEnvironmentTemperature(float pTemperature);
9716
9718 {
9720 }
9721
9726
9727 bool Consume(ItemBase source, float amount, EConsumeType consume_type)
9728 {
9729 PlayerConsumeData consumeData = new PlayerConsumeData();
9730 consumeData.m_Type = consume_type;
9731 consumeData.m_Amount = amount;
9732 consumeData.m_Source = source;
9733 consumeData.m_Agents = 0;
9734
9735 return Consume(consumeData);
9736 }
9737
9739 {
9740 if (!GetStaminaHandler())
9741 return false;
9742
9743 return GetStaminaHandler().GetStamina() > 0;
9744 }
9745
9747 {
9748 InsertAgent(eAgents.SALMONELLA, 1);
9749 }
9750
9751 override void DepleteStamina(EStaminaModifiers modifier, float dT = -1)
9752 {
9753 if (GetStaminaHandler())
9754 GetStaminaHandler().DepleteStaminaEx(modifier,dT);
9755 }
9756
9757 [Obsolete("use the GetUndergroundHandler instead")]
9762
9763 [Obsolete("no replacement")]
9764 void SetNVGWorking(bool state)
9765 {
9766 //Deprecated, below is for legacy's sake
9767 AddActiveNV(NVTypes.NV_GOGGLES);
9768 }
9769
9770 [Obsolete("not used but kept in the case of modders needing/using it")]
9771 void AntibioticsAttack(float value)
9772 {
9773 m_AgentPool.DrugsAttack(EMedicalDrugsType.ANTIBIOTICS, value);
9774 }
9775}
9776
9777
9778#ifdef DEVELOPER
9780#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Definition entityai.c:104
void syncDebugPrint(string s)
Definition debug.c:1
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition inventory.c:22
const int INPUT_UDT_INVENTORY
Definition _constants.c:9
const int INPUT_UDT_ITEM_MANIPULATION
Definition _constants.c:8
const int INPUT_UDT_RESET_ADS
Definition _constants.c:17
const int INPUT_UDT_WEAPON_LIFT_EVENT
Definition _constants.c:16
const int INPUT_UDT_USER_MUTE_XBOX
Definition _constants.c:13
const int INPUT_UDT_GESTURE
Definition _constants.c:18
const int INPUT_UDT_ADVANCED_PLACEMENT
Definition _constants.c:10
eBleedingSourceType GetType()
void ActionDrinkPondContinuous()
override bool CanBePerformedWhileChangingStance()
Prevent this action from beeing performed while changing stance.
ActionEatSnowContinuousCB ActionContinuousBaseCB ActionEatSnowContinuous()
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
ActionStartCarCB ActionContinuousBaseCB ActionStartEngine()
ActionStartEngineBoatCB ActionContinuousBaseCB ActionStartEngineBoat()
class ActionTargets ActionTarget
ActionUncoverHeadBase ActionContinuousBase ActionUncoverHeadSelf()
ActionWashHandsSnowCB ActionContinuousBaseCB ActionWashHandsSnow()
ActionWashHandsWaterCB ActionContinuousBaseCB ActionWashHandsWater()
void AddAction(typename actionName)
void RemoveAction(typename actionName)
void SetActions()
void InitializeActions()
override ArrowManagerBase GetArrowManager()
Definition animalbase.c:49
const int BREATH_VAPOUR_LEVEL_MAX
void EffectRadial(Param param1, Param param2)
string Debug()
override event void Read(PawnStateReader ctx)
Definition carscript.c:144
override event void Write(PawnStateWriter ctx)
Definition carscript.c:139
const int ECE_EQUIP_ATTACHMENTS
const int ECE_PLACE_ON_SURFACE
const int ECE_INITAI
const int ECE_KEEPHEIGHT
const int ECE_IN_INVENTORY
const int RF_DEFAULT
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
bool IsFullBody(PlayerBase player)
Definition actionbase.c:720
ActionInput GetInput()
static string GetPulseMessage(EPulseType pulse_type, int blood_level)
const int TARGET_IRREGULAR_PULSE_BIT
bool IsActive()
void PerformActionStart(ActionBase action, ActionTarget target, ItemBase item, Param extra_data=NULL)
override void RequestEndAction()
void PerformActionFromQuickbar(ItemBase mainItem, ItemBase targetItem)
bool CanPerformActionFromQuickbar(ItemBase mainItem, ItemBase targetItem)
override void EndActionInput()
override void RequestInterruptAction()
client requests action interrupt
void ForceTarget(Object targetObject)
static void PlayerDisconnected(StatsEventDisconnectedData data)
static void PlayerMeasures(StatsEventMeasuresData data)
bool Load(ParamsReadContext ctx)
bool Save(ParamsWriteContext ctx)
static SoundOnVehicle SaySound(Object source, string sound_name, float distance, bool looped)
Definition betasound.c:3
Definition bot.c:19
static ref TStringArray ARRAY_STRING
static ref Param1< bool > PARAM1_BOOL
static ref Param2< float, float > PARAM2_FLOAT_FLOAT
static ref Param1< string > PARAM1_STRING
static ref Param1< int > PARAM1_INT
represents base for cargo storage for entities
Definition cargo.c:7
static bool GetAllowStaminaAffectInertia()
static bool GetHitIndicationPPEEnabled()
static int GetLightingConfig()
static bool GetDisableRespawnDialog()
static TStringSet GetDisallowedTypesInUnderground()
static bool IsPointInPlayerRestrictedArea(vector point, out PlayerRestrictedAreaInstance hitArea)
Super root of all classes in Enforce script.
Definition enscript.c:11
static void AddPlayerBase(Man player)
Definition clientdata.c:23
static void RemovePlayerBase(Man player)
Definition clientdata.c:29
Definition colors.c:4
const int WHITE
Definition colors.c:15
Client only - manage set up crafting on client.
static proto bool RaycastRV(vector begPos, vector endPos, out vector contactPos, out vector contactDir, out int contactComponent, set< Object > results=NULL, Object with=NULL, Object ignore=NULL, bool sorted=false, bool ground_only=false, int iType=ObjIntersectView, float radius=0.0, CollisionFlags flags=CollisionFlags.NEARESTCONTACT)
Raycasts world by given parameters.
this is main camera class
static bool NoHeading(float pDt, SDayZPlayerHeadingModel pModel, out float pLastHeadingDiff)
static bool ClampHeading(float pDt, SDayZPlayerHeadingModel pModel, out float pLastHeadingDiff)
This HeadingModel - Clamps heading.
static bool RestrictHeading(float pDt, SDayZPlayerHeadingModel pModel, out float pLastHeadingDiff, HeadingRestrictData restrictData)
static void SendDeleteItem(DayZPlayer pPlayer, EntityAI item)
static bool ReadBrokenLegsParamsEx(ParamsReadContext pCtx, out int currentState)
static const int SJ_PLAYER_ADD_MODIFIER
static bool ReadInjuryParams(ParamsReadContext pCtx, out bool pEnable, out eInjuryHandlerLevels level)
static const int SJ_WEAPON_ACTION_ACK_REJECT
static bool ReadPlayerUnconsciousnessParams(ParamsReadContext pCtx, out bool enable)
static void SendPlayerUnconsciousness(DayZPlayer pPlayer, bool enable)
Conscious / Unconscious.
static void SendBrokenLegsEx(DayZPlayer pPlayer, int currentState)
static const int SJ_WEAPON_ACTION_ACK_ACCEPT
static const int SJ_QUICKBAR_SET_SHORTCUT
static const int SJ_WEAPON_SET_JAMMING_CHANCE
static bool ReadShockParams(ParamsReadContext pCtx, out float shockValue)
static bool ReadKuruRequest(ParamsReadContext pCtx, out float amount)
Kuru Disease Shake.
Definition debug.c:2
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition debug.c:182
bool Consume(float amount, PlayerBase consumer)
Definition edible_base.c:95
override FoodStage GetFoodStage()
int FilterAgents(int agentsIn)
Filter agents from the item (override on higher implementations).
Wrapper class for managing particles through SEffectManager.
void SetDecalOwner(Object o)
Particle GetParticle()
Gets the main particle which this Effect is managing.
Wrapper class for managing sound through SEffectManager.
Definition effectsound.c:5
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
int GetEffectsPriority()
bool PredictiveSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
Definition man.c:528
static int GetEnumSize(typename e)
Return amount of values in enum.
Definition enconvert.c:636
script counterpart to engine's class Inventory
Definition inventory.c:81
static proto native EntityAI LocationCreateLocalEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
static bool CanForceSwapEntitiesEx(notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
Definition inventory.c:666
static proto native bool HasInventoryReservation(EntityAI item, InventoryLocation dst)
Internally: HasInventoryReservationEx(item, dst, FindInventoryReservationMode.LEGACY,...
proto native bool IsInventoryLocked()
const float c_MaxItemDistanceRadius
anti-cheats
Definition inventory.c:815
proto native EntityAI GetAttachmentFromIndex(int index)
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
proto native int GetSlotIdCount()
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
Definition inventory.c:630
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native int GetSlotId(int index)
proto native EntityAI FindPlaceholderForSlot(int slot)
Returns placeholder entity for slot (naked arms, legs etc).
static proto native bool PrepareDropEntityPos(EntityAI owner, notnull EntityAI item, out vector mat[4], bool useValuesInMatrix=false, int conflictCheckDepth=-1)
proto native bool FindFirstFreeLocationForNewEntity(string item_type, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFirstFreeLocationForNewEntity.
proto native EntityAI FindAttachment(int slot)
Returns attached entity in slot (you can use InventorySlots.GetSlotIdFromString(name) to get slot id)...
proto native void UnlockInventory(int lockType)
bool LocalDestroyEntity(notnull EntityAI item)
Definition inventory.c:1346
bool CanAddEntityIntoHands(notnull EntityAI item)
Test if entity can be put into hands.
Definition inventory.c:978
bool GetCurrentAttachmentSlotInfo(out int slot_id, out string slot_name)
Returns true if the item is currently attached and outputs attachment slot id and name.
Definition inventory.c:456
proto native void LockInventory(int lockType)
grouped gameplay effect widgets and their handling
proto void SelectPhysics(Physics physics)
Applies impulses to set the position when dynamic, otherwise sets the transform in the physics scene.
proto void SelectObject(Object object)
Sets the transform of the object directly.
const int NUMBER_OF_STAGES
Definition heatbuffer.c:3
Definition hive.c:6
proto native bool CharacterIsLoginPositionChanged(Man player)
Only valid during login.
proto native void CharacterKill(Man player)
proto native void CharacterSave(Man player)
Hot spring area trigger.
static void ApplyEffects(PlayerBase player)
static const float HEAT_DAMAGE_TICK_TIME
void ShowHudUI(bool show)
void ShowQuickbarUI(bool show)
proto native vector GetLogoutPosition()
returns the safe logout position in worldspace the position is closest to the last possible exit poin...
proto native void SetDirectionSprintFilterModifier(float value)
sets the multiplier for SHumanCommandMoveSettings::m_fDirFilterSprintTimeout
proto native void SetRunSprintFilterModifier(float value)
sets the multiplier for SHumanCommandMoveSettings::m_fRunSpringTimeout
proto native void ForceStance(int pStanceIdx)
pStanceIds is one of STANCEIDX_ERECT,STANCEIDX_CROUCH,STANCEIDX_PRONE,STANCEIDX_RAISEDERECT,...
proto native void SetMeleeBlock(bool pBlock)
this enables/disables block
proto native void SetTurnSpanSprintModifier(float value)
sets the multiplier for HumanItemBehaviorCfg::m_fMoveHeadingSprintFilterSpan
proto native void WakeUp(int targetStance=-1)
proto native bool IsInWater()
proto native Transport GetTransport()
proto native bool IsGettingIn()
proto native bool IsSwitchSeat()
proto native bool IsGettingOut()
proto native void SetVehicleType(int pVehicleType)
proto native bool IsQuickBarContinuousUseEnd()
is end of cont use (== true for 1 tick only) long quickbar + not raised !
proto native void LimitsDisableSprint(bool pDisable)
this disables sprint
proto native void ResetADS()
resets ADS mode to default
proto native bool IsQuickBarSingleUse()
single use (== true for 1 tick only) quickbar + not raised !
proto native bool IsQuickBarContinuousUseStart()
is start of cont use (== true for 1 tick only) long quickbar + not raised !
proto native int IsQuickBarSlot()
returns 1..10 if some quickbar slot is used, 0 otherwise
proto native bool CameraIsFreeLook()
returns true if freelook is active
int m_StanceRotation[6]
6 stances -> all has movement mask, STANCEIDX_ ... is index
Definition humanitems.c:19
int m_iMovement
current stance (DayZPlayerConstants.STANCEIDX_ERECT, ...), only if the command has a stance
Definition human.c:1157
Internal ancestor of all Entity implementations.
Definition enentity.c:165
const float LVL3
Client only - manage set up crafting on client.
InventoryLocation.
proto native int GetSlot()
returns slot id if current type is Attachment
proto native bool IsValid()
verify current set inventory location
proto native int GetType()
returns type of InventoryLocation
proto native void SetCargoAuto(notnull CargoBase cargo, EntityAI e, int row, int col, bool flip)
proto native vector GetPos()
returns position of item in world if type is Ground
proto native void SetAttachment(notnull EntityAI parent, EntityAI e, int slotId)
proto native void SetHands(notnull EntityAI parent, EntityAI e)
bool ReadFromContext(ParamsReadContext ctx)
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
proto native void SetGround(EntityAI e, vector mat[4])
static string DumpToStringNullSafe(InventoryLocation loc)
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
proto native float GetCurrentStepFOV()
returns fov value at current index, or 'OpticsInfo.opticsZoomInit' config value (non-zooming optics)
LOD class.
Definition gameplay.c:204
static const string NAME_FIRE
Definition gameplay.c:208
static bool IsSyncLogEnable()
Definition debug.c:776
void SetLastMapInfo(float scale, vector pos)
ref ScriptInvoker m_OnUnconsciousStop
Definition playerbase.c:350
void PlayAttachmentDropSound()
bool m_IsInWater
Definition playerbase.c:143
void CheckForBurlap()
void SetModifiers(bool enable)
PlayerBase m_CheckPulseLastTarget
Definition playerbase.c:187
void AdjustBandana(EntityAI item, string slot_name)
bool IsChelationActive()
Definition playerbase.c:720
void BreakLegSound()
bool GetLiquidTendencyDrain()
void RemoveMedicalDrugsInUse(EMedicalDrugsType drugType)
Definition playerbase.c:714
void SendSoundEvent(EPlayerSoundEventID id)
ref Timer m_DeathCheckTimer
Definition playerbase.c:146
float GetTemporaryResistanceToAgent(int agent)
int m_AnimCommandStarting
Definition playerbase.c:74
bool CanManipulateInventory()
override bool IsInventoryVisible()
void SetBleedingBits(int bits)
override void OnPlayerRecievedHit()
vector m_LastMapPos
Definition playerbase.c:290
bool ItemToInventory
Definition playerbase.c:277
override bool IsAlreadyInFallingCommand(int pCurrentCommandID)
EffectTrigger m_CurrentEffectTrigger
Definition playerbase.c:213
bool TogglePlacingServer(int userDataType, ParamsReadContext ctx)
ref HeadingRestrictData m_HeadingRestrictData
Definition playerbase.c:151
bool IsPlayerLoaded()
void SetHairLevelToHide(int level, bool state, bool was_debug=false)
Dynamic hair hiding.
bool CanSprint()
ItemBase m_CheckMeleeItem
Definition playerbase.c:305
override void CommandHandler(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
bool IsNVGLowered()
void ShockRefill(float pDt)
functionality moved to ShockMdfr::OnTick
bool GetDrowningWaterLevelCheck()
void SetLastShavedSeconds(int last_shaved_seconds)
ref Hologram m_HologramLocal
Definition playerbase.c:247
ref InjuryAnimationHandler m_InjuryHandler
Definition playerbase.c:98
PluginConfigEmotesProfile m_ConfigEmotesProfile
Definition playerbase.c:78
void SetLastFirePointIndex(int last_fire_point_index)
ref EmoteManager m_EmoteManager
Definition playerbase.c:94
void ToggleHeatBufferVisibility(bool show)
void SetShakesForced(int value)
float GetBordersImmunity()
int m_DiseaseCount
Definition playerbase.c:172
float GetFeetDamageMoveModifier()
const int SIMPLIFIED_SHOCK_CAP
Definition playerbase.c:51
bool TakeToDstImpl(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
ref Param2< float, float > m_UAProgressParam
Definition playerbase.c:112
ref DebugMonitorValues m_DebugMonitorValues
Definition playerbase.c:103
ref ArrowManagerPlayer m_ArrowManager
Definition playerbase.c:131
void MapNavigationItemNotInPossession(EntityAI item)
void dmgDebugPrint(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
void RemoveCurrentEffectTrigger()
Definition playerbase.c:793
float GetStatBordersWater()
void OnContaminatedAreaEnterServer()
Definition playerbase.c:915
EntityAI SpawnEntityOnGroundOnCursorDir(string object_name, float distance)
static ref array< string > m_BleedingSourcesUp
Definition playerbase.c:200
void OnRestrainChangeClient()
override void DepleteStaminaEx(EStaminaModifiers modifier, float dT=-1, float coef=1.0)
int m_HealingsCount
Definition playerbase.c:173
static Particle m_ContaminatedAroundPlayerTiny
Definition playerbase.c:323
EntityAI CreateInInventory(string item_name, string cargo_type="", bool full_quantity=false)
/brief Creates ItemBase in players inventory.
bool m_CanPlayBrokenLegSound
Definition playerbase.c:197
bool TakeEntityToTargetCargoImpl(InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
vector GetLastFirePoint()
float GetStatBordersEnergy()
void ForceUpdateInjuredState()
update injured state immediately
void BrokenLegWalkShock()
void IncreaseAntibioticsCount()
vector GetAimPosition()
void CloseMap()
DEPRECATED; terminates map animation callback and re-enables controls.
ref array< int > m_ProcessRemoveGlassesEffects
Definition playerbase.c:344
bool IsSprinting()
bool m_CanDisplayHitEffectPPE
Definition playerbase.c:220
void CheckDeath()
override array< string > GetSuitableFinisherHitComponents()
returns list of suitable finisher hit components (defined on base entity/entity type)
float m_UnconsciousVignetteTarget
Definition playerbase.c:165
void StaminaHUDNotifier(bool show)
override bool IsUnconsciousStateOnly()
ref UndergroundBunkerHandlerClient m_UndergroundBunkerHandler
const int SHAKE_LEVEL_MAX
Definition playerbase.c:52
float m_UnconRefillModifier
Definition playerbase.c:201
void SetFlagTendencyRaise(bool state)
DEPRECATED.
void SetDecayEffects(int effect=-1)
ref PlayerStats m_PlayerStats
Definition playerbase.c:83
override void OnCommandDeathStart()
override void EEItemIntoHands(EntityAI item)
void SetBloodyHandsPenaltyChancePerAgent(eAgents type, float amount)
increments the chances per agents
bool IsQuickFishing()
void CheckForGag()
void FixAllInventoryItems()
UndergroundHandlerClient GetUndergroundHandler()
override void SwitchItemSelectionTexture(EntityAI item, string slot_name)
void Init()
Definition playerbase.c:359
override bool IsSelfAdjustingTemperature()
void ToggleHeatBufferVisibility(int heatbufferStage)
void SetLastFirePoint(vector last_fire_point)
bool TakeEntityToCargoImpl(InventoryMode mode, notnull EntityAI item)
int GetBleedingSourceCount()
EntityAI SpawnAI(string object_name, vector pos)
void PlacingStartServer(ItemBase item)
void TestSend()
bool m_InsideEffectArea
Definition playerbase.c:211
EntityAI SpawnEntityOnGroundRaycastDispersed(string object_name, float raycastDistance=DEFAULT_SPAWN_DISTANCE, float radius=UAItemsSpreadRadius.DEFAULT)
int m_SoundEvent
Definition playerbase.c:108
bool Consume(ItemBase source, float amount, EConsumeType consume_type)
void IncreaseContaminatedAreaCount()
Definition playerbase.c:807
void SaveAreaPersistenceFlag(ParamsWriteContext ctx)
void SetNextRecipe()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
void CheckSendSoundEvent()
void SetActions()
override bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
void TogglePlacingLocal(ItemBase item=null)
float m_UnconsciousEndTime
Definition playerbase.c:183
bool GetInColdArea()
override void OnCommandClimbFinish()
void CheckHairClippingOnCharacterLoad()
helper method for re-checking hairhiding on character load
void CalculateVisibilityForAI()
bool CheckMeleeItemDamage(ItemBase item)
vector m_DirectionToCursor
Definition playerbase.c:170
float m_LastFirePointRot
Definition playerbase.c:274
bool AllowDecayEffects()
override void InsertAgent(int agent, float count=1)
override void SetDeathDarknessLevel(float duration, float tick_time)
bool HasStaminaRemaining()
void GiveShock(float shock)
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)
ref EffectSound m_SoundFliesEffect
Definition playerbase.c:137
int m_EffectAreaCount
Definition playerbase.c:210
bool IsJumpInProgress()
SoftSkillsManager GetSoftSkillsManager()
ref StanceIndicator m_StanceIndicator
Definition playerbase.c:101
ref Environment m_Environment
Definition playerbase.c:93
void SendSoundEventEx(EPlayerSoundEventID id, int param=0)
override void EOnPostFrame(IEntity other, int extra)
vector SetDefaultHitPosition(string pSelection)
void SetEnergyManagerState(ItemBase itemInHands, bool state)
Definition playerbase.c:616
ModifiersManager GetModifiersManager()
bool CheckAndExecuteStackSplitToInventoryLocation(InventoryLocation il, notnull EntityAI item)
ref array< int > m_ProcessAddGlassesEffects
Definition playerbase.c:343
void SetPulseType(EPulseType pulse_type)
ref VirtualHud m_VirtualHud
Definition playerbase.c:96
override void OnStanceChange(int previousStance, int newStance)
ref map< EEffectAreaType, float > m_EffectAreaTimeToTick
Definition playerbase.c:218
void HandleGlassesEffect()
void ShowUnconsciousScreen(bool show)
int m_HealthLevel
Definition playerbase.c:179
void ProcessADDModifier()
PlayerStat< float > GetStatEnergy()
string m_DecayedTexture
Definition playerbase.c:190
ItemBase CreateCopyOfItemInInventoryOrGroundEx(ItemBase src, bool markItemAsSplitResult=false)
void SwitchItemTypeAttach(EntityAI item, string slot)
EntityAI m_Item1
Definition playerbase.c:256
override void HideClothing(ItemOptics optic, bool state)
state 'true' == hide
bool m_ProcessUIWarning
Definition playerbase.c:68
int m_LastFirePointIndex
Definition playerbase.c:275
override void RequestSoundEventStop(EPlayerSoundEventID id, bool from_server_and_client=false, int param=EPlayerSoundEventParam.STOP_PLAYBACK)
float GetPlayerLoad()
void BrokenLegForceProne(bool forceOverride=false)
override bool CanDropEntity(notnull EntityAI item)
Definition playerbase.c:979
PlayerStat< float > m_StatToxicity
Definition playerbase.c:326
void MovingShock(float legHealth, float highShock, float midShock, float lowShock)
void OnRestrainStartedChangeClient()
void PlacingCancelLocal()
float m_LastMapScale
Definition playerbase.c:289
override void OnCommandVehicleFinish()
int GetLastShavedSeconds()
EntityAI m_Item2
Definition playerbase.c:257
void SpawnDrowningBubbles()
int m_HasBloodyHandsVisible
Definition playerbase.c:59
void SetNVGLowered(bool state)
PlayerStat< int > GetStatBloodType()
float m_LastTick
Definition playerbase.c:252
void AddToEnvironmentTemperature(float pTemperature)
override void OnStoreSave(ParamsWriteContext ctx)
void ApplySplint()
void OnSpawnedFromConsole()
bool IsPlayerDisconnected()
void ProcessADSSyncResetRequest()
ref array< EntityAI > m_ItemsToDelete
Definition playerbase.c:191
override void RPC(int rpc_type, array< ref Param > params, bool guaranteed, PlayerIdentity recipient=NULL)
void SetActionEndInput(ActionBase action)
int m_BleedingSourceCount
Definition playerbase.c:184
bool ResetADSPlayerSync(int userDataType, ParamsReadContext ctx)
server only
bool IsPlacingServer()
float m_UnconsciousTime
Definition playerbase.c:155
DamageDealtEffect GetDamageDealtEffect()
bool m_IsCraftingReady
Definition playerbase.c:258
override string GetHitComponentForAI()
Melee helpers.
void AddActiveNV(int type)
override bool IsInventorySoftLocked()
void SetActivePrimarySymptomID(SymptomIDs id)
Definition playerbase.c:747
bool IsTargetInActiveRefresherRange(EntityAI target)
int GetLastFirePointIndex()
Head_Default m_CharactersHead
Definition playerbase.c:185
void OnDrowningStart()
ref array< int > m_Recipes
Definition playerbase.c:261
PlayerStat< float > GetStatSpecialty()
bool m_MapCloseRequestProcessed
Definition playerbase.c:287
void ClearLastUAMessage()
ref InventoryActionHandler m_InventoryActionHandler
Definition playerbase.c:132
override bool OnLand(int pCurrentCommandID, FallDamageData fallDamageData)
bool m_IsRestrainPrelocked
Definition playerbase.c:162
bool IsItemInInventory(EntityAI entity)
override bool CanReceiveItemIntoCargo(EntityAI item)
void UpdateTranslatedSelections(SelectionTranslation stt)
int m_RefreshAnimStateIdx
Definition playerbase.c:70
EStatLevels GetImmunityLevel()
override bool PredictiveDropEntity(notnull EntityAI item)
int m_ShockSimplified
Definition playerbase.c:156
void RequestUnconsciousness(bool enable)
override bool CanRoll()
ref Param2< int, int > m_UAParam
Definition playerbase.c:113
const string CONTAMINATED_AREA_AMBIENT
Definition playerbase.c:207
override bool IsHoldingBreath()
override void OnCommandClimbStart()
override bool PredictiveForceSwapEntities(notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
void OnPlayerIsNowInsideEffectAreaEndServer()
Definition playerbase.c:932
void DealShock(float dmg)
PlayerStat< float > GetStatStamina()
vector m_CraftingInitialPos
Definition playerbase.c:260
static Particle m_ContaminatedAroundPlayer
Definition playerbase.c:322
void SetPlayerLoad(float load)
bool GetLastMapInfo(out float scale, out vector pos)
int m_SoundEventParam
Definition playerbase.c:109
EStatLevels GetStatLevelHealth()
void QueueRemoveEffectWidget(array< int > effects)
void AddPossibleCoverFaceForShave()
DEPRECATED!
ref WeaponManager m_WeaponManager
Definition playerbase.c:129
bool m_MapClosingSyncSent
Definition playerbase.c:288
int GetNVType()
override void OnRollFinish()
int GetVoiceType()
int GetStaminaState()
int GetCurrentRecipe()
ref TInputActionMap m_InputActionMapAsTarget
Definition playerbase.c:125
override void SetProcessUIWarning(bool state)
int m_SyncedModifiersPrev
Definition playerbase.c:318
void ProcessHoldBreath(float dT)
void SpawnShockEffect(float intensity_max)
override void JunctureDeleteItem(EntityAI item)
int m_PerformedAnimActionID
Definition playerbase.c:310
void RadialQuickBarSingleUse(int slotClicked)
bool ReadLiftWeaponRequest(int userDataType, ParamsReadContext ctx)
override void DepleteStamina(EStaminaModifiers modifier, float dT=-1)
void OnInventoryMenuClose()
override bool PredictiveTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
ref TInputActionMap m_InputActionMap
Definition playerbase.c:123
void DecreaseContaminatedAreaCount()
Definition playerbase.c:814
void ~PlayerBase()
Definition playerbase.c:601
ref SoundParams m_SaySoundParams
Definition playerbase.c:263
bool GetMapClosingSyncSent()
vector GetLocalProjectionOrientation()
bool m_MeleeDebug
melee stats
Definition playerbase.c:303
void QueueRemoveGlassesEffect(int id)
bool m_FlagRaisingTendency
Definition playerbase.c:58
string m_DatabaseID
Definition playerbase.c:299
bool m_IsVehicleSeatDriver
Definition playerbase.c:182
override void RemoveAgent(int agent_id)
void ImmuneSystemTick(float value, float deltaT)
void MessageStatus(string text)
override void EEKilled(Object killer)
override bool CanBeTargetedByAI(EntityAI ai)
PluginAdminLog m_AdminLog
Definition playerbase.c:319
EmoteManager GetEmoteManager()
bool CanShave()
void OnUnconsciousUpdate(float pDt, int last_command)
override void OnParticleEvent(string pEventType, string pUserString, int pUserInt)
bool m_ActionQBControl
Definition playerbase.c:268
int m_MixedSoundStates
Definition playerbase.c:180
bool m_AreHandsLocked
Definition playerbase.c:164
ActionUnfoldMapCB m_hac
Definition playerbase.c:285
ref MapNavigationBehaviour m_MapNavigationBehaviour
Definition playerbase.c:291
void Message(string text, string style)
colorStatusChannel colorAction colorFriendly colorImportant
void RemoveQuickBarEntityShortcut(EntityAI entity)
ref PlayerStomach m_PlayerStomach
Definition playerbase.c:320
bool m_IsRestrained
Definition playerbase.c:158
override bool PredictiveTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
void OnDisconnect()
override EntityAI SpawnEntityOnGroundPos(string object_name, vector pos)
void DecreaseEffectAreaCount()
Definition playerbase.c:834
void AddAction(typename actionName)
override void RemoveAllAgents()
void OnQuickBarContinuousUseStart(int slotClicked)
bool CheckAndExecuteStackSplit(FindInventoryLocationType flags, notnull EntityAI item, notnull EntityAI target)
bool IsOverloaded()
TransferValues GetTransferValues()
bool IsFacingTarget(Object target)
bool m_LoweredNVGHeadset
Definition playerbase.c:314
int m_SyncedModifiers
Definition playerbase.c:317
void OnReconnect()
float m_CameraSwayModifier
Definition playerbase.c:166
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
vector m_DefaultHitPosition
Definition playerbase.c:171
override bool PredictiveTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
float m_RecipeAnimLength
Definition playerbase.c:259
void OnQuickBarContinuousUseEnd(int slotClicked)
int m_StaminaState
Definition playerbase.c:154
array< int > GetNVTypesArray()
void SetRestrained(bool is_restrained)
override void TakeEntityToHandsImpl(InventoryMode mode, EntityAI item)
VirtualHud GetVirtualHud()
void RemoveAllItems()
void SetNVGWorking(bool state)
int m_BleedingBits
Definition playerbase.c:169
override bool PlaySoundEventType(ESoundEventType soundType, int soundEventID, int param=0)
bool IsMale()
bool m_HideHairAnimated
Definition playerbase.c:189
bool GetHitPPEEnabled()
PlayerStomach GetStomach()
void DropHeavyItem()
void OnContaminatedAreaExitServer()
Definition playerbase.c:921
override void SpawnDamageDealtEffect()
ref EffectRadial m_EffectRadial
Definition playerbase.c:119
void OnUpdateEffectAreaServer(float timeSlice)
Definition playerbase.c:880
override void OnReceivedHit(ImpactEffectsData hitData)
Call only on client or single player PlayerBase (as g_Game.GetPlayer()).
bool m_IsRestrainedLocal
Definition playerbase.c:159
string GetCachedName()
ref array< int > m_ProcessAddEffectWidgets
Definition playerbase.c:339
void SetLiftWeapon(int pJunctureID, ParamsReadContext ctx)
void UpdateDelete()
void MessageImportant(string text)
void SetActionsRemoteTarget()
EntityAI GetQuickBarEntity(int index)
int m_AntibioticsActive
UndergroundBunkerHandlerClient GetUndergroundBunkerHandler()
ref HiddenSelectionsData m_EmptyGloves
Definition playerbase.c:128
void UpdatePlayerMeasures()
float GetHeatBufferDynamicMax()
override void AddItemToDelete(EntityAI item)
void RequestHandAnimationStateRefresh()
override ArrowManagerBase GetArrowManager()
void DecreaseDiseaseCount()
SymptomManager GetSymptomManager()
override bool PredictiveTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
override bool PhysicalPredictiveDropItem(EntityAI entity, bool heavy_item_only=true)
void SetLoadedQuickBarItemBind(EntityAI entity, int index)
void OnPlayerIsNowInsideEffectAreaBeginClient()
Definition playerbase.c:937
DayZPlayerCameraBase m_CurrentCamera
Definition playerbase.c:168
PluginRecipesManager m_ModuleRecipesManager
Definition playerbase.c:84
ref Hologram m_HologramServer
Definition playerbase.c:246
void DecreaseHealingsCount()
void UpdateMaskBreathWidget(notnull MaskBase mask, bool is_start=false)
int m_ActivePrimarySymptomID
Definition playerbase.c:311
bool m_IsHoldingBreath
Definition playerbase.c:142
ref Param1< float > m_UnconParam
Definition playerbase.c:116
ItemBase CreateCopyOfItemInInventoryOrGround(ItemBase src)
int m_FliesIndex
Definition playerbase.c:110
float GetSimplifiedShockNormalized()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
bool m_PlayerLoaded
Definition playerbase.c:66
void SetUnderground(EUndergroundPresence presence)
override string GetDefaultHitComponent()
returns default hit component (fallback)
float m_HeatBufferDynamicMax
Definition playerbase.c:63
override bool IsRestrained()
bool m_QuickBarFT
Definition playerbase.c:139
ref EffectParticle m_FliesEff
Definition playerbase.c:122
bool m_ShowDbgUI
int m_Shakes
Definition playerbase.c:176
NotifiersManager GetNotifiersManager()
override void OnCommandMelee2Finish()
string m_CachedPlayerName
Definition playerbase.c:222
void SetActions(out TInputActionMap InputActionMap)
void SetInWater(bool pState)
water contact (driven by Environment)
ref ConstructionActionData m_ConstructionActionData
Definition playerbase.c:271
void OnPlayerLoaded()
int GetShakeLevel()
void IncreaseEffectAreaCount()
Definition playerbase.c:823
PlayerStat< float > m_StatHeatComfort
Definition playerbase.c:328
bool Consume(PlayerConsumeData data)
void OnStoreSaveLifespan(ParamsWriteContext ctx)
void SetSoundCategoryHash(int hash)
Definition playerbase.c:730
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
void PlacingCompleteLocal()
void EndFighting()
override void CheckAnimationOverrides()
static ref array< string > m_BleedingSourcesLow
Definition playerbase.c:199
EMedicalDrugsType m_MedicalDrugsActive
Definition playerbase.c:346
void TryHideItemInHands(bool hide, bool force=false)
tries to hide item in player's hands, some exceptions for various movement states
void OnUnconsciousStart()
void SetTemporaryResistanceToAgent(int agent, float time)
string m_CachedPlayerID
Definition playerbase.c:223
void SwitchItemTypeDetach(EntityAI item, string slot)
void OnPlayerReceiveFlashbangHitEnd()
void UnsetMixedSoundState(eMixedSoundStates state)
override bool CanPlaceItem(EntityAI item)
void OnDrowningEnd()
ref PlayerSoundManagerClient m_PlayerSoundManagerClient
Definition playerbase.c:135
PlayerSoundManagerServer GetPlayerSoundManagerServer()
EStatLevels GetStatLevel(float stat_value, float critical, float low, float normal, float high)
override bool CanSwapItemInCargo(EntityAI child_entity, EntityAI new_entity)
int m_QuickBarBonus
Definition playerbase.c:181
void RequestResetADSSync()
ref SoundObject m_SaySoundObject
Definition playerbase.c:265
ActionManagerBase GetActionManager()
bool CanDeleteItems()
void SetPersistentFlag(PersistentFlag bit, bool enable)
void UpdateQuickBarEntityVisibility(EntityAI entity)
override void OnRollStart(bool isToTheRight)
void SetCheckMeleeItem(ItemBase item=null)
bool m_IsFighting
Definition playerbase.c:278
bool m_HasBloodTypeVisible
Definition playerbase.c:56
float GetHealthRegenSpeed()
bool m_IsRestrainStarted
Definition playerbase.c:160
PluginLifespan m_ModuleLifespan
Definition playerbase.c:79
ConstructionActionData GetConstructionActionData()
int GetHeatBufferStage()
int m_DebugMonitorEnabled
Definition playerbase.c:282
override vector GetDefaultHitPosition()
override bool CanReleaseAttachment(EntityAI attachment)
void RemovePossibleCoverFaceForShave()
DEPRECATED!
void SetNewCharName()
ref EffectSound m_BrokenLegSound
Definition playerbase.c:195
bool m_ContaminatedAreaEffectEnabled
Definition playerbase.c:206
void QueueAddEffectWidget(array< int > effects)
bool m_MapOpen
Definition playerbase.c:286
override bool CanPickupHeavyItem(notnull EntityAI item)
override bool CanReleaseCargo(EntityAI cargo)
bool m_AllowQuickFishing
Definition playerbase.c:175
void OnBleedingSourceRemovedEx(ItemBase item)
FlashbangEffect GetFlashbangEffect()
float GetBloodyHandsPenaltyChancePerAgent(eAgents type)
override void RequestSoundEventEx(EPlayerSoundEventID id, bool from_server_and_client=false, int param=0)
override void OnCommandLadderStart()
bool m_IsDrowning
Definition playerbase.c:279
override void OnLadder(float delta_time, HumanMovementState pState)
called every command handler tick when player is on ladder
Hud m_Hud
Definition playerbase.c:140
void SpawnFlashbangEffect(PlayerBase player, bool visual)
eMixedSoundStates GetMixedSoundStates()
void SetBloodTypeVisible(bool show)
void ContaminatedParticleAdjustment()
void SetEnableQuickBarEntityShortcut(EntityAI entity, bool value)
void SetRestrainPrelocked(bool restrain_prelock)
ref TransferValues m_TrasferValues
Definition playerbase.c:102
string GetCachedID()
bool IsSyncedModifierActive(eModifierSyncIDs modifier)
Checks whether modifier (which has syncing enabled) is currently active, works on both Client and Ser...
float GetImmunity()
returns player's immunity strength between 0..1
int m_HeatBufferStage
Definition playerbase.c:62
float GetLastFirePointRot()
vector GetLocalProjectionPosition()
void RunFightBlendTimer()
PlayerStat< float > m_StatTremor
Definition playerbase.c:329
void ClearBloodyHandsPenaltyChancePerAgent(eAgents type)
bool m_IsRestrainStartedLocal
Definition playerbase.c:161
override void RequestSoundEvent(EPlayerSoundEventID id, bool from_server_and_client=false)
override void EEDelete(EntityAI parent)
override void OnJumpEnd(int pLandType=0)
override void OnCommandVehicleStart()
override bool HeadingModel(float pDt, SDayZPlayerHeadingModel pModel)
void UnsetInEffectAreaTypeFlag(EEffectAreaType flag)
Definition playerbase.c:858
void PlacingCancelServer()
PlayerStat< float > GetStatHeatComfort()
string GetPlayerClass()
Hologram GetHologramServer()
ref HeatComfortAnimHandler m_HCAnimHandler
Definition playerbase.c:136
override void EEItemDetached(EntityAI item, string slot_name)
int SimplifyShock()
void SetFirstRecipe()
ItemBase CreateCopyOfItemInInventory(ItemBase src)
ref TInputActionMap m_InputActionMapControled
Definition playerbase.c:124
bool CanBeRestrained()
void UpdateLighting()
int GetCraftingRecipeID()
ref NotifiersManager m_NotifiersManager
Definition playerbase.c:89
StaminaHandler GetStaminaHandler()
void SpawnDamageDealtEffect2(Param param1=null, Param param2=null)
float GetStatBordersToxicity()
PlayerStats GetPlayerStats()
void SetLiftWeapon(bool state, float obstruct=0)
override bool PlaySoundEvent(EPlayerSoundEventID id, bool from_anim_system=false, bool is_from_server=false)
SymptomIDs GetActivePrimarySymptomID()
Definition playerbase.c:753
void AdjustShemag(EntityAI item, string slot_name)
void OnCommandHandlerTick(float delta_time, int pCurrentCommandID)
void ResetPlayer(bool set_max)
override bool PredictiveTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
PlayerStat< float > GetStatHeatBuffer()
float GetVisibilityCoef()
override bool IsInFBEmoteState()
void ProcessHandDamage(float delta_time, HumanMovementState pState)
PlayerSoundEventHandler GetPlayerSoundEventHandler()
ref Timer m_AnalyticsTimer
Definition playerbase.c:300
override SoundOnVehicle PlaySound(string sound_name, float range, bool create_local=false)
ref FlashbangEffect m_FlashbangEffect
Definition playerbase.c:120
bool IsPersistentFlag(PersistentFlag bit)
int m_LastShavedSeconds
Definition playerbase.c:54
void EndSurrenderRequest(SurrenderData data=null)
ends surrender, originally intended for surrender->restrained transitioning
void AddPlayerLoad(float addedload)
bool IsSurrendered()
PlayerStat< float > GetStatToxicity()
void PlacingCompleteServer()
void OnTick()
void PreloadDecayTexture()
override void OnVehicleSeatDriverLeft()
static ref array< CargoBase > SPREAD_AGENTS_PROXY_CARGOS
override void AfterStoreLoad()
EStatLevels GetStatLevelEnergy()
override void OnFreezeStateChangeClient()
bool m_PlayerDisconnectProcessed
Definition playerbase.c:67
ref ShockDealtEffect m_ShockDealtEffect
Definition playerbase.c:121
override int GetQuickBarBonus()
Definition playerbase.c:971
override void AddArrow(Object arrow, int componentIndex, vector closeBonePosWS, vector closeBoneRotWS)
int GetBloodType()
void SetInEffectAreaTypeFlag(EEffectAreaType flag)
Definition playerbase.c:846
ref PlayerSoundManagerServer m_PlayerSoundManagerServer
Definition playerbase.c:134
void OnQuickBarSingleUse(int slotClicked)
bool m_ActionsInitialize
Definition playerbase.c:126
override void SimulateDeath(bool state)
int GetBreathVapourLevel()
Definition playerbase.c:999
void DropAllItems()
Drops all clothes/wearables this character is carrying on themselves.
int m_DbgListSelection
void RemoveActiveNV(int type)
PluginPresenceNotifier m_PresenceNotifier
Definition playerbase.c:80
ref UndergroundHandlerClient m_UndergroundHandler
Definition playerbase.c:82
override bool IsPlayer()
void CloseInventoryMenu()
bool HasHealings()
static set< int > GetFaceCoverageShaveValues()
returns a set of face covering values
float m_OriginalSlidePoseAngle
Definition playerbase.c:107
bool CanSpawnBreathVaporEffect()
EUndergroundPresence m_UndergroundPresence
Definition playerbase.c:75
void OnVoiceEventPlayback(PlayerSoundEventBase voice_event, AbstractWave callback, float playback_time)
called every cmd handler tick during a playback of PlayerSoundEvent, m_ProcessPlaybackEvent needs to ...
PlayerStat< int > GetStatWet()
override bool CanStartConsumingStamina(EStaminaConsumers consumer)
override void OnJumpStart()
BleedingSourcesManagerServer GetBleedingManagerServer()
override bool IsIgnoredByConstruction()
bool IsRestrainPrelocked()
ShockDealtEffect GetShockEffect()
const int ACT_STORE_SAVE_VERSION
Definition playerbase.c:72
int m_ContaminatedAreaCount
Definition playerbase.c:209
ref BleedingSourcesManagerServer m_BleedingManagerServer
Definition playerbase.c:85
bool IsMapOpen()
override void SetInventorySoftLock(bool status)
'soft lock' meaning inventory screen cannot be displayed, but mechanically, inventory operations are ...
void MessageFriendly(string text)
void OnHoldBreathStart()
void DecreaseAntibioticsCount()
float GetSingleAgentCountNormalized(int agent_id)
void SetDrowning(bool enable)
bool IsInWater()
EffectSound m_AmbientContamination
Definition playerbase.c:208
void AddMedicalDrugsInUse(EMedicalDrugsType drugType)
Definition playerbase.c:708
override void OnSyncJuncture(int pJunctureID, ParamsReadContext pCtx)
SyncJunctures.
bool IsPlacingLocal()
int m_LocalBrokenState
Definition playerbase.c:193
override void OnCommandSwimFinish()
int m_BrokenLegState
Definition playerbase.c:192
void SetBloodyHandsEx(eBloodyHandsTypes type)
void UpdateQuickBarExtraSlots()
override void EEHitByRemote(int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos)
const int OVERLOAD_LIMIT
Definition playerbase.c:104
override void OnCommandSwimStart()
void PrintAgents()
ref DamageDealtEffect m_DamageDealtEffect
Definition playerbase.c:118
vector m_LocalProjectionOrientation
Definition playerbase.c:249
ref ModifiersManager m_ModifiersManager
Definition playerbase.c:88
bool HasDisease()
float m_CurrentShock
Definition playerbase.c:157
void OnBleedingSourceRemoved()
override bool IsWeaponObstructionBlockingADS()
void SetQuickRestrain(bool enable)
bool TakeEntityToInventoryImpl(InventoryMode mode, FindInventoryLocationType flags, notnull EntityAI item)
bool m_SoundEventSent
Definition playerbase.c:111
override void OnCommandFallFinish()
ref Timer m_UALastMessageTimer
Definition playerbase.c:309
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
float GetStatBordersBlood()
PlayerStat< float > m_StatEnergy
Definition playerbase.c:327
static ref array< Object > SPREAD_AGENTS_OBJECTS
bool TakeEntityToTargetAttachmentImpl(InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
bool IsInRasedProne()
ref StaminaHandler m_StaminaHandler
Definition playerbase.c:97
void ResetActionEndInput()
PlayerStat< float > GetStatTremor()
void SetBrokenLegs(int stateId)
bool HandleRemoteItemManipulation(int userDataType, ParamsReadContext ctx)
void ProcessDrowning(float dT)
bool IsEmotePlaying()
PlayerStat< float > m_StatWater
Definition playerbase.c:325
void PlayerBase()
Definition playerbase.c:354
EPulseType GetPulseType()
int m_Agents
Definition playerbase.c:92
eBrokenLegs GetBrokenLegs()
override void OnCommandMelee2Start()
int m_FaceCoveredForShaveLayers
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
void OnBleedingSourceAdded()
ref Param1< string > m_UAParamMessage
Definition playerbase.c:115
ref array< int > m_ProcessRemoveEffectWidgets
Definition playerbase.c:340
bool IsItemsToDelete()
void IncreaseDiseaseCount()
override void ClearInventory()
/brief Delete all items in inventory
int m_StoreLoadVersion
Definition playerbase.c:71
override bool CanJump()
override bool IsFighting()
override bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnHoldBreathExhausted()
float m_LastShockHitTime
Definition playerbase.c:167
override bool IsRefresherSignalingViable()
void SetLiquidTendencyDrain(bool state)
ref ScriptInvoker m_OnUnconsciousStart
invokers
Definition playerbase.c:349
override WeaponManager GetWeaponManager()
bool IsInProne()
vector m_LocalProjectionPosition
Definition playerbase.c:248
void UpdateBrokenLegs(int stateId)
EntityAI GetMagazineToReload(EntityAI weapon)
void LockHandsUntilItemHeld()
int m_InventorySoftLockCount
Definition playerbase.c:295
bool IsQuickRestrain()
void OnQuickbarSetEntityRequest(ParamsReadContext ctx)
int GetBloodyHandsPenaltyAgents()
void SetStaminaState(eStaminaState state)
bool m_CorpseProcessing
Definition playerbase.c:147
bool TakeEntityAsAttachmentImpl(InventoryMode mode, notnull EntityAI item)
bool IsQBControl()
string m_SaySoundLastSetName
Definition playerbase.c:266
bool IsSwapBetweenHandsAndGroundLargeItem(notnull EntityAI item1, notnull EntityAI item2, out EntityAI item_hands, out EntityAI item_ground)
void SetLegHealth()
int GetPerformedActionID()
Definition playerbase.c:742
void SetHeatBufferDynamicMax(float value)
void SetStamina(int value, int range)
override void CheckLiftWeapon()
float GetWeightSpecialized(bool forceRecalc=false)
string GetLastUAMessage()
UA Last Message.
override bool CanChangeStance(int previousStance, int newStance)
override bool CanConsumeStamina(EStaminaConsumers consumer)
void UpdateHairSelectionVisibility(bool was_debug=false)
bool m_IsInColdArea
Definition playerbase.c:65
void OnSelectPlayer()
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)
Definition playerbase.c:758
bool IsClimbing()
vector m_PlayerOldPos
override bool NeedInventoryJunctureFromServer(notnull EntityAI item, EntityAI currParent, EntityAI newParent)
void SpreadAgentsEx(float distance=3, float chance=0.25)
chance between [0..1] , distance in meters
ref map< eAgents, float > m_BloodyHandsPenaltyChancePerAgent
Definition playerbase.c:352
void UpdateCorpseStateVisual()
void RemoveAction(typename actionName, out TInputActionMap InputActionMap)
PlayerStat< float > GetStatDiet()
bool CanRedirectToWeaponManager(notnull EntityAI item, out bool isActionPossible)
int GetStoreLoadVersion()
override void EEItemAttached(EntityAI item, string slot_name)
EStatLevels GetStatLevelWater()
void CloseMapEx(bool cancelled)
bool IsMapCallbackCancelInput()
void OnBleedingEnd()
RandomGeneratorSyncManager m_RGSManager
Definition playerbase.c:202
eBloodyHandsTypes HasBloodyHandsEx()
void IncreaseHealingsCount()
int m_BreathVapour
Definition playerbase.c:178
int GetBleedingBits()
void KillUndergroundHandler()
void OnVoiceEvent(PlayerSoundEventBase voice_event)
ref SymptomManager m_SymptomManager
Definition playerbase.c:95
bool IsMapCallbackEndInput()
void SpreadAgents()
void SetVisibilityCoef(float pVisibility)
float m_CargoLoad
Definition playerbase.c:105
override bool IsLiftWeapon()
void SetPerformedActionID(int id)
Definition playerbase.c:736
override vector GetCenter()
void SetCraftingRecipeID(int recipeID)
void SetBloodyHands(bool show)
void HideHairSelections(ItemBase item, bool state)
bool m_InsideEffectAreaPrev
Definition playerbase.c:212
ItemBase GetItemOnHead()
Returns item on player's head. For an example, a headtorch.
Definition playerbase.c:966
DayZPlayerCamera GetCurrentPlayerCamera()
void SetLastFirePointRot(float last_fire_point_rot)
ref CraftingManager m_CraftingManager
Definition playerbase.c:130
override bool PredictiveSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
void DamageAllLegs(float inputDmg)
void QueueAddGlassesEffect(int id)
EPulseType m_PulseType
Definition playerbase.c:186
void SetRestrainStarted(bool restrain_started)
bool m_BrokenLegsJunctureReceived
Definition playerbase.c:194
bool HasBloodTypeVisible()
void SetPlayerDisconnected(bool state)
bool CanConsumeFood(ConsumeConditionData data=null)
override void OnVehicleSeatDriverEnter()
bool IsLeaning()
int GetLifeSpanState()
float ConvertNonlethalDamage(float damage, DamageType damageType)
override void OnThrowingModeChange(bool change_to_enabled)
ref Param1< float > m_DeathDarkeningParam
Definition playerbase.c:117
int FindQuickBarEntityIndex(EntityAI entity)
bool m_WorkingNVGHeadset
Definition playerbase.c:313
int m_LifeSpanState
Definition playerbase.c:53
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)
void SetLifeSpanStateVisible(int show_state)
bool HasCoveredFaceForShave()
void OnPlayerReceiveFlashbangHitStart(bool visual)
void ResetActiveNV()
EEffectAreaType m_InEffectAreaType
Definition playerbase.c:216
override void OnCommandMoveStart()
override bool StopSoundEvent(EPlayerSoundEventID id, bool is_from_server=false, int param=0)
override void EEItemOutOfHands(EntityAI item)
override bool PlaySoundEventEx(EPlayerSoundEventID id, bool from_anim_system=false, bool is_from_server=false, int param=0)
float GetStatLevelBorders(float stat_value, float critical, float low, float normal, float high, float max)
override void OnVariablesSynchronized()
bool IsFalling()
void MapNavigationItemInPossession(EntityAI item)
void CheckZeroSoundEvent()
void SendLiftWeaponSync(bool state, float obstruct=0)
Client-side only.
override bool CanClimb(int climbType, SHumanCommandClimbResult climbRes)
void SetImmunityBoosted(bool boosted)
void FreezeCheck()
ScriptInvoker GetOnUnconsciousStop()
Definition playerbase.c:700
ref map< EEffectAreaType, int > m_EffectAreaOverlap
Definition playerbase.c:217
void RadialQuickBarCombine(int slotClicked)
void SetQuickBarEntityShortcut(EntityAI entity, int index, bool force=false)
bool AnimCommandCheck(HumanMoveCommandID mask)
Returns whether the specified movement command(s) are starting the next frame.
bool IsStance(int stance, int stanceMask)
void ShavePlayer()
override void PredictiveTakeEntityToHands(EntityAI item)
bool IsAntibioticsActive()
Definition playerbase.c:725
override bool IsLanded(int pCurrentCommandID)
bool m_LiquidTendencyDrain
Definition playerbase.c:57
GameplayEffectWidgets_base m_EffectWidgets
effect widgets
Definition playerbase.c:338
const string SOUND_BREAK_LEG
Definition playerbase.c:196
void SetActionsRemoteTarget(out TInputActionMap InputActionMap)
void SetLastUAMessage(string pMsg)
void AntibioticsAttack(float value)
ScriptInvoker GetOnUnconsciousStart()
Definition playerbase.c:692
static bool DEBUG_INVENTORY_ACCESS
Definition playerbase.c:198
int GetQuickBarSize()
void SetBloodType(int blood_type)
void QuickReloadWeapon(EntityAI weapon)
void MessageAction(string text)
ref array< string > m_DbgOptions
void SetLocalProjectionPosition(vector local_position)
Hologram GetHologramLocal()
ref Param3< float, float, bool > m_StaminaParam
Definition playerbase.c:114
override bool PredictiveTakeEntityToTargetInventory(notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
override bool IsManagingArrows()
bool m_QuickBarHold
Definition playerbase.c:138
void OnConnect()
int m_LifespanLevelLocal
Definition playerbase.c:73
void OnBleedingBegin()
void OnCameraChanged(DayZPlayerCameraBase new_camera)
vector m_LastFirePoint
Definition playerbase.c:273
bool IsNVGWorking()
void OnHoldBreathEnd()
void SetMixedSoundState(eMixedSoundStates state)
int m_RecipeID
Definition playerbase.c:255
ref BleedingSourcesManagerRemote m_BleedingManagerRemote
Definition playerbase.c:86
static ref array< Man > m_ServerPlayers
Definition playerbase.c:219
void UpdateMovementInertia()
Update movement inertia based on stamina available.
override void ProcessLiftWeapon()
int m_CorpseState
Definition playerbase.c:148
override bool PredictiveTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
int m_AddModifier
Definition playerbase.c:253
int m_ForceInjuryAnimMask
Definition playerbase.c:188
int GetSingleAgentCount(int agent_id)
AbstractWave SaySoundSet(string name)
ref array< int > m_ActiveNVTypes
Definition playerbase.c:315
ItemBase GetItemInHands()
override int GetAgents()
bool OnStoreLoadLifespan(ParamsReadContext ctx, int version)
ref ShockHandler m_ShockHandler
Definition playerbase.c:99
ActionManagerBase m_ActionManager
Definition playerbase.c:90
override bool IsUnconscious()
float m_DbgSliderValue
void OnPlayerIsNowInsideEffectAreaBeginServer()
Definition playerbase.c:927
void SetLocalProjectionOrientation(vector local_orientation)
bool m_HasHeatBuffer
Definition playerbase.c:61
BleedingSourcesManagerRemote GetBleedingManagerRemote()
bool m_InventorySoftLocked
Definition playerbase.c:294
void UpdateShoulderProxyVisibility(EntityAI item, string slot_name)
void AddAction(typename actionName, out TInputActionMap InputActionMap)
bool IsWearingSplint()
void SetMapClosingSyncSet(bool state)
int m_PersistentFlags
Definition playerbase.c:153
int m_ShakesForced
Definition playerbase.c:177
bool HasBloodyHands()
void ReloadWeapon(EntityAI weapon, EntityAI magazine)
string m_UALastMessage
user actions & symptoms
Definition playerbase.c:308
EStatLevels GetStatLevelBlood()
PlayerStat< float > GetStatWater()
void OnInventoryMenuOpen()
override void ProcessFeetDamageServer(int pUserInt)
bool DropItem(ItemBase item)
void OnRestrainStart()
override float GetWeaponObstruction()
void OnJumpOutVehicleFinish(float carSpeed)
void SetToDelete(ParamsReadContext pCtx)
RandomGeneratorSyncManager GetRandomGeneratorSyncManager()
ref array< ref Param2< EntityAI, int > > m_aQuickBarLoad
Definition playerbase.c:243
bool GetFlagTendencyRaise()
DEPRECATED.
void InitEditor()
void RefreshHandAnimationState(int delay=0)
float m_VisibilityCoef
Definition playerbase.c:106
void RemoveAction(typename actionName)
override bool CanReceiveItemIntoHands(EntityAI item_to_hands)
EntityAI FindCargoByBaseType(string searched_item)
bool m_IsHeadingRestricted
Definition playerbase.c:150
override void OnCommandFallStart()
bool HasHeatBuffer()
float GetTotalAgentCount()
void SetInColdArea(bool state)
void SetQuickFishing(bool enable)
bool IsRolling()
ref SoftSkillsManager m_SoftSkillsManager
Definition playerbase.c:100
void OnUnconsciousStop(int pCurrentCommandID)
ItemBase GetItemOnSlot(string slot_type)
Returns item that's on this player's attachment slot. Parameter slot_type should be a string from con...
Definition playerbase.c:949
bool m_AllowQuickRestrain
Definition playerbase.c:174
DebugMonitorValues GetDebugMonitorValues()
bool IsRestrainStarted()
override void EOnFrame(IEntity other, float timeSlice)
int m_LocalRefreshAnimStateIdx
Definition playerbase.c:69
bool Save()
void OnPlayerIsNowInsideEffectAreaEndClient()
Definition playerbase.c:942
PluginPlayerStatus m_ModulePlayerStatus
Definition playerbase.c:77
void UpdateCorpseState()
bool IsCurrentCameraAimedAtGround()
void SetBloodyHandsPenalty()
CraftingManager GetCraftingManager()
void SetBloodyHandsBase(int type)
void CheckSoundEvent()
int m_BloodType
Definition playerbase.c:55
bool m_ImmunityBoosted
Definition playerbase.c:163
EStatLevels GetStatLevelToxicity()
bool IsInEffectArea(EEffectAreaType area)
Definition playerbase.c:871
int GetNoisePresenceInAI()
Return actual noise presence of player.
static ref TStringArray m_QBarItems
Definition playerbase.c:296
void SetMapOpen(bool state)
ref SoundObjectBuilder m_SaySoundBuilder
Definition playerbase.c:264
override void OnCommandLadderFinish()
bool TakeEntityToTargetInventoryImpl(InventoryMode mode, notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
int m_CorpseStateLocal
Definition playerbase.c:149
void HandleBrokenLegsSync()
QuickBarBase m_QuickBarBase
Definition playerbase.c:133
float m_LastPostFrameTickTime
Definition playerbase.c:144
void SpawnBreathVaporEffect()
MapNavigationBehaviour GetMapNavigationBehaviour()
override void OnGameplayDataHandlerSync()
void ResetConstructionActionData()
bool CanEatAndDrink()
float GetStatBordersHealth()
ref PlayerAgentPool m_AgentPool
Definition playerbase.c:91
bool IsBleeding()
int m_RecipePick
Definition playerbase.c:141
void PlacingStartLocal(ItemBase item)
void SetHitPPEEnabled(bool enabled)
void OnScheduledTick(float deltaTime)
void OnVehicleSwitchSeat(int seatIndex)
void InitializeActions()
Definition enmath.c:7
proto native void SaveCharacter(bool localPlayer, bool verified)
proto native int GetLastPlayedCharacter()
proto native void SetCharacterName(int index, string newName)
proto native void SaveCharactersLocal()
Saves characters menu data to file.
Mission class.
Definition gameplay.c:686
Static component of PPE manager, used to hold the instance.
Definition ppemanager.c:3
static PPEManager GetPPEManager()
Returns the manager instance singleton.
Definition ppemanager.c:27
void Start(Param par=null)
Base Param Class with no parameters.
Definition param.c:12
Legacy way of using particles in the game.
Definition particle.c:7
static const int DROWNING_BUBBLES
static const int BREATH_VAPOUR_MEDIUM
static const int CONTAMINATED_AREA_GAS_TINY
static const int CONTAMINATED_AREA_GAS_AROUND
static const int BREATH_VAPOUR_HEAVY
static const int BREATH_VAPOUR_LIGHT
Keeps track of agents and their simulation.
override void OnGameplayDataHandlerSync()
static const float SL_HEALTH_HIGH
static const float BROKEN_LEGS_ROLL_SHOCK
static const float BROKEN_LEGS_HIGH_SHOCK_WALK
static const float SL_BLOOD_LOW
static const int LAST_UA_MSG_LIFETIME
static const float IMMUNITY_THRESHOLD_LEVEL_LOW
static const float UNCONSCIOUS_IN_WATER_TIME_LIMIT_TO_DEATH
static const float THRESHOLD_HEAT_COMFORT_MINUS_WARNING
static const int DROWNING_BUBBLE_FREQUENCY_MIN
static const float DROWNING_SWIMMING_THRESHOLD
static const float BROKEN_CROUCH_MODIFIER
static const float BAREFOOT_MOVEMENT_BLEED_MODIFIER
static const float MELEE2_MOVEMENT_BLEND_DELAY
static const float SL_BLOOD_CRITICAL
static const float SL_ENERGY_NORMAL
static const float IMMUNITY_THRESHOLD_LEVEL_NORMAL
static const float SL_HEALTH_CRITICAL
static const float HEALTH_REGEN_MIN
static const float SL_ENERGY_CRITICAL
static const float SL_WATER_MAX
static const float SL_ENERGY_HIGH
static const float SHOES_MOVEMENT_DAMAGE_PER_STEP
static const float BROKEN_LEGS_SHOCK_SWIM
static const float IMMUNITY_THRESHOLD_LEVEL_HIGH
static const float BROKEN_LEGS_HIGH_HEALTH_THRESHOLD
static const float BROKEN_LEGS_MID_SHOCK_WALK
static const float BROKEN_LEGS_INITIAL_SHOCK
static const int CHECK_EVERY_N_STEP
static const int CORPSE_STATE_DECAYED
static const float CHANCE_TO_BLEED_SLIDING_LADDER_PER_SEC
static const float FULL_SPRINT_DELAY_FROM_PRONE
[seconds]
static const float HEALTH_REGEN_MAX
static const float BROKEN_LEGS_LOW_HEALTH_THRESHOLD
static const float SL_ENERGY_LOW
static const float FULL_SPRINT_DELAY_FROM_CROUCH
[seconds]
static const float SL_WATER_HIGH
static const float SL_BLOOD_HIGH
static const float DROWNING_DEFAULT_THRESHOLD
static const float THRESHOLD_HEAT_COMFORT_MINUS_CRITICAL
static const float SL_ENERGY_MAX
static const float SL_HEALTH_NORMAL
static const float BROKEN_LEGS_STAND_SHOCK
static const int BLOOD_THRESHOLD_FATAL
static const float IMMUNITY_THRESHOLD_LEVEL_CRITICAL
static const float SL_WATER_CRITICAL
static const float GLOVES_DAMAGE_SLIDING_LADDER_PER_SEC
static const float SL_WATER_LOW
static const float CAMERA_THRESHOLD_PITCH
static const float BROKEN_LEGS_LOW_SHOCK_WALK
static const int DROWNING_BUBBLE_FREQUENCY_MAX
static const float DROWNING_UNCONSCIOUS_THRESHOLD
static const float SL_BLOOD_NORMAL
static const float SL_WATER_NORMAL
static const int CORPSE_STATE_MEDIUM
static const float SL_HEALTH_LOW
proto string GetName()
nick (short) name of player
proto string GetId()
unique id of player (hashed steamID, database Xbox id...) can be used in database or logs
The class that will be instanced (moddable).
Definition gameplay.c:389
void OnRPC(PlayerBase player, int rpc_type, ParamsReadContext ctx)
Manager class for managing Effect (EffectParticle, EffectSound).
static int PlayInWorld(notnull Effect eff, vector pos)
Play an Effect.
static int PlayOnObject(notnull Effect eff, Object obj, vector local_pos="0 0 0", vector local_ori="0 0 0", bool force_rotation_relative_to_world=false)
Play an Effect.
static EffectSound PlaySoundOnObject(string sound_set, Object parent_object, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
static bool IsEffectExist(int effect_id)
Checks whether an Effect ID is registered in SEffectManager.
proto static native bool CanStoreInputUserData()
Returns true when the channel is free, AND the InputBuffer is NOT full (same as '!...
proto native void Send()
ScriptInvoker Class provide list of callbacks usage:
Definition tools.c:116
bool GetSelectionState()
Definition head.c:148
void SetSelectionState(bool state)
Definition head.c:143
ref array< int > GetTranslatedSelections()
Definition head.c:153
proto bool Write(void value_out)
proto bool Read(void value_in)
string m_CharacterId
character ID
string m_Reason
reason of disconnect (quit, kick, ban, sign-out...)
int m_DaytimeHour
current daytime in gameplay (hour in 24h format)
vector m_PositionEnd
player world position at the end of interval
int m_TimeInterval
amount of real time in seconds covered by this event
vector m_PositionStart
player world position at the start of interval
float m_DistanceOnFoot
traveled distance on foot (meters) during interval
string m_CharacterId
character ID
static float GetParamFloat(string surface_name, string param_name)
Definition surface.c:18
static void SendEntityKilled(EntityAI victim, EntityAI killer, EntityAI source, bool is_headshot)
Definition syncevents.c:56
proto native float GetDamage(string zoneName, string healthType)
Native class for boats - handles physics simulation.
Definition boat.c:32
proto native UAInput GetInputByID(int iID)
returns list of all bindable (i.e. visible) inputs from the active group ('core' by default)
proto native void Supress()
proto native float SyncedValue_ID(int action, bool check_focus=true)
Get action state.
proto native void CloseDialog()
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID).
Definition uimanager.c:160
proto native bool IsDialogVisible()
bool IsMenuOpen(int id)
Returns true if menu with specific ID is opened (see MenuID).
Definition uimanager.c:154
Xbox menu.
Definition dayzgame.c:64
Volcanic area trigger.
static void ApplyEffects(PlayerBase player)
static const float HEAT_DAMAGE_TICK_TIME
bool CanAttachMagazine(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
bool CanSwapMagazine(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
bool CanLoadBullet(Weapon_Base wpn, Magazine mag, bool reservationCheck=true)
void SetCalcDetails(string details)
Definition debug.c:916
Keeps information about currently loaded world, like temperature.
Definition worlddata.c:3
float GetLiquidTypeEnviroTemperature(int liquidType)
Definition worlddata.c:229
int GetPollution()
Definition worlddata.c:282
void SetGlobalLighting(int lightingID)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto string ToString(bool simple=true)
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto float Normalize()
Normalizes vector.
static const vector Zero
Definition enconvert.c:123
proto native float LengthSq()
Returns squared length (magnitudeSqr).
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
void GetActionManager()
DamageType
exposed from C++ (do not change)
proto native int GetBoneIndexByName(string pBoneName)
returns bone index for a name (-1 if pBoneName doesn't exist)
DayZGame g_Game
Definition dayzgame.c:3942
override Widget Init()
Definition dayzgame.c:127
DayZGame GetDayZGame()
Definition dayzgame.c:3944
void DayZPlayerType()
Definition dayzplayer.c:512
const int SIMPLE_SELECTION_SHOULDER_RIFLE
const int SIMPLE_SELECTION_SHOULDER_MELEE
override string GetDebugName()
void SDayZPlayerHeadingModel()
cannot be created from script
DayZPlayerInstanceType
defined in C++
proto native DayZPlayerType GetDayZPlayerType()
returns appropriate DayZPlayerType
proto native DayZPlayerCamera GetCurrentCamera()
-------------— camera additional functions ----------------------—
proto native DayZPlayerInstanceType GetInstanceType()
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
proto native void SendSyncJuncture(int pJunctureID, ParamsWriteContext ctx)
-------------— sync stuff ----------------------—
class SDayZPlayerAimingModel SIMPLE_SELECTION_MELEE_RIFLE
float GetCurrentWaterLevel()
const int SIMPLE_SELECTION_MELEE_MELEE
proto native bool IsPlayerInStance(int pStanceMask)
-------------— camera additiona functions ----------------------—
string GetDefaultHitPositionComponent()
Definition dayzplayer.c:502
class DayZPlayerCameraResult DayZPlayerCamera(DayZPlayer pPlayer, HumanInputController pInput)
Definition dayzplayer.c:56
ref HumanMovementState m_MovementState
movement state
void DayZPlayerCameraOptics(DayZPlayer pPlayer, HumanInputController pInput)
void AbortWeaponEvent()
override bool OnInventoryCheck(int userDataType, ParamsReadContext ctx)
ref DayZPlayerImplementMeleeCombat m_MeleeCombat
void DayZPlayerUtils()
cannot be instantiated
DisplayElementBase GetElement(eDisplayElements element_id)
Mission mission
void VirtualHud(PlayerBase player)
EActions
Definition eactions.c:2
eAgents
Definition eagents.c:3
eBrokenLegs
Definition ebrokenlegs.c:2
EConsumeType
Definition econsumetype.c:2
DiagMenuIDs
Definition ediagmenuids.c:2
bool Consume(float amount, PlayerBase consumer)
EMedicalDrugsType
eMixedSoundStates
bits
eModifiers
Definition emodifiers.c:2
void EmoteManager(PlayerBase player)
bool IsControllsLocked()
bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
bool IsEmotePlaying()
proto string ToString()
void Environment(PlayerBase pPlayer)
EPlayerStates
EPulseType
Definition epulsetype.c:2
ERPCs
Definition erpcs.c:2
EStaminaConsumers
EStaminaModifiers
EStatLevels
Definition estatlevels.c:2
bool IsProcessing()
returns true when FP is heating or cooling
proto native float GetMax()
Serializer ParamsReadContext
Definition gameplay.c:15
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Definition gameplay.c:6
Serializer ParamsWriteContext
Definition gameplay.c:16
proto GizmoApi GetGizmoApi()
const int AGT_UACTION_CONSUME
Definition constants.c:502
const int AGT_AIRBOURNE_BIOLOGICAL
Definition constants.c:506
const int COLOR_RED_A
Definition constants.c:69
const int COLOR_GREEN_A
Definition constants.c:70
void Error(string err)
Messagebox with error message.
Definition endebug.c:90
proto void Print(void var)
Prints content of variable to console/log.
enum ShapeType ErrorEx
proto native void SetPosition(vector position)
Set the world position of the Effect.
Definition effect.c:463
ShapeFlags
Definition endebug.c:126
static proto bool GetBool(int id, bool reverse=false)
Get value as bool from the given script id.
static proto void SetValue(int id, int value)
Set value at the given script id.
class DiagMenu Shape
Instance of created debug visualizer.
const float DZPLAYER_CAMERA_FOV_IRONSIGHTS
Definition constants.c:983
const int INVENTORY_ENTITY_DROP_OVERLAP_DEPTH
Definition constants.c:1057
const int DEFAULT_CHARACTER_MENU_ID
Definition constants.c:987
const float REFRESHER_RADIUS
Definition constants.c:1028
const float NL_DAMAGE_FIREARM_CONVERSION_PLAYERS
Definition constants.c:1008
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
array< string > TStringArray
Definition enscript.c:712
void Obsolete(string msg="")
Definition enscript.c:371
set< string > TStringSet
Definition enscript.c:802
class array< Class T > PrintString
EntityEvent
Entity events for event-mask, or throwing event from code.
Definition enentity.c:45
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Definition constants.c:811
const int STATE_RUINED
Definition constants.c:851
const int LIQUID_WATER
Definition constants.c:544
static proto void MatrixOrthogonalize4(vector mat[4])
Orthogonalizes matrix.
static proto void MatrixInvMultiply4(vector mat0[4], vector mat1[4], out vector res[4])
Invert-transforms matrix.
static proto void YawPitchRollMatrix(vector ang, out vector mat[3])
Creates rotation matrix from angles.
static void MatrixIdentity4(out vector mat[4])
Creates identity matrix.
Definition enmath3d.c:256
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Definition enmath.c:126
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float AbsFloat(float f)
Returns absolute value.
static const float PI2
Definition enmath.c:13
static const float RAD2DEG
Definition enmath.c:16
static proto float Sin(float angle)
Returns sinus of angle in radians.
static proto int AbsInt(int i)
Returns absolute value.
const string CFG_AMMO
Definition constants.c:223
const int MENU_WARNING_TELEPORT
Definition constants.c:210
const int MENU_INSPECT
Definition constants.c:179
const int MENU_MAP
Definition constants.c:191
const int MENU_WARNING_ITEMDROP
Definition constants.c:208
const int MENU_RESPAWN_DIALOGUE
Definition constants.c:209
const int MENU_INVENTORY
Definition constants.c:180
const int MENU_RADIAL_QUICKBAR
Definition constants.c:198
EmitorParam
Definition envisual.c:114
const int SAT_DEBUG_ACTION
Definition constants.c:457
SetSoundControllerOverride(string controllerName, float value, SoundControllerAction action)
Overrides or limits soundmap value for a sound cotroller.
vector GetPosition()
Get the world position of the Effect.
Definition effect.c:473
class AbstractSoundScene SoundObjectBuilder(SoundParams soundParams)
void AbstractWave()
Definition sound.c:167
class SoundObject SoundParams(string name)
const float STAMINA_MAX
Definition constants.c:715
proto native int Length()
Returns length of string.
proto void GetHourMinuteSecond(out int hour, out int minute, out int second)
Returns system time.
proto native bool IsCLIParam(string param)
Returns if command line argument is present.
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10
bool IsRunning()
Definition tools.c:264
const int CALL_CATEGORY_GUI
Definition tools.c:9
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
proto native Widget GetParent()
Get parent of the Effect.
Definition effect.c:422
proto native void AddChild(Widget child, bool immedUpdate=true)
proto native Hive GetHive()
proto native int GetRunningAction()
returns -1 when no action is running or RELOAD,MECHANISM, ....
proto native bool IsModifierActive()
is modifier active
proto native bool IsInWater()
proto native float GetWeaponObstruction()
return obstruction value
class HumanCommandMelee2 HumanCommandFall()
Definition human.c:574
class HumanCommandWeapons HumanCommandAdditives()
Definition human.c:1127
void HumanItemAccessor()
Definition humanitems.c:141
class HumanItemBehaviorCfg OnItemInHandsChanged(bool pInstant=false)
signalization from script to engine that item in hands changed
eInjuryHandlerLevels
void InjuryAnimationHandler(PlayerBase player)
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
override void InsertAgent(int agent, float count=1)
Definition itembase.c:8895
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Definition itembase.c:4911
static string GetDisplayName(int liquid_type)
Definition liquid.c:382
void MapNavigationBehaviour(PlayerBase pPlayer, EMapNavigationType pNavigationType=EMapNavigationType.BASIC)
string GetDebugText()
eModifierSyncIDs
bool OnStoreLoad(ParamsReadContext ctx, int version)
void ModifiersManager(PlayerBase player)
void NotifiersManager(PlayerBase player)
void OnScheduledTick()
VirtualHud GetVirtualHud()
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor).
PersistentFlag
void PlayerSoundEventHandler(PlayerBase player)
void PlayerSoundManagerClient(PlayerBase player)
override float Get()
void PlayerStat(T min, T max, T init, string label, int flags)
bool LoadStats(ParamsReadContext ctx, int version)
void PlayerStats(Man player)
Definition playerstats.c:19
EPlayerStats_current
void PlayerStomach(PlayerBase player)
PluginConfigDebugProfile m_ConfigDebugProfile
void PluginItemDiagnostic()
void PluginLifespan()
eBloodyHandsTypes
PluginManager GetPluginManager()
Returns registred plugin by class type, better is to use global funtion GetPlugin(typename plugin_typ...
PluginBase GetPlugin(typename plugin_type)
void PluginPresenceNotifier()
EPresenceNotifierNoiseEventType
PPERequesterCategory
void QuickBarBase(PlayerBase player)
PlayerBase _player
void RandomGeneratorSyncManager(DayZPlayer player)
const float DEFAULT_SPAWN_DISTANCE
Definition recipebase.c:3
void ReplaceSoundEventHandler(PlayerBase player)
StaminaHandler m_StaminaHandler
proto native UAInputAPI GetUApi()
void UndergroundHandlerClient(PlayerBase player)
override bool IsIdle()