DayZ 1.24
Loading...
Searching...
No Matches
PlayerBase.c
Go to the documentation of this file.
1class PlayerBase extends ManBase
2{
3 const int SIMPLIFIED_SHOCK_CAP = 63;
4 const int SHAKE_LEVEL_MAX = 7;
5 private int m_LifeSpanState;
6 private int m_LastShavedSeconds;
7 private int m_BloodType;
9 private bool m_LiquidTendencyDrain; //client-side only - Obsolete
12 private int m_FaceCoveredForShaveLayers = 0; //DEPRECATED
13 protected bool m_HasHeatBuffer;
14 protected bool m_PlayerLoaded;
16 protected bool m_ProcessUIWarning;
18 protected int m_RefreshAnimStateIdx;
19 private int m_StoreLoadVersion;
20 const int ACT_STORE_SAVE_VERSION = 4;
21 protected int m_LifespanLevelLocal; //control variable for change calls
22 protected int m_AnimCommandStarting; //signals the command that is about to start the next frame (e.g. Swim, Fall...)
24
25 private PluginPlayerStatus m_ModulePlayerStatus;
26 PluginConfigEmotesProfile m_ConfigEmotesProfile;
29
32 PluginRecipesManager m_ModuleRecipesManager;
37 ref protected ActionManagerBase m_ActionManager;
38 //ref PlayerLightManager m_PlayerLightManager;
47 ref ShockHandler m_ShockHandler; //New shock handler
50 ref TransferValues m_TrasferValues;
52 const int OVERLOAD_LIMIT = 30000;
71 ref TInputActionMap m_InputActionMap; // Backwards compatibility
75 //ref CraftingMeta m_CraftingMeta;
87 bool m_QuickBarFT = false;
89 protected int m_RecipePick;
90 protected bool m_IsHoldingBreath;
91 protected bool m_IsInWater;
93 //AbstractWave m_SaySoundWave;
97 protected int m_CorpseStateLocal;
98
103 float m_CurrentShock; //Used to synchronize shock between server and client
108 bool m_AreHandsLocked; //Currently only used to block quickbar usage after canceling placement
109 float m_UnconsciousVignetteTarget = 2;
110 float m_CameraSwayModifier = 0.2;
118 protected bool m_AllowQuickRestrain;
119 protected bool m_AllowQuickFishing;
120 protected int m_Shakes;
121 protected int m_ShakesForced;
127 float m_UnconsciousEndTime = 0;
129 Head_Default m_CharactersHead;
133 //string m_sOpticsType;
137 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
138 int m_LocalBrokenState = eBrokenLegs.NO_BROKEN_LEGS;
141 const string SOUND_BREAK_LEG = "broken_leg_SoundSet";
142 bool m_CanPlayBrokenLegSound; //Used to check if sound has already been played
143 static bool DEBUG_INVENTORY_ACCESS = false;
144 static ref array<string> m_BleedingSourcesLow; //Stores all LOWER body part bleeding sources
145 static ref array<string> m_BleedingSourcesUp; //Stores all UPPER body part bleeding sources EXCLUDING HEAD
146 float m_UnconRefillModifier = 1;
148 int m_AntibioticsActive;//ref count for antibiotics activation
149
150 // CONTAMINATED AREA RELATED
152 const string CONTAMINATED_AREA_AMBIENT = "ContaminatedArea_SoundSet";//obsolete, use EffectTrigger::GetAmbientSoundsetName() instead
155 protected int m_EffectAreaCount;
156 protected bool m_InsideEffectArea;
159
160 static ref array<Man> m_ServerPlayers = new array<Man>;
162
163 protected string m_CachedPlayerName;//cached from player identity
164 protected string m_CachedPlayerID;//cached from player identity
165
166
167#ifdef DIAG_DEVELOPER
169 bool m_CanBeTargetedDebug; //server-side only
171 bool m_PresetSpawned;
173#endif
174
175#ifdef DEVELOPER
177#endif
178
179#ifdef BOT
180 ref Bot m_Bot;
181#endif
182
183 //Temp QuickBar load
185
186 //hologram
189 vector m_LocalProjectionPosition = "0 0 0 ";
190 vector m_LocalProjectionOrientation = "0 0 0 ";
191
192 //Sheduler
193 float m_LastTick = -1;
194 int m_AddModifier = -1;
195 //crafting start
196 int m_RecipeID = -1;
203 //crafting end
208 //input control
210
211 //Action data for base building actions
213 //Action data for fireplace (indoor)
217
219 bool m_IsFighting = false;
220 bool m_IsDrowning;//Set only via the setter SetDrowning
221
222 // debug monitor
224
225 //map
228 bool m_MapCloseRequestProcessed; //DEPRECATED
229 protected bool m_MapClosingSyncSent;
230 protected float m_LastMapScale = -1.0;
233
234 //inventory soft locking
235 protected bool m_InventorySoftLocked; //obsolete, count should be checked instead. Left in here for legacy's sake.
236 protected int m_InventorySoftLockCount = 0;
238
239 //Analytics
242
244 protected bool m_MeleeDebug;
245 //protected bool m_CheckMeleeItem;
247
249 protected string m_UALastMessage;
251
252 bool m_WorkingNVGHeadset; //Deprecated
255 //bool m_PreviousNVGState;
258 PluginAdminLog m_AdminLog;
260
263
269 protected PlayerStat<int> m_StatWet
275
280
281 //postprocess processing
284
286 {
287 Init();
288 }
289
290 void Init()
291 {
292 SetEventMask(EntityEvent.INIT | EntityEvent.POSTFRAME | EntityEvent.FRAME);
293 m_StoreLoadVersion = 0;
294 m_IsCraftingReady = false;
295 m_Recipes = new array<int>;
296 m_LastShavedSeconds = 0;
297 m_BloodType = 0;
298 m_HasBloodTypeVisible = false;
299 m_LifeSpanState = 0;
300 m_LifespanLevelLocal = -1;
301 m_CorpseState = 0;
302 m_CorpseStateLocal = 0;
303 m_HasBloodyHandsVisible = 0;
304 m_PlayerLoaded = false;
305 m_PlayerSelected = false;
306 m_ProcessUIWarning = false;
307 m_FlagRaisingTendency = true;
308 m_LiquidTendencyDrain = false;
309 m_UAParamMessage = new Param1<string>("");
310 m_UnconParam = new Param1<float>(0);
311 m_DeathDarkeningParam = new Param1<float>(0);
312 m_UAParam = new Param2<int, int>(0, 0);
313 m_UAProgressParam = new Param2<float, float>(0, 0);
314 m_QuickBarBase = new QuickBarBase(this);
315 m_QuickBarBonus = Math.Max(ConfigGetInt("quickBarBonus"), 0);
316 m_CargoLoad = 0;
317 m_VisibilityCoef = 1.0;
318 m_Hud = GetGame().GetMission().GetHud();
319 m_RecipePick = 0;
320 m_ActionQBControl = false;
321 m_QuickBarHold = false;
322 m_HideHairAnimated = true;
323 m_WorkingNVGHeadset = false;
324 m_LoweredNVGHeadset = false;
325 m_AreHandsLocked = false;
326 m_ItemsToDelete = new array<EntityAI>;
327 m_AnimCommandStarting = HumanMoveCommandID.None;
328 m_EmptyGloves = new HiddenSelectionsData(ConfigGetString("emptyGloves"));
329 m_CanDisplayHitEffectPPE = true;
330
331#ifdef DIAG_DEVELOPER
333 //RegisterNetSyncVariableBool("m_CanBeTargetedDebug");
334#endif
335
336 m_AnalyticsTimer = new Timer(CALL_CATEGORY_SYSTEM);
337
338 m_StaminaHandler = new StaminaHandler(this);//current stamina calculation
339 m_InjuryHandler = new InjuryAnimationHandler(this);
340 m_ShockHandler = new ShockHandler(this); //New shock handler
341 m_HCAnimHandler = new HeatComfortAnimHandler(this);
342 m_PlayerStats = new PlayerStats(this);//player stats
344
345 if (GetGame().IsServer())
346 {
347 m_PlayerStomach = new PlayerStomach(this);
348 m_NotifiersManager = new NotifiersManager(this); // player notifiers
349 m_AgentPool = new PlayerAgentPool(this); // agent pool manager
350 m_BleedingManagerServer = new BleedingSourcesManagerServer(this);
351 m_Environment = new Environment(this);//environment effects on player
352 m_ModifiersManager = new ModifiersManager(this); // player modifiers
353 m_PlayerSoundManagerServer = new PlayerSoundManagerServer(this);
354 m_VirtualHud = new VirtualHud(this);
355
356 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
357 }
358
359 m_SymptomManager = new SymptomManager(this); // state manager
360 m_ModuleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
361
362 m_TrasferValues = new TransferValues(this);
363 m_EmoteManager = new EmoteManager(this);
364 m_SoftSkillsManager = new SoftSkillsManager(this);//Soft Skills calculation
365
366 m_WeaponManager = new WeaponManager(this);
367 m_DebugMonitorValues = new DebugMonitorValues(this);
368 m_RGSManager = new RandomGeneratorSyncManager(this);
369
370 if (!GetGame().IsDedicatedServer())
371 {
372 m_MeleeDebug = false;
373 m_UALastMessage = "";
374 m_UALastMessageTimer = new Timer;
375 m_InventoryActionHandler = new InventoryActionHandler(this);
376 m_BleedingManagerRemote = new BleedingSourcesManagerRemote(this);
377 m_PlayerSoundManagerClient = new PlayerSoundManagerClient(this);
378 m_StanceIndicator = new StanceIndicator(this);
379 m_ActionsInitialize = false;
381
382 m_ProcessAddEffectWidgets = new array<int>;
383 m_ProcessRemoveEffectWidgets = new array<int>;
384 m_ActiveNVTypes = new array<int>;
385 m_ProcessAddGlassesEffects = new array<int>;
386 m_ProcessRemoveGlassesEffects = new array<int>;
387 }
388
389 m_ActionManager = NULL;
390 //m_PlayerLightManager = NULL;
391
392 m_ConfigEmotesProfile = PluginConfigEmotesProfile.Cast(GetPlugin(PluginConfigEmotesProfile));
393
394 if (GetDayZGame().IsDebug())
395 {
396 PluginConfigDebugProfileFixed m_ConfigDebugProfileFixed = PluginConfigDebugProfileFixed.Cast(GetPlugin(PluginConfigDebugProfileFixed));
398 PluginDeveloper m_Developer = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
399
400 PlayerBase player = this;
401
403 {
404 string default_preset = m_ConfigDebugProfile.GetDefaultPreset();
405 if (player && default_preset != "")
406 {
408 m_ConfigDebugProfileFixed.GetPresetItems(default_preset, preset_array);
409
410 bool is_preset_fixed = true;
411 if (preset_array.Count() == 0)
412 {
414 is_preset_fixed = false;
415 }
416
417 if (preset_array.Count() > 0)
418 {
419 m_Developer.ClearInventory(player);
420
421 for (int i = 0; i < preset_array.Count(); i++)
422 {
423 float health = -1;
424 int quantity = -1;
425 if (is_preset_fixed)
426 {
427 health = m_ConfigDebugProfileFixed.GetItemHealth(default_preset, i);
428 quantity = m_ConfigDebugProfileFixed.GetItemQuantity(default_preset, i);
429 }
430 else
431 {
433 quantity = m_ConfigDebugProfile.GetItemQuantity(default_preset, i);
434 }
435 m_Developer.SpawnEntityInPlayerInventory(player, preset_array.Get(i), health, quantity);
436 }
437 }
438 }
439 }
440 }
441
442 m_MapNavigationBehaviour = new MapNavigationBehaviour(this);
443
444 m_ModulePlayerStatus = PluginPlayerStatus.Cast(GetPlugin(PluginPlayerStatus));
445 m_ModuleLifespan = PluginLifespan.Cast(GetPlugin(PluginLifespan));
446
447 m_BleedingSourcesLow = new array<string>;
448 m_BleedingSourcesLow.Insert("RightToeBase");
449 m_BleedingSourcesLow.Insert("RightFoot");
450 m_BleedingSourcesLow.Insert("LeftToeBase");
451 m_BleedingSourcesLow.Insert("LeftFoot");
452 m_BleedingSourcesLow.Insert("RightUpLegRoll");
453 m_BleedingSourcesLow.Insert("RightUpLeg");
454 m_BleedingSourcesLow.Insert("RightLegRoll");
455 m_BleedingSourcesLow.Insert("RightLeg");
456 m_BleedingSourcesLow.Insert("LeftUpLegRoll");
457 m_BleedingSourcesLow.Insert("LeftUpLeg");
458 m_BleedingSourcesLow.Insert("LeftLegRoll");
459 m_BleedingSourcesLow.Insert("LeftLeg");
460
461 m_BleedingSourcesUp = new array<string>;
462 m_BleedingSourcesUp.Insert("RightForeArmRoll");
463 m_BleedingSourcesUp.Insert("LeftForeArmRoll");
464 m_BleedingSourcesUp.Insert("RightForeArm");
465 m_BleedingSourcesUp.Insert("RightArmRoll");
466 m_BleedingSourcesUp.Insert("RightArm");
467 m_BleedingSourcesUp.Insert("RightShoulder");
468 m_BleedingSourcesUp.Insert("LeftForeArm");
469 m_BleedingSourcesUp.Insert("LeftArmRoll");
470 m_BleedingSourcesUp.Insert("LeftArm");
471 m_BleedingSourcesUp.Insert("LeftShoulder");
472 m_BleedingSourcesUp.Insert("Spine3");
473 m_BleedingSourcesUp.Insert("Spine2");
474 m_BleedingSourcesUp.Insert("Spine1");
475 m_BleedingSourcesUp.Insert("Spine");
476 m_BleedingSourcesUp.Insert("Pelvis");
477 m_BleedingSourcesUp.Insert("Neck");
478
479 RegisterNetSyncVariableInt("m_LifeSpanState", LifeSpanState.BEARD_NONE, LifeSpanState.COUNT);
480 RegisterNetSyncVariableInt("m_BloodType", 0, 128);
481 RegisterNetSyncVariableInt("m_ShockSimplified", 0, SIMPLIFIED_SHOCK_CAP);
482 RegisterNetSyncVariableInt("m_SoundEvent", 0, EPlayerSoundEventID.ENUM_COUNT - 1);
483 RegisterNetSyncVariableInt("m_SoundEventParam", 0, ((EPlayerSoundEventParam.ENUM_COUNT - 1) * 2) - 1);
484 RegisterNetSyncVariableInt("m_StaminaState", 0, eStaminaState.COUNT - 1);
485 RegisterNetSyncVariableInt("m_BleedingBits");
486 RegisterNetSyncVariableInt("m_Shakes", 0, SHAKE_LEVEL_MAX);
487 RegisterNetSyncVariableInt("m_BreathVapour", 0, BREATH_VAPOUR_LEVEL_MAX);
488 RegisterNetSyncVariableInt("m_HealthLevel", eInjuryHandlerLevels.PRISTINE, eInjuryHandlerLevels.RUINED);
489 RegisterNetSyncVariableInt("m_MixedSoundStates", 0, eMixedSoundStates.COUNT - 1);
490 RegisterNetSyncVariableInt("m_CorpseState", -PlayerConstants.CORPSE_STATE_DECAYED, PlayerConstants.CORPSE_STATE_DECAYED); //do note the negative min, negative sign denotes a special meaning
491 RegisterNetSyncVariableInt("m_RefreshAnimStateIdx", 0, 3);
492 RegisterNetSyncVariableInt("m_BrokenLegState", -eBrokenLegs.BROKEN_LEGS_SPLINT, eBrokenLegs.BROKEN_LEGS_SPLINT);
493 RegisterNetSyncVariableInt("m_SyncedModifiers", 0, ((eModifierSyncIDs.LAST_INDEX - 1) * 2) - 1);
494 RegisterNetSyncVariableInt("m_HasBloodyHandsVisible", 0, eBloodyHandsTypes.LAST_INDEX - 1);
495 RegisterNetSyncVariableInt("m_ActionSoundCategoryHash");
496
497 RegisterNetSyncVariableBool("m_IsUnconscious");
498 RegisterNetSyncVariableBool("m_IsRestrained");
499 RegisterNetSyncVariableBool("m_IsInWater");
500 RegisterNetSyncVariableBool("m_InsideEffectArea");
501
502 RegisterNetSyncVariableBool("m_HasBloodTypeVisible");
503 //RegisterNetSyncVariableBool("m_LiquidTendencyDrain");
504 RegisterNetSyncVariableBool("m_IsRestrainStarted");
505 RegisterNetSyncVariableBool("m_IsRestrainPrelocked");
506 RegisterNetSyncVariableBool("m_HasHeatBuffer");
507
508 RegisterNetSyncVariableFloat("m_CurrentShock"); //Register shock synchronized variable
509
510 m_OriginalSlidePoseAngle = GetSlidePoseAngle();
511
513 m_DefaultHitPosition = SetDefaultHitPosition(GetDayZPlayerType().GetDefaultHitPositionComponent());
514
515 m_DecayedTexture = ConfigGetString("decayedTexture");
516 m_FliesIndex = -1;
517 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Call(this.OnPlayerLoaded);
518 }
519
521 {
522 m_AntibioticsActive++;
523 }
524
526 {
527 m_AntibioticsActive--;
528 if (m_AntibioticsActive < 0)
529 {
530 m_AntibioticsActive = 0;
531 Error("DecreaseAntibioticsCount called more times than IncreaseAntibioticsCount (should be equal) - check your code, forcing clamp to 0");
532 }
533 }
534
536 {
537 return (m_AntibioticsActive > 0);
538 }
539
541 {
542 m_ActionSoundCategoryHash = hash;
543 SetSynchDirty();
544 }
545
546
548 {
549 //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)
550
551 if (!m_InsideEffectArea)
552 return;
553 bool allow = false;
554 if (!m_CurrentEffectTrigger)
555 allow = true;
556 else if (trigger == m_CurrentEffectTrigger && forceUpdate)
557 {
558 allow = true;
559 //Print("ON Enabling effect FORCED " + trigger);
560 }
561 else if (trigger.GetEffectsPriority() > m_CurrentEffectTrigger.GetEffectsPriority())
562 {
563 RemoveCurrentEffectTrigger();
564 allow = true;
565 }
566 if (allow)
567 {
568 /*
569 Print("--------------------------------------------------");
570 Print("ON Enabling effect " + trigger);
571 Print("------------> soundset " + soundset);
572 Print("--------------------------------------------------");
573 */
574 m_CurrentEffectTrigger = trigger;
575 SetContaminatedEffectEx(true, ppeIdx, aroundId, tinyId, soundset, partDynaUpdate, newBirthRate);
576 }
577 }
578
579
581 {
582 if (m_CurrentEffectTrigger)
583 {
584 /*
585 Print("--------------------------------------------------");
586 Print("OFF Disabling effect");
587 Print("--------------------------------------------------");
588 */
589 SetContaminatedEffectEx(false, m_CurrentEffectTrigger.m_PPERequester);
590 m_CurrentEffectTrigger = null;
591 }
592 }
593
595 {
596 if (m_ContaminatedAreaCount == 0)
597 OnContaminatedAreaEnterServer();
598 m_ContaminatedAreaCount++;
599 }
600
602 {
603 m_ContaminatedAreaCount--;
604 if (m_ContaminatedAreaCount <= 0)
605 {
606 m_ContaminatedAreaCount = 0;
607 OnContaminatedAreaExitServer();
608 }
609 }
611 {
612 if (m_EffectAreaCount == 0)
613 {
614 m_InsideEffectArea = true;
615 SetSynchDirty();
616 OnPlayerIsNowInsideEffectAreaBeginServer();
617 }
618 m_EffectAreaCount++;
619 }
620
622 {
623 m_EffectAreaCount--;
624 if (m_EffectAreaCount <= 0)
625 {
626 m_EffectAreaCount = 0;
627 m_InsideEffectArea = false;
628 SetSynchDirty();
629 OnPlayerIsNowInsideEffectAreaEndServer();
630 }
631 }
632
633
635 {
636 GetModifiersManager().ActivateModifier(eModifiers.MDF_AREAEXPOSURE);
637 //Print("Contaminated ENTERED <------------------------------------------------------------- FINAL");
638 }
639
641 {
642 GetModifiersManager().DeactivateModifier(eModifiers.MDF_AREAEXPOSURE);
643 //Print("Contaminated LEFT <------------------------------------------------------------- FINAL");
644 }
645
647 {
648 //Print("ANY EFFECT AREA ENTERED <------------------------------------------------------------- FINAL");
649 }
650
652 {
653 //Print("ANY EFFECT AREA LEFT <------------------------------------------------------------- FINAL");
654 }
655
657 {
658 //Print("ANY EFFECT AREA ENTERED CLIENT <------------------------------------------------------------- FINAL");
659 }
660
662 {
663 RemoveCurrentEffectTrigger();
664 //Print("ANY EFFECT AREA LEFT CLIENT <------------------------------------------------------------- FINAL");
665 }
666
669 {
671 EntityAI item_EAI = this.GetInventory().FindAttachment(slot_id);
673
674 if (item_EAI && !item_IB)
675 {
676 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() + "!";
677 Error(str);
678 return null;
679 }
680
681 return item_IB;
682 }
683
686 {
687 return GetItemOnSlot("Headgear");
688 }
689
690 override int GetQuickBarBonus()
691 {
692 return m_QuickBarBonus;
693 }
694
695 //--------------------------------------------------------------------------
696 // Inventory overrides
697 //--------------------------------------------------------------------------
699 {
700 if (GetInventory().HasInventoryReservation(item, null))
701 return false;
702
703 if (IsRestrained())
704 {
705 if (GetHumanInventory().GetEntityInHands() == item)
706 return false;
707 }
708
709 return true;
710 }
711
712 //--------------------------------------------------------------------------
713 // PLAYER DAMAGE EVENT HANDLING
714 //--------------------------------------------------------------------------
715
717 {
718 return m_BreathVapour;
719 }
720
721 // adds state to and syncs sound states variable which is used to generate sound client-side
723 {
725
726 eMixedSoundStates new_states = m_MixedSoundStates & bit_mask_remove;
727
728 if (new_states != m_MixedSoundStates)
729 {
730 m_MixedSoundStates = new_states;
731 SetSynchDirty();
732 }
733 }
734
735 // adds state to and syncs sound states variable which is used to generate sound client-side
737 {
738 eMixedSoundStates new_states = m_MixedSoundStates | state;
739
740 if (new_states != m_MixedSoundStates)
741 {
742 m_MixedSoundStates = new_states;
743 SetSynchDirty();
744 }
745 }
746
747 override bool IsPlayer()
748 {
749 return true;
750 }
751
753 {
754 return (m_BleedingBits != 0);
755 }
756
758 {
759 if (m_BleedingBits != bits)
760 {
761 if (m_BleedingBits == 0)
762 OnBleedingBegin();
763 else if (bits == 0)
764 OnBleedingEnd();
765 }
766 m_BleedingBits = bits;
767 SetSynchDirty();
768 }
769
771 {
772 return m_BleedingBits;
773 }
774
776 {
777 m_DiseaseCount++;
778 }
779
781 {
782 m_DiseaseCount--;
783 }
784
786 {
787 m_HealingsCount++;
788 }
789
791 {
792 m_HealingsCount--;
793 }
794
795
797 {
798 return m_HealingsCount;//0 for no healings, 1+ for healings, gets truncated to 1
799 }
800
802 {
803 return m_DiseaseCount;//0 for no disease, 1+ for disease, gets truncated to 1
804 }
805
806
808 {
809 return m_PulseType;
810 }
811
813 {
814 m_PulseType = pulse_type;
815 }
816
818 {
819 m_ProcessAddEffectWidgets.InsertArray(effects);
820 }
821
823 {
824 m_ProcessRemoveEffectWidgets.InsertArray(effects);
825 }
826
828 {
829 m_ProcessAddGlassesEffects.Insert(id);
830 }
831
833 {
834 m_ProcessRemoveGlassesEffects.Insert(id);
835 }
836
838 {
839 return m_DamageDealtEffect;
840 }
841
843 {
844 if (m_DamageDealtEffect)
845 delete m_DamageDealtEffect;
846
847 if (m_CanDisplayHitEffectPPE)
848 m_DamageDealtEffect = new DamageDealtEffect();
849 }
850
851 void SpawnDamageDealtEffect2(Param param1 = null, Param param2 = null)
852 {
853 if (m_EffectRadial)
854 delete m_EffectRadial;
855
856 m_EffectRadial = new EffectRadial(param1, param2);
857 }
858
860 {
861 return m_FlashbangEffect;
862 }
863
865 {
866 if (m_FlashbangEffect)
867 {
868 m_FlashbangEffect.Stop();
869 delete m_FlashbangEffect;
870 }
871
872 m_FlashbangEffect = new FlashbangEffect(player, visual);
873 }
874
876 {
877 return m_ShockDealtEffect;
878 }
879
881 {
882 if (m_ShockDealtEffect)
883 delete m_ShockDealtEffect;
884
885 m_ShockDealtEffect = new ShockDealtEffect(intensity_max);
886 }
887
888 override void EEKilled(Object killer)
889 {
890 //Print(Object.GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " event EEKilled, player has died at STS=" + GetSimulationTimeStamp());
891
892 if (m_AdminLog)
893 m_AdminLog.PlayerKilled(this, killer);
894
895 if (GetBleedingManagerServer())
896 delete GetBleedingManagerServer();
897
898 if (GetModifiersManager())
899 GetModifiersManager().DeactivateAllModifiers();
900
901 // kill character in database
902 if (GetHive())
903 GetHive().CharacterKill(this);
904
905 // disable voice communication
906 GetGame().EnableVoN(this, false);
907 if (!GetGame().IsDedicatedServer())
909 GetSymptomManager().OnPlayerKilled();
910
911 if (GetEconomyProfile() && !m_CorpseProcessing && m_CorpseState == 0 && GetGame().GetMission().InsertCorpse(this))
912 {
913 m_CorpseProcessing = true;
914 //Print("EEKilled - processing corpse");
915 }
916
917 if (GetGame().IsMultiplayer() && GetGame().IsServer())
918 {
919 if (GetGame().GetMission())
920 GetGame().GetMission().SyncRespawnModeInfo(GetIdentity());
921 }
922
923 super.EEKilled(killer);
924 }
925
927 {
929
930 if (m_AdminLog)
932
933 if (damageResult != null && damageResult.GetDamage(dmgZone, "Shock") > 0)
934 {
935 m_LastShockHitTime = GetGame().GetTime();
936
937 if (!IsUnconscious())
938 {
939 if (GetGame().ConfigIsExisting("cfgAmmo " + ammo + " unconRefillModifier"))
940 m_UnconRefillModifier = GetGame().ConfigGetInt("cfgAmmo " + ammo + " unconRefillModifier");
941 else
942 m_UnconRefillModifier = 1;
943 }
944 }
945
947 if (damageType == DT_EXPLOSION && ammo == "FlashGrenade_Ammo")
948 GetStaminaHandler().DepleteStamina(EStaminaModifiers.OVERALL_DRAIN);
949
950 //new bleeding computation
951 //---------------------------------------
952 if (damageResult != null && GetBleedingManagerServer())
953 {
954 float dmg = damageResult.GetDamage(dmgZone, "Blood");
955 GetBleedingManagerServer().ProcessHit(dmg, source, component, dmgZone, ammo, modelPos);
956 }
957 //---------------------------------------
958
959#ifdef DIAG_DEVELOPER
960 if (DiagMenu.GetBool(DiagMenuIDs.MELEE_DEBUG))
961 Print("EEHitBy() | " + GetDisplayName() + " hit by " + source.GetDisplayName() + " to " + dmgZone);
962
965 plugin_remote_server.OnDamageEvent(this, damageResult);
966#endif
967
968 if (GetGame().IsDebugMonitor())
969 m_DebugMonitorValues.SetLastDamage(source.GetDisplayName());
970
971 if (m_ActionManager)
972 m_ActionManager.Interrupt();
973
974 int transferShockToDamageCoef = g_Game.ConfigGetInt(string.Format("%1 %2 DamageApplied transferShockToDamage", CFG_AMMO, ammo));
976 {
977 //Print("PlayerBase | EEHitBy | nonlethal hit");
978 AddHealth("", "Health", -ConvertNonlethalDamage(damageResult.GetDamage(dmgZone, "Shock"), damageType));
979 if (dmgZone != "Head")
980 AddHealth(dmgZone, "Health", -damageResult.GetDamage(dmgZone, "Shock")); //Also deal damage to zone health, no dmg reduction
981 }
982
983 if (GetGame().IsServer())
984 {
985 if (GetHealth("RightLeg", "Health") <= 1 || GetHealth("LeftLeg", "Health") <= 1 || GetHealth("RightFoot", "Health") <= 1 || GetHealth("LeftFoot", "Health") <= 1)
986 {
987 if (GetModifiersManager().IsModifierActive(eModifiers.MDF_BROKEN_LEGS))//effectively resets the modifier
988 GetModifiersManager().DeactivateModifier(eModifiers.MDF_BROKEN_LEGS);
989 GetModifiersManager().ActivateModifier(eModifiers.MDF_BROKEN_LEGS);
990 }
991
992 if (ammo == "Bullet_CupidsBolt" && IsAlive())
993 {
994 DamageSystem.ResetAllZones(this);
995 m_ModifiersManager.ResetAll();
996 m_ModifiersManager.ActivateModifier(eModifiers.MDF_IMMUNITYBOOST);
997
998 // bleeding sources
999 if (m_BleedingManagerServer)
1000 m_BleedingManagerServer.RemoveAllSources();
1001
1002 // Stats
1003 if (GetPlayerStats())
1004 {
1005 int bloodType = GetStatBloodType().Get();
1006 float energyValue = GetStatEnergy().Get();
1007 float waterValue = GetStatWater().Get();
1008 float heatBuffer = GetStatHeatBuffer().Get();
1009 float heatComfort = GetStatHeatComfort().Get();
1010
1011 GetPlayerStats().ResetAllStats();
1012
1013 GetStatBloodType().Set(bloodType);
1014 GetStatWater().Set(waterValue);
1015 GetStatEnergy().Set(energyValue);
1016 GetStatHeatBuffer().Set(heatBuffer);
1017 GetStatHeatComfort().Set(heatComfort);
1018 }
1019
1020 // Agents
1021 if (m_AgentPool)
1022 m_AgentPool.RemoveAllAgents();
1023
1024 if (m_StaminaHandler)
1026
1027 // uncon
1028 if (IsUnconscious())
1030 }
1031 }
1032
1033 m_ShockHandler.CheckValue(true);
1034
1035 //analytics
1036 GetGame().GetAnalyticsServer().OnEntityHit(source, this);
1037 }
1038
1039 override void EEHitByRemote(int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos)
1040 {
1041 super.EEHitByRemote(damageType, source, component, dmgZone, ammo, modelPos);
1042
1043 if (m_MeleeFightLogic.IsInBlock())
1044 {
1045 EffectSound sound = SEffectManager.PlaySoundOnObject("BlockingAttack_SoundSet", this);
1046 sound.SetAutodestroy(true);
1047 }
1048 }
1049
1050 override void EEDelete(EntityAI parent)
1051 {
1052 SEffectManager.DestroyEffect(m_FliesEff);
1053 StopSoundSet(m_SoundFliesEffect);
1054
1055 if (GetArrowManager())
1056 GetArrowManager().ClearArrows();
1057 }
1058
1063
1068 {
1069 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
1070 {
1071 float shakeStrength = Math.InverseLerp(0, 500, hitData.m_InSpeed.Length());
1072 GetCurrentCamera().SpawnCameraShake(shakeStrength);
1073 OnPlayerRecievedHit();
1074 }
1075
1076 if (hitData.m_AmmoType == "Bullet_CupidsBolt")
1077 Ammo_CupidsBolt.PlayOnHitParticle(hitData.m_Position);
1078
1079 //ParticleManager.GetInstance().PlayInWorld(ParticleList.BOLT_CUPID_HIT, hitData.m_Position);
1080 }
1081
1082 // DEPRECATED by method above
1083 override void OnPlayerRecievedHit()
1084 {
1085#ifndef NO_GUI
1086 if (m_MeleeFightLogic.IsInBlock())
1087 {
1088 EffectSound sound = SEffectManager.PlaySoundOnObject("BlockingAttack_SoundSet", this);
1089 sound.SetAutodestroy(true);
1090 return;
1091 }
1092
1093 SpawnDamageDealtEffect();
1096 SpawnDamageDealtEffect2(CachedObjectsParams.PARAM2_FLOAT_FLOAT);
1097
1098 CloseMapEx(true);
1099#endif
1100 }
1101
1103 {
1104 SpawnFlashbangEffect(this, visual);
1105 }
1106
1108
1109 //--------------------------------------------------------------------------
1111 //--------------------------------------------------------------------------
1112
1114 override string GetHitComponentForAI()
1115 {
1116 return GetDayZPlayerType().GetHitComponentForAI();
1117 }
1118
1120 override string GetDefaultHitComponent()
1121 {
1122 return GetDayZPlayerType().GetDefaultHitComponent();
1123 }
1124
1126 {
1127 return m_DefaultHitPosition;
1128 }
1129
1132 {
1133 return GetDayZPlayerType().GetSuitableFinisherHitComponents();
1134 }
1135
1137 {
1138 return GetSelectionPositionMS(pSelection);
1139 }
1140
1141 //--------------------------------------------------------------------------
1144 {
1145 m_FaceCoveredForShaveLayers++;
1146 }
1149 {
1150 m_FaceCoveredForShaveLayers--;
1151 }
1152 //--------------------------------------------------------------------------
1153 override void EEItemAttached(EntityAI item, string slot_name)
1154 {
1155 super.EEItemAttached(item, slot_name);
1156
1157 ItemBase itemIB = ItemBase.Cast(item);
1158 SwitchItemSelectionTexture(item, slot_name);
1160 item.SwitchItemSelectionTextureEx(EItemManipulationContext.ATTACHING, p);
1161 m_QuickBarBase.updateSlotsCount();
1162 CalculateVisibilityForAI();
1163 UpdateShoulderProxyVisibility(item, slot_name);
1164
1165 HideHairSelections(itemIB, true);
1166
1167 GetGame().GetAnalyticsClient().OnItemAttachedAtPlayer(item, slot_name);
1169 if (clothing)
1170 {
1171 if (!GetGame().IsDedicatedServer())
1172 {
1173 if (clothing.GetEffectWidgetTypes())
1174 QueueAddEffectWidget(clothing.GetEffectWidgetTypes());
1175
1176 if (clothing.GetGlassesEffectID() > -1)
1177 QueueAddGlassesEffect(clothing.GetGlassesEffectID());
1178
1179 GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(UpdateCorpseStateVisual, 200, false);//sometimes it takes a while to load in
1180 UpdateCorpseStateVisual();//....but if possible, we don't want a delay
1181 }
1182 else if (GetGame().IsServer())
1183 {
1184 if (clothing.IsGasMask())
1185 GetModifiersManager().ActivateModifier(eModifiers.MDF_MASK);
1186 }
1187
1188 clothing.UpdateNVGStatus(this, true);
1189 }
1190
1191 AdjustBandana(item, slot_name);
1192 }
1193
1194 override void EEItemDetached(EntityAI item, string slot_name)
1195 {
1196 super.EEItemDetached(item, slot_name);
1198 SwitchItemSelectionTexture(item, slot_name);
1199 item.SwitchItemSelectionTextureEx(EItemManipulationContext.DETACHING);
1200 m_QuickBarBase.updateSlotsCount();
1201 CalculateVisibilityForAI();
1202
1203 HideHairSelections(item_base, false);
1204
1206
1207 if (clothing)
1208 {
1209 if (!GetGame().IsDedicatedServer())
1210 {
1211 if (clothing.GetEffectWidgetTypes())
1212 QueueRemoveEffectWidget(clothing.GetEffectWidgetTypes());
1213
1214 if (clothing.GetGlassesEffectID() > -1)
1215 QueueRemoveGlassesEffect(clothing.GetGlassesEffectID());
1216 }
1217
1218 if (GetGame().IsServer())
1219 {
1220 if (clothing.IsGasMask())
1221 GetModifiersManager().DeactivateModifier(eModifiers.MDF_MASK);
1222 }
1223
1224 clothing.UpdateNVGStatus(this);
1225 GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(UpdateCorpseStateVisual, 200, false);//sometimes it takes a while to load in
1226 UpdateCorpseStateVisual();//....but if possible, we don't want a delay
1227 }
1228 }
1229
1231 {
1232 //Print("SwitchItemTypeAttach: " + item.GetType());
1233 if (!GetGame().IsServer())
1234 return;
1235
1236 /*InventoryLocation invloc = new InventoryLocation;
1237
1238 item.GetInventory().GetCurrentInventoryLocation(invloc);
1239 //Print(invloc.DumpToString());
1240 if (item.ConfigIsExisting("ChangeIntoOnAttach") && invloc.GetType() != InventoryLocationType.UNKNOWN)
1241 {
1242 string str = item.ChangeIntoOnAttach(slot);
1243 if (str != "")
1244 {
1245 string typestr = item.GetType();
1246 MiscGameplayFunctions.TurnItemIntoItem(ItemBase.Cast(item), str, this);
1247 }
1248 }*/
1249 }
1250
1252 {
1253 //Print("SwitchItemTypeDetach: " + item.GetType());
1254 }
1255
1257 {
1258 string slot = slot_name;
1259 bool boo;
1260 boo = item.IsWeapon();
1261
1262 if (slot == "Melee")
1263 {
1264 SetSimpleHiddenSelectionState(SIMPLE_SELECTION_MELEE_RIFLE, boo);
1265 SetSimpleHiddenSelectionState(SIMPLE_SELECTION_MELEE_MELEE, !boo);
1266 }
1267 else if (slot == "Shoulder")
1268 {
1269 SetSimpleHiddenSelectionState(SIMPLE_SELECTION_SHOULDER_RIFLE, boo);
1270 SetSimpleHiddenSelectionState(SIMPLE_SELECTION_SHOULDER_MELEE, !boo);
1271 }
1272 }
1273
1275 {
1276 super.SwitchItemSelectionTexture(item, slot_name);
1277
1278 //shirt + armband
1279 EntityAI armband = FindAttachmentBySlotName("Armband");
1280 if (slot_name == "Body" && armband)
1281 {
1283 armband.SwitchItemSelectionTextureEx(EItemManipulationContext.UPDATE, p);
1284 }
1285 }
1286
1288 {
1290 ItemBase item;
1291 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER, itemsArray);
1292
1293 for (int i = 0; i < itemsArray.Count(); i++)
1294 {
1295 Class.CastTo(item, itemsArray.Get(i));
1296 if (item && !item.IsInherited(SurvivorBase)) GetInventory().LocalDestroyEntity(item);
1297 }
1298 }
1299
1301 {
1302 return m_CanDisplayHitEffectPPE;
1303 }
1304
1306 {
1307 m_CanDisplayHitEffectPPE = enabled;
1308 }
1309
1310 bool IsMale()
1311 {
1312 if (ConfigGetBool("woman") != 1)
1313 return true;
1314 return false;
1315 }
1316
1318 {
1319 int voice_type = ConfigGetInt("voiceType");
1320
1321 if (voice_type == 0)
1322 voice_type = 1;
1323
1324 return voice_type;
1325 }
1326
1328 {
1329 return m_PlayerSoundManagerServer;
1330 }
1331
1332
1334 {
1335 if (!m_UndergroundHandler && IsAlive())
1336 m_UndergroundHandler = new UndergroundHandlerClient(this);
1337
1338 return m_UndergroundHandler;
1339 }
1340
1342 {
1343 m_UndergroundHandler = null;
1344 }
1345 // --------------------------------------------------
1346 // User Actions
1347 //---------------------------------------------------
1375
1376 void SetActions() // Backwards compatibility, not recommended to use
1377 {
1378 }
1379
1388
1389 void SetActionsRemoteTarget() // Backwards compatibility, not recommended to use
1390 {
1391 }
1392
1394 {
1395 // Backwards compatibility
1396 if (IsControlledPlayer())
1397 {
1399 SetActions();
1400 }
1401 else
1402 {
1404 SetActionsRemoteTarget();
1405 }
1407
1408 m_InputActionMapControled = new TInputActionMap;
1409 SetActions(m_InputActionMapControled);
1410
1411 m_InputActionMapAsTarget = new TInputActionMap;
1412 SetActionsRemoteTarget(m_InputActionMapAsTarget);
1413 }
1414
1416 {
1418 {
1419 m_ActionsInitialize = true;
1421 }
1422
1423 // Backwards compatibility
1425 if (!bcActions)
1426 {
1427 if (IsControlledPlayer())
1428 actions = m_InputActionMapControled.Get(action_input_type);
1429 else
1430 actions = m_InputActionMapAsTarget.Get(action_input_type);
1431 }
1432 else
1433 {
1434 if (!actions)
1436
1437 if (IsControlledPlayer())
1438 actions.InsertAll(m_InputActionMapControled.Get(action_input_type));
1439 else
1440 actions.InsertAll(m_InputActionMapAsTarget.Get(action_input_type));
1441
1442 actions.InsertAll(bcActions);
1443 }
1444 }
1445
1447 {
1448 ActionBase action = GetActionManager().GetAction(actionName);
1449
1450 typename ai = action.GetInputType();
1451 if (!ai)
1452 {
1453 m_ActionsInitialize = false;
1454 return;
1455 }
1456
1458
1459 if (!action_array)
1460 {
1463 }
1464 action_array.Insert(action);
1465 }
1466
1467 void AddAction(typename actionName) // Backwards compatibility, not recommended to use
1468 {
1470 }
1471
1473 {
1474 ActionBase action = GetActionManager().GetAction(actionName);
1475 typename ai = action.GetInputType();
1477
1478 if (action_array)
1479 {
1480 for (int i = 0; i < action_array.Count(); i++)
1481 {
1482 if (action == action_array.Get(i))
1483 action_array.Remove(i);
1484 }
1487 }
1488 action_array.Insert(action);
1489 }
1490
1491 void RemoveAction(typename actionName) // Backwards compatibility, not recommended to use
1492 {
1494 }
1495
1497 {
1498 return m_RecipePick;
1499 }
1500
1502 {
1503 m_RecipePick++;
1504 }
1505
1507 {
1508 m_RecipePick = 0;
1509 }
1510
1511 //---------------------------------------------------
1512
1513
1514 ActionManagerBase GetActionManager()
1515 {
1516 return m_ActionManager;
1517 }
1518
1520 {
1521 return m_EmoteManager;
1522 }
1523
1525 {
1526 return m_RGSManager;
1527 }
1528
1531 {
1532 ProcessHandDamage(delta_time, pState);
1533 }
1534
1536 {
1537 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !GetGame().IsMultiplayer())
1538 {
1539 if (pState.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_SLIDE)
1540 {
1541 //Print("sliding down");
1542 EntityAI gloves = GetInventory().FindAttachment(InventorySlots.GLOVES);
1543
1544 if (gloves && gloves.GetHealthLevel() < 4)
1545 {
1547 return;
1548 }
1549
1551 {
1552 if (Math.RandomFloat01() < 0.5)
1553 {
1554 if (GetBleedingManagerServer().AttemptAddBleedingSourceBySelection("LeftForeArmRoll"))
1555 SendSoundEvent(EPlayerSoundEventID.INJURED_LIGHT);
1556 }
1557 else
1558 {
1559 if (GetBleedingManagerServer().AttemptAddBleedingSourceBySelection("RightForeArmRoll"))
1560 SendSoundEvent(EPlayerSoundEventID.INJURED_LIGHT);
1561 }
1562 }
1563
1564 }
1565 }
1566 }
1567
1569 {
1570 //InventorySlots.HEADGEAR
1571 EntityAI shoes = GetInventory().FindAttachment(InventorySlots.FEET);
1572
1573 string surface; int liquid;
1574 GetGame().SurfaceUnderObject(this, surface, liquid);
1575 float modifier_surface = Surface.GetParamFloat(surface, "footDamage");
1576
1577 if (shoes && shoes.GetHealthLevel() < 4)
1578 {
1580
1581 return;
1582 }
1583
1584 float rnd = Math.RandomFloat01();
1585 float modifier_movement = GetFeetDamageMoveModifier();
1587 if (rnd < chance)
1588 {
1589 if (pUserInt % 2 == 0)
1590 {
1591 if (GetBleedingManagerServer().AttemptAddBleedingSourceBySelection("RightFoot"))
1592 SendSoundEvent(EPlayerSoundEventID.INJURED_LIGHT);
1593
1594 }
1595 else
1596 {
1597 if (GetBleedingManagerServer().AttemptAddBleedingSourceBySelection("LeftFoot"))
1598 SendSoundEvent(EPlayerSoundEventID.INJURED_LIGHT);
1599 }
1600 }
1601 }
1602
1604 {
1605 float modifier;
1606 switch (m_MovementState.m_iMovement)
1607 {
1608 case DayZPlayerConstants.MOVEMENTIDX_SPRINT:
1609 modifier = 1;
1610 break
1611 case DayZPlayerConstants.MOVEMENTIDX_RUN:
1612 modifier = 0.5;
1613 break
1614 case DayZPlayerConstants.MOVEMENTIDX_WALK:
1615 modifier = 0;
1616 break
1617 }
1618 return modifier;
1619 }
1620
1621 void SetStamina(int value, int range)
1622 {
1624 m_ModulePlayerStatus.SetStamina(value, range);
1625 }
1626
1627#ifdef DIAG_DEVELOPER
1628 void SetStaminaDisabled(bool value)
1629 {
1630 if (m_StaminaHandler)
1631 m_StaminaHandler.SetStaminaDisabled(value);
1632 }
1633#endif
1634
1636 {
1637 m_AllowQuickRestrain = enable;
1638 }
1639
1641 {
1642 m_AllowQuickFishing = enable;
1643 }
1644
1646 {
1647 return m_AllowQuickRestrain;
1648 }
1649
1651 {
1652 return m_AllowQuickFishing;
1653 }
1654
1656 {
1657 return m_PlayerStats;
1658 }
1659
1661 {
1662 return m_CraftingManager;
1663 }
1664
1669
1671 {
1672 return m_WeaponManager;
1673 }
1674
1676 {
1677 return m_ArrowManager;
1678 }
1679
1681 {
1682 if (IsInVehicle() || IsRaised() || IsSwimming() || IsClimbing() || IsClimbingLadder() || IsRestrained() || !GetWeaponManager() || GetWeaponManager().IsRunning() || !GetActionManager() || GetActionManager().GetRunningAction() != null || IsMapOpen())
1683 return false;
1684 if (GetThrowing() && GetThrowing().IsThrowingModeEnabled())
1685 return false;
1686 return true;
1687 }
1688
1690 {
1691 m_IsRestrainStarted = restrain_started;
1692 SetSynchDirty();
1693 }
1694
1696 {
1697 return m_IsRestrainStarted;
1698 }
1699
1701 {
1702 m_IsRestrainPrelocked = restrain_prelock;
1703 SetSynchDirty();
1704 }
1705
1707 {
1708 return m_IsRestrainPrelocked;
1709 }
1710
1712 {
1713 m_IsRestrained = is_restrained;
1714 SetSynchDirty();
1715 }
1716
1717 override bool IsRestrained()
1718 {
1719 return m_IsRestrained;
1720 }
1721
1722 override bool IsInventoryVisible()
1723 {
1724 return true;
1725 }
1726
1728 {
1729 if (IsControlledPlayer())
1730 return !IsRestrained() && !IsRestrainPrelocked();
1731 return true;
1732 }
1733
1735 {
1736 return super.CanReleaseAttachment(attachment);
1737 }
1738
1740 {
1741 return super.CanReleaseCargo(cargo);
1742 }
1743
1745 {
1746 return super.CanReceiveItemIntoCargo(item);
1747 }
1748
1750 {
1751 return super.CanSwapItemInCargo(child_entity, new_entity);
1752 }
1753
1755 {
1756 if (IsInVehicle())
1757 return false;
1758
1759 if (!CanPickupHeavyItem(item_to_hands))
1760 return false;
1761
1762 return super.CanReceiveItemIntoHands(item_to_hands);
1763 }
1764
1766 {
1767 return super.CanSaveItemInHands(item_in_hands);
1768 }
1769
1771 {
1772 return super.CanReleaseFromHands(handheld);
1773 }
1774
1776 {
1777 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
1778 return GetCraftingManager().GetRecipeID();
1779 else
1780 return m_RecipeID;
1781 }
1782
1784 {
1785 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
1786 GetCraftingManager().SetRecipeID(recipeID);
1787 else
1789 }
1790
1791 // --------------------------------------------------
1792 // Action data for base building actions
1793 //---------------------------------------------------
1795 {
1796 return m_ConstructionActionData;
1797 }
1798
1800 {
1801 if (m_ConstructionActionData)
1802 m_ConstructionActionData.ResetActionIndexes();
1803 }
1804
1805 // --------------------------------------------------
1806 // Action data for fireplace (indoor)
1807 //---------------------------------------------------
1809 {
1810 return m_LastFirePoint;
1811 }
1813 {
1814 return m_LastFirePointRot;
1815 }
1817 {
1818 return m_LastFirePointIndex;
1819 }
1820
1822 {
1823 m_LastFirePoint = last_fire_point;
1824 }
1826 {
1827 m_LastFirePointRot = last_fire_point_rot;
1828 }
1830 {
1831 m_LastFirePointIndex = last_fire_point_index;
1832 }
1833
1834 // --------------------------------------------------
1835 // QuickBar
1836 //---------------------------------------------------
1837
1839 {
1840 int index = m_QuickBarBase.FindEntityIndex(entity);
1841 if (index != -1)
1842 m_QuickBarBase.SetEntityShortcut(entity, -1);
1843 }
1844 //---------------------------------------------------
1846 {
1847 int index = m_QuickBarBase.FindEntityIndex(entity);
1848 if (index != -1)
1849 m_QuickBarBase.SetShotcutEnable(index, value);
1850
1851 }
1852 //---------------------------------------------------
1854 {
1855 int index;
1856 index = m_QuickBarBase.FindEntityIndex(entity);
1857
1858 if (m_QuickBarBase.GetEntity(index) == NULL)
1859 return -1;
1860
1861 return index;
1862 }
1863 //---------------------------------------------------
1864
1866 {
1867 return m_QuickBarBase.GetSize();
1868 }
1869 //---------------------------------------------------
1871 {
1872 return m_QuickBarBase.GetEntity(index);
1873 }
1874 //---------------------------------------------------
1876 {
1877 int i = FindQuickBarEntityIndex(entity);
1878 if (i >= 0)
1879 m_QuickBarBase.UpdateShotcutVisibility(i);
1880 }
1881 //---------------------------------------------------
1883 {
1884 m_QuickBarBase.SetEntityShortcut(entity, index, force);
1885 }
1886 //---------------------------------------------------
1888 {
1889 m_QuickBarBase.OnSetEntityRequest(ctx);
1890 }
1891 //---------------------------------------------------
1892
1893 // Applies splint on all limbs.
1895 {
1896 float add_health_coef = 0.33;
1897 // 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.
1898 if (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
1899 {
1900 AddHealth("LeftLeg", "Health", (GetMaxHealth("LeftLeg", "Health") - GetHealth("LeftLeg", "Health")) * add_health_coef);
1901 AddHealth("RightLeg", "Health", (GetMaxHealth("RightLeg", "Health") - GetHealth("RightLeg", "Health")) * add_health_coef);
1902 AddHealth("RightFoot", "Health", (GetMaxHealth("RightFoot", "Health") - GetHealth("RightFoot", "Health")) * add_health_coef);
1903 AddHealth("LeftFoot", "Health", (GetMaxHealth("LeftFoot", "Health") - GetHealth("LeftFoot", "Health")) * add_health_coef);
1904 }
1905 }
1906
1908 {
1909 GetStaminaHandler().DepleteStamina(EStaminaModifiers.DROWN, dT);
1910
1911#ifndef SERVER
1912 //PP EFFECTS
1914 req.SetStamina01(GetStaminaHandler().GetStaminaNormalized());
1915#endif
1916 }
1917
1919 {
1920 if (!GetDrowningWaterLevelCheck())
1921 return;
1923 int boneIdx = GetBoneIndexByName("Head");
1924
1925 if (boneIdx != -1)
1926 {
1927 Particle p = ParticleManager.GetInstance().PlayInWorld(ParticleList.DROWNING_BUBBLES, "-0.03 0.15 0");
1928 if (p)
1929 AddChild(p, boneIdx);
1930 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(SpawnDrowningBubbles, bubbleFrequency);
1931 }
1932 }
1933
1935 {
1936 if (IsTryingHoldBreath() && CanStartConsumingStamina(EStaminaConsumers.HOLD_BREATH))
1937 {
1938 if (!m_IsHoldingBreath)
1939 {
1940 OnHoldBreathStart();
1941 m_IsHoldingBreath = true;
1942 }
1943 }
1944 else if (!IsTryingHoldBreath() || !CanConsumeStamina(EStaminaConsumers.HOLD_BREATH))
1945 {
1946 if (m_IsHoldingBreath) OnHoldBreathEnd();
1947 m_IsHoldingBreath = false;
1948 }
1949 }
1950
1952 {
1953 //SendSoundEvent(SoundSetMap.GetSoundSetID("holdBreath_male_Char_SoundSet"));
1954 RequestSoundEventEx(EPlayerSoundEventID.HOLD_BREATH, true, EPlayerSoundEventParam.SKIP_CONTROLLED_PLAYER);
1955 }
1956
1958 {
1959 RequestSoundEventEx(EPlayerSoundEventID.EXHAUSTED_BREATH, true, EPlayerSoundEventParam.SKIP_CONTROLLED_PLAYER);
1960 }
1961
1963 {
1964 //SendSoundEvent(SoundSetMap.GetSoundSetID("releaseBreath_male_Char_SoundSet"));
1965 RequestSoundEventEx(EPlayerSoundEventID.RELEASE_BREATH, true, EPlayerSoundEventParam.SKIP_CONTROLLED_PLAYER);
1966 }
1967
1968 override bool IsHoldingBreath()
1969 {
1970 return m_IsHoldingBreath;
1971 }
1972
1974 {
1975 return false;
1976 }
1977
1979 {
1980 return m_MixedSoundStates;
1981 }
1982
1984 {
1985 if (m_SaySoundLastSetName != name)
1986 {
1987 m_SaySoundParams = new SoundParams(name);
1988 m_SaySoundBuilder = new SoundObjectBuilder(m_SaySoundParams);
1989
1990 m_SaySoundLastSetName = name;
1991 }
1992
1993 m_SaySoundObject = m_SaySoundBuilder.BuildSoundObject();
1994 m_SaySoundObject.SetPosition(GetPosition());
1995 return GetGame().GetSoundScene().Play3D(m_SaySoundObject, m_SaySoundBuilder);
1996 }
1997
1999 {
2001 string item_name;
2002 int attcount = this.GetInventory().AttachmentCount();
2003
2004 for (int att = 0; att < attcount; att++)
2005 {
2006 attachment = GetInventory().GetAttachmentFromIndex(att);
2007 if (attachment.IsItemBase())
2008 {
2009 item_name = attachment.GetType();
2010 if (GetGame().IsKindOf(item_name, searched_item))
2011 return attachment;
2012 }
2013 }
2014 return NULL;
2015 }
2016
2018 {
2019 if (GetGame().IsDebug())
2020 {
2021 if (!GetGame().IsMultiplayer() && GetGame().GetPlayer() && GetGame().GetPlayer().GetID() == this.GetID())
2022 {
2023 PluginSceneManager scene_editor = PluginSceneManager.Cast(GetPlugin(PluginSceneManager));
2024 scene_editor.InitLoad();
2025 }
2026 }
2027 }
2028
2029 //---------------------------------------------------------------------------------------------------------------------------
2031 {
2032 InitEditor();
2033
2034 if (GetGame().IsMultiplayer() || GetGame().IsServer())
2035 {
2036 if (m_ModuleLifespan)
2037 m_ModuleLifespan.SynchLifespanVisual(this, m_LifeSpanState, m_HasBloodyHandsVisible, m_HasBloodTypeVisible, m_BloodType);
2038 }
2039
2040 if (IsControlledPlayer())//true only on client for the controlled character
2041 {
2042 if (!m_VirtualHud)
2043 m_VirtualHud = new VirtualHud(this);
2044 if (m_Hud)
2045 {
2047 PPERequesterBank.GetRequester(PPERequester_DeathDarkening).Stop();
2049 PPERequesterBank.GetRequester(PPERequester_UnconEffects).Stop(); //TODO - stop en mass...check if effects do not terminate (spawning inside of contaminated area)?!
2050 GetGame().GetUIManager().CloseAll();
2051 GetGame().GetMission().SetPlayerRespawning(false);
2052 GetGame().GetMission().OnPlayerRespawned(this);
2053
2054 m_Hud.ShowHudUI(true);
2055 m_Hud.ShowQuickbarUI(true);
2057 }
2058 m_EffectWidgets = GetGame().GetMission().GetEffectWidgets();
2059 }
2060 if (!GetGame().IsDedicatedServer())
2061 {
2062 GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(UpdateCorpseStateVisual, 2000, false);//sometimes it takes a while to load in
2063 m_PlayerSoundEventHandler = new PlayerSoundEventHandler(this);
2064 }
2066 m_CharactersHead = Head_Default.Cast(GetInventory().FindPlaceholderForSlot(slot_id));
2067 CheckHairClippingOnCharacterLoad();
2068 UpdateHairSelectionVisibility();
2069 PreloadDecayTexture();
2070
2071 Weapon_Base wpn = Weapon_Base.Cast(GetItemInHands());
2072 if (wpn)
2073 wpn.ValidateAndRepair();
2074 /*
2075 PreloadDecayTexture();
2076 UpdateCorpseStateVisual();
2077 */
2078 m_PlayerLoaded = true;
2079
2080 //Print("PlayerBase | OnPlayerLoaded()");
2081
2082 }
2083
2085 {
2086 m_PlayerDisconnectProcessed = state;
2087 }
2088
2090 {
2091 return m_PlayerDisconnectProcessed;
2092 }
2093
2094 // --------------------------------------------------
2095 // Advanced placement
2096 //---------------------------------------------------
2097
2098 //get hologram
2100 {
2101 return m_HologramServer;
2102 }
2103
2105 {
2106 return m_HologramLocal;
2107 }
2108
2110 {
2111 if (item)
2112 {
2113 m_HologramServer = new Hologram(this, GetLocalProjectionPosition(), item);
2114 GetHologramServer().SetProjectionPosition(GetLocalProjectionPosition());
2115 GetHologramServer().SetProjectionOrientation(GetLocalProjectionOrientation());
2116 GetHologramServer().GetProjectionEntity().OnPlacementStarted(this);
2117 GetHologramServer().CheckPowerSource();
2118 GetHologramServer().RefreshVisual();
2119 }
2120 }
2121
2123 {
2124 if (GetGame().IsMultiplayer() && GetGame().IsServer())
2125 return;
2126
2127 if (item)
2128 {
2129 m_HologramLocal = new Hologram(this, GetLocalProjectionPosition(), item);
2130 GetHologramLocal().GetProjectionEntity().OnPlacementStarted(this);
2131 }
2132 }
2133
2135 {
2136 EntityAI entityInHands = GetHumanInventory().GetEntityInHands();
2137
2138 if (IsPlacingServer())
2139 {
2140 GetHologramServer().CheckPowerSource();
2141 GetHologramServer().GetParentEntity().OnPlacementCancelled(this);
2142 SetLocalProjectionPosition(vector.Zero);
2143
2144 delete m_HologramServer;
2145
2146 return;
2147 }
2148 else if (entityInHands && entityInHands.HasEnergyManager())
2149 {
2150 if (entityInHands.GetCompEM().IsPlugged())
2151 entityInHands.OnPlacementCancelled(this);
2152 }
2153 }
2154
2155 //Called when item placement is canceled, will prevent quickbar usage until the item the player was placing is back in hands
2157 {
2158 m_AreHandsLocked = true;
2159 }
2160
2162 {
2163 EntityAI entityInHands = GetHumanInventory().GetEntityInHands();
2164 if (entityInHands && entityInHands.HasEnergyManager())
2165 {
2166 if (entityInHands.GetCompEM().IsPlugged())
2167 entityInHands.OnPlacementCancelled(this);
2168 }
2169
2170 SetLocalProjectionPosition(vector.Zero);
2171
2172 delete m_HologramLocal;
2173 }
2174
2176 {
2177 SetLocalProjectionPosition(vector.Zero);
2178 delete m_HologramServer;
2179 }
2180
2182 {
2183 SetLocalProjectionPosition(vector.Zero);
2184 delete m_HologramLocal;
2185 }
2186
2188 {
2189 if (m_HologramServer)
2190 return true;
2191
2192 return false;
2193 }
2194
2196 {
2197 if (m_HologramLocal)
2198 return true;
2199
2200 return false;
2201 }
2202
2204 {
2205 if (enable != m_IsDrowning)
2206 {
2207 if (enable)
2208 OnDrowningStart();
2209 else
2210 OnDrowningEnd();
2211 }
2212
2213 m_IsDrowning = enable;
2214 }
2215
2217 {
2218#ifndef SERVER
2219 if (IsControlledPlayer())
2220 {
2222 req.Start();
2223 }
2224 //Particles
2225 SpawnDrowningBubbles();
2226#endif
2227 }
2228
2230 {
2231#ifndef SERVER
2232 if (IsControlledPlayer())
2233 {
2235 req.Stop();
2236 }
2237 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(SpawnDrowningBubbles);
2238#endif
2239 }
2240
2242 {
2244 {
2245 PlacingCancelServer();
2246 return true;
2247 }
2248
2249 return false;
2250 }
2251
2253 {
2254 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT && GetGame().IsMultiplayer())
2255 {
2257 {
2259 ctx.Write(INPUT_UDT_RESET_ADS);
2260 ctx.Send();
2261 }
2262 }
2263 else if (!GetGame().IsMultiplayer())
2264 m_ResetADS = true;
2265 }
2266
2269 {
2271 {
2274 return true;
2275 }
2276
2277 return false;
2278 }
2279
2281 {
2282 if (m_UndergroundPresence > EUndergroundPresence.NONE)
2283 {
2285 foreach (string t: disallowedUndergroundTypes)
2286 {
2287 if (item.IsKindOf(t))
2288 return false;
2289 }
2290 }
2291 return true;
2292 }
2293
2295 {
2296 m_UndergroundPresence = presence;
2297 }
2298
2300 {
2301 if (IsPlacingLocal())
2302 {
2303 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT && GetGame().IsMultiplayer())
2304 {
2306 {
2309 ctx.Send();
2310 }
2311 }
2312 PlacingCancelLocal();
2313 }
2314 else if (!item)
2315 PlacingStartLocal(GetItemInHands());
2316 else
2317 PlacingStartLocal(item);
2318 }
2319
2321 {
2322 m_LocalProjectionPosition = local_position;
2323 }
2324
2326 {
2327 m_LocalProjectionOrientation = local_orientation;
2328 }
2329
2331 {
2332 return m_LocalProjectionPosition;
2333 }
2334
2336 {
2337 return m_LocalProjectionOrientation;
2338 }
2339
2342
2343 // ------------------------------------------------------------------------
2344
2347 {
2348 m_IsInWater = pState;
2349 SetSynchDirty();
2350 }
2351
2353 {
2354 return m_IsInWater;
2355 }
2356
2357 // -------------------------------------------------------------------------
2359 {
2360 if (GetGame() && (!GetGame().IsDedicatedServer()))
2361 {
2363 SetContaminatedEffectEx(false);
2364 }
2365
2366 SEffectManager.DestroyEffect(m_FliesEff);
2367 StopSoundSet(m_SoundFliesEffect);
2368 }
2369
2371 {
2372 m_CameraSwayModifier = new_camera.GetWeaponSwayModifier();
2373 m_CurrentCamera = new_camera;
2374 }
2375
2377 {
2378 return m_CurrentCamera;
2379 }
2380
2382 {
2383 if (!m_CurrentCamera)
2384 return false;
2385
2386 return m_CurrentCamera.GetCurrentPitch() < PlayerConstants.CAMERA_THRESHOLD_PITCH;
2387 }
2388
2390 {
2391 return m_BleedingManagerServer;
2392 }
2393
2395 {
2396 return m_BleedingManagerRemote;
2397 }
2398
2400 {
2401 return m_SymptomManager;
2402 }
2404 {
2405 if (!m_VirtualHud)
2406 m_VirtualHud = new VirtualHud(this);
2407 return m_VirtualHud;
2408 }
2409
2410 TransferValues GetTransferValues()
2411 {
2412 return m_TrasferValues;
2413 }
2414
2416 {
2417 return m_DebugMonitorValues;
2418 }
2419
2420 // -------------------------------------------------------------------------
2421 /*bool IsCraftingSetUp()
2422 {
2423 return m_IsCraftingReady;
2424 }*/
2425 // -------------------------------------------------------------------------
2426 /*void PerformRecipe()
2427 {*/
2428 /*
2429 Debug.Log("Ingredient1: "+ToString(m_Item1.Ptr().GetType()),"recipes");
2430 Debug.Log("Ingredient2: "+ToString(m_Item2.Ptr().GetType()),"recipes");
2431 */
2432 /*int id = GetCraftingMeta().GetRecipeID();
2433 ItemBase item1 = GetCraftingMeta().GetIngredient1();
2434 ItemBase item2 = GetCraftingMeta().GetIngredient2();
2435
2436 Debug.Log("PerformRecipe called on player: "+ string.ToString(this),"recipes");
2437
2438 if (m_ModuleRecipesManager)
2439 {
2440 if (!item1 || !item2)
2441 {
2442 Debug.Log("PerformRecipe: At least one of the object links is now null, not performing the recipe","recipes");
2443 }
2444 else
2445 {
2446
2447 m_ModuleRecipesManager.PerformRecipeServer(id, item1,item2,this);
2448 }
2449 RequestCraftingDisable();
2450 }
2451 }*/
2452 // -------------------------------------------------------------------------
2453 /*float GetCraftingSetUpDistance()
2454 {
2455 return Math.AbsFloat(vector.Distance(GetCraftingMeta().GetInitPos(), GetPosition()));
2456 }*/
2457 // -------------------------------------------------------------------------
2458
2459 /*void RequestCraftingSetup(int id, EntityAI item1, EntityAI item2, int craft_type)
2460 {
2461 if (!GetGame().IsDedicatedServer())
2462 {
2463 SetUpCraftingClient(id,item1,item2,craft_type);
2464 SendCraftingMeta();
2465 }
2466
2467 }*/
2468
2469 /*void RequestCraftingDisable()
2470 {
2471 if (GetGame().IsServer())
2472 {
2473 SendDisableRequestToClient();
2474 DisableCrafting();
2475 }
2476
2477 }*/
2478
2479 /*private void SendDisableRequestToClient()
2480 {
2481 GetGame().RPCSingleParam(this, ERPCs.RPC_CRAFTING_DISABLE, NULL,this);
2482 }*/
2483
2484 /*private void OnReceiveDisableRequest()
2485 {
2486 DisableCrafting();
2487 }*/
2488
2489 /*private void SendCraftingMeta()
2490 {
2491 array<ref Param> params = new array<ref Param>;
2492 CraftingMeta cm = GetCraftingMeta();
2493 cm.SerializeValues(params);
2494 GetGame().RPC(this, ERPCs.RPC_CRAFTING_SETUP, params,this);
2495 }*/
2496
2497 /*private void OnReceiveCraftingMeta(ParamsReadContext ctx)
2498 {
2499 CreateCraftingMeta(0,NULL,NULL,"0 0 0", 0,0);
2500 GetCraftingMeta().DeserializeValuesCtx(ctx);
2501 SetUpCraftingServer();
2502
2503 }*/
2504 // -------------------------------------------------------------------------
2505 /*private void SetUpCraftingServer()
2506 {
2507 if (GetGame().IsMultiplayer() && GetGame().IsServer())
2508 {
2509 m_IsCraftingReady = true;
2510 m_ModuleRecipesManager.OnCraftingSetUpServer(GetCraftingMeta(), this);
2511 }
2512 }*/
2513
2514 /*private void SetUpCraftingClient(int id, EntityAI item1, EntityAI item2, int craft_type)
2515 {
2516 if (!GetGame().IsDedicatedServer())
2517 {
2518 m_IsCraftingReady = true;
2519
2520 float specialty_weight = m_ModuleRecipesManager.GetRecipeSpecialty(id);
2521 float length = m_ModuleRecipesManager.GetRecipeLengthInSecs(id);
2522 CreateCraftingMeta(id, item1, item2, GetPosition(), length, specialty_weight);
2523 m_ModuleRecipesManager.OnCraftingSetUpClient(GetCraftingMeta(), this);
2524 Debug.Log("SetUpCrafting2 called for id: "+ id.ToString()+ " on player: "+ this.ToString(),"recipes");
2525 if (craft_type != AT_WORLD_CRAFT)
2526 {
2527 ActionManagerClient mngr = GetActionManager();
2528 mngr.DisableActions();
2529 ActionTarget actionTarget;
2530 if (item2 == GetItemInHands())
2531 {
2532 actionTarget = new ActionTarget(item1, -1, vector.Zero, -1);
2533 mngr.InjectContinuousAction(craft_type,actionTarget,item2);
2534 }
2535 else
2536 {
2537 actionTarget = new ActionTarget(item2, -1, vector.Zero, -1);
2538 mngr.InjectContinuousAction(craft_type,actionTarget,item1);
2539 }
2540 }
2541 }
2542
2543 }*/
2544
2545 // -------------------------------------------------------------------------
2546 /*void DisableCrafting()
2547 {
2548 m_IsCraftingReady = false;
2549 if (!GetGame().IsDedicatedServer())
2550 {
2551 ActionManagerClient mngr = GetActionManager();
2552 if (mngr)
2553 {
2554 mngr.EnableActions();
2555 GetCraftingMeta() = NULL;
2556 }
2557 }
2558 }*/
2559
2560 //--------------------------------------------------------------------------
2562 {
2563 if (!IsPlayerSelected() || !IsAlive())
2564 return;
2565 if (m_ModifiersManager)
2566 m_ModifiersManager.OnScheduledTick(deltaTime);
2567 if (m_NotifiersManager)
2568 m_NotifiersManager.OnScheduledTick();
2569 if (m_TrasferValues)
2570 m_TrasferValues.OnScheduledTick(deltaTime);
2571 if (m_VirtualHud)
2572 m_VirtualHud.OnScheduledTick();
2573 if (GetBleedingManagerServer())
2574 GetBleedingManagerServer().OnTick(deltaTime);
2575 if (m_Environment)
2576 m_Environment.Update(deltaTime);
2577
2578 // Check if electric device needs to be unplugged
2579 ItemBase heldItem = GetItemInHands();
2580 if (heldItem && heldItem.HasEnergyManager() && heldItem.GetCompEM().IsPlugged())
2581 {
2582 // Now we know we are working with an electric device which is plugged into a power source.
2584
2585 // Unplug the device when the player is too far from the power source.
2586 placed_entity.GetCompEM().UpdatePlugState();
2587 }
2588 }
2589
2591 {
2592 if (!IsAlive())
2593 {
2594 if (!m_DeathSyncSent && m_KillerData)
2595 {
2596 SyncEvents.SendEntityKilled(this, m_KillerData.m_Killer, m_KillerData.m_MurderWeapon, m_KillerData.m_KillerHiTheBrain);
2597 //Print("Sending Death Sync, yay! Headshot by killer = " + m_KillerData.m_KillerHiTheBrain);
2598 //Print("And was he killed by headshot in general? = " + m_KilledByHeadshot);
2599 m_DeathSyncSent = true;
2600 }
2601 return;
2602 }
2603 if (m_DebugMonitorValues)
2604 m_DebugMonitorValues.OnScheduledTick(delta_time);
2605 if (GetSymptomManager())
2606 GetSymptomManager().OnTick(delta_time, pCurrentCommandID, m_MovementState);//needs to stay in command handler tick as it's playing animations
2607 //if (GetBleedingManagerServer()) GetBleedingManagerServer().OnTick(delta_time);
2608
2610 if (instType == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
2611 {
2612 if (m_PlayerSoundEventHandler)
2613 m_PlayerSoundEventHandler.OnTick(delta_time);
2614
2615 if (m_ProcessRemoveEffectWidgets && m_ProcessRemoveEffectWidgets.Count() > 0)
2616 m_EffectWidgets.RemoveActiveEffects(m_ProcessRemoveEffectWidgets);
2617
2618 if (m_ProcessAddEffectWidgets && m_ProcessAddEffectWidgets.Count() > 0)
2619 m_EffectWidgets.AddActiveEffects(m_ProcessAddEffectWidgets);
2620
2621 HandleGlassesEffect();
2622
2623 if (m_ContaminatedAreaEffectEnabled)
2624 ContaminatedParticleAdjustment();
2625
2626#ifdef DIAG_DEVELOPER
2627 if (m_WeaponDebug)
2628 m_WeaponDebug.OnCommandHandlerUpdate();
2629#endif
2630
2631 m_ProcessAddEffectWidgets.Clear(); //clears array for remotes as well
2632 m_ProcessRemoveEffectWidgets.Clear(); //clears array for remotes as well
2633 }
2634
2635 m_AnimCommandStarting = HumanMoveCommandID.None;
2636
2638 UpdateMovementInertia();
2639 }
2640
2643 {
2645 if (hcm)
2646 {
2647 float staminaPercentage = GetStaminaHandler().GetSyncedStaminaNormalized();
2648 hcm.SetTurnSpanSprintModifier(2 - staminaPercentage);
2649 hcm.SetRunSprintFilterModifier((2 - staminaPercentage) * 0.5);
2650 hcm.SetDirectionSprintFilterModifier(2 - staminaPercentage);
2651 }
2652 }
2653
2654 bool m_ShowDbgUI = true;
2655 int m_DbgListSelection = 0;
2656 float m_DbgSliderValue = 0.0;
2657 ref array<string> m_DbgOptions = {"jedna", "dva", "tri"};
2658
2660 {
2661 return m_NotifiersManager;
2662 }
2663
2664 //--------------------------------------------------------------------------
2665 void OnTick()
2666 {
2667 float deltaT = (GetGame().GetTime() - m_LastTick) * 0.001;
2668 if (m_LastTick < 0)
2669 deltaT = 0; //first tick protection
2670
2671 m_LastTick = GetGame().GetTime();
2672
2674 }
2675
2676 // -------------------------------------------------------------------------
2678 {
2679 super.EEItemIntoHands(item);
2680
2681 if (item)
2682 {
2683 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(item, {Bolt_Base});
2684
2685 Weapon_Base w;
2686 if (Class.CastTo(w, item))
2687 {
2688 w.ResetWeaponAnimState();
2689
2691 if (cm)
2692 {
2693 cm.SetMeleeBlock(false);
2694 GetMeleeFightLogic().SetBlock(false);
2695 }
2696 }
2697
2699 if (item.IsHeavyBehaviour() && IsRaised())
2700 {
2702 if (cm2)
2703 cm2.ForceStance(DayZPlayerConstants.STANCEIDX_ERECT);
2704 }
2705
2707 }
2708 }
2709
2711 {
2712 super.EEItemOutOfHands(item);
2713
2714 if (IsPlacingLocal())
2715 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Call(TogglePlacingLocal);
2716
2718 }
2719
2721 {
2722 return m_PlayerStomach;
2723 }
2724
2726 {
2727 EvaluateDamageHit(pCurrentCommandID);
2728
2729 // lower implement
2731
2733
2734 CheckZeroSoundEvent();
2735 CheckSendSoundEvent();
2736
2737 ProcessADDModifier();
2738
2739 if (m_BrokenLegsJunctureReceived)//was there a change in broken legs state ?
2740 {
2741 m_BrokenLegsJunctureReceived = false;
2742 bool initial = m_BrokenLegState < 0;//negative values indicate initial activation
2743
2744 if (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
2745 {
2746 DropHeavyItem();
2747 if (initial)
2748 {
2749 BrokenLegForceProne();
2750 hic.ResetADS();
2751 GetUApi().GetInputByID(UATempRaiseWeapon).Supress();
2752 ExitSights();
2753 }
2754 }
2755 }
2756
2757 GetDayZPlayerInventory().HandleInventory(pDt);
2758
2759 if (IsFireWeaponRaised() || m_IsHoldingBreath)
2760 ProcessHoldBreath(pDt);
2761
2762 ActionManagerBase mngr = GetActionManager();
2763
2764 if (m_AreHandsLocked && GetHumanInventory().GetEntityInHands())
2765 m_AreHandsLocked = false;
2766
2767 // freelook camera memory for weapon raycast
2768 if (hic.CameraIsFreeLook() && m_DirectionToCursor == vector.Zero)
2769 m_DirectionToCursor = GetGame().GetCurrentCameraDirection();
2770 else if (!hic.CameraIsFreeLook() && m_DirectionToCursor != vector.Zero)
2771 m_DirectionToCursor = vector.Zero;
2772
2773 if (m_WeaponManager)
2774 m_WeaponManager.Update(pDt);
2775 if (m_EmoteManager && IsPlayerSelected())
2776 m_EmoteManager.Update(pDt);
2777 if (m_RGSManager)
2778 m_RGSManager.Update();
2779 if (m_StanceIndicator)
2780 m_StanceIndicator.Update();
2781 if (m_StaminaHandler)
2783 if (m_InjuryHandler)
2784 m_InjuryHandler.Update(pDt);
2785 if (m_HCAnimHandler)
2786 m_HCAnimHandler.Update(pDt, m_MovementState);
2787 if (m_ShockHandler)
2788 m_ShockHandler.Update(pDt);
2789
2790 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !GetGame().IsMultiplayer())
2791 {
2792 GetPlayerSoundManagerServer().Update();
2793 ShockRefill(pDt);
2794 FreezeCheck();
2795 }
2796
2797 GetHumanInventory().Update(pDt);
2798 if (m_IsDrowning)
2799 ProcessDrowning(pDt);
2800 UpdateDelete();
2801
2802 HandleDamageHit(pCurrentCommandID);
2803
2804 if (mngr && hic)
2805 {
2806 mngr.Update(pCurrentCommandID);
2807
2810
2811 if (!m_UnconsciousDebug)
2812 {
2814 if (m_ShouldBeUnconscious && m_IsUnconscious)
2815 {
2816 if (hcu)
2817 {
2819 m_Swimming.m_bWasSwimming |= hcu.IsInWater();
2820 }
2821
2822 if (m_Swimming.m_bWasSwimming)
2823 m_LastCommandBeforeUnconscious = DayZPlayerConstants.COMMANDID_SWIM;
2824
2825 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
2826 }
2828 else if (m_ShouldBeUnconscious)
2829 {
2831 bool isTransitioning = hcv && (hcv.IsGettingIn() || hcv.IsGettingOut() || hcv.IsSwitchSeat());
2832
2833 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
2834 {
2835 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
2836
2837 m_IsUnconscious = true;
2838 OnUnconsciousStart();
2839 }
2843 else if (pCurrentCommandID != DayZPlayerConstants.COMMANDID_DEATH && pCurrentCommandID != DayZPlayerConstants.COMMANDID_FALL && !isTransitioning)
2844 {
2845 m_LastCommandBeforeUnconscious = pCurrentCommandID;
2846
2847 if (hcv)
2848 m_TransportCache = hcv.GetTransport();
2849
2851 m_JumpClimb.CheckAndFinishJump();
2853 SetFallYDiff(GetPosition()[1]);
2854 }
2855 }
2857 else if (m_IsUnconscious)
2858 {
2860 if (hcu && pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
2861 {
2862 OnUnconsciousUpdate(pDt, m_LastCommandBeforeUnconscious);
2863
2865 if (m_UnconsciousTime > 2)
2866 {
2867 int wakeUpStance = DayZPlayerConstants.STANCEIDX_PRONE;
2868
2870 if (m_Swimming.m_bWasSwimming || m_LastCommandBeforeUnconscious == DayZPlayerConstants.COMMANDID_VEHICLE)
2871 wakeUpStance = -1;
2872
2873 hcu.WakeUp(wakeUpStance);
2874
2875 m_IsUnconscious = false;
2876 OnUnconsciousStop(pCurrentCommandID);
2877 }
2878 }
2879 else
2880 {
2882 if (IsAlive())
2883 {
2884 m_IsUnconscious = false;
2885 OnUnconsciousStop(pCurrentCommandID);
2886 }
2887 }
2888 }
2889 }
2890
2891 // quickbar use
2892 int quickBarSlot = hic.IsQuickBarSlot();
2893 if (quickBarSlot && IsAlive())
2894 {
2895 if (hic.IsQuickBarSingleUse())
2896 {
2897 OnQuickBarSingleUse(quickBarSlot);
2898 //Print("PlayerBase.c IsQuickBarSingleUse - slot: " + quickBarSlot.ToString());
2899 }
2900 if (hic.IsQuickBarContinuousUseStart() && ((!GetGame().IsDedicatedServer()) && !GetGame().GetUIManager().GetMenu()))
2901 {
2902 OnQuickBarContinuousUseStart(quickBarSlot);
2903 //Print("PlayerBase.c IsQuickBarContinuousUseStart - slot: " + quickBarSlot.ToString());
2904 }
2905 if (hic.IsQuickBarContinuousUseEnd() && ((!GetGame().IsDedicatedServer())))
2906 {
2907 OnQuickBarContinuousUseEnd(quickBarSlot);
2908 //Print("PlayerBase.c IsQuickBarContinuousUseEnd - slot: " + quickBarSlot.ToString());
2909 }
2910 }
2911
2912 /*if ((pCurrentCommandID == DayZPlayerConstants.COMMANDID_ACTION || pCurrentCommandID == DayZPlayerConstants.COMMANDID_MOVE || pCurrentCommandID == DayZPlayerConstants.COMMANDID_LADDER || pCurrentCommandID == DayZPlayerConstants.COMMANDID_SWIM))
2913 {
2914 mngr.Update(); // checks for suitable action and sets it
2915 }*/
2916 }
2917 if (m_StaminaHandler && hic)
2918 {
2920 if (!CanConsumeStamina(EStaminaConsumers.SPRINT) || !CanSprint())
2921 hic.LimitsDisableSprint(true);
2922 else
2923 hic.LimitsDisableSprint(false);
2924 }
2925
2926 //map closing - feel free to move to different "update" if it does not belong here
2927 if (IsMapOpen())
2928 {
2929 if (!GetGame().IsDedicatedServer())
2930 {
2931 if (!CfgGameplayHandler.GetUse3DMap() && !GetGame().GetUIManager().IsMenuOpen(MENU_MAP))
2932 CloseMapEx(false);
2934 {
2935 if (IsMapCallbackCancelInput())
2936 CloseMapEx(true);
2937 else if (IsMapCallbackEndInput())
2938 CloseMapEx(false);
2939 }
2940 }
2941 }
2942
2943
2944#ifdef BOT
2945 if (m_Bot)
2946 m_Bot.OnUpdate(pDt);
2947#endif
2948
2949 if (m_CheckMeleeItem && (!GetGame().IsDedicatedServer()))
2950 {
2951 CheckMeleeItemDamage(m_CheckMeleeItem);
2952 SetCheckMeleeItem();
2953 }
2954
2955#ifdef DEVELOPER
2957#endif
2958
2959 OnCommandHandlerTick(pDt, pCurrentCommandID);
2960 }
2961
2962#ifdef DEVELOPER
2963
2965 {
2967 }
2968
2970 {
2972 {
2974 if (vehCommand)
2975 vehCommand.SetVehicleType(m_GetInVehicleTransportDebug.GetAnimInstance());
2977 }
2978 }
2979#endif
2980
2981 //MAP handling
2984 {
2985 CloseMapEx(false);
2986 }
2987
2989 {
2990 if (m_hac && !GetMapClosingSyncSent())
2991 {
2993 {
2994 if (GetGame().IsMultiplayer() && GetGame().IsClient())
2995 {
2997 CastTo(mngr_client, GetActionManager());
2998
2999 if (cancelled)
3000 mngr_client.RequestInterruptAction();
3001 else
3002 mngr_client.RequestEndAction();
3003
3004 GetGame().GetMission().RemoveActiveInputExcludes({"map"});
3005 GetGame().GetMission().RemoveActiveInputRestriction(EInputRestrictors.MAP);
3006 }
3007 else if (!GetGame().IsMultiplayer())
3008 {
3009 int command_ID = DayZPlayerConstants.CMD_ACTIONINT_END;
3010 if (cancelled)
3011 command_ID = DayZPlayerConstants.CMD_ACTIONINT_INTERRUPT;
3012 m_hac.InternalCommand(command_ID);
3013 }
3014 SetMapClosingSyncSet(true);
3015 }
3016 }
3017
3018 if (!GetGame().IsDedicatedServer())
3019 {
3020 if (GetGame().GetUIManager().IsMenuOpen(MENU_MAP))
3021 {
3022 GetGame().GetUIManager().FindMenu(MENU_MAP).Close();
3023 if (m_Hud)
3024 {
3025 m_Hud.ShowHudPlayer(true);
3027 }
3028
3029 GetGame().GetMission().RemoveActiveInputExcludes({"map"});
3030 GetGame().GetMission().RemoveActiveInputRestriction(EInputRestrictors.MAP);
3031 }
3032 }
3033 }
3034
3036 {
3037 m_MapOpen = state;
3038 }
3039
3041 {
3042 return m_MapOpen;
3043 }
3044
3046 {
3047 m_MapClosingSyncSent = state;
3048 }
3049
3051 {
3052 return m_MapClosingSyncSent;
3053 }
3054
3056 {
3057 if (IsRaised() || (GetUApi().GetInputByID(UAUIMenu).LocalPress() || GetUApi().GetInputByID(UAGear).LocalPress()))
3058 return true;
3059
3060 return false;
3061 }
3062
3064 {
3065 if (GetUApi().GetInputByID(UADefaultAction).LocalPress())
3066 return true;
3067
3068 return false;
3069 }
3070
3072 {
3073 return m_MapNavigationBehaviour;
3074 }
3075
3077 {
3078 if (GetMapNavigationBehaviour())
3079 GetMapNavigationBehaviour().OnItemInPlayerPossession(item);
3080 }
3081
3083 {
3084 if (GetMapNavigationBehaviour())
3085 GetMapNavigationBehaviour().OnItemNotInPlayerPossession(item);
3086 }
3087
3089 {
3090 m_CheckMeleeItem = item;
3091 }
3092
3093 /*
3094 void AirTemperatureCheck()
3095 {
3096 if (!m_Environment.IsTemperatureSet())
3097 return;
3098 float air_temperature = m_Environment.GetTemperature();
3099 int level = 0;//default
3100 if (MiscGameplayFunctions.IsValueInRange(air_temperature, PlayerConstants.BREATH_VAPOUR_THRESHOLD_HIGH, PlayerConstants.BREATH_VAPOUR_THRESHOLD_LOW))
3101 {
3102 float value = Math.InverseLerp(PlayerConstants.BREATH_VAPOUR_THRESHOLD_LOW, PlayerConstants.BREATH_VAPOUR_THRESHOLD_HIGH,air_temperature);
3103 value = Math.Clamp(value,0,1);
3104 level = Math.Round(Math.Lerp(1,BREATH_VAPOUR_LEVEL_MAX,value));
3105 }
3106 else if (air_temperature < PlayerConstants.BREATH_VAPOUR_THRESHOLD_HIGH)
3107 {
3108 level = BREATH_VAPOUR_LEVEL_MAX;
3109 }
3110 if (level != m_BreathVapour)
3111 {
3112 m_BreathVapour = level;
3113 SetSynchDirty();
3114 }
3115 }
3116 */
3117
3119 {
3120 m_ShakesForced = value;
3121 }
3122
3124 {
3125 int level;
3126 if (m_ShakesForced > 0)
3127 level = m_ShakesForced;
3128 else
3129 {
3130 float heat_comfort = GetStatHeatComfort().Get();
3132 {
3134 level = Math.Lerp(1, 7, value);
3135 level = Math.Clamp(value, 1, 7);
3136 /*
3137 value = Math.Clamp(value,0,1);
3138 level = Math.Round(value * SHAKE_LEVEL_MAX);//translate from normalized value to levels
3139 */
3140 }
3141 }
3142 if (level != m_Shakes)
3143 {
3144 m_Shakes = level;
3145 SetSynchDirty();
3146 }
3147 }
3148
3149 override bool IsLanded(int pCurrentCommandID)
3150 {
3151 if (super.IsLanded(pCurrentCommandID))
3152 return true;
3153
3155 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
3156 {
3157 bool wasFalling = m_IsUnconsciousFalling;
3158 m_IsUnconsciousFalling = PhysicsIsFalling(false);
3159 return wasFalling && !m_IsUnconsciousFalling;
3160 }
3161
3163
3164 return false;
3165 }
3166
3168 {
3170 return true;
3171
3174
3175 return false;
3176 }
3177
3179 {
3180 if (super.IsAlreadyInFallingCommand(pCurrentCommandID))
3181 return true;
3182
3185 return pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS || pCurrentCommandID == DayZPlayerConstants.COMMANDID_DAMAGE;
3186 }
3187
3189 {
3190 CloseInventoryMenu();
3191
3192 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
3193 {
3194 SetInventorySoftLock(true);
3195 if (m_LastCommandBeforeUnconscious != DayZPlayerConstants.COMMANDID_VEHICLE)
3196 {
3197 EntityAI entity_in_hands = GetHumanInventory().GetEntityInHands();
3198 if (entity_in_hands && CanDropEntity(entity_in_hands) && !IsRestrained() && !IsSurrendered())
3199 DropItem(ItemBase.Cast(entity_in_hands));
3200 }
3201 GetGame().GetSoundScene().SetSoundVolume(0, 2);
3202 m_EffectWidgets.AddSuspendRequest(EffectWidgetSuspends.UNCON);
3203 }
3204
3205 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || (!GetGame().IsMultiplayer() && GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT))
3206 {
3207 SetSynchDirty();
3208
3209 if (m_LastCommandBeforeUnconscious == DayZPlayerConstants.COMMANDID_VEHICLE)
3210 {
3211 if (m_TransportCache)
3212 m_TransportCache.MarkCrewMemberUnconscious(m_TransportCache.CrewMemberIndex(this));
3213 }
3214
3215 // disable voice communication
3216 GetGame().EnableVoN(this, false);
3217
3218 if (m_AdminLog)
3219 m_AdminLog.UnconStart(this);
3220
3221 // When we fall uncon we force out of block
3222 if (GetMeleeFightLogic())
3223 GetMeleeFightLogic().SetBlock(false);
3224 }
3225
3226 SetMasterAttenuation("UnconsciousAttenuation");
3227 }
3228
3230 {
3231 m_UnconRefillModifier = 1;
3232 SetSynchDirty();
3233 m_UnconsciousTime = 0;
3234 m_UnconsciousVignetteTarget = 2;
3235 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
3236 {
3237 if (pCurrentCommandID != DayZPlayerConstants.COMMANDID_DEATH)
3238 {
3239 GetGame().GetSoundScene().SetSoundVolume(g_Game.m_volume_sound, 1);
3240 PPERequesterBank.GetRequester(PPERequester_UnconEffects).Stop();
3241 GetGame().GetMission().GetHud().ShowHudUI(true);
3242 GetGame().GetMission().GetHud().ShowQuickbarUI(true);
3243 if (GetGame().GetUIManager().IsDialogVisible())
3244 GetGame().GetUIManager().CloseDialog();
3245 if (GetGame().GetUIManager().IsMenuOpen(MENU_RESPAWN_DIALOGUE))
3246 GetGame().GetUIManager().FindMenu(MENU_RESPAWN_DIALOGUE).Close();
3247 }
3248 SetInventorySoftLock(false);
3249 m_EffectWidgets.RemoveSuspendRequest(EffectWidgetSuspends.UNCON);
3250 }
3251 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
3252 {
3253 // enable voice communication
3254 if (IsAlive())
3255 GetGame().EnableVoN(this, true);
3256
3257 if (m_AdminLog)
3258 m_AdminLog.UnconStop(this);
3259 }
3260
3261 SetMasterAttenuation("");
3262 }
3263
3265 {
3266 m_UnconsciousTime += pDt;
3267 if (GetGame().IsServer())
3268 {
3269 int shock_simplified = SimplifyShock();
3270
3271 if (m_ShockSimplified != shock_simplified)
3272 {
3273 m_ShockSimplified = shock_simplified;
3274 SetSynchDirty();
3275 }
3276
3278 SetHealth("", "", -100);
3279 }
3280 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
3281 {
3282 GetGame().GetMission().GetHud().ShowHudUI(false);
3283 GetGame().GetMission().GetHud().ShowQuickbarUI(false);
3284 if (GetPulseType() == EPulseType.REGULAR)
3285 {
3286 float shock_simple_normalized = GetSimplifiedShockNormalized();
3287
3288 float sin = Math.Sin(m_UnconsciousTime * 0.3);
3289 float sin_normalized = (sin + 1) / 2;
3290 if (sin_normalized < 0.05)
3291 m_UnconsciousVignetteTarget = (1 - shock_simple_normalized / 3) * 2/*vignette max*/;
3292 float vignette = Math.Lerp(2, m_UnconsciousVignetteTarget, sin_normalized);
3293 //PrintString(m_UnconsciousVignetteTarget.ToString());
3294 m_UnconParam.param1 = vignette;
3295 PPERequesterBank.GetRequester(PPERequester_UnconEffects).Start(m_UnconParam);
3296 }
3297 }
3298 }
3299
3301 {
3302 int shock = Math.Lerp(0, SIMPLIFIED_SHOCK_CAP, GetHealth("", "Shock") / GetMaxHealth("", "Shock"));
3303 shock = Math.Clamp(shock, 0, SIMPLIFIED_SHOCK_CAP);
3304 return shock;
3305 }
3306
3308 {
3309 return (m_ShockSimplified / SIMPLIFIED_SHOCK_CAP);
3310 }
3311
3312 override bool IsUnconscious()
3313 {
3314 return m_MovementState.m_CommandTypeId == DayZPlayerConstants.COMMANDID_UNCONSCIOUS || m_IsUnconscious;
3315 }
3316
3318 {
3319#ifdef DIAG_DEVELOPER
3321 return false;
3322#endif
3323
3324 return super.CanBeTargetedByAI(ai) && !IsUnconscious() && !IsInVehicle();
3325 }
3326
3327 void GiveShock(float shock)
3328 {
3329 AddHealth("", "Shock", shock);
3330 }
3331
3332
3334 {
3335 CloseInventoryMenu();
3336 GetGame().GetMission().RemoveActiveInputExcludes({"inventory"}, true);
3337 GetGame().GetMission().RemoveActiveInputRestriction(EInputRestrictors.INVENTORY);
3338 }
3339
3341 void ShockRefill(float pDt);
3342
3343 //BrokenLegs
3344 // -----------------------
3345
3347 {
3348 return Math.AbsInt(m_BrokenLegState);//negative value denotes first time activation
3349 }
3350
3351 //Server side
3353 {
3354 m_BrokenLegState = stateId;
3355
3357 eBrokenLegs state = GetBrokenLegs();//m_BrokenLegState can go bellow 0, cannot be used directly
3358
3359 if (state == eBrokenLegs.NO_BROKEN_LEGS)
3360 {
3361 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS;
3362 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS_SPLINT;
3363 }
3364 else if (state == eBrokenLegs.BROKEN_LEGS)
3365 SetLegHealth();
3366 else if (state == eBrokenLegs.BROKEN_LEGS_SPLINT)
3367 {
3368 // handle splint here
3369 }
3370
3371 SetSynchDirty();
3372 }
3373
3374 //Update of state
3376 {
3377 eBrokenLegs state = GetBrokenLegs();
3378 //Raise broken legs flag and force to prone
3379 if (state != eBrokenLegs.NO_BROKEN_LEGS)
3380 {
3381 if (state == eBrokenLegs.BROKEN_LEGS_SPLINT)
3382 {
3383 if (m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_PRONE)
3384 {
3385 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.PRONE_ANIM_OVERRIDE;
3386 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS;
3387 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask | eInjuryOverrides.BROKEN_LEGS_SPLINT;
3388 }
3389 m_InjuryHandler.CheckValue(false);
3390
3391 }
3392 else if (state == eBrokenLegs.BROKEN_LEGS)
3393 {
3394
3395 if (m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_PRONE)
3396 {
3397 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.PRONE_ANIM_OVERRIDE;
3398 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS_SPLINT;
3399 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask | eInjuryOverrides.BROKEN_LEGS;
3400 }
3401
3402 BrokenLegWalkShock();
3403 m_InjuryHandler.CheckValue(false);
3404
3405 }
3406 }
3407 else if (state == eBrokenLegs.NO_BROKEN_LEGS)
3408 {
3409 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS;
3410 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.BROKEN_LEGS_SPLINT;
3411 }
3412
3413 }
3414
3416 {
3417 PlaySoundSet(m_BrokenLegSound, SOUND_BREAK_LEG, 0.1, 0.1);
3418 }
3420 {
3421 if (!IsInWater() && !IsSwimming() && !IsClimbingLadder() && !IsInVehicle() && !IsClimbing() && DayZPlayerUtils.PlayerCanChangeStance(this, DayZPlayerConstants.STANCEIDX_PRONE))
3422 {
3423 if (m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_PRONE && m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
3424 {
3426 Class.CastTo(attachment, GetItemOnSlot("Splint_Right"));
3427 if (attachment && attachment.GetType() == "Splint_Applied")
3428 attachment.Delete();
3429
3430 m_ShockHandler.SetShock(PlayerConstants.BROKEN_LEGS_INITIAL_SHOCK);
3431 m_ShockHandler.CheckValue(true);
3432
3433
3434 if (m_ShockHandler.GetCurrentShock() >= 25) //Prevent conflict with unconsciousness by not forcing prone when going uncon (25 shock or less left)
3435 {
3436
3437 //calcels user action
3439 if (cmd)
3440 cmd.Cancel();
3441
3442 StopHandEvent();
3443 //Get command move and verify not null
3444 HumanCommandMove hcm = StartCommand_Move();//not sure why this is here
3445 hcm = GetCommand_Move();
3446 if (hcm)
3447 hcm.ForceStance(DayZPlayerConstants.STANCEIDX_PRONE);
3448 }
3449 }
3450 }
3451
3452 m_JumpClimb.CheckAndFinishJump();
3453 }
3454
3455 //Used to inflict shock when player is walking (only inflicted on Update timer)
3457 {
3458 //No need to pursue here if player is prone as the following logic is not applied
3459 if (m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_PRONE && m_MovementState.m_iStanceIdx != DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
3460 {
3461 float avgLegHealth = GetHealth("RightLeg", "") + GetHealth("LeftLeg", "") + GetHealth("RightFoot", "") + GetHealth("LeftFoot", "");
3462 avgLegHealth *= 0.25; //divide by 4 to make the average leg health;
3463
3464 if (IsSwimming())
3465 {
3466 //swimming other than forward is not detectable in script other than through velocity check
3467 vector v;
3469
3470 if (v.LengthSq() > 0)
3471 m_ShockHandler.SetShock(PlayerConstants.BROKEN_LEGS_SHOCK_SWIM);
3472 }
3473 else if (m_MovementState.m_iMovement != 0)
3474 {
3475 if (IsClimbingLadder())
3477 else if (m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_ERECT || m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDERECT)
3478 {
3479 if (m_MovementState.m_iMovement > 1)//only jog and faster
3481 }
3482 else if (m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_CROUCH || m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDCROUCH)
3483 {
3484 //any speed other than idle
3486 }
3487 }
3488 else
3489 {
3490 //Here apply shock if player is standing or crouched and STANDING STILL
3491 m_ShockHandler.SetShock(PlayerConstants.BROKEN_LEGS_STAND_SHOCK);
3492 }
3493
3494 m_ShockHandler.CheckValue(true);
3495 }
3496 }
3497
3498 //Always use the same thresholds but allow passing of different shock values
3499 void MovingShock(float legHealth, float highShock, float midShock, float lowShock)
3500 {
3502 {
3503 //Inflict "high shock"
3504 m_ShockHandler.SetShock(highShock);
3505 }
3507 {
3508 //Inflict "low shock"
3509 m_ShockHandler.SetShock(lowShock);
3510 }
3511 else
3512 {
3513 //If neither high nore low, inflict "mid shock"
3514 m_ShockHandler.SetShock(midShock);
3515 }
3516 }
3517
3518 void DealShock(float dmg)
3519 {
3521 damage.param1 = dmg;
3522 GetGame().RPCSingleParam(this, ERPCs.RPC_SHOCK, damage, true, GetIdentity());
3523 }
3524
3525 //Prevent player from picking up heavy items when legs are broken
3527 {
3528 if (item.IsHeavyBehaviour() && (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS || GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS_SPLINT))
3529 return false;
3530
3531 return super.CanPickupHeavyItem(item);
3532 }
3533
3534 //Set all leg zones' health to 0 in order to limit emergent behaviour and prevent confusion as to how broken legs really work
3536 {
3537 SetHealth("RightLeg", "", 0);
3538 SetHealth("RightFoot", "", 0);
3539 SetHealth("LeftLeg", "", 0);
3540 SetHealth("LeftFoot", "", 0);
3541 }
3542
3544 {
3545 ItemBase itemInHands = GetItemInHands();
3546 if (itemInHands && itemInHands.IsHeavyBehaviour())
3547 DropItem(itemInHands);
3548 }
3549
3551 {
3553 Class.CastTo(attachment, GetItemOnSlot("Splint_Right"));
3554 if (attachment && attachment.GetType() == "Splint_Applied")
3555 return true;
3556 return false;
3557 }
3558
3559 // -----------------------
3560
3561
3562 override void OnCommandSwimStart()
3563 {
3564 ItemBase itemInHands = GetItemInHands();
3565 if (itemInHands)
3566 {
3567 if (itemInHands.IsHeavyBehaviour())
3568 {
3569 TryHideItemInHands(false);
3570 DropHeavyItem();
3571 }
3572 else
3573 TryHideItemInHands(true);
3574 itemInHands.OnItemInHandsPlayerSwimStart(this);
3575 }
3576 m_AnimCommandStarting = HumanMoveCommandID.CommandSwim;
3577
3578 if (GetInventory())
3579 GetInventory().LockInventory(LOCK_FROM_SCRIPT);
3580
3581 CloseInventoryMenu();
3582 GetDayZGame().GetBacklit().OnSwimmingStart();
3583
3585 GetWeaponManager().DelayedRefreshAnimationState(10);
3586 RequestHandAnimationStateRefresh();
3587
3588 GetGame().GetMission().AddActiveInputExcludes({"swimming"});
3589 }
3590
3591 override void OnCommandSwimFinish()
3592 {
3593 TryHideItemInHands(false, true);
3594
3595 if (GetInventory())
3596 GetInventory().UnlockInventory(LOCK_FROM_SCRIPT);
3597
3598 GetDayZGame().GetBacklit().OnSwimmingStop();
3599
3600 GetWeaponManager().RefreshAnimationState();
3601
3602 GetGame().GetMission().RemoveActiveInputExcludes({"swimming"});
3603 }
3604
3605 override void OnCommandLadderStart()
3606 {
3607 m_AnimCommandStarting = HumanMoveCommandID.CommandLadder;
3608 TryHideItemInHands(true);
3609
3610 if (GetInventory())
3611 GetInventory().LockInventory(LOCK_FROM_SCRIPT);
3612
3613 CloseInventoryMenu();
3614
3615 GetGame().GetMission().AddActiveInputExcludes({"ladderclimbing"});
3616 }
3617
3619 {
3620 TryHideItemInHands(false, true);
3621
3622 if (GetInventory())
3623 GetInventory().UnlockInventory(LOCK_FROM_SCRIPT);
3624
3625 GetGame().GetMission().RemoveActiveInputExcludes({"ladderclimbing"});
3626 }
3627
3628 override void OnCommandFallStart()
3629 {
3630 m_AnimCommandStarting = HumanMoveCommandID.CommandFall;
3631
3632 if (GetInventory())
3633 GetInventory().LockInventory(LOCK_FROM_SCRIPT);
3634
3635 CloseInventoryMenu();
3636
3638 GetWeaponManager().DelayedRefreshAnimationState(10);
3639 RequestHandAnimationStateRefresh();
3640 }
3641
3642 override void OnCommandFallFinish()
3643 {
3644 if (GetInventory())
3645 GetInventory().UnlockInventory(LOCK_FROM_SCRIPT);
3646
3647 GetWeaponManager().RefreshAnimationState();
3648 }
3649
3650 override void OnCommandClimbStart()
3651 {
3652 m_AnimCommandStarting = HumanMoveCommandID.CommandClimb;
3653
3654 if (GetInventory())
3655 GetInventory().LockInventory(LOCK_FROM_SCRIPT);
3656
3657 CloseInventoryMenu();
3658
3660 GetWeaponManager().DelayedRefreshAnimationState(10);
3661 RequestHandAnimationStateRefresh();
3662 }
3663
3664 override void OnCommandClimbFinish()
3665 {
3666 if (GetInventory())
3667 GetInventory().UnlockInventory(LOCK_FROM_SCRIPT);
3668
3669 GetWeaponManager().RefreshAnimationState();
3670 }
3671
3673 {
3674 m_AnimCommandStarting = HumanMoveCommandID.CommandVehicle;
3675
3676 if (GetInventory())
3677 GetInventory().LockInventory(LOCK_FROM_SCRIPT);
3678
3679 CloseInventoryMenu();
3680
3681 ItemBase itemInHand = GetItemInHands();
3682 EntityAI itemOnHead = FindAttachmentBySlotName("Headgear");
3683
3684 if (itemInHand && itemInHand.GetCompEM())
3685 itemInHand.GetCompEM().SwitchOff();
3686
3687 TryHideItemInHands(true);
3688
3689 if (itemOnHead && itemOnHead.GetCompEM())
3690 itemOnHead.GetCompEM().SwitchOff();
3691
3693 if (hcv && hcv.GetVehicleSeat() == DayZPlayerConstants.VEHICLESEAT_DRIVER)
3694 OnVehicleSeatDriverEnter();
3695
3696 GetGame().GetMission().AddActiveInputExcludes({"vehicledriving"});
3697 }
3698
3700 {
3701 if (GetInventory())
3702 GetInventory().UnlockInventory(LOCK_FROM_SCRIPT);
3703
3704 TryHideItemInHands(false, true);
3705
3706 if (m_IsVehicleSeatDriver)
3707 OnVehicleSeatDriverLeft();
3708
3709 GetGame().GetMission().RemoveActiveInputExcludes({"vehicledriving"});
3710 }
3711
3712 override void OnCommandMelee2Start()
3713 {
3714 m_AnimCommandStarting = HumanMoveCommandID.CommandMelee2;
3715 m_IsFighting = true;
3716
3718 GetWeaponManager().DelayedRefreshAnimationState(10);
3719 RequestHandAnimationStateRefresh();
3720 }
3721
3723 {
3724 RunFightBlendTimer();
3725
3726 GetWeaponManager().RefreshAnimationState();
3727
3728 }
3729
3730 override void OnCommandDeathStart()
3731 {
3732 m_AnimCommandStarting = HumanMoveCommandID.CommandDeath;
3733
3735 GetWeaponManager().DelayedRefreshAnimationState(10);
3736 RequestHandAnimationStateRefresh();
3737 }
3738
3739 override void OnJumpStart()
3740 {
3741 m_ActionManager.OnJumpStart();
3742
3744 GetWeaponManager().DelayedRefreshAnimationState(10);
3745 RequestHandAnimationStateRefresh();
3746 CloseMapEx(true);
3747 }
3748
3749 override void OnJumpEnd(int pLandType = 0)
3750 {
3751 if (m_PresenceNotifier)
3752 {
3753 switch (pLandType)
3754 {
3755 case HumanCommandFall.LANDTYPE_NONE:
3756 case HumanCommandFall.LANDTYPE_LIGHT:
3757 m_PresenceNotifier.ProcessEvent(EPresenceNotifierNoiseEventType.LAND_LIGHT);
3758 break;
3759 case HumanCommandFall.LANDTYPE_MEDIUM:
3760 case HumanCommandFall.LANDTYPE_HEAVY:
3761 m_PresenceNotifier.ProcessEvent(EPresenceNotifierNoiseEventType.LAND_HEAVY);
3762 break;
3763 }
3764 }
3765
3766 GetWeaponManager().RefreshAnimationState();
3767 }
3768
3770 {
3771 return ((1 << stance) & stanceMask) != 0;
3772 }
3773
3775 {
3776 int prone = DayZPlayerConstants.STANCEMASK_PRONE | DayZPlayerConstants.STANCEMASK_RAISEDPRONE;
3777 int notProne = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_RAISEDERECT | DayZPlayerConstants.STANCEMASK_RAISEDCROUCH;
3778
3779 if (IsStance(previousStance, DayZPlayerConstants.STANCEMASK_PRONE) && IsStance(newStance, DayZPlayerConstants.STANCEMASK_ERECT))
3780 m_SprintedTimePerStanceMin = PlayerConstants.FULL_SPRINT_DELAY_FROM_PRONE;
3781
3782 if (IsStance(previousStance, DayZPlayerConstants.STANCEMASK_PRONE) && IsStance(previousStance, DayZPlayerConstants.STANCEMASK_CROUCH) || (IsStance(previousStance, DayZPlayerConstants.STANCEMASK_CROUCH) && IsStance(newStance, DayZPlayerConstants.STANCEMASK_ERECT)))
3783 m_SprintedTimePerStanceMin = PlayerConstants.FULL_SPRINT_DELAY_FROM_CROUCH;
3784
3785 if ((IsStance(previousStance, prone) && IsStance(newStance, notProne)) || (IsStance(previousStance, notProne) && IsStance(newStance, prone)))
3786 {
3788 GetWeaponManager().RefreshAnimationState();
3789 }
3790 }
3791
3793 {
3794 // Check if the player is playing a throwing animation
3795 if (GetThrowing().IsThrowingAnimationPlaying())
3796 return false;
3797
3798 // don't allow base stance change, only raised hands change
3799 if (IsRolling())
3800 {
3801 if (Math.AbsInt(previousStance - newStance) == 3)
3802 return true;
3803
3804 return false;
3805 }
3806
3807 // Check if the player is going to crouch or raised crouch
3808 if (newStance == DayZPlayerConstants.STANCEIDX_CROUCH || newStance == DayZPlayerConstants.STANCEIDX_RAISEDCROUCH)
3809 return GetCurrentWaterLevel() <= GetDayZPlayerType().CommandSwimSettingsW().m_fToErectLevel;
3810
3811 // Check if the player is going to prone
3812 if (newStance == DayZPlayerConstants.STANCEIDX_PRONE || newStance == DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
3813 return GetCurrentWaterLevel() <= GetDayZPlayerType().CommandSwimSettingsW().m_fToCrouchLevel;
3814
3815 // The player can change stance if none of the conditions above are met
3816 return true;
3817 }
3818
3819
3820 override void OnCommandMoveStart()
3821 {
3822 if (GetGame().IsServer())
3823 {
3824 //In case player changes stance through a different command, we refresh the anim overrides
3825 int prone = DayZPlayerConstants.STANCEMASK_PRONE | DayZPlayerConstants.STANCEMASK_RAISEDPRONE;
3826 if (!IsPlayerInStance(prone))
3827 {
3828 m_InjuryHandler.m_ForceInjuryAnimMask = m_InjuryHandler.m_ForceInjuryAnimMask & ~eInjuryOverrides.PRONE_ANIM_OVERRIDE;
3829 ForceUpdateInjuredState();
3830 }
3831 }
3832 }
3833
3834 override bool CanRoll()
3835 {
3836 if (!CanConsumeStamina(EStaminaConsumers.ROLL))
3837 return false;
3838
3839 if (IsInFBEmoteState() || m_EmoteManager.m_MenuEmote)
3840 return false;
3841
3842 return IsPlayerInStance(DayZPlayerConstants.STANCEMASK_PRONE | DayZPlayerConstants.STANCEMASK_RAISEDPRONE) && GetCommand_Move() && !GetCommand_Move().IsOnBack();
3843 }
3844
3845 override void OnRollStart(bool isToTheRight)
3846 {
3847 DepleteStamina(EStaminaModifiers.ROLL);
3848
3849 if (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
3850 m_ShockHandler.SetShock(PlayerConstants.BROKEN_LEGS_ROLL_SHOCK);
3851 }
3852
3853 override void OnRollFinish()
3854 {
3855 }
3856
3858 {
3859 string surfaceType;
3860 int liquidType;
3861 GetGame().SurfaceUnderObject(this, surfaceType, liquidType);
3862 }
3863
3865 {
3866 if (seatIndex == DayZPlayerConstants.VEHICLESEAT_DRIVER)
3867 OnVehicleSeatDriverEnter();
3868 else
3869 OnVehicleSeatDriverLeft();
3870 }
3871
3873 {
3874 m_IsVehicleSeatDriver = true;
3875 if (m_Hud)
3877 }
3878
3880 {
3881 m_IsVehicleSeatDriver = false;
3882 if (m_Hud)
3884 }
3885
3887 {
3889 {
3890 PlacingCancelLocal();
3891 PlacingCancelServer();
3892 }
3893 }
3894
3895 override void EOnFrame(IEntity other, float timeSlice)
3896 {
3897 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
3898 {
3899#ifndef NO_GUI
3901 m_Hud.ToggleHeatBufferPlusSign(m_HasHeatBuffer);
3902
3903 if (IsControlledPlayer() && m_EffectWidgets && m_EffectWidgets.IsAnyEffectRunning())
3904 m_EffectWidgets.Update(timeSlice);
3905#endif
3906
3907 if (m_UndergroundHandler)
3908 m_UndergroundHandler.Tick(timeSlice);
3909 }
3910 }
3911
3912 override void EOnPostFrame(IEntity other, int extra)
3913 {
3914 float delta_time = (GetGame().GetTime() - m_LastPostFrameTickTime) / 1000;
3915 m_LastPostFrameTickTime = GetGame().GetTime();
3916 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
3917 {
3918 if (GetDamageDealtEffect())
3919 {
3920 if (IsAlive())
3921 GetDamageDealtEffect().Update(delta_time);
3922 else
3923 delete GetDamageDealtEffect();
3924 }
3925
3926 if (m_EffectRadial)
3927 {
3928 if (IsAlive())
3929 m_EffectRadial.Update(delta_time);
3930 else
3931 m_EffectRadial = null;
3932 }
3933
3934
3935 if (GetFlashbangEffect())
3936 {
3937 if (IsAlive())
3938 GetFlashbangEffect().Update(delta_time);
3939 else
3940 {
3941 GetFlashbangEffect().Stop();
3942 delete GetFlashbangEffect();
3943 }
3944 }
3945
3946 if (GetShockEffect())
3947 {
3948 if (IsAlive())
3949 GetShockEffect().Update(delta_time);
3950 else
3951 delete GetShockEffect();
3952 }
3953
3954 m_InventoryActionHandler.OnUpdate();
3955 }
3956
3957#ifdef DIAG_DEVELOPER
3959#endif
3960 }
3961
3962#ifdef DIAG_DEVELOPER
3963 protected void DiagOnPostFrame(IEntity other, int extra)
3964 {
3965 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
3966 {
3967 if (m_WeaponDebug)
3968 m_WeaponDebug.OnPostFrameUpdate();
3969
3970 if (GetBleedingManagerRemote())
3971 GetBleedingManagerRemote().OnUpdate();
3972
3973 if (m_MeleeCombat)
3974 {
3975 if (DiagMenu.GetBool(DiagMenuIDs.MELEE_DEBUG))
3976 {
3977 m_MeleeDebug = true;
3978 m_MeleeCombat.Debug(GetItemInHands(), m_MeleeCombat.GetHitType());
3979 }
3980 else if (!DiagMenu.GetBool(DiagMenuIDs.MELEE_DEBUG) && m_MeleeDebug)
3981 {
3982 m_MeleeDebug = false;
3983 m_MeleeCombat.Debug(GetItemInHands(), m_MeleeCombat.GetHitType());
3984 }
3985 }
3986
3987 if (DiagMenu.GetBool(DiagMenuIDs.SOUNDS_ITEM_IMPACT_SOUNDS))
3988 InventoryItem.DrawImpacts();
3989
3990 if (GetPluginManager())
3991 {
3992 PluginDrawCheckerboard drawCheckerboard = PluginDrawCheckerboard.Cast(GetPluginManager().GetPluginByType(PluginDrawCheckerboard));
3993 if (drawCheckerboard && !drawCheckerboard.IsActive())
3994 drawCheckerboard.ShowWidgets(DiagMenu.GetBool(DiagMenuIDs.MISC_DRAW_CHECKERBOARD));
3995 }
3996
3997 if (m_PresenceNotifier)
3998 m_PresenceNotifier.EnableDebug(DiagMenu.GetBool(DiagMenuIDs.MISC_PRESENCE_NOTIFIER_DBG));
3999
4000 if (DiagMenu.GetBool(DiagMenuIDs.TRIGGER_PLAYER_DEBUG))
4001 {
4002 vector minmax[2];
4003 GetCollisionBox(minmax);
4004
4005 int color = COLOR_RED_A;
4008
4009 Shape dbgShape = Debug.DrawBoxEx(minmax[0], minmax[1], color, ShapeFlags.TRANSP | ShapeFlags.NOZWRITE | ShapeFlags.ONCE);
4010
4011 vector mat[4];
4012 GetTransform(mat);
4013 dbgShape.CreateMatrix(mat);
4014 dbgShape.SetMatrix(mat);
4015 }
4016 }
4017
4018 if (m_Environment && m_Environment.m_Debug)
4019 {
4020#ifdef SERVER
4021 EnvDebugData envDebugData = m_Environment.GetEnvDebugData();
4022 GetGame().RPCSingleParam(this, ERPCs.DIAG_MISC_ENVIRONMENT_DEBUG_DATA, envDebugData, false, GetIdentity());
4023#else
4024 m_Environment.ShowEnvDebugPlayerInfo(DiagMenu.GetBool(DiagMenuIDs.MISC_ENVIRONMENT_DEBUG));
4025#endif
4026 }
4027
4028 if (m_FallDamage && m_FallDamage.m_Debug)
4029 {
4030#ifdef SERVER
4031 FallDamageDebugData fallDamageDebugData = m_FallDamage.GetFallDamageDebugData();
4032 GetGame().RPCSingleParam(this, ERPCs.DIAG_MISC_FALLDAMAGE_DEBUG_DATA, fallDamageDebugData, false, GetIdentity());
4033#else
4034 m_FallDamage.ShowFallDamageDebugInfo(DiagMenu.GetBool(DiagMenuIDs.MISC_FALLDAMAGE_DEBUG));
4035#endif
4036 }
4037 }
4038
4039 override void OnEnterTrigger(ScriptedEntity trigger)
4040 {
4041 super.OnEnterTrigger(trigger);
4042
4044 }
4045
4046 override void OnLeaveTrigger(ScriptedEntity trigger)
4047 {
4048 super.OnLeaveTrigger(trigger);
4049
4051 }
4052#endif
4053
4054 void StaminaHUDNotifier(bool show)
4055 {
4056 if (m_Hud)
4058 }
4059
4060 override void DepleteStamina(EStaminaModifiers modifier, float dT = -1)
4061 {
4062 if (GetStaminaHandler())
4063 GetStaminaHandler().DepleteStamina(modifier, dT);
4064 }
4065
4067 {
4068 if (!GetStaminaHandler()) return false;
4069
4070 bool val = (GetStaminaHandler().HasEnoughStaminaFor(consumer) /*&& !IsOverloaded()*/ && !IsRestrained() && !IsInFBEmoteState());
4071
4072 if (!val)
4073 StaminaHUDNotifier(false);
4074
4075 return val;
4076 }
4077
4079 {
4080 if (!GetStaminaHandler()) return false;
4081
4082 bool val = (GetStaminaHandler().HasEnoughStaminaToStart(consumer) && !IsRestrained() && !IsInFBEmoteState());
4083
4084 if (!val)
4085 StaminaHUDNotifier(false);
4086
4087 return val;
4088 }
4089
4092 {
4093 if (!GetStaminaHandler())
4094 return false;
4095
4096 return GetStaminaHandler().GetStamina() > 0;
4097 }
4098
4100 {
4101 if (GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS)
4102 return false;
4103
4104 if (climbType == 1 && !CanConsumeStamina(EStaminaConsumers.VAULT))
4105 return false;
4106
4107 if (climbType == 2 && (!CanConsumeStamina(EStaminaConsumers.CLIMB) || GetBrokenLegs() != eBrokenLegs.NO_BROKEN_LEGS))
4108 return false;
4109
4110 if (climbType > 0 && m_InjuryHandler && m_InjuryHandler.GetInjuryAnimValue() >= InjuryAnimValues.LVL3)
4111 return false;
4112
4113 return super.CanClimb(climbType, climbRes);
4114 }
4115
4116 override bool CanJump()
4117 {
4118 if (GetBrokenLegs() != eBrokenLegs.NO_BROKEN_LEGS)
4119 return false;
4120
4121 if (!CanConsumeStamina(EStaminaConsumers.JUMP))
4122 return false;
4123
4125 if (m_InjuryHandler && m_InjuryHandler.GetInjuryAnimValue() >= InjuryAnimValues.LVL3)
4126 return false;
4127
4128 if (IsInFBEmoteState() || m_EmoteManager.m_MenuEmote)
4129 return false;
4130
4131 return super.CanJump();
4132 }
4133
4135 {
4136 return m_JumpClimb.m_bIsJumpInProgress;
4137 }
4138
4140 {
4142 temp = GetGame().GetMission().GetActiveRefresherLocations();
4143 int count = temp.Count();
4144 if (count > 0)
4145 {
4146 vector pos = target.GetPosition();
4147 for (int i = 0; i < count; i++)
4148 {
4150 return true;
4151 }
4152
4153 return false;
4154 }
4155 else
4156 return false;
4157 }
4158
4160 {
4161 if ((GetGame().IsMultiplayer() && GetGame().IsServer()))
4162 {
4163 m_RefreshAnimStateIdx++;
4164 if (m_RefreshAnimStateIdx > 3)
4165 m_RefreshAnimStateIdx = 0;
4166 SetSynchDirty();
4167 }
4168 }
4169
4171 {
4172 if (delay == 0)
4173 {
4174 GetItemAccessor().OnItemInHandsChanged(true);
4175 GetItemAccessor().ResetWeaponInHands();
4176 }
4177 else
4178 GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(RefreshHandAnimationState, delay, false, 0);
4179 }
4180
4181 // -------------------------------------------------------------------------
4182 // USER ACTIONS
4183 // -------------------------------------------------------------------------
4184
4186 {
4187 vector pdir = GetDirection();
4188 vector ptv = target.GetPosition() - GetPosition();
4189 pdir.Normalize();
4190 ptv.Normalize();
4191
4192 if (Math.AbsFloat(pdir[0] - ptv[0]) < 0.5 && Math.AbsFloat(pdir[2] - ptv[2]) < 0.5)
4193 return true;
4194 return false;
4195 }
4196
4197 //---------------------------------------------------------
4199 {
4200 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
4201 return;
4202
4203 if (m_AreHandsLocked)
4204 return; //Player is in the short window of time after interrupting placement of an item and before getting it back in hands
4205
4206 if (GetInventory().IsInventoryLocked() || IsEmotePlaying())
4207 return;
4208
4209 if (GetThrowing().IsThrowingModeEnabled() || GetThrowing().IsThrowingAnimationPlaying())
4210 return;
4211
4212 if (IsRaised() || GetCommand_Melee() || IsSwimming() || IsClimbingLadder() || IsClimbing() || IsRestrained() || IsRestrainPrelocked())
4213 return;
4214
4215 if (GetDayZPlayerInventory().IsProcessing() || IsItemsToDelete())
4216 return;
4217
4219 return;
4220
4221 if (GetWeaponManager() && GetWeaponManager().IsRunning())
4222 return;
4223
4225 return;
4226
4227 //TODO MW change locking method
4228 //if (GetDayZPlayerInventory().HasLockedHands())
4229 // return;
4230
4231 EntityAI quickBarEntity = GetQuickBarEntity(slotClicked - 1);//GetEntityInQuickBar(slotClicked - 1);
4232
4233 if (!quickBarEntity)
4234 return;
4235
4236 Magazine mag;
4238
4239 if (Class.CastTo(mag, quickBarEntity) && Class.CastTo(wpn, mag.GetHierarchyParent()))
4240 return;
4241
4242 EntityAI inHandEntity = GetHumanInventory().GetEntityInHands();
4243
4244 if (!GetDayZPlayerInventory().IsIdle())
4245 return; // player is already performing some animation
4246
4248 handInventoryLocation.SetHands(this, quickBarEntity);
4249 if (this.GetInventory().HasInventoryReservation(quickBarEntity, handInventoryLocation))
4250 return;
4251
4253 {
4254 if (GetHumanInventory().CanRemoveEntityInHands())
4255 {
4256 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Stash - PredictiveMoveItemFromHandsToInventory HND=" + Object.GetDebugName(inHandEntity));
4257 PredictiveMoveItemFromHandsToInventory();
4258 }
4259 }
4260 else
4261 {
4263 quickBarEntity.GetInventory().GetCurrentInventoryLocation(invLocQBItem);
4264 if (GetInventory().HasInventoryReservation(quickBarEntity, invLocQBItem))
4265 return;
4266
4267 if (inHandEntity)
4268 {
4270
4272 inHandEntity.GetInventory().GetCurrentInventoryLocation(inHandEntityFSwapDst);
4273
4274 int index = GetHumanInventory().FindUserReservedLocationIndex(inHandEntity);
4275 if (index >= 0)
4276 GetHumanInventory().GetUserReservedLocation(index, Reserved_Item_il);
4277
4278 if (Reserved_Item_il)
4279 inHandEntityFSwapDst.CopyLocationFrom(Reserved_Item_il, true);
4280
4282 {
4283 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] PredictiveSwapEntities QB=" + Object.GetDebugName(quickBarEntity) + " HND=" + Object.GetDebugName(inHandEntity));
4284 PredictiveSwapEntities(quickBarEntity, inHandEntity);
4285 }
4287 {
4288 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Swap - PredictiveForceSwapEntities HND=" + Object.GetDebugName(inHandEntity) + " QB=" + Object.GetDebugName(quickBarEntity) + " fswap_dst=" + InventoryLocation.DumpToStringNullSafe(inHandEntityFSwapDst));
4289 PredictiveForceSwapEntities(quickBarEntity, inHandEntity, inHandEntityFSwapDst);
4290 }
4291 }
4292 else
4293 {
4294 if (GetInventory().HasInventoryReservation(quickBarEntity, handInventoryLocation))
4295 return;
4296
4297 if (GetInventory().CanAddEntityIntoHands(quickBarEntity))
4298 {
4299 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[QB] Stash - PredictiveTakeEntityToHands QB=" + Object.GetDebugName(quickBarEntity));
4300 PredictiveTakeEntityToHands(quickBarEntity);
4301 }
4302 }
4303 }
4304 }
4305 //---------------------------------------------------------
4307 {
4308 if (GetInventory().IsInventoryLocked())
4309 return;
4310
4311 if (IsSwimming() || IsClimbingLadder() || GetCommand_Melee() || IsClimbing() || IsRestrained() || IsRestrainPrelocked())
4312 return;
4313
4314 ItemBase quickBarItem = ItemBase.Cast(GetQuickBarEntity(slotClicked - 1));
4315
4316 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
4317 {
4318 ItemBase itemInHands = ItemBase.Cast(GetHumanInventory().GetEntityInHands());
4319
4321 {
4323
4324 if (amc.CanPerformActionFromQuickbar(itemInHands, quickBarItem))
4325 amc.PerformActionFromQuickbar(itemInHands, quickBarItem);
4326 else
4327 {
4328 if (IsRaised() || GetCommand_Melee())
4329 return;
4330
4331 amc.ForceTarget(quickBarItem);
4332 m_QuickBarFT = true;
4333 }
4334 }
4335 }
4336 m_QuickBarHold = true;
4337 }
4338 //---------------------------------------------------------
4340 {
4341 if (m_QuickBarHold)
4342 {
4343 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
4344 {
4346
4347 if (m_ActionQBControl)
4348 {
4349 ActionBase action = am.GetRunningAction();
4350 if (action)
4351 {
4352 if (!action.GetInput().IsActive())
4353 am.EndActionInput();
4354
4355 }
4356 }
4357
4358 if (m_QuickBarFT)
4359 {
4360 am.ClearForceTarget();
4361 m_QuickBarFT = false;
4362 }
4363 }
4364 }
4365 m_QuickBarHold = false;
4366 }
4367 void SetActionEndInput(ActionBase action)
4368 {
4369 m_ActionQBControl = !action.GetInput().IsActive();
4370 }
4371
4373 {
4374 return m_ActionQBControl;
4375 }
4377 {
4378 m_ActionQBControl = false;
4379 }
4380
4381 //---------------------------------------------------------
4382 // RADIAL QUICKBAR AND RELOAD ACTIONS
4383 //---------------------------------------------------------
4384 //the same functionality as normal quick bar slot key press
4386 {
4387 OnQuickBarSingleUse(slotClicked);
4388 }
4389
4390 //removed the need for holding down quick bar slot key
4392 {
4393 EntityAI quickBarEntity = GetQuickBarEntity(slotClicked - 1);
4394 EntityAI entity_in_hands = GetHumanInventory().GetEntityInHands();
4395
4396 ReloadWeapon(entity_in_hands, quickBarEntity);
4397 }
4398
4399 //removed the need for holding down quick bar slot key
4401 {
4402 EntityAI magazine = GetMagazineToReload(weapon);
4403 ReloadWeapon(weapon, magazine);
4404 }
4405
4406 //Reload weapon with given magazine
4408 {
4409 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
4410 {
4412 CastTo(mngr_client, GetActionManager());
4413
4414 if (mngr_client && FirearmActionLoadMultiBulletRadial.Cast(mngr_client.GetRunningAction()))
4415 mngr_client.Interrupt();
4416 else if (GetHumanInventory().GetEntityInHands() != magazine)
4417 {
4419 Magazine mag;
4422 if (GetWeaponManager().CanUnjam(wpn))
4423 GetWeaponManager().Unjam();
4424 else if (GetWeaponManager().CanAttachMagazine(wpn, mag))
4425 GetWeaponManager().AttachMagazine(mag);
4426 else if (GetWeaponManager().CanSwapMagazine(wpn, mag))
4427 GetWeaponManager().SwapMagazine(mag);
4428 else if (GetWeaponManager().CanLoadBullet(wpn, mag))
4429 {
4430 //GetWeaponManager().LoadMultiBullet(mag);
4431
4432 ActionTarget atrg = new ActionTarget(mag, this, -1, vector.Zero, -1.0);
4433 if (mngr_client && !mngr_client.GetRunningAction() && mngr_client.GetAction(FirearmActionLoadMultiBulletRadial).Can(this, atrg, wpn))
4434 mngr_client.PerformActionStart(mngr_client.GetAction(FirearmActionLoadMultiBulletRadial), atrg, wpn);
4435 }
4436 }
4437 }
4438 }
4439
4440 //returns compatible magazine from player inventory with highest ammo count
4442 {
4444 WeaponManager weapon_manager = GetWeaponManager();
4446
4447 EntityAI ammo_magazine; //magazine
4450
4451 EntityAI ammo_pile; //ammo pile
4453 int ammo_pile_count;
4454
4455 //Get all magazines in (player) inventory
4456 for (int att_i = 0; att_i < GetInventory().AttachmentCount(); ++att_i)
4457 {
4458 EntityAI attachment = GetInventory().GetAttachmentFromIndex(att_i);
4459 ref CargoBase attachment_cargo = attachment.GetInventory().GetCargo();
4460
4461 if (attachment_cargo)
4462 {
4463 for (int cgo_i = 0; cgo_i < attachment_cargo.GetItemCount(); ++cgo_i)
4464 {
4466
4467 //check for proper magazine
4468 if (cargo_item.IsMagazine())
4469 {
4471 ammo_pile_count = magazine.GetAmmoCount();
4472
4473 //magazines (get magazine with max ammo count)
4474 if (weapon_manager.CanAttachMagazine(weapon_base, magazine) || weapon_manager.CanSwapMagazine(weapon_base, magazine))
4475 {
4476 if (ammo_pile_count > 0)
4477 {
4478 if (last_ammo_magazine_count == 0)
4479 {
4482 }
4483 else
4484 {
4486 {
4489 }
4490 }
4491 }
4492 }
4493 //bullets (get ammo pile with min ammo count)
4494 else if (weapon_manager.CanLoadBullet(weapon_base, magazine))
4495 {
4496 if (ammo_pile_count > 0)
4497 {
4498 if (last_ammo_pile_count == 0)
4499 {
4502 }
4503 else
4504 {
4506 {
4509 }
4510 }
4511 }
4512 }
4513 }
4514 }
4515 }
4516 }
4517
4518 //prioritize magazine
4519 if (ammo_magazine)
4520 return ammo_magazine;
4521
4522 return ammo_pile;
4523 }
4524 //---------------------------------------------------------
4525
4526
4527 //---------------------------------------------------------
4529 {
4530 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !GetGame().IsMultiplayer())
4531 {
4532 GetGame().GetMission().AddDummyPlayerToScheduler(this);
4533 OnSelectPlayer();
4534 }
4535 }
4536
4537 //---------------------------------------------------------
4538 //Obsolete
4540 {
4541 return m_LiquidTendencyDrain;
4542 }
4543 //---------------------------------------------------------
4544 //Obsolete
4546 {
4547 m_LiquidTendencyDrain = state;
4548 }
4549
4550 //---------------------------------------------------------
4553 {
4554 return m_FlagRaisingTendency;
4555 }
4556 //---------------------------------------------------------
4559 {
4560 m_FlagRaisingTendency = state;
4561 }
4562
4563 override SoundOnVehicle PlaySound(string sound_name, float range, bool create_local = false)
4564 {
4565 return BetaSound.SaySound(this, sound_name, range, false);
4566 }
4567
4569 {
4570 return GetWeightEx();
4571 }
4572
4574 {
4575 return GetWeightEx() >= OVERLOAD_LIMIT;
4576 }
4577
4578 void SetPlayerLoad(float load)//Deprecated
4579 {
4580 m_CargoLoad = load;
4581 //Print("m_CargoLoad: " + m_CargoLoad);
4582 //Log(ToString(this) + "'s load weight is " + ftoa(m_CargoLoad) + " g.", LogTemplates.TEMPLATE_PLAYER_WEIGHT);
4583 }
4584
4585 //Deprecated, will be overrid by other method calls (in order to ensure stamina calculation is properly set)
4586 void AddPlayerLoad(float addedload)//Deprecated
4587 {
4588 float newload = GetPlayerLoad() + addedload;
4589 SetPlayerLoad(newload);
4590
4591 // Do not need -> Log is in SetPlayerLoad
4592 //PrintString(ToString(this) + "'s load weight is " + ToString(m_CargoLoad) + " g.");
4593 }
4594
4596 {
4597 return GetInventory().HasEntityInInventory(entity);
4598 }
4599
4601 {
4602 if (GetGame().IsMultiplayer())
4603 {
4605 switch (t)
4606 {
4607 case DayZPlayerInstanceType.INSTANCETYPE_AI_SINGLEPLAYER:
4608 return false;
4609 case DayZPlayerInstanceType.INSTANCETYPE_CLIENT:
4610 case DayZPlayerInstanceType.INSTANCETYPE_SERVER:
4611 case DayZPlayerInstanceType.INSTANCETYPE_AI_SERVER:
4612 case DayZPlayerInstanceType.INSTANCETYPE_AI_REMOTE:
4613 case DayZPlayerInstanceType.INSTANCETYPE_REMOTE:
4614 return true; // Might help mitigate "megabugged" (desync)
4615
4616 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " NeedInventoryJunctureFromServer item=" + Object.GetDebugName(item) + " currPar=" + currParent + " newPar=" + newParent);
4617
4618 bool i_owned = GetHumanInventory().HasEntityInInventory(item);
4619
4620 bool cp_owned = false;
4621 if (currParent)
4622 cp_owned = GetHumanInventory().HasEntityInInventory(currParent);
4623
4624 bool np_owned = false;
4625 if (newParent)
4626 np_owned = GetHumanInventory().HasEntityInInventory(newParent);
4627
4628 bool all_owned = i_owned && cp_owned && (np_owned || (newParent == null));
4629 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " NeedInventoryJunctureFromServer=" + !all_owned + " i_pwn=" + i_owned + " cp_pwn=" + cp_owned + " np_pwn=" + np_owned);
4630
4631 return !all_owned;
4632 default:
4633 Error("[syncinv] unsupported instance type t=" + t);
4634 break;
4635 }
4636 }
4637 return false;
4638 }
4639
4640
4641 override protected float GetWeightSpecialized(bool forceRecalc = false)
4642 {
4643 float totalWeight = super.GetWeightSpecialized(forceRecalc);
4644
4645 ItemBase itemHands = GetItemInHands();
4646 if (itemHands) // adds weight of item carried in hands
4647 totalWeight += itemHands.GetWeightEx(forceRecalc);
4648#ifdef DEVELOPER
4649 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
4650 {
4651 float itemInHandsWeight = totalWeight - super.GetWeightSpecialized(forceRecalc);
4652 WeightDebugData dta = WeightDebug.GetWeightDebug(this);
4653 dta.SetCalcDetails("TMan: " + (super.GetWeightSpecialized(forceRecalc) + itemInHandsWeight) + "(contents weight[includes item in hands])");
4654 }
4655#endif
4656 return totalWeight;
4657 }
4658
4660 {
4661 const int VISIBILITY_SLOTS_COUNT = 10;
4662
4663 int attcount = GetInventory().AttachmentCount();
4664 float sumVisibility = 0;
4665 float countVisibility = 0;
4666 float visibilityMean = 0;
4667
4668 if (attcount > 0)
4669 {
4670 for (int att = 0; att < attcount; att++)
4671 {
4672 EntityAI attachment = GetInventory().GetAttachmentFromIndex(att);
4673 if (attachment.IsClothing())
4674 {
4677 sumVisibility += clothing.GetItemVisibility();
4679 }
4680 }
4681
4683 SetVisibilityCoef(visibilityMean);
4684 }
4685 else
4686 {
4687 visibilityMean = 1;
4688 SetVisibilityCoef(visibilityMean);
4689 }
4690 }
4691
4693 {
4694 m_VisibilityCoef = pVisibility;
4695 }
4696
4698 {
4699 return m_VisibilityCoef;
4700 }
4701
4702
4704 {
4705 return m_Shakes;
4706 }
4707
4708
4714
4720
4726
4732
4738
4740 /*
4741 EStatLevels GetImmunityLevel()
4742 {
4743 float immunity = GetImmunity();
4744
4745 EStatLevels level;
4746 if (immunity > PlayerConstants.IMMUNITY_THRESHOLD_LEVEL_HIGH)
4747 {
4748 level = EStatLevels.GREAT;
4749 }
4750 else if (immunity > PlayerConstants.IMMUNITY_THRESHOLD_LEVEL_NORMAL)
4751 {
4752 level = EStatLevels.HIGH;
4753 }
4754 else if (immunity > PlayerConstants.IMMUNITY_THRESHOLD_LEVEL_LOW)
4755 {
4756 level = EStatLevels.MEDIUM;
4757 }
4758 else if (immunity > PlayerConstants.IMMUNITY_THRESHOLD_LEVEL_CRITICAL)
4759 {
4760 level = EStatLevels.LOW;
4761 }
4762 else
4763 {
4764 level = EStatLevels.CRITICAL;
4765 }
4766
4767 if (m_ImmunityBoosted && level != EStatLevels.GREAT)
4768 {
4769 level--;
4770 }
4771 return level;
4772 }
4773 */
4774
4782
4783 //-------------------------------------
4790
4791
4793 {
4794 float health = GetHealth("", "");
4795 float health_max = GetMaxHealth("", "");
4797 }
4798
4800 {
4801 float toxicity = GetStatToxicity().Get();
4802 float toxicity_max = GetStatToxicity().GetMax();
4804 }
4805
4807 {
4808 float blood = GetHealth("", "Blood");
4809 float blood_max = GetMaxHealth("", "Blood");
4811 }
4812
4814 {
4815 float energy = GetStatEnergy().Get();
4816 float energy_max = GetStatEnergy().GetMax();
4818 }
4819
4821 {
4822 float water = GetStatWater().Get();
4823 float water_max = GetStatWater().GetMax();
4825 }
4826
4827 //------------------------------------
4828
4829 float GetStatLevelBorders(float stat_value, float critical, float low, float normal, float high, float max)
4830 {
4831 if (stat_value <= critical)
4832 return Math.InverseLerp(0, critical, stat_value);
4833 if (stat_value <= low)
4835 if (stat_value <= normal)
4837 if (stat_value <= high)
4840 }
4841
4842 EStatLevels GetStatLevel(float stat_value, float critical, float low, float normal, float high)
4843 {
4844 if (stat_value <= critical)
4845 return EStatLevels.CRITICAL;
4846 if (stat_value <= low)
4847 return EStatLevels.LOW;
4848 if (stat_value <= normal)
4849 return EStatLevels.MEDIUM;
4850 if (stat_value <= high)
4851 return EStatLevels.HIGH;
4852 return EStatLevels.GREAT;
4853 }
4854
4856 {
4857 m_ImmunityBoosted = boosted;
4858 }
4859
4860
4863 {
4864 float immunity;
4865 if (GetPlayerStats())
4866 {
4867 float max_health = GetMaxHealth("GlobalHealth", "Health") + 0.01;//addition to prevent divisioin by zero in case of some messup
4868 float max_blood = GetMaxHealth("GlobalHealth", "Blood") + 0.01;//addition to prevent divisioin by zero in case of some messup
4869 float energy_normalized = GetStatEnergy().Get() / PlayerConstants.SL_ENERGY_MAX;
4870 float water_normalized = GetStatWater().Get() / PlayerConstants.SL_WATER_MAX;
4871 float health_normalized = GetHealth("GlobalHealth", "Health") / max_health;
4872 float blood_normalized = GetHealth("GlobalHealth", "Blood") / max_blood;
4874 immunity = immunity / 4;//avg
4875 immunity = Math.Clamp(immunity, 0, 1);
4876 }
4877 return immunity;
4878 }
4879
4881 {
4882 return m_MovementState.m_iMovement == DayZPlayerConstants.MOVEMENT_SPRINT);
4883 }
4884
4886 {
4887 ItemBase item = GetItemInHands();
4888 if (IsRaised() || (item && item.IsHeavyBehaviour()))
4889 return false;
4890
4891 if (item && GetThrowing() && GetThrowing().IsThrowingModeEnabled())
4892 return false;
4893
4894 if (GetBrokenLegs() != eBrokenLegs.NO_BROKEN_LEGS)
4895 return false;
4896
4897 return true;
4898 }
4899
4901 {
4902 return m_MovementState.IsInProne();
4903 }
4904
4906 {
4907 return m_MovementState.IsInRaisedProne();
4908 }
4909
4911 {
4912 return m_MovementState.IsLeaning();
4913 }
4914
4916 {
4917 return GetCommand_Move() && GetCommand_Move().IsInRoll());
4918 }
4919
4920 /*
4921 override bool IsRaised()
4922 {
4923 //GetMovementState(m_MovementState);
4924 return m_MovementState.IsRaised();
4925 }
4926 */
4927
4928
4930 {
4931 return m_MovementState.m_CommandTypeId == DayZPlayerConstants.COMMANDID_CLIMB;
4932 }
4933
4935 {
4936 return m_MovementState.m_CommandTypeId == DayZPlayerConstants.COMMANDID_FALL;
4937 }
4938 override bool IsFighting()
4939 {
4940 return m_IsFighting;
4941 }
4942
4944 {
4945 return m_EmoteManager && m_EmoteManager.IsEmotePlaying();
4946 }
4947
4949 {
4950 return IsRuined();
4951 }
4952
4958 {
4959 return m_AnimCommandStarting & mask;
4960 }
4961
4963 {
4964 if (!m_FightEndBlendTimer)
4965 m_FightEndBlendTimer = new Timer();
4966 if (!m_FightEndBlendTimer.IsRunning())
4967 m_FightEndBlendTimer.Run(PlayerConstants.MELEE2_MOVEMENT_BLEND_DELAY, this, "EndFighting");
4968 }
4969
4971 {
4972 m_IsFighting = false;
4973 }
4974
4976 {
4977 //on-hit drop of melee weapons
4978 //bayonets & buttstocks
4979 if (item && item.GetHierarchyParent() && item.GetHierarchyParent().IsWeapon() && item.IsRuined()/*&& item.FindAttachmentBySlotName()*/)
4980 {
4981 PlayAttachmentDropSound();
4982 return DropItem(item);
4983 }
4984 //handheld items themselves
4985 if (item && item == GetItemInHands() && item.IsRuined())
4986 return PredictiveDropEntity(item);
4987 return false;
4988 }
4989
4991 {
4992 //TODO
4993 }
4994
4995 // -------------------------------------------------------------------------
5000
5001 // -------------------------------------------------------------------------
5003 {
5004 super.OnRPC(sender, rpc_type, ctx);
5005
5006 switch (rpc_type)
5007 {
5008#ifndef SERVER
5009
5010 case ERPCs.RPC_SYNC_DISPLAY_STATUS:
5011 if (GetVirtualHud())
5012 GetVirtualHud().OnRPC(ctx);
5013 break;
5014
5015 case ERPCs.RPC_PLAYER_SYMPTOM_ON:
5016 if (GetSymptomManager())
5017 GetSymptomManager().OnRPC(ERPCs.RPC_PLAYER_SYMPTOM_ON, ctx);
5018 break;
5019
5020 case ERPCs.RPC_PLAYER_SYMPTOM_OFF:
5021 if (GetSymptomManager())
5022 GetSymptomManager().OnRPC(ERPCs.RPC_PLAYER_SYMPTOM_OFF, ctx);
5023 break;
5024
5025 case ERPCs.RPC_DAMAGE_VALUE_SYNC:
5026 if (m_TrasferValues)
5027 m_TrasferValues.OnRPC(ctx);
5028 break;
5029
5030 case ERPCs.RPC_USER_ACTION_MESSAGE:
5031 if (!GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
5032 break;
5033 if (ctx.Read(m_UAParamMessage))
5034 {
5035 string actiontext = m_UAParamMessage.param1;
5036 MessageAction(actiontext);
5037 }
5038 break;
5039
5040 case ERPCs.RPC_SOFT_SKILLS_SPECIALTY_SYNC:
5042 ctx.Read(p_synch);
5043 float specialty_level = p_synch.param1;
5044 GetSoftSkillsManager().SetSpecialtyLevel(specialty_level);
5045 break;
5046
5047 case ERPCs.RPC_SOFT_SKILLS_STATS_SYNC:
5049 ctx.Read(p_debug_synch);
5050 float general_bonus_before = p_debug_synch.param1;
5051 float general_bonus_after = p_debug_synch.param2;
5052 float last_UA_value = p_debug_synch.param3;
5053 float cooldown_value = p_debug_synch.param4;
5054 float cooldown_active = p_debug_synch.param5;
5055 GetSoftSkillsManager().SetGeneralBonusBefore(general_bonus_before);
5056 GetSoftSkillsManager().SetGeneralBonusAfter(general_bonus_after);
5057 GetSoftSkillsManager().SetLastUAValue(last_UA_value);
5058 GetSoftSkillsManager().SetCoolDownValue(cooldown_value);
5059 GetSoftSkillsManager().SetCoolDown(cooldown_active);
5060 break;
5061
5062 case ERPCs.RPC_WARNING_ITEMDROP:
5063 {
5064 if (GetGame().IsClient() && GetGame().GetUIManager() && !GetGame().GetUIManager().FindMenu(MENU_WARNING_ITEMDROP))
5065 {
5066 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).Call(GetGame().GetUIManager().EnterScriptedMenu, MENU_WARNING_ITEMDROP, null);
5067 GetGame().GetMission().AddActiveInputExcludes({"menu"});
5068 }
5069 break;
5070 }
5071
5072 case ERPCs.RPC_WARNING_TELEPORT:
5073 {
5074 if (GetGame().IsClient() && GetGame().GetUIManager() && !GetGame().GetUIManager().FindMenu(MENU_WARNING_TELEPORT))
5075 {
5076 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).Call(GetGame().GetUIManager().EnterScriptedMenu, MENU_WARNING_TELEPORT, null);
5077 GetGame().GetMission().AddActiveInputExcludes({"menu"});
5078 }
5079 break;
5080 }
5081 case ERPCs.RPC_INIT_SET_QUICKBAR:
5083 if (ctx.Read(count));
5084 {
5085 for (int i = 0; i < count.param1 ; i++)
5086 m_QuickBarBase.OnSetEntityRPC(ctx);
5087 }
5088 break;
5089
5090 case ERPCs.RPC_SYNC_THERMOMETER:
5091 {
5092 float value;
5093 if (ctx.Read(value))
5094 m_Hud.SetTemperature(value.ToString() + "#degrees_celsius");
5095 break;
5096 }
5097
5098
5099 case ERPCs.RPC_CHECK_PULSE:
5103 pulse = EPulseType.REGULAR;
5104 else
5105 pulse = EPulseType.IRREGULAR;
5106
5108 if (m_CheckPulseLastTarget)
5109 m_CheckPulseLastTarget.SetLastUAMessage(ActionCheckPulse.GetPulseMessage(pulse, blood_level));
5110 break;
5111
5113 //woodcutting
5114 case PlantType.TREE_HARD:
5115 SoundHardTreeFallingPlay();
5116 break;
5117
5118 case PlantType.TREE_SOFT:
5119 SoundSoftTreeFallingPlay();
5120 break;
5121
5122 case PlantType.BUSH_HARD:
5123 SoundHardBushFallingPlay();
5124 break;
5125
5126 case PlantType.BUSH_SOFT:
5127 SoundSoftBushFallingPlay();
5128 break;
5129
5130 case ERPCs.RPC_DEBUG_MONITOR_FLT:
5131 if (m_DebugMonitorValues)
5132 m_DebugMonitorValues.OnRPCFloat(ctx);
5133 break;
5134
5135 case ERPCs.RPC_DEBUG_MONITOR_STR:
5136 if (m_DebugMonitorValues)
5137 m_DebugMonitorValues.OnRPCString(ctx);
5138 break;
5139#endif
5140
5141
5142 /*
5143 case ERPCs.RPC_CRAFTING_INVENTORY_INSTANT:
5144 ref Param3<int, ItemBase, ItemBase> craftParam = new Param3<int, ItemBase, ItemBase>(-1, NULL, NULL);
5145 if (ctx.Read(craftParam))
5146 {
5147 m_ModuleRecipesManager.PerformRecipeServer(craftParam.param1, craftParam.param2, craftParam.param3, this);
5148 }
5149 break;
5150 */
5151
5152
5153#ifdef DIAG_DEVELOPER
5154 case ERPCs.DEV_RPC_AGENT_RESET:
5155 {
5156 bool val;
5157 if (ctx.Read(val))
5158 m_AgentPool.RemoveAllAgents();
5159 break;
5160 }
5161
5162 case ERPCs.DEV_PLAYER_DEBUG_REQUEST:
5163 {
5165 plugin_remote_server.OnRPC(ctx, this);
5166 break;
5167 }
5168
5169 case ERPCs.DEV_PLAYER_DEBUG_DATA:
5170 {
5172 PluginDeveloper plugin_dev = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
5173 if (plugin_dev.m_ScriptConsole)
5174 plugin_dev.m_ScriptConsole.OnRPCEx(rpc_type, ctx);
5175 else
5177 break;
5178 }
5179
5180 case ERPCs.DEV_AGENT_GROW:
5181 {
5182 m_AgentPool.RemoteGrowRequestDebug(ctx);
5183 break;
5184 }
5185
5186 case ERPCs.RPC_ITEM_DIAG_CLOSE:
5187 {
5189 mid.StopWatchRequest(this);
5190 break;
5191 }
5192
5194 case ERPCs.DEV_REQUEST_UTS_DEBUG:
5195 {
5196 PluginUniversalTemperatureSourceServer plugin_uts_server = PluginUniversalTemperatureSourceServer.Cast(GetPlugin(PluginUniversalTemperatureSourceServer));
5197 plugin_uts_server.OnRPC(ctx, this);
5198 break;
5199 }
5200
5201 case ERPCs.DEV_UTS_DEBUG_DATA:
5202 {
5203 PluginUniversalTemperatureSourceClient plugin_uts_client = PluginUniversalTemperatureSourceClient.Cast(GetPlugin(PluginUniversalTemperatureSourceClient));
5204 plugin_uts_client.OnRPC(ctx);
5205 break;
5206 }
5208#endif
5209
5210#ifdef DEVELOPER
5211 case ERPCs.DEV_RPC_SERVER_SCRIPT:
5212 {
5213 //PluginItemDiagnostic plugin = PluginItemDiagnostic.Cast(GetPlugin(PluginItemDiagnostic));
5214 //SetDebugDeveloper_item(plugin.GetWatchedItem(this));//!! needs to be inside DEVELOPER ifdef
5215
5217 {
5218 _player = this;
5219 string code = CachedObjectsParams.PARAM1_STRING.param1;
5220 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
5222 RPCSingleParam(ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT, CachedObjectsParams.PARAM1_BOOL, true, GetIdentity());
5223 }
5224 break;
5225 }
5226
5227 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
5228 {
5229 PluginDeveloper dev = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
5230 if (dev.m_ScriptConsole)
5231 dev.m_ScriptConsole.OnRPCEx(rpc_type, ctx);
5232 break;
5233 }
5234
5235 case ERPCs.DEV_SET_DEV_ITEM:
5236 {
5238 if (ctx.Read(ent) && ent.param1)
5239 {
5241 mid2.RegisterDebugItem(ent.param1, this);
5242 }
5243 //SetDebugDeveloper_item(this);
5244 break;
5245 }
5246
5247 case ERPCs.RPC_ITEM_DIAG:
5248 {
5250 if (ctx.Read(p1))
5251 {
5253 plgn.OnRPC(p1.param1, ctx);
5254 }
5255 break;
5256 }
5257#endif
5258 }
5259
5260#ifdef DIAG_DEVELOPER
5261 PluginDeveloper module_rc = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
5262 if (module_rc)
5263 module_rc.OnRPC(this, rpc_type, ctx);
5264
5265 PluginDeveloperSync module_rcs = PluginDeveloperSync.Cast(GetPlugin(PluginDeveloperSync));
5266 if (module_rcs)
5267 module_rcs.OnRPC(this, rpc_type, ctx);
5268
5269#ifdef SERVER
5271#else
5273#endif
5274
5275 if (plugin_diag_menu)
5276 plugin_diag_menu.OnRPC(this, rpc_type, ctx);
5277#endif
5278 }
5279
5281 {
5282 super.OnGameplayDataHandlerSync();
5283
5284 UpdateLighting();
5285 //Print("setting respawn to " + CfgGameplayHandler.GetDisableRespawnDialog());
5286 GetGame().GetMission().SetRespawnModeClient(CfgGameplayHandler.GetDisableRespawnDialog());//TODO: maybe move to mission/game ?
5288 }
5289
5291 {
5292 Mission mission = GetGame().GetMission();
5293 if (mission)
5294 {
5296 if (wLighting)
5297 wLighting.SetGlobalLighting(CfgGameplayHandler.GetLightingConfig());
5298 }
5299 }
5300
5302 {
5303 if (enable) // enable
5304 {
5305 // We assume that if this is set to true the PPE is already active
5306 if (m_ContaminatedAreaEffectEnabled == enable)
5307 return;
5308
5309 if (aroundId != 0)
5310 {
5311 if (!m_ContaminatedAroundPlayer)
5312 m_ContaminatedAroundPlayer = ParticleManager.GetInstance().PlayInWorld(aroundId, GetPosition());
5313 // First entry in an area with dynamic tweaks to particles
5314 if (partDynaUpdate)
5315 m_ContaminatedAroundPlayer.SetParameter(0, EmitorParam.BIRTH_RATE, newBirthRate);
5316 }
5317
5318 if (!m_ContaminatedAroundPlayerTiny && tinyId != 0)
5319 m_ContaminatedAroundPlayerTiny = ParticleManager.GetInstance().PlayInWorld(tinyId, GetPosition());
5320
5321 if (ppeIdx != -1)
5322 {
5324 if (Class.CastTo(ppeRequester, PPERequesterBank.GetRequester(ppeIdx)))
5325 ppeRequester.Start();
5326 }
5327
5328 // We start playing the ambient sound
5329 if (!m_AmbientContamination && soundset != "")
5330 PlaySoundSetLoop(m_AmbientContamination, soundset, 0.1, 0.1);
5331
5332 }
5333 else // disable
5334 {
5335 if (m_ContaminatedAroundPlayer)
5336 {
5337 m_ContaminatedAroundPlayer.Stop();
5338 m_ContaminatedAroundPlayer = null;
5339 }
5340
5341 if (m_ContaminatedAroundPlayerTiny)
5342 {
5343 m_ContaminatedAroundPlayerTiny.Stop();
5344 m_ContaminatedAroundPlayerTiny = null;
5345 }
5346 if (ppeIdx != -1)
5347 PPERequesterBank.GetRequester(ppeIdx).Stop(new Param1<bool>(true)); //fade out
5348
5349 // We stop the ambient sound
5350 if (m_AmbientContamination)
5351 StopSoundSet(m_AmbientContamination);
5352
5353 // We make sure to reset the state
5354 }
5355 m_ContaminatedAreaEffectEnabled = enable;
5356 }
5357
5362
5363 // -------------------------------------------------------------------------
5365 {
5366 UpdateCorpseStateVisual();
5367 if (m_CorpseState > 0)
5368 SetDecayEffects(Math.AbsInt(m_CorpseState));
5369 else if (m_CorpseState < 0)
5370 SetDecayEffects();//no params means remove the effects
5371 m_CorpseStateLocal = m_CorpseState;
5372 }
5373
5374 // -------------------------------------------------------------------------
5375 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
5376 {
5377 super.EEHealthLevelChanged(oldLevel, newLevel, zone);
5378 if (!GetGame().IsDedicatedServer())
5379 {
5381 ClearLastUAMessage();
5382 if (m_CorpseState != 0)
5383 GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(UpdateCorpseState, 0, false);
5384 }
5385 }
5386
5387
5388 // -------------------------------------------------------------------------
5390 {
5391 super.OnVariablesSynchronized();
5392 if (m_ModuleLifespan)
5393 {
5394 m_ModuleLifespan.SynchLifespanVisual(this, m_LifeSpanState, m_HasBloodyHandsVisible, m_HasBloodTypeVisible, m_BloodType);
5395
5396 if (m_LifespanLevelLocal != m_LifeSpanState) //client solution, lifespan level changed
5397 {
5398 m_LifespanLevelLocal = m_LifeSpanState;
5399 UpdateHairSelectionVisibility();
5400 }
5401 }
5402
5403 CheckSoundEvent();
5404 if (GetBleedingManagerRemote() && IsPlayerLoaded())
5405 GetBleedingManagerRemote().OnVariablesSynchronized(GetBleedingBits());
5406
5407 if (m_CorpseStateLocal != m_CorpseState && (IsPlayerLoaded() || IsControlledPlayer()))
5408 UpdateCorpseState();
5409
5410 if (m_RefreshAnimStateIdx != m_LocalRefreshAnimStateIdx)
5411 {
5412 RefreshHandAnimationState(396); //mean animation blend time
5413 m_LocalRefreshAnimStateIdx = m_RefreshAnimStateIdx;
5414 }
5415 if (m_InsideEffectArea != m_InsideEffectAreaPrev)
5416 {
5417 if (m_InsideEffectArea)
5418 OnPlayerIsNowInsideEffectAreaBeginClient();
5419 else
5420 OnPlayerIsNowInsideEffectAreaEndClient();
5421 m_InsideEffectAreaPrev = m_InsideEffectArea;
5422 }
5423
5424 //-------MODIFIERS START--------
5425 if (m_SyncedModifiers != m_SyncedModifiersPrev)
5426 {
5427 int diff = (m_SyncedModifiers & ~m_SyncedModifiersPrev) | (~m_SyncedModifiers & m_SyncedModifiersPrev);//XOR gets us a mask for modifiers that changed by either deactivating, or activating
5428
5429 if (eModifierSyncIDs.MODIFIER_SYNC_DROWNING & diff)//has this modifier's status as active/inactive changed ?
5430 {
5431 if (eModifierSyncIDs.MODIFIER_SYNC_DROWNING & m_SyncedModifiers)//is this modifier currently active ? if so, it means it's been just activated
5432 SetDrowning(true);
5433 else
5434 SetDrowning(false);
5435
5436 }
5437
5438 m_SyncedModifiersPrev = m_SyncedModifiers;
5439 }
5440 //-------MODIFIERS END--------
5441
5442 HandleBrokenLegsSync();
5443
5445 ItemBase itemHands = GetItemInHands();
5446 if (itemHands)
5447 {
5448 RemotelyActivatedItemBehaviour raib = itemHands.GetRemotelyActivatedItemBehaviour();
5449 if (raib)
5450 raib.OnVariableSynchronized();
5451 }
5452 }
5453
5456 {
5457 return (m_SyncedModifiers & m_SyncedModifiersPrev);
5458 }
5459
5461 {
5462 if (m_BrokenLegState != m_LocalBrokenState)
5463 {
5464 m_LocalBrokenState = m_BrokenLegState;
5465 bool initial = (m_BrokenLegState < 0);
5466 int state = GetBrokenLegs();
5467 if (state == eBrokenLegs.BROKEN_LEGS)
5468 {
5469 //Print(m_BrokenLegState);
5470 if (initial)// <0 values indicate initial activation
5471 {
5472 //Print("synced variables - inital activation of broken legs");
5473 BreakLegSound();
5474 }
5475 else
5476 {
5477 //Print("synced variables - secondary activation of broken legs");
5478 }
5479 }
5480 }
5481 }
5482
5483
5485 {
5487 GetInventory().EnumerateInventory(InventoryTraversalType.INORDER, items);
5488 foreach (EntityAI item : items)
5489 item.SetHealthMax("", "");
5490 }
5491
5492
5494 {
5495
5496 }
5497
5499 {
5500
5501 }
5502
5503 //--------------------------------------------------------------------------
5505 {
5506 //Print("PlayerBase | OnSelectPlayer()");
5507 m_PlayerSelected = true;
5508
5509 m_QuickBarBase.updateSlotsCount();
5510
5511 m_WeaponManager.SortMagazineAfterLoad();
5512
5513 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !GetGame().IsMultiplayer())
5514 {
5515 PlayerIdentity identity = GetIdentity();
5516
5517 if (identity)
5518 {
5519 m_CachedPlayerID = identity.GetId();
5520 m_CachedPlayerName = identity.GetName();
5521 }
5522
5524 SetAITargetCallbacks(new AITargetCallbacksPlayer(this));
5525
5527 if (m_aQuickBarLoad)
5528 {
5529 int count = m_aQuickBarLoad.Count();
5531 params.Insert(paramCount);
5532 for (int i = 0; i < count; i++)
5533 {
5534 m_QuickBarBase.OnSetEntityNoSync(m_aQuickBarLoad.Get(i).param1, m_aQuickBarLoad.Get(i).param2);
5535 params.Insert(m_aQuickBarLoad.Get(i));
5536 }
5537
5538 if (count > 0 && GetGame().IsMultiplayer())
5539 GetGame().RPC(this, ERPCs.RPC_INIT_SET_QUICKBAR, params, true, identity);
5540 m_aQuickBarLoad = NULL;
5541 }
5542
5543 GetSoftSkillsManager().InitSpecialty(GetStatSpecialty().Get());
5544 GetModifiersManager().SetModifiers(true);
5545
5546 SetSynchDirty();
5547
5548 if (GetGame().IsMultiplayer())
5549 {
5550 //Drop item warning
5551 if (m_ProcessUIWarning)
5552 {
5553 GetGame().RPCSingleParam(this, ERPCs.RPC_WARNING_ITEMDROP, null, true, identity);
5554 m_ProcessUIWarning = false;
5555 }
5556
5557 GetGame().GetMission().SyncRespawnModeInfo(identity);
5558 }
5559 }
5560
5561 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
5562 {
5563 m_ActionManager = new ActionManagerServer(this);
5564 m_ConstructionActionData = new ConstructionActionData();
5565
5566 CheckForGag();
5567 }
5568 else if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
5569 {
5570 m_ActionManager = new ActionManagerClient(this);
5571 m_CraftingManager = new CraftingManager(this, m_ModuleRecipesManager);
5572 m_ConstructionActionData = new ConstructionActionData();
5573
5574 }
5575 else if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_AI_SINGLEPLAYER)
5576 m_ActionManager = new ActionManagerServer(this);
5577
5578 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
5579 {
5580 //m_PlayerLightManager = new PlayerLightManager(this);
5581 if (GetGame().GetMission())
5582 {
5583 GetGame().GetMission().ResetGUI();
5584 // force update player
5585 GetDayZGame().GetBacklit().UpdatePlayer(true);
5586 }
5587
5588 m_DeathCheckTimer = new Timer();
5589 m_DeathCheckTimer.Run(0.1, this, "CheckDeath", null, true);
5591 CheckForBurlap();
5592
5593 int characterCount = GetGame().GetMenuData().GetCharactersCount() - 1;
5594 int idx = GetGame().GetMenuData().GetLastPlayedCharacter();
5596 GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(SetNewCharName);
5597
5598 GetGame().GetMission().EnableAllInputs(true);
5599
5600 m_PresenceNotifier = PluginPresenceNotifier.Cast(GetPlugin(PluginPresenceNotifier));
5601 m_PresenceNotifier.Init(this);
5602 OnGameplayDataHandlerSync();//only here for legacy reasons
5603 }
5604
5605#ifdef BOT
5606 m_Bot = new Bot(this);
5607 m_Bot.Start(true, new MyBotTrigger(this));
5608#endif
5609 }
5610
5611 override void SimulateDeath(bool state)
5612 {
5613 super.SimulateDeath(state);
5614
5615 m_UndergroundHandler = null;
5616 if (m_EffectWidgets)
5617 {
5618 m_EffectWidgets.StopAllEffects();
5619 m_EffectWidgets.ClearSuspendRequests();
5620 }
5621 }
5622
5624 {
5625 g_Game.GetMenuData().SaveCharacter(false, true);
5626 g_Game.GetMenuData().SetCharacterName(g_Game.GetMenuData().GetLastPlayedCharacter(), g_Game.GetMenuDefaultCharacterData(false).GetCharacterName());
5627 g_Game.GetMenuData().SaveCharactersLocal();
5628 }
5629
5631 {
5632 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
5633 {
5635 Class.CastTo(attachment, GetInventory().FindAttachment(InventorySlots.HEADGEAR));
5636
5638 if (Class.CastTo(req, PPERequesterBank.GetRequester(PPERequesterBank.REQ_BURLAPSACK)))
5639 {
5640 if (attachment)
5641 req.Start();
5642 else if (req.IsRequesterRunning())
5644 }
5645 }
5646 }
5647
5649 {
5650#ifdef SERVER
5651 Clothing item;
5652 Class.CastTo(item, GetInventory().FindAttachment(InventorySlots.MASK));
5653 if (!item)
5654 Class.CastTo(item, GetInventory().FindAttachment(InventorySlots.HEADGEAR));
5655
5656 if (item && item.IsObstructingVoice())
5657 item.MutePlayer(this, true);
5658 else //should probably check for relevant types before removing mumbling and obstruction specifically..
5659 {
5660 GetGame().SetVoiceEffect(this, VoiceEffectMumbling, false);
5661 GetGame().SetVoiceEffect(this, VoiceEffectObstruction, false);
5662 }
5663#endif
5664 }
5665
5667 {
5668 if (is_start)
5669 m_EffectWidgets.ResetMaskUpdateCount();
5670 float resistance = 0;
5671 if (mask.HasIntegratedFilter() || mask.IsExternalFilterAttached())
5672 resistance = 1 - mask.GetFilterQuantity01();
5673
5674
5675 m_EffectWidgets.OnVoiceEvent(resistance);
5676 m_EffectWidgets.IncreaseMaskUpdateCount();
5677
5678 }
5679
5680
5681 // -------------------------------------------------------------------------
5683 {
5684 if (m_EffectWidgets)
5685 {
5686 MaskBase mask = MaskBase.Cast(GetInventory().FindAttachment(InventorySlots.MASK));
5687 if (mask)
5688 {
5689 UpdateMaskBreathWidget(mask, true);
5690 //m_EffectWidgets.SetBreathIntensityStamina(GetStaminaHandler().GetStaminaCap(),GetStaminaHandler().GetStamina());
5691 }
5692 }
5693 }
5694
5695 // -------------------------------------------------------------------------
5698 {
5699 if (m_EffectWidgets)
5700 {
5701 MaskBase mask = MaskBase.Cast(GetInventory().FindAttachment(InventorySlots.MASK));
5702 if (mask)
5703 {
5704 if (m_EffectWidgets.m_MaskWidgetUpdateCount < 2 && callback.GetLength() > 2 && playback_time > 0.5)
5705 UpdateMaskBreathWidget(mask);
5706 }
5707 }
5708 }
5709
5710
5711 // -------------------------------------------------------------------------
5713 {
5714 if (super.OnInputUserDataProcess(userDataType, ctx))
5715 return true;
5716
5717 if (m_QuickBarBase.OnInputUserDataProcess(userDataType, ctx))
5718 return true;
5719
5720 if (m_WeaponManager.OnInputUserDataProcess(userDataType, ctx))
5721 return true;
5722
5723 if (HandleRemoteItemManipulation(userDataType, ctx))
5724 return true;
5725
5726 if (userDataType == INPUT_UDT_INVENTORY && GetHumanInventory().OnInputUserDataProcess(ctx))
5727 return true;
5728
5729 if (TogglePlacingServer(userDataType, ctx))
5730 return true;
5731
5732 if (ResetADSPlayerSync(userDataType, ctx))
5733 return true;
5734
5735 string uid;
5736 bool mute;
5738 {
5739 if (ctx.Read(uid) && ctx.Read(mute))
5740 {
5741 GetGame().MutePlayer(uid, GetIdentity().GetPlainId(), mute);
5742 // commented because plainID should not be present in logs
5743 //Print("Player: " + GetIdentity().GetId() + " set mute for " + uid + " to " + mute);
5744 }
5745 }
5746
5747 if (m_EmoteManager && userDataType == INPUT_UDT_GESTURE)
5748 return m_EmoteManager.OnInputUserDataProcess(userDataType, ctx);
5749
5751 return ReadLiftWeaponRequest(userDataType, ctx);
5752
5753 if (m_ActionManager)
5754 return m_ActionManager.OnInputUserDataProcess(userDataType, ctx);
5755 return false;
5756 }
5757
5765
5767 {
5769 {
5770 int type = -1;
5773 bool use_stack_max = false;
5774 int slot_id = -1;
5775
5776 if (!ctx.Read(type))
5777 return false;
5778
5779 if (type == 4)
5780 {
5781 if (!ctx.Read(item1))
5782 return false;
5784 if (dst.ReadFromContext(ctx))
5785 {
5786 //Print(InventoryLocation.DumpToStringNullSafe(dst));
5787 bool dummy;
5788 if (ctx.Read(dummy))
5789 item1.SplitItemToInventoryLocation(dst);
5790 else
5791 item1.SplitIntoStackMaxToInventoryLocation(dst);
5792 return true;
5793 }
5794 return false;
5795 }
5796
5797 if (!ctx.Read(item1))
5798 return false;
5799 if (!ctx.Read(item2))
5800 return false;
5801 if (!ctx.Read(use_stack_max))
5802 return false;
5803 if (!ctx.Read(slot_id))
5804 return false;
5805
5806 if (type == -1 && item1 && item2)//combine
5807 item1.CombineItems(item2, use_stack_max);
5808 else if (type == 1 && item1)
5809 {
5810 if (use_stack_max)
5811 item1.SplitIntoStackMax(item2, slot_id, this);
5812 else
5813 item1.SplitItem(this);
5814 }
5815 else if (type == 2 && item1)
5816 {
5817 int row, col;
5818 if (!ctx.Read(row))
5819 return false;
5820 if (!ctx.Read(col))
5821 return false;
5822 item1.SplitIntoStackMaxCargo(item2, slot_id, row, col);
5823 }
5824 else if (type == 3 && item1)
5825 item1.SplitIntoStackMaxHands(this);
5826 return true;
5827 }
5828 return false;
5829 }
5830
5831 // -------------------------------------------------------------------------
5833 {
5834 if (GetHumanInventory())
5835 return ItemBase.Cast(GetHumanInventory().GetEntityInHands());
5836 return null;
5837
5838 }
5839
5840 //--------------------------------------------------------------------------
5841
5842
5844 {
5845 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !GetGame().IsMultiplayer())
5846 {
5847 bool is_AI = GetGame().IsKindOf(object_name, "DZ_LightAI");
5848 if (is_AI)
5849 return SpawnAI(object_name, pos);
5850 else
5851 {
5853 vector mtx[4];
5855 mtx[3] = pos;
5856 inv_loc.SetGround(NULL, mtx);
5857 //return GetGame().SpawnEntity(object_name, inv_loc, ECE_PLACE_ON_SURFACE, RF_DEFAULT);
5858 return EntityAI.Cast(GetGame().CreateObjectEx(object_name, inv_loc.GetPos(), ECE_PLACE_ON_SURFACE));
5859 }
5860 }
5861 return null;
5862 }
5863
5865 {
5866 vector position = GetPosition() + (GetDirection() * distance);
5867 return SpawnEntityOnGroundPos(object_name, position);
5868 }
5869
5871 {
5872 bool is_ai = GetGame().IsKindOf(object_name, "DZ_LightAI");
5873 if (is_ai)
5874 return EntityAI.Cast(GetGame().CreateObjectEx(object_name, pos, ECE_PLACE_ON_SURFACE | ECE_INITAI | ECE_EQUIP_ATTACHMENTS));
5875 return NULL;
5876 }
5877
5891 /*EntityAI SpawnItem (string object_name, bool full_quantity, float distance = 0, bool usePosition = false, vector pos = "0 0 0", EntityAI attachmentObject = NULL)
5892 {
5893 EntityAI entity = NULL;
5894
5895 // Creat Object
5896 bool is_ai = GetGame().IsKindOf(object_name, "DZ_LightAI");
5897 vector item_position;
5898 if (usePosition)
5899 {
5900 item_position = pos;
5901 }
5902 else
5903 {
5904 item_position = GetPosition() + (GetDirection() * distance);
5905 }
5906 entity = GetGame().CreateObject(object_name, item_position, false, is_ai);
5907
5908 if (!entity)
5909 {
5910 string s = "Cannot spawn entity: "+object_name;
5911 Print(s);
5912 //g_Game.GetUIManager().ShowDialog("Spawn error", "Cannot spawn item: "+object_name, 0, DBT_OK, DBB_YES, DMT_EXCLAMATION, this);
5913 return NULL;
5914 }
5915
5916 if (entity.IsInherited(ItemBase))
5917 {
5918 ItemBase item = entity;
5919
5920 // Set full quantity
5921 if (full_quantity)
5922 {
5923 item.SetQuantity(item.GetQuantityMax());
5924 }
5925
5926 // Spawn In Inventory
5927 if (spawn_type == SPAWNTYPE_INVENTORY)
5928 {
5929 TakeItemToInventory(item);
5930 }
5931 // Spawn In Hands
5932 if (spawn_type == SPAWNTYPE_HANDS)
5933 {
5934 TakeItemToHands(item);
5935 }
5936 // Spawn As Attachment
5937 if (spawn_type == SPAWNTYPE_ATTACHMENT)
5938 {
5939 Object cursor_obj = GetCursorObject();
5940 if (cursor_obj != NULL && cursor_obj.IsInherited(EntityAI))
5941 {
5942 EntityAI eai = (EntityAI)cursor_obj;
5943 eai.TakeEntityAsAttachment(item);
5944 }
5945 else if (attachmentObject != NULL)
5946 {
5947 attachmentObject.TakeEntityAsAttachment(item);
5948 }
5949 }
5950 }
5951
5952 return entity;
5953 }*/
5954
5955 //--------------------------------------------------------------------------
5957 {
5958 bool can_be_dropped = CanDropEntity(item);
5959 if (can_be_dropped)
5960 can_be_dropped = PredictiveDropEntity(item);
5961
5962 vector pos_spawn = GetPosition() + GetDirection();
5963 pos_spawn[0] = pos_spawn[0] + Math.RandomFloat(-0.2, 0.2);
5964 pos_spawn[2] = pos_spawn[2] + Math.RandomFloat(-0.2, 0.2);
5965
5966 item.SetPosition(pos_spawn);
5967 item.PlaceOnSurface();
5968 return can_be_dropped;
5969 }
5970
5971 // -------------------------------------------------------------------------
5982 EntityAI CreateInInventory(string item_name, string cargo_type = "", bool full_quantity = false) // TODO: Create item in cargo
5983 {
5985 if (GetInventory().FindFirstFreeLocationForNewEntity(item_name, FindInventoryLocationType.ANY, inv_loc))
5987 return NULL;
5988 }
5989
5990
5991 // -------------------------------------------------------------------------
6000 /*ItemBase CopyInventoryItem(ItemBase orig_item)
6001 {
6002 ItemBase item = ItemBase.Cast(GetInventory().CreateInInventory(orig_item.GetType()));
6003 if (item == NULL)
6004 {
6005 return NULL;
6006 }
6007
6008 // Copy of quantity
6009 item.SetQuantity(orig_item.GetQuantity());
6010
6011 // Copy of damage
6012 item.SetHealth("", "", orig_item.GetHealth("", ""));
6013
6014 return item;
6015 }*/
6016
6018 {
6020 string t = src.GetType();
6021 if (GetInventory().FindFirstFreeLocationForNewEntity(t, FindInventoryLocationType.CARGO, loc))
6022 {
6023 bool locked = GetGame().HasInventoryJunctureDestination(this, loc);
6024 if (locked)
6025 {
6026 Print("Warning: Split: CreateCopyOfItemInInventory - Cannot create entity at locked inventory at loc=" + InventoryLocation.DumpToStringNullSafe(loc));
6027 return null;
6028 }
6029 ItemBase dst = ItemBase.Cast(GetInventory().LocationCreateLocalEntity(loc, t, ECE_IN_INVENTORY, RF_DEFAULT));
6030 if (dst)
6031 {
6032 MiscGameplayFunctions.TransferItemProperties(src, dst);
6033
6034 GetGame().RemoteObjectTreeCreate(dst);
6035
6036 Print("CreateCopyOfItemInInventory - created " + dst.GetName() + " at loc=" + InventoryLocation.DumpToStringNullSafe(loc));
6037 }
6038 return dst;
6039 }
6040 return NULL;
6041 }
6042
6044 {
6045 return CreateCopyOfItemInInventoryOrGroundEx(src, false);
6046 }
6047
6049 {
6050 ItemBase dst = CreateCopyOfItemInInventory(src);
6051 if (!dst)
6052 {
6053 dst = ItemBase.Cast(SpawnEntityOnGroundPos(src.GetType(), this.GetPosition()));
6054 dst.PlaceOnSurface();
6055 dst.SetResultOfSplit(markItemAsSplitResult);
6056 MiscGameplayFunctions.TransferItemProperties(src, dst);
6057 }
6058
6059 return dst;
6060 }
6061
6062
6063 // -------------------------------------------------------------------------
6070 void Message(string text, string style)
6071 {
6072 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
6073 GetGame().ChatMP(this, text, style);
6074 else
6075 GetGame().Chat(text, style);
6076 }
6077
6078 // -------------------------------------------------------------------------
6079 void MessageStatus(string text)
6080 {
6081 Message(text, "colorStatusChannel");
6082 }
6083
6084 // -------------------------------------------------------------------------
6085 void MessageAction(string text)
6086 {
6087 Message(text, "colorAction");
6088 }
6089
6090 // -------------------------------------------------------------------------
6092 {
6093 Message(text, "colorFriendly");
6094 }
6095
6096 // -------------------------------------------------------------------------
6098 {
6099 Message(text, "colorImportant");
6100 }
6101
6103 {
6104 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
6105 {
6106#ifndef NO_GUI
6107 UIScriptedMenu menu = GetGame().GetUIManager().GetMenu();
6108 if (menu && (menu.GetID() == MENU_INVENTORY || menu.GetID() == MENU_INSPECT))
6109 {
6110 GetGame().GetUIManager().CloseAll();
6111 GetGame().GetMission().RemoveActiveInputExcludes({"inventory"}, false);
6112 GetGame().GetMission().RemoveActiveInputRestriction(EInputRestrictors.INVENTORY);
6113 }
6114#endif
6115 }
6116 }
6117
6118 // -------------------------------------------------------------------------
6127 override void ClearInventory()
6128 {
6129 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
6130 {
6131 GameInventory inv = PlayerBase.Cast(this).GetInventory();
6133 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
6134 for (int i = 0; i < items.Count(); i++)
6135 {
6136 ItemBase item = ItemBase.Cast(items.Get(i));
6137 if (item)
6138 GetGame().ObjectDelete(item);
6139 }
6140
6141 ItemBase item_in_hands = ItemBase.Cast(GetHumanInventory().GetEntityInHands());
6142
6143 if (item_in_hands)
6144 LocalDestroyEntityInHands();
6145 }
6146 }
6147
6150 {
6152 ItemBase item;
6153 GetInventory().EnumerateInventory(InventoryTraversalType.LEVELORDER, itemsArray);
6154 int count = itemsArray.Count();
6155
6156 for (int i = 0; i < itemsArray.Count(); i++)
6157 {
6158 Class.CastTo(item, itemsArray.Get(i));
6159
6160 if (item && !item.IsInherited(SurvivorBase))
6161 ServerDropEntity(item);
6162 }
6163 }
6164
6166 {
6167 string type;
6168 GetGame().ObjectGetType(this, type);
6169 return type;
6170 }
6171
6172 // --------------------------------------------------
6173 // Lifespan
6174 //---------------------------------------------------
6175
6177 {
6178 SetLastShavedSeconds(StatGet(AnalyticsManagerServer.STAT_PLAYTIME));
6179
6180 m_ModuleLifespan.UpdateLifespan(this, true);
6181 }
6182
6184 {
6185 if (!HasCoveredFaceForShave() && GetLifeSpanState())
6186 return true;
6187 else
6188 return false;
6189 }
6190
6191
6192 override void OnParticleEvent(string pEventType, string pUserString, int pUserInt)
6193 {
6194 super.OnParticleEvent(pEventType, pUserString, pUserInt);
6195
6196 if (!GetGame().IsDedicatedServer())
6197 {
6198 if (pUserInt == 123456) // 123456 is ID for vomiting effect. The current implementation is WIP.
6199 {
6200 PlayerBase player = PlayerBase.Cast(this);
6201 int boneIdx = player.GetBoneIndexByName("Head");
6202
6203 if (boneIdx != -1)
6204 {
6206
6207 if (m_SyncedModifiers & eModifierSyncIDs.MODIFIER_SYNC_CONTAMINATION2)
6208 eff = new EffVomitBlood();
6209 else
6210 eff = new EffVomit();
6211
6212 eff.SetDecalOwner(player);
6213 eff.SetAutodestroy(true);
6215 Particle p = eff.GetParticle();
6216 player.AddChild(p, boneIdx);
6217 }
6218 }
6219 }
6220 }
6221
6222
6224 {
6225 if (!ToDelete() && IsAlive() && !IsSwimming() && !m_IsDrowning)
6226 return true;
6227 return false;
6228 }
6229
6230
6232 {
6233 if (m_AddModifier != -1)
6234 {
6236 if (ad)
6237 ad.StartModifier(m_AddModifier);
6238
6239 m_AddModifier = -1;
6240 }
6241 }
6242
6244 {
6245 //Print("SpawnBreathVaporEffect:"+GetGame().GetTime());
6246 int boneIdx = GetBoneIndexByName("Head");
6247 if (boneIdx != -1)
6248 {
6249 Particle p;
6250 switch (m_BreathVapour)
6251 {
6252 case 1:
6253 p = ParticleManager.GetInstance().PlayInWorld(ParticleList.BREATH_VAPOUR_LIGHT, "-0.03 0.15 0");
6254 break;
6255 case 2:
6256 p = ParticleManager.GetInstance().PlayInWorld(ParticleList.BREATH_VAPOUR_MEDIUM, "-0.03 0.15 0");
6257 break;
6258 case 3:
6259 p = ParticleManager.GetInstance().PlayInWorld(ParticleList.BREATH_VAPOUR_HEAVY, "-0.03 0.15 0");
6260 break;
6261 default:
6262 break;
6263 }
6264
6265 if (p)
6266 AddChild(p, boneIdx);
6267 }
6268 }
6269
6270 // 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
6272 {
6273 int index = GetBoneIndexByName("head");
6274 vector pos = GetBonePositionWS(index);
6275 float depth = g_Game.GetWaterDepth(pos);
6276
6277 if (IsSwimming())
6279 else if (IsUnconscious())
6282 }
6283
6285 {
6286 bool state_changed;
6287 if (show_state != m_LifeSpanState)
6288 state_changed = true;
6289 m_LifeSpanState = show_state;
6290 SetSynchDirty();
6291
6292 if (state_changed) //server only, client solution in OnVariablesSynchronized()
6293 {
6294 //SendLifespanSyncEvent(m_LifeSpanState);
6295
6296 UpdateHairSelectionVisibility();
6297 }
6298 }
6299
6301 {
6302 return m_LifeSpanState;
6303 }
6304
6306 {
6307 return m_LastShavedSeconds;
6308 }
6309
6311 {
6312 m_LastShavedSeconds = last_shaved_seconds;
6313 }
6314
6316 {
6317 return IsExclusionFlagPresent(GetFaceCoverageShaveValues());
6318 }
6319
6322 {
6323 set<int> ret = new set<int>;
6324 ret.Insert(EAttExclusions.SHAVING_MASK_ATT_0);
6325 ret.Insert(EAttExclusions.SHAVING_HEADGEAR_ATT_0);
6326 //ret.Insert(EAttExclusions.SHAVING_EYEWEAR_ATT_0);
6327
6328 return ret;
6329 }
6330
6332 {
6333 return m_HasBloodyHandsVisible;
6334 }
6335
6337 {
6338 return m_HasBloodyHandsVisible;
6339 }
6340
6341 void SetBloodyHands(bool show)
6342 {
6343 SetBloodyHandsBase(show);
6344 }
6345
6347 {
6348 SetBloodyHandsBase(type);
6349 }
6350
6351 private void SetBloodyHandsBase(int type)
6352 {
6353 m_HasBloodyHandsVisible = type;
6354 SetSynchDirty();
6355
6356#ifdef DIAG_DEVELOPER
6357#ifndef SERVER
6358 if (IsControlledPlayer())
6359 {
6360 bool enable = type;
6361 DiagMenu.SetValue(DiagMenuIDs.LIFESPAN_BLOODY_HANDS, enable);
6362 }
6363#endif
6364#endif
6365 }
6366
6368 {
6369 InsertAgent(eAgents.SALMONELLA, 1);
6370 }
6371
6373 {
6374 return m_HasBloodTypeVisible;
6375 }
6376
6377 void SetBloodTypeVisible(bool show)
6378 {
6379 m_HasBloodTypeVisible = show;
6380 SetSynchDirty();
6381 }
6382
6384 {
6385 return m_BloodType;
6386 }
6387
6389 {
6391 SetSynchDirty();
6392 }
6393
6394 // --------------------------------------------------
6395 // Soft Skills
6396 //---------------------------------------------------
6397
6399 {
6400 return m_SoftSkillsManager;
6401 }
6402
6404 {
6405 if (IsPlayerSelected() && !IsAlive())
6406 {
6407 SimulateDeath(true);
6408 m_DeathCheckTimer.Stop();
6409 }
6410 }
6411
6412 // -------------------------------------------------------------------------
6413
6414 // --------------------------------------------------
6415 // AI Presence
6416 //---------------------------------------------------
6417
6420 {
6421 if (m_PresenceNotifier)
6422 return m_PresenceNotifier.GetNoisePresence();
6423
6424 return 0;
6425 }
6426
6427 // is a bit on in the persistent flags
6429 {
6430 return (m_PersistentFlags & bit);
6431 }
6432 // turn on/off a bit in the persistent flag
6434 {
6435 if (enable)//turn on bit
6436 m_PersistentFlags = (m_PersistentFlags | bit);
6437 else//turn off bit
6438 m_PersistentFlags = ((~bit) & m_PersistentFlags);
6439
6440 }
6441
6442
6443 // -------------------------------------------------------------------------
6444
6446 {
6447 return m_StoreLoadVersion;
6448 }
6449
6451 {
6452 //Print("OnStoreSave");
6453 if (GetGame().SaveVersion() < 102)
6454 {
6455 ctx.Write(ACT_STORE_SAVE_VERSION);//to be removed after we push 102+
6456 }
6457
6458 super.OnStoreSave(ctx);
6459
6460 GetHumanInventory().OnStoreSave(ctx); // FSM of hands
6461 OnStoreSaveLifespan(ctx);
6462
6463 if (GetDayZGame().IsServer() && GetDayZGame().IsMultiplayer())
6464 {
6465 GetPlayerStats().SaveStats(ctx);// save stats
6466 m_ModifiersManager.OnStoreSave(ctx);// save modifiers
6467 m_AgentPool.OnStoreSave(ctx);//save agents
6468 GetSymptomManager().OnStoreSave(ctx);//save states
6469 if (GetBleedingManagerServer())
6470 {
6471 GetBleedingManagerServer().OnStoreSave(ctx);//save bleeding sources
6472 }
6473 m_PlayerStomach.OnStoreSave(ctx);
6474 ctx.Write(GetBrokenLegs());
6475 //ctx.Write(m_LocalBrokenState);
6476 SaveAreaPersistenceFlag(ctx);
6477
6479 if (ladder)
6480 {
6481 ctx.Write(true);
6482 ctx.Write(ladder.GetLogoutPosition());
6483 }
6484 else
6485 ctx.Write(false);
6486
6488 arrowManager.Save(ctx);
6489 }
6490 }
6491
6492
6494 {
6495 if (GetModifiersManager())
6496 SetPersistentFlag(PersistentFlag.AREA_PRESENCE, GetModifiersManager().IsModifierActive(eModifiers.MDF_AREAEXPOSURE));//set the flag for player's presence in contaminated area
6497 ctx.Write(m_PersistentFlags);
6498 }
6499
6500
6501 override bool OnStoreLoad(ParamsReadContext ctx, int version)
6502 {
6503 //Print("---- PlayerBase OnStoreLoad START ----, version: "+version);
6504 m_aQuickBarLoad = new array<ref Param2<EntityAI, int>>;
6505
6506 // todo :: this should be after base call !!!!
6507 if (version < 102)//write removed in v. 102
6508 {
6509 if (!ctx.Read(m_StoreLoadVersion))
6510 return false;
6511 }
6512
6513 if (!super.OnStoreLoad(ctx, version))
6514 return false;
6515
6516 // FSM of hands
6517 if (!GetHumanInventory().OnStoreLoad(ctx, version))
6518 return false;
6519
6520 if (!OnStoreLoadLifespan(ctx, version))
6521 return false;
6522
6523 if (GetDayZGame().IsServer() && GetDayZGame().IsMultiplayer())
6524 {
6525 if (!GetPlayerStats().LoadStats(ctx, version)) // load stats
6526 {
6527 Print("---- failed to load PlayerStats ----");
6528 return false;
6529 }
6530
6531 if (version < m_ModifiersManager.GetStorageVersion())//load modifiers !! WILL CANCEL REST OF STREAM IF UNSUPPORTED VERSION !!
6532 {
6533 Print("---- failed to load ModifiersManager, unsupported version ----");
6534 return false;
6535 }
6536 else
6537 {
6538 if (!m_ModifiersManager.OnStoreLoad(ctx, version))
6539 {
6540 Print("---- failed to load ModifiersManager, read fail ----");
6541 return false;
6542 }
6543 }
6544
6545 if (version < m_AgentPool.GetStorageVersion())//load agents !! WILL CANCEL REST OF STREAM IF UNSUPPORTED VERSION !!
6546 {
6547 Print("---- failed to load AgentPool, unsupported version ----");
6548 return false;
6549 }
6550 else
6551 {
6552 if (!m_AgentPool.OnStoreLoad(ctx, version))
6553 {
6554 Print("---- failed to load AgentPool, read fail ----");
6555 return false;
6556 }
6557 }
6558
6559
6560 if (version < GetSymptomManager().GetStorageVersion())//load symptoms !! WILL CANCEL REST OF STREAM IF UNSUPPORTED VERSION !!
6561 {
6562 Print("---- failed to load SymptomManager, unsupported version ----");
6563 return false;
6564 }
6565 else
6566 {
6567 if (!GetSymptomManager().OnStoreLoad(ctx, version))
6568 {
6569 Print("---- failed to load SymptomManager, read fail ----");
6570 return false;
6571 }
6572 }
6573
6574 if (version < GetBleedingManagerServer().GetStorageVersion())//load bleeding manager !! WILL CANCEL REST OF STREAM IF UNSUPPORTED VERSION !!
6575 {
6576 Print("---- failed to load BleedingManagerServer, unsupported version ----");
6577 return false;
6578 }
6579 else
6580 {
6581 if (!GetBleedingManagerServer().OnStoreLoad(ctx, version))
6582 {
6583 Print("---- failed to load BleedingManagerServer, read fail ----");
6584 return false;
6585 }
6586 }
6587
6588 if (version < m_PlayerStomach.GetStorageVersion())//load PlayerStomach !! WILL CANCEL REST OF STREAM IF UNSUPPORTED VERSION !!
6589 {
6590 Print("---- failed to load PlayerStomach, unsupported version ----");
6591 return false;
6592 }
6593 else
6594 {
6595 if (!m_PlayerStomach.OnStoreLoad(ctx, version))
6596 {
6597 Print("---- failed to load PlayerStomach, read fail ----");
6598 return false;
6599 }
6600 }
6601
6602 //Check for broken leg value
6603 if (version >= 116)
6604 {
6605 if (!ctx.Read(m_BrokenLegState))
6606 return false;
6607 if (version <= 126)// WHILE >= 116
6608 {
6609 if (!ctx.Read(m_LocalBrokenState))
6610 return false;
6611 }
6612 }
6613 //Check for broken leg value
6614 if (version >= 125 && (!ctx.Read(m_PersistentFlags)))
6615 {
6616 Print("---- failed to load Persistent Flags, read fail ----");
6617 return false;
6618 }
6619
6620 if (version >= 131)
6621 {
6622 bool onLadder;
6623 if (!ctx.Read(onLadder))
6624 return false;
6625
6626 if (onLadder)
6627 {
6629 if (!ctx.Read(position))
6630 return false;
6631
6632 Hive hive = GetHive();
6633 if (!hive || !hive.CharacterIsLoginPositionChanged(this))
6635 }
6636 }
6637
6638 if (version >= 134)
6639 {
6641 arrowManager.Load(ctx);
6642 }
6643 }
6644
6645 Print("---- PlayerBase OnStoreLoad SUCCESS ----");
6646 return true;
6647 }
6648
6649 override void AfterStoreLoad()
6650 {
6651 GetHumanInventory().OnAfterStoreLoad();
6652 if (m_EmoteManager)
6653 m_EmoteManager.AfterStoreLoad();
6654 }
6655
6657 {
6658 ctx.Write(m_LifeSpanState);
6659 ctx.Write(m_LastShavedSeconds);
6660 ctx.Write(m_HasBloodyHandsVisible);
6661 ctx.Write(m_HasBloodTypeVisible);
6662 ctx.Write(m_BloodType);
6663 }
6664
6666 {
6667 int lifespan_state = 0;
6668 if (!ctx.Read(lifespan_state))
6669 return false;
6670 m_LifeSpanState = lifespan_state;
6671
6672 int last_shaved = 0;
6673 if (!ctx.Read(last_shaved))
6674 return false;
6675 m_LastShavedSeconds = last_shaved;
6676
6677 if (version < 122)
6678 {
6679 bool bloody_hands_old;
6680 if (!ctx.Read(bloody_hands_old))
6681 return false;
6682 m_HasBloodyHandsVisible = bloody_hands_old;
6683 }
6684 else
6685 {
6686 int bloody_hands = 0;
6687 if (!ctx.Read(bloody_hands))
6688 return false;
6689 m_HasBloodyHandsVisible = bloody_hands;
6690 }
6691
6692
6693 bool blood_visible = false;
6694 if (!ctx.Read(blood_visible))
6695 return false;
6696 m_HasBloodTypeVisible = blood_visible;
6697
6698 int blood_type = 0;
6699 if (!ctx.Read(blood_type))
6700 return false;
6702
6703 return true;
6704 }
6705
6708 {
6709 int hour, minute, second;
6711 float distance;
6713 if (m_AnalyticsTimer)
6714 {
6716 data.m_CharacterId = g_Game.GetDatabaseID();
6717 data.m_TimeInterval = m_AnalyticsTimer.GetRemaining();
6718 data.m_DaytimeHour = hour;
6719 data.m_PositionStart = m_PlayerOldPos;
6720 data.m_PositionEnd = GetPosition();
6721 data.m_DistanceOnFoot = distance;
6723 }
6724
6725 m_PlayerOldPos = GetPosition();
6726 }
6727
6729 {
6730 Debug.Log("Player connected:" + this.ToString(), "Connect");
6731
6732 // analytics
6733 GetGame().GetAnalyticsServer().OnPlayerConnect(this);
6734
6735 m_PlayerOldPos = GetPosition();
6736 if (m_AnalyticsTimer)
6737 m_AnalyticsTimer.Run(60, this, "UpdatePlayerMeasures", null, true);
6738
6739 //construction action data
6740 ResetConstructionActionData();
6741 }
6742
6744 {
6745 Debug.Log("Player reconnected:" + this.ToString(), "Reconnect");
6746
6747 //construction action data
6748
6749 ResetConstructionActionData();
6750 }
6751
6753 {
6754 Debug.Log("Player disconnected:" + this.ToString(), "Connect");
6755
6756 // analytics
6757 // force update of the stats
6758 // if player disconnect too soon, UpdatePlayersStats() is not called
6759 GetGame().GetAnalyticsServer().OnPlayerDisconnect(this);
6760
6762 data.m_CharacterId = g_Game.GetDatabaseID();
6763 data.m_Reason = "Disconnected";
6765
6766 if (m_AnalyticsTimer)
6767 m_AnalyticsTimer.Stop();
6768 UpdatePlayerMeasures();
6769
6770 SetPlayerDisconnected(true);
6771 }
6772
6774 {
6775 GetModifiersManager().SetModifiers(enable);
6776 }
6777
6779 {
6780 PluginTransmissionAgents plugin = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
6781 int agents;
6782 if (consume_type == EConsumeType.ENVIRO_POND || consume_type == EConsumeType.ENVIRO_WELL)
6783 {
6784 if (consume_type == EConsumeType.ENVIRO_POND)
6785 {
6786 agents = agents | eAgents.CHOLERA;
6787 //plugin.TransmitAgents(NULL, this, AGT_WATER_POND, amount);
6788 }
6789 m_PlayerStomach.AddToStomach(Liquid.GetLiquidClassname(LIQUID_WATER), amount, 0, agents);
6790
6791
6792 return true;
6793 }
6794
6796 if (!edible_item)
6797 return false;
6798 agents = edible_item.GetAgents();
6799 if (consume_type == EConsumeType.ITEM_SINGLE_TIME || consume_type == EConsumeType.ITEM_CONTINUOUS)
6800 {
6801 if (consume_type == EConsumeType.ITEM_SINGLE_TIME)
6802 plugin.TransmitAgents(edible_item, this, AGT_UACTION_CONSUME, amount);
6803 /*
6804 else
6805 {
6806 plugin.TransmitAgents(edible_item, this, AGT_UACTION_TO_PLAYER, amount);
6807 }
6808 */
6809 if (edible_item.IsLiquidContainer())
6810 {
6811 int liquid_type = edible_item.GetLiquidType();
6813 if (liquidClassName.Length() == 0)
6814 Error("Error! Trying to add unknown liquid to stomach with item=" + Object.GetDebugName(edible_item) + " consume_type=" + consume_type + " liquid_type=" + liquid_type);
6815 m_PlayerStomach.AddToStomach(liquidClassName, amount, 0, agents);
6816 }
6817 else
6818 {
6819 int food_stage_type;
6820 if (edible_item.GetFoodStage())
6821 food_stage_type = edible_item.GetFoodStage().GetFoodStageType();
6822 m_PlayerStomach.AddToStomach(source.GetType(), amount, food_stage_type, agents);
6823 }
6824 edible_item.Consume(amount, this);
6825 return true;
6826
6827 }
6828 /*
6829 if (consume_type == EConsumeType.ITEM_CONTINUOUS)
6830 {
6831 if (edible_item)
6832 {
6833 plugin.TransmitAgents(edible_item, this, AGT_UACTION_TO_PLAYER, amount);
6834 edible_item.Consume(amount, this);
6835 //ProcessNutritions(edible_item.GetNutritionalProfile(),amount);
6836 m_PlayerStomach.AddToStomach(source.GetType(), amount, edible_item.GetNutritionalProfile());
6837 return true;
6838 }
6839 }
6840 */
6841 return false;
6842 }
6843
6844 /*
6845 void ProcessNutritions(NutritionalProfile profile, float consumedquantity)
6846 {
6847 float energy_per_unit = profile.GetEnergy() / 100;
6848 float water_per_unit = profile.GetWaterContent() / 100;
6849 float nutritions = profile.GetNutritionalIndex();
6850 float fullness_index = profile.GetFullnessIndex();
6851 float toxicity = profile.GetToxicity();
6852 bool is_liquid = profile.IsLiquid();
6853
6854 if (consumedquantity > 0)
6855 {
6856 float water_consumed = consumedquantity * water_per_unit;
6857 GetStatStomachVolume().Add(consumedquantity * fullness_index);
6858 GetStatStomachEnergy().Add(consumedquantity * energy_per_unit);
6859 GetStatStomachWater().Add(water_consumed);
6860 GetStatToxicity().Add(consumedquantity * toxicity);
6861 }
6862 else
6863 {
6864 Print("ProcessNutritions - ZERO VOLUME! Fix config");
6865 }
6866 }
6867 */
6868
6870 {
6871#ifndef NO_GUI
6872 if (show)
6873 {
6874 GetGame().GetUIManager().ScreenFadeIn(0, "You are Unconscious", FadeColors.BLACK, FadeColors.WHITE);
6875 PrintString("Fade in");
6876 }
6877 else
6878 {
6879 GetGame().GetUIManager().ScreenFadeOut(0);
6880 PrintString("Fade out");
6881 }
6882#endif
6883 }
6884
6886 {
6887 if (from_server_and_client && GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
6888 {
6889 PlaySoundEventEx(id, false, false, param);
6890 return;
6891 }
6892 SendSoundEventEx(id, param);
6893 }
6894
6896 {
6897 RequestSoundEventEx(id, from_server_and_client);
6898 }
6899
6900 override protected void SendSoundEvent(EPlayerSoundEventID id)
6901 {
6902 SendSoundEventEx(id);
6903 }
6904
6905 override protected void SendSoundEventEx(EPlayerSoundEventID id, int param = 0)
6906 {
6907 if (!GetGame().IsServer())
6908 return;
6909 m_SoundEvent = id;
6910 m_SoundEventParam = param;
6911 SetSynchDirty();
6912
6913 if (!GetGame().IsMultiplayer())
6914 CheckSoundEvent();
6915
6916 //PrintString(GetGame().GetTime().ToString() + " Set SoundEvent, id:" + id.ToString());
6917 }
6918
6920 {
6921 if (m_SoundEvent != 0 && m_SoundEventSent)
6922 {
6923 m_SoundEvent = 0;
6924 m_SoundEventParam = 0;
6925 m_SoundEventSent = false;
6926 SetSynchDirty();
6927 }
6928 }
6929
6931 {
6932 if (m_SoundEvent != 0 && !m_SoundEventSent)
6933 m_SoundEventSent = true;
6934 }
6935
6936 override bool PlaySoundEvent(EPlayerSoundEventID id, bool from_anim_system = false, bool is_from_server = false)
6937 {
6938 return PlaySoundEventEx(id, from_anim_system, is_from_server);
6939 }
6940
6941 override bool PlaySoundEventEx(EPlayerSoundEventID id, bool from_anim_system = false, bool is_from_server = false, int param = 0)
6942 {
6943 if (!m_PlayerSoundEventHandler)
6944 return false;
6945
6946 return m_PlayerSoundEventHandler.PlayRequestEx(id, is_from_server, param);
6947 }
6948
6950 {
6951 return m_PlayerSoundEventHandler;
6952 }
6953
6956
6958 {
6959 m_BleedingSourceCount++;
6960 if (IsControlledPlayer())
6961 {
6962 if (!GetGame().IsDedicatedServer())
6963 {
6965 if (dis_elm)
6966 dis_elm.SetValue(GetBleedingSourceCount());
6967
6968
6969 //Print("----------bleeding_SoundSet----------");
6970 SEffectManager.PlaySoundOnObject("bleeding_SoundSet", this);
6971 }
6972 }
6973 }
6974
6976 {
6977 m_BleedingSourceCount--;
6978 if (GetGame().IsServer())
6979 {
6981 if (GetBleedingSourceCount() > 0)
6982 arrowManager.DropFirstArrow();
6983 else
6984 arrowManager.DropAllArrows();
6985 }
6986
6987 if (IsControlledPlayer())
6988 {
6989 if (!GetGame().IsDedicatedServer())
6990 {
6991 //Print("GetBleedingSourceCount() "+GetBleedingSourceCount());
6993 if (dis_elm)
6994 dis_elm.SetValue(GetBleedingSourceCount());
6995 }
6996 }
6997 }
6998
6999
7001 {
7002 OnBleedingSourceRemoved();
7003 }
7004
7006 {
7007 return m_BleedingSourceCount;
7008 }
7009
7010 // for debug purposes, should reset some systems like Modifiers, Stats, Damage etc.....
7012 {
7013#ifdef DIAG_DEVELOPER
7014 if (GetGame().IsServer() || !GetGame().IsMultiplayer())
7015 {
7016 GetStomach().ClearContents();
7017
7018 DamageSystem.ResetAllZones(this);
7019 GetModifiersManager().ResetAll();
7020
7021 // bleeding sources
7022 if (m_BleedingManagerServer)
7023 m_BleedingManagerServer.RemoveAllSources();
7024
7025 // Stats
7026 if (GetPlayerStats())
7027 {
7028 int bloodType = GetStatBloodType().Get();
7029 GetPlayerStats().ResetAllStats();
7030 GetStatBloodType().Set(bloodType);
7031 }
7032
7033 // Agents
7034 if (m_AgentPool)
7035 m_AgentPool.RemoveAllAgents();
7036
7037 if (m_StaminaHandler)
7039
7040 // uncon
7041 if (IsUnconscious())
7043
7044 // set max
7045 if (set_max)
7046 {
7047 GetStatWater().Set(GetStatWater().GetMax());
7048 GetStatEnergy().Set(GetStatEnergy().GetMax());
7049 }
7050
7051 // fix up inventory
7052 FixAllInventoryItems();
7053
7054 //remove bloody hands
7056 moduleLifespan.UpdateBloodyHandsVisibilityEx(this, eBloodyHandsTypes.CLEAN);
7057
7058 if (GetArrowManager())
7059 GetArrowManager().ClearArrows();
7060
7061 }
7062
7063 // client + single + server
7065 if (vehCmd)
7066 {
7067 CarScript car = CarScript.Cast(vehCmd.GetTransport());
7068 if (car)
7069 car.FixEntity();
7070 }
7071#endif
7072 }
7073
7075 {
7076 if (m_SoundEvent != 0)
7077 {
7078 PlaySoundEventEx(m_SoundEvent, false, true, m_SoundEventParam);
7079 m_SoundEvent = 0;
7080 m_SoundEventParam = 0;
7081 }
7082 }
7083
7085 {
7086 if (GetGame().IsClient()) return;
7087 RequestSoundEvent(1234);
7088 //Math.RandomInt(1,4096)
7089 }
7090
7092 {
7093 if (state != m_StaminaState)
7094 {
7095 m_StaminaState = state;
7096 //PrintString("m_StaminaState:"+m_StaminaState.ToString());
7097 SetSynchDirty();
7098 }
7099 }
7100
7102 {
7103 return m_StaminaState;
7104 }
7105
7107 {
7108 m_QuickBarBase.updateSlotsCount();
7109 }
7110
7111 bool Save()
7112 {
7113 // saved player must be alive and not captive
7114 if (GetPlayerState() == EPlayerStates.ALIVE && !IsRestrained())
7115 {
7116 GetHive().CharacterSave(this);
7117 Debug.Log("Player " + this.ToString() + " saved as alive");
7118
7119 return true;
7120 }
7121 return false;
7122 }
7123
7124 // agent transfer
7125
7126 static ref array<Object> SPREAD_AGENTS_OBJECTS = new array<Object>;
7127 static ref array<CargoBase> SPREAD_AGENTS_PROXY_CARGOS = new array<CargoBase>;
7128
7129
7131 void SpreadAgentsEx(float distance = 3, float chance = 0.25)
7132 {
7133 if (Math.RandomFloat01() > chance)
7134 return;
7135
7136 GetGame().GetPlayers(m_ServerPlayers);
7137 float dist_check = distance * distance;//make it sq
7138 PluginTransmissionAgents plugin = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
7139
7140 foreach (Man target: m_ServerPlayers)
7141 {
7142 if (vector.DistanceSq(GetWorldPosition(), target.GetWorldPosition()) < dist_check && target != this)
7143 plugin.TransmitAgents(this, target, AGT_AIRBOURNE_BIOLOGICAL, 1);
7144 }
7145 }
7146
7147 void SpreadAgents()//legacy method
7148 {
7149 SpreadAgentsEx(3, 1);
7150 }
7151
7152 //--------------------------------------------------------------------------------------------
7153 override int GetAgents()
7154 {
7155 return m_AgentPool.GetAgents();
7156 }
7157
7158 //--------------------------------------------------------------------------------------------
7159 override void RemoveAgent(int agent_id) //removes a single agent type from the player agent pool
7160 {
7161 m_AgentPool.RemoveAgent(agent_id);
7162 }
7163
7164 //--------------------------------------------------------------------------------------------
7165 override void RemoveAllAgents()
7166 {
7167 m_AgentPool.RemoveAllAgents();
7168 }
7169
7170
7171 //--------------------------------------------------------------------------------------------
7172 override void InsertAgent(int agent, float count = 1) //adds a single agent type to the player agent pool
7173 {
7174 m_AgentPool.AddAgent(agent, count);
7175 }
7176
7177 //--------------------------------------------------------------------------------------------
7179 {
7180 return m_AgentPool.GetSingleAgentCount(agent_id);
7181 }
7182
7183 //--------------------------------------------------------------------------------------------
7185 {
7186 int max_count = PluginTransmissionAgents.GetAgentMaxCount(agent_id);
7187 return m_AgentPool.GetSingleAgentCount(agent_id) / max_count;
7188 }
7189
7191 {
7192 return m_AgentPool.GetTotalAgentCount();
7193 }
7194
7196 {
7197 m_AgentPool.PrintAgents();
7198 }
7199
7200 void ImmuneSystemTick(float value, float deltaT)
7201 {
7202 m_AgentPool.ImmuneSystemTick(value, deltaT);
7203 }
7204
7206 {
7207 m_AgentPool.AntibioticsAttack(value);
7208 }
7209
7210 //Get aim (player crosshair) position
7212 {
7213 float min_distance = 0.5; //min distance, default = 5m
7214
7215 vector from = GetGame().GetCurrentCameraPosition();
7216 vector to = from + (GetGame().GetCurrentCameraDirection() * min_distance);
7219 int contactComponent;
7220
7222
7223 return contactPos;
7224 }
7225
7226
7228 {
7229 ItemBase mask = ItemBase.Cast(GetInventory().FindAttachment(InventorySlots.MASK));
7230 return (!mask || (mask && mask.AllowFoodConsumption()));
7231 }
7232
7233 //get modifier manager
7235 {
7236 return m_ModifiersManager;
7237 }
7238
7240 {
7241 if (!m_StatWater && GetPlayerStats())
7242 m_StatWater = PlayerStat<float>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.WATER));
7243 return m_StatWater;
7244 }
7245
7247 {
7248 if (!m_StatToxicity && GetPlayerStats())
7249 m_StatToxicity = PlayerStat<float>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.TOXICITY));
7250 return m_StatToxicity;
7251 }
7252
7254 {
7255 if (!m_StatEnergy && GetPlayerStats())
7256 m_StatEnergy = PlayerStat<float>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.ENERGY));
7257 return m_StatEnergy;
7258 }
7259
7261 {
7262 if (!m_StatHeatComfort && GetPlayerStats())
7263 m_StatHeatComfort = PlayerStat<float>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.HEATCOMFORT));
7264 return m_StatHeatComfort;
7265 }
7266
7268 {
7269 if (!m_StatTremor && GetPlayerStats())
7270 m_StatTremor = PlayerStat<float>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.TREMOR));
7271 return m_StatTremor;
7272 }
7273
7275 {
7276 if (!m_StatWet && GetPlayerStats())
7277 m_StatWet = PlayerStat<int>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.WET));
7278 return m_StatWet;
7279 }
7280
7282 {
7283 if (!m_StatDiet && GetPlayerStats())
7284 m_StatDiet = PlayerStat<float>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.DIET));
7285 return m_StatDiet;
7286 }
7287
7289 {
7290 if (!m_StatStamina && GetPlayerStats())
7291 m_StatStamina = PlayerStat<float>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.STAMINA));
7292 return m_StatStamina;
7293 }
7294
7296 {
7297 if (!m_StatSpecialty && GetPlayerStats())
7298 m_StatSpecialty = PlayerStat<float>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.SPECIALTY));
7299 return m_StatSpecialty;
7300 }
7301
7303 {
7304 if (!m_StatBloodType && GetPlayerStats())
7305 m_StatBloodType = PlayerStat<int>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.BLOODTYPE));
7306 return m_StatBloodType;
7307 }
7308
7310 {
7311 if (!m_StatHeatBuffer && GetPlayerStats())
7312 m_StatHeatBuffer = PlayerStat<float>.Cast(GetPlayerStats().GetStatObject(EPlayerStats_current.HEATBUFFER));
7313 return m_StatHeatBuffer;
7314 }
7315
7317 {
7318 m_HasHeatBuffer = show;
7319 SetSynchDirty();
7320 }
7321
7324 {
7325 return m_UALastMessage;
7326 }
7327
7329 {
7330 m_UALastMessage = pMsg;
7331
7332 if (m_UALastMessageTimer.IsRunning())
7333 m_UALastMessageTimer.Stop();
7334
7335 m_UALastMessageTimer.Run(PlayerConstants.LAST_UA_MSG_LIFETIME, this, "ClearLastUAMessage", null);
7336 }
7337
7338 protected void ClearLastUAMessage()
7339 {
7340 if (m_UALastMessageTimer.IsRunning())
7341 m_UALastMessageTimer.Stop();
7342
7343 m_UALastMessage = "";
7344 }
7345
7348
7351 {
7352 m_InjuryHandler.CheckValue(true);
7353 }
7354
7355 // -------------------------------------------------------------------------
7357 {
7358 PluginTransmissionAgents pluginTransmissionAgents = PluginTransmissionAgents.Cast(GetPlugin(PluginTransmissionAgents));
7359
7360 string name;
7361 int id;
7363
7364 for (int i = 0; i < agentList.Count(); i++)
7365 {
7366 name = agentList.GetElement(i);
7367 id = agentList.GetKey(i);
7368
7369 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DEBUG_AGENTS_RANGE_INJECT_START + id, "Inject " + name, Colors.WHITE));
7370 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DEBUG_AGENTS_RANGE_REMOVE_START + id, "Remove " + name, Colors.WHITE));
7371 }
7372 }
7373
7374 //-------------------------------------------------------------
7378
7380 {
7381 super.OnSyncJuncture(pJunctureID, pCtx);
7382
7383 switch (pJunctureID)
7384 {
7387 bool enable;
7389 m_InjuryHandler.SetInjuryCommandParams(enable, level);
7390 break;
7392 GetSymptomManager().SetAnimation(pCtx);
7393 break;
7395 OnQuickbarSetEntityRequest(pCtx);
7396 break;
7398 GetInventory().OnInventoryJunctureFromServer(pCtx);
7399 break;
7401 GetInventory().OnInventoryJunctureRepairFromServer(pCtx);
7402 break;
7404 GetInventory().OnInventoryJunctureFailureFromServer(pCtx);
7405 break;
7409 m_ActionManager.OnSyncJuncture(pJunctureID, pCtx);
7410 break;
7414 m_WeaponManager.OnSyncJuncture(pJunctureID, pCtx);
7415 break;
7418 break;
7420 GetSymptomManager().SetAnimation(pCtx);
7421 break;
7423 float amount;
7425 {
7426 if (GetAimingModel() && IsFireWeaponRaised())
7427 GetAimingModel().RequestKuruShake(amount);
7428 }
7429 break;
7431 m_EmoteManager.OnSyncJuncture(pJunctureID, pCtx);
7432 break;
7434 SetLiftWeapon(pJunctureID, pCtx);
7435 break;
7437 m_ResetADS = true;
7438 break;
7440 SetToDelete(pCtx);
7441 break;
7443 m_BrokenLegsJunctureReceived = true;
7445 break;
7448 break;
7451 break;
7454 break;
7455#ifdef DEVELOPER
7456 case DayZPlayerSyncJunctures.SJ_DEBUG_GET_IN_CAR:
7457 EntityAI car;
7458 DayZPlayerSyncJunctures.ReadGetInCarParams(pCtx, car);
7460 break;
7461#endif
7462 }
7463 }
7464
7466 {
7467 return m_ItemsToDelete.Count() > 0;
7468 }
7469
7471 {
7472 EntityAI item;
7473 pCtx.Read(item);
7474 AddItemToDelete(item);
7475 }
7476
7478 {
7479 if (item)
7480 {
7481 item.SetPrepareToDelete();
7482 m_ItemsToDelete.Insert(item);
7483 }
7484 }
7485
7487 {
7488 return !(GetThrowing().IsThrowingAnimationPlaying() || GetDayZPlayerInventory().IsProcessing() || (GetActionManager() && GetActionManager().GetRunningAction()));
7489 }
7490
7495
7497 {
7498 int count = m_ItemsToDelete.Count();
7499 if (count > 0)
7500 {
7501 if (CanDeleteItems())
7502 {
7504
7505 if (GetGame().IsClient() && GetGame().IsMultiplayer())
7506 {
7508 for (int i = count - 1; i >= 0 ; i--)
7509 {
7510 itemToDelete = m_ItemsToDelete.Get(i);
7511 if (itemToDelete != null)
7512 itemToDelete.GetInventory().GetCurrentInventoryLocation(il);
7513
7514 if (itemToDelete == null || (GetItemInHands() == null && il.GetType() == InventoryLocationType.UNKNOWN))
7515 m_ItemsToDelete.Remove(i);
7516 }
7517 }
7518 else
7519 {
7520 for (int j = count - 1; j >= 0 ; j--)
7521 {
7522 itemToDelete = m_ItemsToDelete.Get(j);
7523 if (itemToDelete == null)
7524 m_ItemsToDelete.Remove(j);
7525 else
7526 {
7527 itemToDelete.Delete();
7528 m_ItemsToDelete.Remove(j);
7529 }
7530 }
7531 }
7532 }
7533 }
7534 }
7535
7537 {
7540 {
7542 HumanItemBehaviorCfg hibcfg = hia.GetItemInHandsBehaviourCfg();
7543 if (hibcfg && hibcfg.m_StanceRotation[m_MovementState.m_iStanceIdx] == DayZPlayerConstants.ROTATION_DISABLE)
7544 return DayZPlayerImplementHeading.NoHeading(pDt, pModel, m_fLastHeadingDiff);
7545 else
7546 {
7547 m_fLastHeadingDiff = 0;
7548 return DayZPlayerImplementHeading.ClampHeading(pDt, pModel, m_fLastHeadingDiff);
7549 }
7550 }
7551
7552 return super.HeadingModel(pDt, pModel);
7553 }
7554
7556 {
7557 return m_InventorySoftLockCount > 0;
7558 }
7559
7561 override void SetInventorySoftLock(bool status)
7562 {
7563 if (status)
7564 m_InventorySoftLockCount++;
7565 else
7566 m_InventorySoftLockCount--;
7567
7568 if (m_InventorySoftLockCount < 0)
7569 m_InventorySoftLockCount = 0;
7570
7571 m_InventorySoftLocked = IsInventorySoftLocked();
7572 }
7573
7575 {
7576 if (m_aQuickBarLoad)
7577 m_aQuickBarLoad.Insert(new Param2<EntityAI, int>(entity, index));
7578 }
7579
7580 override bool IsLiftWeapon()
7581 {
7582 return m_LiftWeapon_player;
7583 }
7584
7585 //Server
7587 {
7588 bool state;
7589 ctx.Read(state);
7590
7592 pCtx.Write(state);
7593
7595
7596 return true;
7597 }
7598
7600 {
7601 bool state;
7602 ctx.Read(state);
7603
7604 m_ProcessLiftWeaponState = state;
7605 m_ProcessLiftWeapon = true;
7606
7607 //Print("SetLiftWeapon | STS: " + GetSimulationTimeStamp());
7608 }
7609
7612 {
7614 //SP version
7615 if (!GetGame().IsMultiplayer())
7616 {
7617 m_LiftWeapon_player = state;
7618
7620 if (hcw)
7621 hcw.LiftWeapon(state);
7622
7623 GetWeaponManager().OnLiftWeapon();
7624
7625 return;
7626 }
7627
7629
7630 if (GetGame().IsMultiplayer() && GetGame().IsClient() && !ctx.CanStoreInputUserData())
7631 {
7632 //Print("ctx unavailable");
7633 return;
7634 }
7635 else if (GetGame().IsMultiplayer() && GetGame().IsClient() && ctx.CanStoreInputUserData())
7636 {
7637 //Print("sending ECB cancel request");
7639 ctx.Write(state);
7640 ctx.Send();
7641 }
7642 }
7643
7644 override void CheckLiftWeapon()
7645 {
7646 // lift weapon check
7647 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
7648 {
7650 if (Weapon_Base.CastTo(weap, GetItemInHands()))
7651 {
7652 bool limited = weap.LiftWeaponCheck(this);
7653
7654 if (limited && !m_LiftWeapon_player)
7655 SendLiftWeaponSync(true);
7656 else if (!limited && m_LiftWeapon_player)
7657 SendLiftWeaponSync(false);
7658 }
7659 else if (m_LiftWeapon_player)
7660 SendLiftWeaponSync(false);
7661 }
7662 }
7663
7664 override void ProcessLiftWeapon()
7665 {
7666 if (m_ProcessLiftWeapon)
7667 {
7669 if (hcw)
7670 hcw.LiftWeapon(m_ProcessLiftWeaponState);
7671
7672 GetWeaponManager().OnLiftWeapon();
7673 m_LiftWeapon_player = m_ProcessLiftWeaponState;
7674 m_ProcessLiftWeapon = false;
7675
7676 //Debug.Log("SimulationStamp_server: " + this.GetSimulationTimeStamp());
7677 }
7678 }
7679
7681 override void HideClothing(ItemOptics optic, bool state)
7682 {
7683 super.HideClothing(optic, state);
7686
7687 if (state && DayZPlayerCameraOptics.Cast(m_CurrentCamera))
7688 {
7689 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
7690 {
7691 clothingArray.Insert(InventorySlots.BACK);
7692 clothingArray.Insert(InventorySlots.SHOULDER);
7693 clothingArray.Insert(InventorySlots.MELEE);
7694 if (optic && optic.GetCurrentStepFOV() < GameConstants.DZPLAYER_CAMERA_FOV_IRONSIGHTS)
7695 {
7696 clothingArray.Insert(InventorySlots.BODY);
7697 clothingArray.Insert(InventorySlots.VEST);
7698 }
7699
7700 SetInvisibleRecursive(true, this, clothingArray);
7701 }
7702 }
7703 //showing should be instant (called directly, not via CallLater)
7704 else
7705 {
7706 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
7707 {
7709
7710 SetInvisibleRecursive(false, this, clothingArray);
7711 }
7712 }
7713 }
7714
7719
7720 override void SetDeathDarknessLevel(float duration, float tick_time)
7721 {
7722 super.SetDeathDarknessLevel(duration, tick_time);
7723
7724 if (IsControlledPlayer())
7725 {
7726 float actual_tick = tick_time;
7727 if (GetDamageDealtEffect())
7728 m_DamageDealtEffect = null;
7729
7730 if (GetFlashbangEffect())
7731 m_FlashbangEffect = null;
7732
7733 float progress;
7734 if (duration > 0)
7735 progress = 1 - ((duration - m_DeathDarkeningCurrentTime) / duration);
7736
7737 m_DeathDarkeningCurrentTime += actual_tick;
7738
7739 if (!IsAlive() && IsPlayerSelected())
7740 {
7741 m_DeathDarkeningParam.param1 = progress;
7742 PPERequesterBank.GetRequester(PPERequester_DeathDarkening).Start(m_DeathDarkeningParam);
7743 }
7744
7745 if (m_DeathDarkeningCurrentTime >= duration)
7746 StopDeathDarkeningEffect();
7747 }
7748 else
7749 StopDeathDarkeningEffect();
7750 }
7751
7752 override bool IsInFBEmoteState()
7753 {
7754 if (!IsEmotePlaying())
7755 return false;
7756 if ((m_EmoteManager.m_Callback && m_EmoteManager.m_Callback.m_IsFullbody) || m_EmoteManager.m_IsSurrendered)
7757 return true;
7758 return false;
7759 }
7760
7763 {
7764 if (m_EmoteManager)
7765 m_EmoteManager.EndSurrenderRequest(data);
7766 }
7767
7769 {
7770 if (m_EmoteManager)
7771 return m_EmoteManager.m_IsSurrendered;
7772
7773 return false;
7774 }
7775
7777 {
7778 return m_PlayerLoaded;
7779 }
7780
7781 //disconnected, caused problems. Awaiting refactor
7783 {
7784 //FB gesture slideposeangle override
7785 if (IsInFBEmoteState() && IsControlledPlayer() && IsPlayerSelected())
7786 OverrideSlidePoseAngle(Math.PI2);
7787 else if (!IsInFBEmoteState() && IsControlledPlayer() && IsPlayerSelected())
7788 OverrideSlidePoseAngle(m_OriginalSlidePoseAngle);
7789
7790 //+add more, if needed
7791 }
7792
7793 /*void OnSurrenderEnd()
7794 {
7795 }*/
7796
7798 {
7799 isActionPossible = false;
7800 Magazine mag = Magazine.Cast(item);
7801 Weapon_Base wpn = Weapon_Base.Cast(item.GetHierarchyParent());
7802 if (mag && wpn)
7803 {
7804 if (GetWeaponManager().CanDetachMagazine(wpn, mag))
7805 {
7806 //Print("[inv] PlayerBase.CanRedirectToWeaponManager OK, can detach mag=" + mag + " from wpn=" + wpn);
7807 isActionPossible = true;
7808 }
7809 else
7810 {
7811 //Print("[inv] PlayerBase.CanRedirectToWeaponManager cannot detach mag=" + mag + " from wpn=" + wpn);
7812 }
7813 return true;
7814 }
7815 return false;
7816 }
7817
7818 // Inventory actions with redirection to weapon manager
7820 {
7821 bool can_detach;
7822 if (CanRedirectToWeaponManager(item, can_detach))
7823 {
7825 if (can_detach && target.GetInventory().FindFreeLocationFor(item, flags, il))
7826 return GetWeaponManager().DetachMagazine(il);
7827 return false;
7828 }
7829 return super.PredictiveTakeEntityToTargetInventory(target, flags, item);
7830 }
7831
7833 {
7834 bool can_detach;
7835 if (CanRedirectToWeaponManager(item, can_detach))
7836 {
7838 if (can_detach && GetInventory().FindFreeLocationFor(item, flags, il))
7839 return GetWeaponManager().DetachMagazine(il);
7840 return false;
7841 }
7842 return super.PredictiveTakeEntityToInventory(flags, item);
7843 }
7844
7846 {
7848 Magazine mag = Magazine.Cast(item);
7849 if (parentWpn && mag)
7850 {
7851 if (GetWeaponManager().CanAttachMagazine(parentWpn, mag))
7852 return GetWeaponManager().AttachMagazine(mag);
7853
7854 return false;
7855 }
7856 return super.PredictiveTakeEntityToTargetAttachment(target, item);
7857 }
7858
7860 {
7862 Magazine mag = Magazine.Cast(item);
7863 if (parentWpn && mag)
7864 {
7865 if (target.CanReceiveAttachment(item, slot) && GetWeaponManager().CanAttachMagazine(parentWpn, mag))
7866 return GetWeaponManager().AttachMagazine(mag);
7867
7868 return false;
7869 }
7870 return super.PredictiveTakeEntityToTargetAttachmentEx(target, item, slot);
7871 }
7872
7874 {
7875 bool can_detach;
7876 if (CanRedirectToWeaponManager(item, can_detach))
7877 {
7879 if (can_detach && target.GetInventory().FindFreeLocationFor(item, FindInventoryLocationType.CARGO, il))
7880 return GetWeaponManager().DetachMagazine(il);
7881 return false;
7882 }
7883 return super.PredictiveTakeEntityToTargetCargo(target, item);
7884 }
7885
7887 {
7888 bool can_detach;
7889 if (CanRedirectToWeaponManager(item, can_detach))
7890 {
7891 if (can_detach)
7892 {
7894 dst.SetCargoAuto(cargo, item, row, col, item.GetInventory().GetFlipCargo());
7895
7896 return GetWeaponManager().DetachMagazine(dst);
7897 }
7898 return false;
7899 }
7900 return super.PredictiveTakeEntityToTargetCargoEx(cargo, item, row, col);
7901 }
7902
7904 {
7905 bool can_detach;
7906 if (CanRedirectToWeaponManager(item, can_detach))
7907 {
7908 if (can_detach)
7909 {
7910 vector m4[4];
7912
7916 il.SetGround(item, m4);
7917 return GetWeaponManager().DetachMagazine(il);
7918 }
7919 return false;
7920 }
7921 return super.PredictiveDropEntity(item);
7922 }
7923
7925 {
7927 //Print("PlayerBase | PredictiveSwapEntities");
7930
7931 if (swapmag1 && swapmag2)
7932 {
7934
7935 if (Class.CastTo(parentWpn, swapmag1.GetHierarchyParent()))
7936 {
7937 if (GetWeaponManager().CanSwapMagazine(parentWpn, swapmag2))
7938 {
7939 Print("[inv] PlayerBase.PredictiveSwapEntities: swapping mag1=" + swapmag1 + " to parent wpn=" + parentWpn + " of mag1=" + swapmag1);
7940 return GetWeaponManager().SwapMagazine(swapmag2);
7941 }
7942 else
7943 {
7944 Print("[inv] PlayerBase.PredictiveSwapEntities: can not swap magazines");
7945 return false;
7946 }
7947 }
7948
7949 if (Class.CastTo(parentWpn, swapmag2.GetHierarchyParent()))
7950 {
7951 if (GetWeaponManager().CanSwapMagazine(parentWpn, swapmag1))
7952 {
7953 Print("[inv] PlayerBase.PredictiveSwapEntities: swapping mag1=" + swapmag1 + " to parent wpn=" + parentWpn + " of mag2=" + swapmag2);
7954 return GetWeaponManager().SwapMagazine(swapmag1);
7955 }
7956 else
7957 {
7958 Print("[inv] PlayerBase.PredictiveSwapEntities: can not swap magazines");
7959 return false;
7960 }
7961 }
7962 }
7963
7966 if (IsSwapBetweenHandsAndGroundLargeItem(item1, item2, item_hands, item_ground) && !m_ActionManager.GetRunningAction())
7967 {
7969 CastTo(mngr_client, m_ActionManager);
7970
7971 ActionTarget atrg = new ActionTarget(item_ground, null, -1, vector.Zero, -1.0);
7972 if (mngr_client.GetAction(ActionSwapItemToHands).Can(this, atrg, ItemBase.Cast(item_hands)))
7973 {
7974 mngr_client.PerformActionStart(mngr_client.GetAction(ActionSwapItemToHands), atrg, ItemBase.Cast(item_hands));
7975 return true;
7976 }
7977 return super.PredictiveSwapEntities(item1, item2);
7978 }
7979 else
7980 return super.PredictiveSwapEntities(item1, item2);
7981 }
7982
7984 {
7986
7988 if (item1.IsHeavyBehaviour() && item1.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() == InventoryLocationType.GROUND && !m_ActionManager.GetRunningAction())
7989 {
7990 //Print("override bool PredictiveForceSwapEntities (notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)");
7992 CastTo(mngr_client, m_ActionManager);
7993
7994 ActionTarget atrg = new ActionTarget(item1, null, -1, vector.Zero, -1.0);
7995 if (mngr_client.GetAction(ActionSwapItemToHands).Can(this, atrg, ItemBase.Cast(item2)))
7996 mngr_client.PerformActionStart(mngr_client.GetAction(ActionSwapItemToHands), atrg, ItemBase.Cast(item2));
7997 return true;
7998 }
7999 else
8000 return super.PredictiveForceSwapEntities(item1, item2, item2_dst);
8001 }
8002
8004 {
8005 if (item.IsHeavyBehaviour() && !m_ActionManager.GetRunningAction() && !item.GetHierarchyParent())
8006 {
8008 if (CastTo(mngr_client, m_ActionManager))
8009 {
8010 ActionTarget atrg = new ActionTarget(item, null, -1, vector.Zero, -1.0);
8011
8012 if (mngr_client.GetAction(ActionTakeItemToHands).Can(this, atrg, null))
8013 mngr_client.PerformActionStart(mngr_client.GetAction(ActionTakeItemToHands), atrg, null);
8014 /*).Can(this,
8015 mngr_client.ActionStart(mngr_client.GetAction(ActionTakeItemToHands),mngr_client.FindActionTarget(),null);
8016 return;*/
8017 }
8018 }
8019 else
8020 super.PredictiveTakeEntityToHands(item);
8021 }
8022
8024 {
8025 EntityAI item = src.GetItem();
8026 if (item)
8027 {
8028 bool can_detach;
8029
8030 if (CanRedirectToWeaponManager(item, can_detach))
8031 {
8032 if (can_detach)
8033 return GetWeaponManager().DetachMagazine(dst);
8034 return false;
8035 }
8036 return super.PredictiveTakeToDst(src, dst);
8037 }
8038 return false;
8039 }
8040
8042 {
8044 if (item1.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() == InventoryLocationType.HANDS)
8045 item_hands = item1;
8046 if (item2.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() == InventoryLocationType.HANDS)
8047 item_hands = item2;
8048 if (item1.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() == InventoryLocationType.GROUND)
8050 if (item2.GetInventory().GetCurrentInventoryLocation(il) && il.GetType() == InventoryLocationType.GROUND)
8052
8053 return item_hands && item_ground && item_ground.IsHeavyBehaviour();
8054 }
8055
8057 void SetHairLevelToHide(int level, bool state, bool was_debug = false)
8058 {
8059 if (was_debug && GetInstanceType() != DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
8060 return;
8061
8062 if (!m_CharactersHead)
8063 {
8064 ErrorEx("No valid head detected on character!");
8065 return;
8066 }
8067
8068 if (level == -1) //hide/show ALL
8069 {
8070 m_HideHairAnimated = !m_HideHairAnimated;
8071 for (int i = 0; i < m_CharactersHead.m_HeadHairSelectionArray.Count(); ++i)
8072 {
8073 //m_CharactersHead.SetSimpleHiddenSelectionState(i,m_HideHairAnimated);
8074 SelectionTranslation stt = SelectionTranslation.Cast(m_CharactersHead.m_HeadHairHidingStateMap.Get(i));
8075 stt.SetSelectionState(m_HideHairAnimated);
8076 m_CharactersHead.m_HeadHairHidingStateMap.Set(i, stt);
8077#ifdef DIAG_DEVELOPER
8078#ifndef SERVER
8080 diagmenu.m_HairHidingStateMap.Set(i, m_HideHairAnimated);
8081#endif
8082#endif
8083 }
8084 }
8085 else //hide/show selected level only
8086 {
8087 bool switchState;
8088 if (was_debug)
8089 {
8090#ifdef DIAG_DEVELOPER
8091#ifndef SERVER
8093 switchState = !diagmenuu.m_HairHidingStateMap.Get(level);
8094 diagmenuu.m_HairHidingStateMap.Set(level, switchState);
8095#endif
8096#endif
8097 }
8098 else
8099 switchState = !state;
8100 //m_CharactersHead.SetSimpleHiddenSelectionState(level,switchState);
8101 stt = SelectionTranslation.Cast(m_CharactersHead.m_HeadHairHidingStateMap.Get(level));
8102 stt.SetSelectionState(switchState);
8103 m_CharactersHead.m_HeadHairHidingStateMap.Set(level, stt); //nescessary?
8104 }
8105 }
8106
8108 {
8109 if (!item || !item.GetHeadHidingSelection() || !m_CharactersHead)
8110 return;
8111
8112 int slot_id; //item currently attached (or detaching from) here
8113 string slot_name; //item currently attached (or detaching from) here
8114 string str
8115 int idx = 0;
8116 int i;
8117 int count;
8118 item.GetInventory().GetCurrentAttachmentSlotInfo(slot_id, slot_name);
8119
8120 if (item.HidesSelectionBySlot())
8121 {
8122 count = item.GetInventory().GetSlotIdCount();
8123 for (i = 0; i < count; i++)
8124 {
8125 if (item.GetInventory().GetSlotId(i) == slot_id)
8126 {
8127 str = item.GetHeadHidingSelection().Get(i);
8128 idx = m_CharactersHead.m_HeadHairSelectionArray.Find(str);
8129 if (idx != -1)
8130 SetHairLevelToHide(idx, state);
8131#ifdef DEVELOPER
8132 else
8133 Debug.Log("No valid selection '" + str + "' found on head of " + GetType() + ". Verify the p3d, model config, and the 'HAIR_HIDING_SELECTIONS' macro in basicDefines.");
8134#endif
8135 }
8136 }
8137 }
8138 else
8139 {
8140 count = item.GetHeadHidingSelection().Count();
8141 for (i = 0; i < count; i++)
8142 {
8143 str = item.GetHeadHidingSelection().Get(i);
8144 idx = m_CharactersHead.m_HeadHairSelectionArray.Find(str);
8145 if (idx != -1)
8146 SetHairLevelToHide(idx, state);
8147#ifdef DEVELOPER
8148 else
8149 Debug.Log("No valid selection '" + str + "' found on head of " + GetType() + ". Verify the p3d, model config, and the 'HAIR_HIDING_SELECTIONS' macro in basicDefines.");
8150#endif
8151 }
8152 }
8153 UpdateHairSelectionVisibility();
8154 }
8155
8157 {
8158 if (!m_CharactersHead)
8159 return;
8160 bool shown;
8161 bool exception_hidden = false;
8162 int i;
8163 int count = m_CharactersHead.m_HeadHairHidingStateMap.Count();
8165
8166 //hide/show beard
8167 if (IsMale() && m_CharactersHead.GetBeardIndex() > -1 && !was_debug)
8168 SetHairLevelToHide(m_CharactersHead.GetBeardIndex(), GetLifeSpanState() != LifeSpanState.BEARD_EXTRA);
8169
8170 //show all first
8171 for (i = 0; i < count; i++)
8172 m_CharactersHead.SetSimpleHiddenSelectionState(i, true);
8173 //then carve it up
8174 for (i = 0; i < count; i++)
8175 {
8176 stt = m_CharactersHead.m_HeadHairHidingStateMap.Get(i);
8177 shown = stt.GetSelectionState();
8178 if (!shown)
8179 {
8180 if (/*IsMale() && */!m_CharactersHead.IsHandlingException())
8181 {
8182 m_CharactersHead.SetSimpleHiddenSelectionState(i, shown);
8183 UpdateTranslatedSelections(stt);
8184 //Print("hidden idx: " + i);
8185 }
8186 else
8187 exception_hidden = true;
8188 }
8189 }
8190
8191 //exceptions handled differently; hides hair
8192 if (exception_hidden)
8193 {
8194 m_CharactersHead.SetSimpleHiddenSelectionState(m_CharactersHead.GetHairIndex(), false);
8195 if (IsMale())
8196 m_CharactersHead.SetSimpleHiddenSelectionState(m_CharactersHead.GetBeardIndex(), false);
8197 }
8198 }
8199
8201 {
8202 int index;
8203 array<int> translatedSelectinosArray = stt.GetTranslatedSelections();
8204 for (int i = 0; i < translatedSelectinosArray.Count(); i++)
8205 {
8207 //if (index > -1)
8208 m_CharactersHead.SetSimpleHiddenSelectionState(index, false); //safe this way, only hiding/carving from shown parts
8209 }
8210 }
8211
8214 {
8215 ItemBase headgear = ItemBase.Cast(GetInventory().FindAttachment(InventorySlots.HEADGEAR));
8216 ItemBase mask = ItemBase.Cast(GetInventory().FindAttachment(InventorySlots.MASK));
8217
8218 HideHairSelections(headgear, true);
8219 HideHairSelections(mask, true);
8220 }
8221
8223 {
8224 return m_ActiveNVTypes && m_ActiveNVTypes.Count() > 0;
8225 }
8226
8228 {
8229 return m_LoweredNVGHeadset;
8230 }
8231
8233 {
8234 if (!m_ActiveNVTypes || m_ActiveNVTypes.Count() == 0)
8235 return NVTypes.NONE;
8236 else
8237 return m_ActiveNVTypes[m_ActiveNVTypes.Count() - 1];
8238 }
8239
8241 {
8242 return m_ActiveNVTypes;
8243 }
8244
8247 {
8248 //Deprecated, below is for legacy's sake
8249 AddActiveNV(NVTypes.NV_GOGGLES);
8250 }
8251
8253 {
8254 m_LoweredNVGHeadset = state;
8255 }
8256
8257 void AddActiveNV(int type)
8258 {
8259 if (!m_ActiveNVTypes || (GetGame().IsMultiplayer() && GetGame().IsServer()))
8260 {
8261#ifdef DEVELOPER
8262 Error("AddActiveNV | illegal server-side call!");
8263#endif
8264
8265 return;
8266 }
8267
8268 if (m_ActiveNVTypes.Find(type) == -1) //TODO - set instead?
8269 m_ActiveNVTypes.Insert(type);
8270 }
8271
8272 void RemoveActiveNV(int type)
8273 {
8274 if (!m_ActiveNVTypes || (GetGame().IsMultiplayer() && GetGame().IsServer()))
8275 {
8276#ifdef DEVELOPER
8277 Error("RemoveActiveNV | illegal server-side call!");
8278#endif
8279
8280 return;
8281 }
8282
8283 if (m_ActiveNVTypes.Find(type) != -1) //TODO - set instead?
8284 m_ActiveNVTypes.RemoveItem(type);
8285 }
8286
8288 {
8289 m_ActiveNVTypes.Clear();
8290 }
8291
8292#ifdef DEVELOPER
8293 override string GetDebugText()
8294 {
8295 string text = super.GetDebugText();
8296 /*
8297 text += "GetMovementTimeToStrafeJog:" + CfgGameplayHandler.GetMovementTimeToStrafeJog() + "\n";
8298 text += "GetMovementTimeToStrafeSprint:" + CfgGameplayHandler.GetMovementTimeToStrafeSprint()+ "\n";
8299
8300 SHumanCommandMoveSettings moveSettings = GetDayZPlayerType().CommandMoveSettingsW();
8301 if (moveSettings)
8302 {
8303 text += "hmcs.m_fDirFilterTimeout:" + moveSettings.m_fDirFilterTimeout + "\n";
8304 text += "hmcs.m_fDirFilterSprintTimeout:" + moveSettings.m_fDirFilterSprintTimeout+ "\n";
8305 }*/
8306
8307 return text;
8308 }
8309
8310
8311 void DEBUGRotateNVG()
8312 {
8313 NVGoggles nvg;
8314
8315 if (FindAttachmentBySlotName("Eyewear"))
8316 nvg = NVGoggles.Cast(FindAttachmentBySlotName("Eyewear").FindAttachmentBySlotName("NVG"));
8317 else if (FindAttachmentBySlotName("Headgear"))
8318 nvg = NVGoggles.Cast(FindAttachmentBySlotName("Headgear").FindAttachmentBySlotName("NVG"));
8319
8320 if (nvg)
8321 nvg.RotateGoggles(nvg.m_IsLowered);
8322 }
8323#endif
8324
8326 {
8327 if (Bandana_ColorBase.Cast(item))
8328 {
8329 if (slot_name == "Headgear")
8330 {
8331 item.SetSimpleHiddenSelectionState(0, 1);
8332 item.SetSimpleHiddenSelectionState(1, 0);
8333 }
8334 else if (slot_name == "Mask")
8335 {
8336 item.SetSimpleHiddenSelectionState(0, 0);
8337 item.SetSimpleHiddenSelectionState(1, 1);
8338 }
8339 }
8340 }
8341
8342 //client-side
8344 {
8345 //Print("---Prettying up corpses... | " + GetGame().GetTime() + " | " + this + " | " + GetType() + "---");
8346 //Print("m_DecayedTexture = " + m_DecayedTexture);
8347 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
8349 {
8351 ItemBase item;
8352
8353 string path;
8354 int idx;
8355 int slot_id;
8356 array<string> bodyparts = {"Gloves", "Body", "Legs", "Feet"};
8357
8358 for (int i = 0; i < bodyparts.Count(); i++)
8359 {
8361 bodypart = GetInventory().FindPlaceholderForSlot(slot_id);
8362 item = ItemBase.Cast(GetInventory().FindAttachment(slot_id));
8363
8364 if (bodypart)
8365 {
8366 path = "cfgVehicles " + bodypart.GetType();
8367 idx = bodypart.GetHiddenSelectionIndex("personality");
8368 if (idx > -1)
8369 bodypart.SetObjectTexture(idx, m_DecayedTexture);
8370 }
8371 if (item)
8372 {
8373 path = "cfgVehicles " + item.GetType();
8374 idx = item.GetHiddenSelectionIndex("personality");
8375 if (idx > -1)
8376 item.SetObjectTexture(idx, m_DecayedTexture);
8377 }
8378 }
8379
8380 SetFaceTexture(m_DecayedTexture);
8381 }
8382 }
8383
8385 {
8386 int boneIdx = GetBoneIndexByName("Spine2");
8387 Particle p;
8388
8389 switch (effect)
8390 {
8392 //play medium sound/flies particle
8393 if (!m_FliesEff)
8394 m_FliesEff = new EffSwarmingFlies();
8395
8396 if (m_FliesEff && !SEffectManager.IsEffectExist(m_FliesIndex))
8397 {
8398 m_FliesEff.SetDecalOwner(this);
8399 m_FliesIndex = SEffectManager.PlayOnObject(m_FliesEff, this, "0 0.25 0");
8400 p = m_FliesEff.GetParticle();
8401 AddChild(p, boneIdx);
8402 if (!m_SoundFliesEffect)
8403 {
8404 PlaySoundSetLoop(m_SoundFliesEffect, "Flies_SoundSet", 1.0, 1.0);
8405 // ErrorEx("DbgFlies | CORPSE_STATE_MEDIUM | m_SoundFliesEffect created! " + m_SoundFliesEffect,ErrorExSeverity.INFO);
8406 }
8407 }
8408 break;
8410 //play serious sound/flies particle
8411 if (!m_FliesEff)
8412 m_FliesEff = new EffSwarmingFlies();
8413
8414 if (m_FliesEff && !SEffectManager.IsEffectExist(m_FliesIndex))
8415 {
8416 m_FliesEff.SetDecalOwner(this);
8417 m_FliesIndex = SEffectManager.PlayOnObject(m_FliesEff, this, "0 0.25 0");
8418 p = m_FliesEff.GetParticle();
8419 AddChild(p, boneIdx);
8420 if (!m_SoundFliesEffect)
8421 {
8422 PlaySoundSetLoop(m_SoundFliesEffect, "Flies_SoundSet", 1.0, 1.0);
8423 // ErrorEx("DbgFlies | CORPSE_STATE_DECAYED | m_SoundFliesEffect created! " + m_SoundFliesEffect,ErrorExSeverity.INFO);
8424 }
8425 }
8426 break;
8427 //remove
8428 default:
8429 SEffectManager.DestroyEffect(m_FliesEff);
8430 // ErrorEx("DbgFlies | StopSoundSet | exit 3 ",ErrorExSeverity.INFO);
8431 StopSoundSet(m_SoundFliesEffect);
8432 break;
8433 }
8434 }
8435
8437 {
8438 int idx;
8439 int slot_id;
8440
8441 idx = GetHiddenSelectionIndex("decay_preload");
8442 if (idx > -1)
8443 {
8444 SetObjectTexture(idx, m_DecayedTexture);
8445 //Print("'decay_preload'" + m_DecayedTexture +" loaded on " + GetModelName());
8446 }
8447 else
8448 {
8449 //Print("No 'decay_preload' selection found on " + this);
8450 }
8451 }
8452
8453 void SetLastMapInfo(float scale, vector pos)
8454 {
8455 m_LastMapScale = scale;
8456 m_LastMapPos = pos;
8457 }
8458
8459 bool GetLastMapInfo(out float scale, out vector pos)
8460 {
8461 scale = m_LastMapScale;
8462 pos = m_LastMapPos;
8463
8464 return m_LastMapScale != -1.0;
8465 }
8466
8468 {
8469 vector dir;
8470 ItemBase item = ItemBase.Cast(entity);
8471
8472 if (GetItemInHands() == item) //from hands
8473 {
8474 //HOTFIX
8475 return PredictiveDropEntity(item);
8476
8477 if (entity.ConfigGetString("physLayer") != "item_large" && heavy_item_only)
8478 return PredictiveDropEntity(item);
8479 else
8480 {
8481 dir = GetOrientation();
8482 //item.m_ItemBeingDropped = true;
8483 return GetHumanInventory().ThrowEntity(item, dir, 0);
8484 }
8485 }
8486 else //from anywhere else
8487 {
8489 if (CastTo(mngr_client, m_ActionManager))
8490 {
8491 ActionTarget atrg = new ActionTarget(null, null, -1, vector.Zero, -1);
8492 if (mngr_client.GetAction(ActionDropItemSimple).Can(this, atrg, item))
8493 {
8494 //Param1<bool> p1 = new Param1<bool>(false);
8495 //p1.param1 = heavy_item_only;
8496 mngr_client.PerformActionStart(mngr_client.GetAction(ActionDropItemSimple), atrg, item/*,p1*/);
8497 return true;
8498 }
8499 return false;
8500 }
8501 else
8502 return true;
8503 }
8504 }
8505
8506 override void SetProcessUIWarning(bool state)
8507 {
8508 m_ProcessUIWarning = state;
8509 }
8510
8512 {
8513 /*Print("ProjectileDebugging | Damage Health: " + damageResult.GetDamage(dmgZone,"Health") + " | Component: " + component + " | Zone: " + dmgZone + "| Timestamp: " + GetSimulationTimeStamp());
8514 Print("ProjectileDebugging | speedCoef: " + speedCoef);
8515 Print("ProjectileDebugging | GetWorldTime(): " + GetWorldTime());
8516 Print("-----------------------------------------------");*/
8517 }
8518
8519 //Use this method to process additionnal dmg to legs specifically (must use the dmg system to fire relevant events)
8520 //Legzone is a dummy to inflict damage once and NOT transfer damage to other zones. All leg zones will drop to 0 anyway
8522 {
8524 legZones.Insert("LeftLeg");
8525 legZones.Insert("RightLeg");
8526 legZones.Insert("RightFoot");
8527 legZones.Insert("LeftFoot");
8528
8529 for (int i = 0; i < legZones.Count(); i++)
8530 DecreaseHealth(legZones[i], "", inputDmg);
8531 }
8532
8534 void TryHideItemInHands(bool hide, bool force = false)
8535 {
8536 if (!hide && ((!IsSwimming() && !IsClimbingLadder() && !IsInVehicle() && !AnimCommandCheck(HumanMoveCommandID.CommandSwim | HumanMoveCommandID.CommandLadder | HumanMoveCommandID.CommandVehicle)) || force))
8537 GetItemAccessor().HideItemInHands(false);
8538 else
8539 GetItemAccessor().HideItemInHands(true);
8540 }
8541
8544 {
8545 float stackable = item.GetTargetQuantityMax();
8546 if (!(stackable == 0 || stackable >= item.GetQuantity()))
8547 {
8549 if (target && target.GetInventory().FindFreeLocationFor(item, flags, il))
8550 {
8552 if (CastTo(itemB, item))
8553 {
8554 itemB.SplitIntoStackMaxToInventoryLocationClient(il);
8555 return true;
8556 }
8557 }
8558 }
8559 return false;
8560 }
8561
8563 {
8564 float stackable = item.GetTargetQuantityMax();
8565 if (!(stackable == 0 || stackable >= item.GetQuantity()))
8566 {
8568 if (CastTo(itemB, item))
8569 {
8570 itemB.SplitIntoStackMaxToInventoryLocationClient(il);
8571 return true;
8572 }
8573 }
8574 return false;
8575 }
8576
8578 {
8579 if (CheckAndExecuteStackSplit(flags, item, this))
8580 {
8581 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2Inv(SPLIT) item=" + GetDebugName(item));
8582 return true;
8583 }
8584
8585 return super.TakeEntityToInventoryImpl(mode, flags, item);
8586 }
8587
8589 {
8590 if (CheckAndExecuteStackSplit(FindInventoryLocationType.CARGO, item, this))
8591 {
8592 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2Cgo(SPLIT) item=" + GetDebugName(item));
8593 return true;
8594 }
8595
8596 return super.TakeEntityToCargoImpl(mode, item);
8597 }
8598
8600 {
8601 if (CheckAndExecuteStackSplit(FindInventoryLocationType.ATTACHMENT, item, this))
8602 {
8603 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2Att(SPLIT) item=" + GetDebugName(item));
8604 return true;
8605 }
8606
8607 return super.TakeEntityAsAttachmentImpl(mode, item);
8608 }
8609
8611 {
8612 if (CheckAndExecuteStackSplit(FindInventoryLocationType.HANDS, item, this))
8613 {
8614 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2Hands(SPLIT) item=" + GetDebugName(item));
8615 return;
8616 }
8617
8618 super.TakeEntityToHandsImpl(mode, item);
8619 }
8620
8622 {
8623 if (CheckAndExecuteStackSplit(flags, item, target))
8624 {
8625 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2TargetInv(SPLIT) item=" + GetDebugName(item));
8626 return true;
8627 }
8628
8629 return super.TakeEntityToTargetInventoryImpl(mode, target, flags, item);
8630 }
8631
8633 {
8634 if (CheckAndExecuteStackSplit(FindInventoryLocationType.CARGO, item, target))
8635 {
8636 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2TargetCgo(SPLIT) item=" + GetDebugName(item));
8637 return true;
8638 }
8639
8640 return super.TakeEntityToTargetCargoImpl(mode, target, item);
8641 }
8642
8644 {
8645 if (CheckAndExecuteStackSplit(FindInventoryLocationType.ATTACHMENT, item, target))
8646 {
8647 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2TargetAtt(SPLIT) item=" + GetDebugName(item));
8648 return true;
8649 }
8650
8651 return super.TakeEntityToTargetAttachmentImpl(mode, target, item);
8652 }
8653
8655 {
8656 if (CheckAndExecuteStackSplitToInventoryLocation(dst, dst.GetItem()))
8657 {
8658 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS=" + GetSimulationTimeStamp() + " Take2Dst(SPLIT) item=" + GetDebugName(dst.GetItem()));
8659 return true;
8660 }
8661
8662 return super.TakeToDstImpl(mode, src, dst);
8663 }
8664
8666 {
8667 return GetBonePositionWS(GetBoneIndexByName("spine3"));
8668 }
8669
8670
8671 // contaminated areas - temp stuff
8673 {
8674 if (GetCommand_Move() && m_ContaminatedAroundPlayer && m_ContaminatedAroundPlayerTiny)
8675 {
8676 float playerSpeed = GetCommand_Move().GetCurrentMovementSpeed();
8677 //Print(playerSpeed);
8678
8679 // 1 - prone, crouch
8680 // 2 - jog
8681 // 3 - sprint
8682 float particleLifetime = 5.25;
8683 float particleSpeed = 0.25;
8684 if (playerSpeed >= 1)
8685 {
8686 particleLifetime = 3.5;
8687 particleSpeed = 3.25;
8688 }
8689 if (playerSpeed >= 2)
8690 {
8691 particleLifetime = 2.5;
8692 particleSpeed = 5.25;
8693 }
8694 if (playerSpeed >= 3)
8695 {
8696 particleLifetime = 1.5;
8697 particleSpeed = 8.25;
8698 }
8699 m_ContaminatedAroundPlayer.SetParameter(0, EmitorParam.LIFETIME, particleLifetime);
8700 m_ContaminatedAroundPlayer.SetParameter(1, EmitorParam.LIFETIME, particleLifetime);
8701 m_ContaminatedAroundPlayer.SetParameter(2, EmitorParam.LIFETIME, particleLifetime);
8702 m_ContaminatedAroundPlayer.SetParameter(3, EmitorParam.LIFETIME, particleLifetime);
8703
8704 m_ContaminatedAroundPlayerTiny.SetParameter(0, EmitorParam.VELOCITY, particleSpeed);
8705 vector transform[4];
8706 GetTransform(transform);
8707 m_ContaminatedAroundPlayer.SetTransform(transform);
8708 m_ContaminatedAroundPlayerTiny.SetTransform(transform);
8709 }
8710 }
8711
8713 {
8714 if (!IsControlledPlayer())
8715 return;
8716 int i;
8717
8718 if (m_ProcessRemoveGlassesEffects)
8719 {
8720 for (i = 0; i < m_ProcessRemoveGlassesEffects.Count(); i++)
8721 PPERequesterBank.GetRequester(m_ProcessRemoveGlassesEffects[i]).Stop();
8722 m_ProcessRemoveGlassesEffects.Clear();
8723 }
8724
8725 if (m_ProcessAddGlassesEffects)
8726 {
8727 for (i = 0; i < m_ProcessAddGlassesEffects.Count(); i++)
8728 PPERequesterBank.GetRequester(m_ProcessAddGlassesEffects[i]).Start();
8729 m_ProcessAddGlassesEffects.Clear();
8730 }
8731 }
8732
8734 {
8736 GetActionComponentNameList(componentIndex, CachedObjectsArrays.ARRAY_STRING, LOD.NAME_FIRE);
8737
8738 int pivot = componentIndex;
8739 int newPivot = -1;
8740 string compName;
8741 for (int i = 0; i < CachedObjectsArrays.ARRAY_STRING.Count() && newPivot == -1; i++)
8742 {
8745
8746 }
8747
8748 if (newPivot != -1)
8749 pivot = newPivot;
8750
8751
8754
8755 arrow.GetTransform(arrowTransMat);
8756
8757 if (pivot == -1)
8759 else
8760 {
8761 vector rotMatrix[3];
8763
8764 parentTransMat[0] = rotMatrix[0];
8765 parentTransMat[1] = rotMatrix[1];
8766 parentTransMat[2] = rotMatrix[2];
8768 }
8769
8772 arrow.SetTransform(arrowTransMat);
8773
8775
8776#ifdef SERVER
8777 // creating bleeding source
8778 BleedingSourcesManagerServer bleedingManager = GetBleedingManagerServer();
8779 if (bleedingManager)
8780 {
8781 if (!bleedingManager.AttemptAddBleedingSourceBySelection(compName))
8782 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
8783 }
8784#endif
8785 }
8786
8787 override bool IsManagingArrows()
8788 {
8789 return true;
8790 }
8791
8793 {
8794 return m_CachedPlayerName;
8795 }
8796
8798 {
8799 return m_CachedPlayerID;
8800 }
8801}
8802
8803
8804#ifdef DEVELOPER
8805
8807#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Definition EntityAI.c:97
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 ActionGetOutTransport()
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void ActionStartEngine()
DEPRECATED.
class ActionTargets ActionTarget
ActionUncoverHeadBase ActionContinuousBase ActionUncoverHeadSelf()
ActionWashHandsWaterCB ActionContinuousBaseCB ActionWashHandsWater()
WorldCraftActionReciveData m_RecipeID
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
bool m_ActionsInitialize
void SetActions()
void InitializeActions()
ref ArrowManagerBase m_ArrowManager
Definition AnimalBase.c:24
override ArrowManagerBase GetArrowManager()
Definition AnimalBase.c:31
vector GetOrientation()
const int BREATH_VAPOUR_LEVEL_MAX
void EffectRadial(Param param1, Param param2)
class RecipeCacheData m_Recipes
const int ECE_EQUIP_ATTACHMENTS
const int ECE_PLACE_ON_SURFACE
const int ECE_INITAI
const int ECE_IN_INVENTORY
const int RF_DEFAULT
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
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:3528
override Widget Init()
Definition DayZGame.c:120
DayZGame GetDayZGame()
Definition DayZGame.c:3530
ref HumanMovementState m_MovementState
movement state
void DayZPlayerCameraOptics(DayZPlayer pPlayer, HumanInputController pInput)
bool IsProcessing()
void AbortWeaponEvent()
ref DayZPlayerImplementMeleeCombat m_MeleeCombat
void DayZPlayerUtils()
cannot be instantiated
int m_LastTick
Hud m_Hud
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
eMixedSoundStates
bits
EPlayerStates
EPulseType
Definition EPulseType.c:2
ERPCs
Definition ERPCs.c:2
EStaminaConsumers
EStaminaModifiers
EStatLevels
Definition EStatLevels.c:2
int GetID()
Get the ID registered in SEffectManager.
Definition Effect.c:517
void EmoteManager(PlayerBase player)
bool IsControllsLocked()
PluginAdminLog m_AdminLog
bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
bool IsEmotePlaying()
proto string ToString()
proto native Hive GetHive()
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:8539
int m_QuickBarBonus
Definition ItemBase.c:4730
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Definition ItemBase.c:4680
void MapNavigationBehaviour(PlayerBase pPlayer, EMapNavigationType pNavigationType=EMapNavigationType.BASIC)
PlayerBase GetPlayer()
PluginPlayerStatus m_ModulePlayerStatus
string GetDebugText()
int GetStorageVersion()
eModifierSyncIDs
bool OnStoreLoad(ParamsReadContext ctx, int version)
void ModifiersManager(PlayerBase player)
void NotifiersManager(PlayerBase player)
ref VirtualHud m_VirtualHud
void OnScheduledTick()
VirtualHud GetVirtualHud()
PPERequesterCategory
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
PersistentFlag
void PlayerSoundEventHandler(PlayerBase player)
void PlayerSoundManagerClient(PlayerBase player)
array< ref PlayerStatBase > Get()
EPlayerStats_current
ref array< ref PlayerStatBase > m_PlayerStats
PlayerStatBase GetStatObject(int id)
void PlayerStomach(PlayerBase player)
bool IsFullBody()
PluginConfigDebugProfile m_ConfigDebugProfile
void PluginItemDiagnostic()
void PluginLifespan()
ref map< PlayerBase, int > m_BloodType
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
void QuickBarBase(PlayerBase player)
PlayerBase _player
void RandomGeneratorSyncManager(DayZPlayer player)
class SoundObjectBuilder SoundObject(SoundParams soundParams)
void SoundObjectBuilder(SoundParams soundParams)
StaminaHandler m_StaminaHandler
proto native UAInputAPI GetUApi()
class JsonUndergroundAreaTriggerData GetPosition
void UndergroundHandlerClient(PlayerBase player)
override bool IsIdle()
static string GetPulseMessage(EPulseType pulse_type, int blood_level)
const int TARGET_IRREGULAR_PULSE_BIT
static void PlayerDisconnected(StatsEventDisconnectedData data)
static void PlayerMeasures(StatsEventMeasuresData data)
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 Param1< int > PARAM1_INT
static ref Param1< string > PARAM1_STRING
static ref Param2< float, float > PARAM2_FLOAT_FLOAT
represents base for cargo storage for entities
Definition Cargo.c:7
static int GetLightingConfig()
static bool GetAllowStaminaAffectInertia()
static bool GetHitIndicationPPEEnabled()
static TStringSet GetDisallowedTypesInUnderground()
static bool GetDisableRespawnDialog()
Super root of all classes in Enforce script.
Definition EnScript.c:11
static void RemovePlayerBase(Man player)
Definition ClientData.c:29
static void AddPlayerBase(Man player)
Definition ClientData.c:23
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)
static bool ReadShockParams(ParamsReadContext pCtx, out float shockValue)
static const int SJ_PLAYER_ADD_MODIFIER
static const int SJ_WEAPON_ACTION_ACK_REJECT
static void SendDeleteItem(DayZPlayer pPlayer, EntityAI item)
static bool ReadKuruRequest(ParamsReadContext pCtx, out float amount)
static const int SJ_QUICKBAR_SET_SHORTCUT
static bool ReadBrokenLegsParamsEx(ParamsReadContext pCtx, out int currentState)
static const int SJ_WEAPON_ACTION_ACK_ACCEPT
static const int SJ_WEAPON_SET_JAMMING_CHANCE
static bool ReadInjuryParams(ParamsReadContext pCtx, out bool pEnable, out eInjuryHandlerLevels level)
static void SendPlayerUnconsciousness(DayZPlayer pPlayer, bool enable)
static bool ReadPlayerUnconsciousnessParams(ParamsReadContext pCtx, out bool enable)
static void SendBrokenLegsEx(DayZPlayer pPlayer, int currentState)
Definition Debug.c:14
static Shape DrawBoxEx(vector pos1, vector pos2, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOZWRITE)
Definition Debug.c:406
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:133
Wrapper class for managing particles through SEffectManager.
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
int GetEffectsPriority()
script counterpart to engine's class Inventory
Definition Inventory.c:79
static proto native bool PrepareDropEntityPos(EntityAI owner, notnull EntityAI item, out vector mat[4], bool useValuesInMatrix=false, int conflictCheckDepth=-1)
Finds a transformation for the item to be dropped to If the initial transforation overlaps with anoth...
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
Definition Inventory.c:610
static bool CanForceSwapEntitiesEx(notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
Definition Inventory.c:645
grouped gameplay effect widgets and their handling
override void AddSuspendRequest(int request_id)
override void OnVoiceEvent(float breathing_resistance01)
override void Update(float timeSlice)
Generic update, called on frame from the player.
override void RemoveSuspendRequest(int request_id)
override void RemoveActiveEffects(array< int > effects)
override void AddActiveEffects(array< int > effects)
Definition Hive.c:6
void UpdateBloodName()
Definition gameplay.c:640
void ShowQuickbarPlayer(bool show)
void HideVehicleInfo()
void ShowVehicleInfo()
void ShowHudUI(bool show)
void SetStaminaBarVisibility(bool show)
void Update(float timeslice)
Definition gameplay.c:643
void SetTemperature(string temp)
void ShowQuickbarUI(bool show)
void ShowHudPlayer(bool show)
void UpdateQuickbarGlobalVisibility()
void ToggleHeatBufferPlusSign(bool show)
const float LVL3
Client only - manage set up crafting on client.
InventoryLocation.
static string DumpToStringNullSafe(InventoryLocation loc)
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
LOD class.
Definition gameplay.c:203
static const string NAME_FIRE
Definition gameplay.c:207
Definition Liquid.c:2
static string GetLiquidClassname(int liquid_type)
Definition Liquid.c:8
static bool IsSyncLogEnable()
Definition Debug.c:759
ref MapNavigationBehaviour m_MapNavigationBehaviour
Definition PlayerBase.c:232
bool AnimCommandCheck(HumanMoveCommandID mask)
void UpdateLighting()
bool IsTargetInActiveRefresherRange(EntityAI target)
override void PredictiveTakeEntityToHands(EntityAI item)
float GetSimplifiedShockNormalized()
string m_UALastMessage
user actions last message
Definition PlayerBase.c:249
ref PlayerSoundManagerServer m_PlayerSoundManagerServer
Definition PlayerBase.c:82
SymptomManager GetSymptomManager()
void UpdateCorpseState()
void UpdateHairSelectionVisibility(bool was_debug=false)
PlayerStat< float > GetStatSpecialty()
DayZPlayerCameraBase m_CurrentCamera
Definition PlayerBase.c:112
void SetNVGWorking(bool state)
Deprecated.
bool GetLiquidTendencyDrain()
bool IsAntibioticsActive()
Definition PlayerBase.c:535
PlayerStat< float > GetStatToxicity()
bool m_CorpseProcessing
Definition PlayerBase.c:95
PlayerBase m_CheckPulseLastTarget
Definition PlayerBase.c:131
float GetSingleAgentCountNormalized(int agent_id)
ref array< ref Param2< EntityAI, int > > m_aQuickBarLoad
Definition PlayerBase.c:184
override bool IsRefresherSignalingViable()
ref BleedingSourcesManagerRemote m_BleedingManagerRemote
Definition PlayerBase.c:34
ref array< int > m_ProcessAddGlassesEffects
Definition PlayerBase.c:282
int m_ShockSimplified
Definition PlayerBase.c:102
override bool PredictiveTakeEntityToTargetCargoEx(notnull CargoBase cargo, notnull EntityAI item, int row, int col)
void SetPlayerLoad(float load)
void AddToEnvironmentTemperature(float pTemperature)
DEPRECATED.
bool HasBloodyHands()
override void ProcessLiftWeapon()
ref CraftingManager m_CraftingManager
Definition PlayerBase.c:78
void ResetActiveNV()
bool ItemToInventory
Definition PlayerBase.c:218
void FixAllInventoryItems()
override bool IsLanded(int pCurrentCommandID)
void ReloadWeapon(EntityAI weapon, EntityAI magazine)
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
bool IsPlacingServer()
void AddPossibleCoverFaceForShave()
DEPRECATED!
void EndFighting()
void RefreshHandAnimationState(int delay=0)
void ImmuneSystemTick(float value, float deltaT)
override void OnReceivedHit(ImpactEffectsData hitData)
override void OnVariablesSynchronized()
ref array< int > m_ProcessRemoveEffectWidgets
Definition PlayerBase.c:279
void OnUnconsciousStart()
void SetCraftingRecipeID(int recipeID)
PlayerSoundManagerServer GetPlayerSoundManagerServer()
void UpdateQuickBarEntityVisibility(EntityAI entity)
vector m_PlayerOldPos
override bool CanStartConsumingStamina(EStaminaConsumers consumer)
override bool NeedInventoryJunctureFromServer(notnull EntityAI item, EntityAI currParent, EntityAI newParent)
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:668
override void OnThrowingModeChange(bool change_to_enabled)
override bool CanSwapItemInCargo(EntityAI child_entity, EntityAI new_entity)
override void OnStoreSave(ParamsWriteContext ctx)
void OnConnect()
bool TakeEntityToInventoryImpl(InventoryMode mode, FindInventoryLocationType flags, notnull EntityAI item)
void MessageAction(string text)
void ClearLastUAMessage()
void OnPlayerLoaded()
void OnCommandHandlerTick(float delta_time, int pCurrentCommandID)
ref SymptomManager m_SymptomManager
Definition PlayerBase.c:43
void SetImmunityBoosted(bool boosted)
bool CheckAndExecuteStackSplit(FindInventoryLocationType flags, notnull EntityAI item, notnull EntityAI target)
override SoundOnVehicle PlaySound(string sound_name, float range, bool create_local=false)
override void OnCommandClimbStart()
void SwitchItemTypeDetach(EntityAI item, string slot)
void RadialQuickBarCombine(int slotClicked)
void SetBloodType(int blood_type)
void Message(string text, string style)
bool m_ActionsInitialize
Definition PlayerBase.c:74
bool IsLeaning()
void RemoveCurrentEffectTrigger()
Definition PlayerBase.c:580
void MapNavigationItemInPossession(EntityAI item)
void SetBloodTypeVisible(bool show)
void SetMixedSoundState(eMixedSoundStates state)
Definition PlayerBase.c:736
PlayerStat< float > m_StatEnergy
Definition PlayerBase.c:266
void PlacingCancelServer()
bool IsClimbing()
bool m_MeleeDebug
melee stats
Definition PlayerBase.c:244
void IncreaseContaminatedAreaCount()
Definition PlayerBase.c:594
float GetImmunity()
returns player's immunity strength between 0..1
bool IsInProne()
override bool IsLiftWeapon()
ItemBase CreateCopyOfItemInInventoryOrGroundEx(ItemBase src, bool markItemAsSplitResult=false)
void SendLiftWeaponSync(bool state)
Client-side only.
static ref array< string > m_BleedingSourcesLow
Definition PlayerBase.c:144
vector m_DirectionToCursor
Definition PlayerBase.c:114
bool CanEatAndDrink()
void OnBleedingSourceAdded()
DamageDealtEffect GetDamageDealtEffect()
Definition PlayerBase.c:837
ref TInputActionMap m_InputActionMap
Definition PlayerBase.c:71
ref PlayerStats m_PlayerStats
Definition PlayerBase.c:31
void SendSoundEventEx(EPlayerSoundEventID id, int param=0)
void ResetPlayer(bool set_max)
bool CanDeleteItems()
override void OnCommandDeathStart()
EntityAI SpawnAI(string object_name, vector pos)
override void OnPlayerRecievedHit()
PluginPlayerStatus m_ModulePlayerStatus
Definition PlayerBase.c:25
void EndSurrenderRequest(SurrenderData data=null)
ends surrender, originally intended for surrender->restrained transitioning
ItemBase GetItemOnHead()
Returns item on player's head. For an example, a headtorch.
Definition PlayerBase.c:685
override bool CanReleaseFromHands(EntityAI handheld)
bool IsRolling()
vector m_LastFirePoint
Definition PlayerBase.c:214
void OnInventoryMenuClose()
bool CanSpawnBreathVaporEffect()
string GetCachedName()
void CloseMapEx(bool cancelled)
TransferValues GetTransferValues()
EPulseType m_PulseType
Definition PlayerBase.c:130
int m_SyncedModifiersPrev
Definition PlayerBase.c:257
override bool OnStoreLoad(ParamsReadContext ctx, int version)
ref array< int > m_Recipes
Definition PlayerBase.c:202
void UpdateBrokenLegs(int stateId)
override bool IsUnconscious()
override void SpawnDamageDealtEffect()
Definition PlayerBase.c:842
void OnHoldBreathStart()
int m_LastShavedSeconds
Definition PlayerBase.c:6
DebugMonitorValues GetDebugMonitorValues()
bool m_MapCloseRequestProcessed
Definition PlayerBase.c:228
ref EffectParticle m_FliesEff
Definition PlayerBase.c:70
void DropHeavyItem()
bool IsBleeding()
Definition PlayerBase.c:752
ref array< int > m_ProcessRemoveGlassesEffects
Definition PlayerBase.c:283
ref Param3< float, float, bool > m_StaminaParam
Definition PlayerBase.c:62
ref ArrowManagerPlayer m_ArrowManager
Definition PlayerBase.c:79
override bool IsPlayer()
Definition PlayerBase.c:747
PlayerStat< float > m_StatHeatComfort
Definition PlayerBase.c:267
ref PlayerAgentPool m_AgentPool
Definition PlayerBase.c:39
void QueueRemoveEffectWidget(array< int > effects)
Definition PlayerBase.c:822
bool m_LiquidTendencyDrain
Definition PlayerBase.c:9
EPulseType GetPulseType()
Definition PlayerBase.c:807
override bool PredictiveDropEntity(notnull EntityAI item)
EntityAI m_Item2
Definition PlayerBase.c:198
void SetPersistentFlag(PersistentFlag bit, bool enable)
void SetStaminaState(eStaminaState state)
override void OnRollFinish()
int GetBreathVapourLevel()
Definition PlayerBase.c:716
bool IsSwapBetweenHandsAndGroundLargeItem(notnull EntityAI item1, notnull EntityAI item2, out EntityAI item_hands, out EntityAI item_ground)
ref UndergroundHandlerClient m_UndergroundHandler
Definition PlayerBase.c:30
vector GetLocalProjectionOrientation()
void SetStamina(int value, int range)
bool IsEmotePlaying()
void SetActionEndInput(ActionBase action)
float GetStatBordersWater()
bool TakeEntityToTargetAttachmentImpl(InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
void dmgDebugPrint(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
override void OnLadder(float delta_time, HumanMovementState pState)
called every command handler tick when player is on ladder
EntityAI m_Item1
Definition PlayerBase.c:197
override bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
void OnPlayerReceiveFlashbangHitStart(bool visual)
override array< string > GetSuitableFinisherHitComponents()
returns list of suitable finisher hit components (defined on base entity/entity type)
string GetLastUAMessage()
UA Last Message.
eMixedSoundStates GetMixedSoundStates()
void SpawnShockEffect(float intensity_max)
Definition PlayerBase.c:880
void MessageFriendly(string text)
float m_LastShockHitTime
Definition PlayerBase.c:111
bool IsMapCallbackCancelInput()
int GetCurrentRecipe()
override int GetQuickBarBonus()
Definition PlayerBase.c:690
ref Hologram m_HologramServer
Definition PlayerBase.c:187
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Definition PlayerBase.c:926
BleedingSourcesManagerServer GetBleedingManagerServer()
override bool PredictiveSwapEntities(notnull EntityAI item1, notnull EntityAI item2)
void OnPlayerIsNowInsideEffectAreaEndServer()
Definition PlayerBase.c:651
void OnBleedingSourceRemovedEx(ItemBase item)
bool m_LoweredNVGHeadset
Definition PlayerBase.c:253
static Particle m_ContaminatedAroundPlayerTiny
Definition PlayerBase.c:262
override void EEKilled(Object killer)
Definition PlayerBase.c:888
void SetBloodyHands(bool show)
float GetStatBordersEnergy()
float m_UnconsciousTime
Definition PlayerBase.c:101
override bool CanReleaseAttachment(EntityAI attachment)
void RadialQuickBarSingleUse(int slotClicked)
override void EEItemOutOfHands(EntityAI item)
int m_BloodType
Definition PlayerBase.c:7
float GetBordersImmunity()
bool m_IsDrowning
Definition PlayerBase.c:220
void QuickReloadWeapon(EntityAI weapon)
void PreloadDecayTexture()
void DecreaseHealingsCount()
Definition PlayerBase.c:790
VirtualHud GetVirtualHud()
EffectSound m_AmbientContamination
Definition PlayerBase.c:153
override void EEItemIntoHands(EntityAI item)
void MapNavigationItemNotInPossession(EntityAI item)
void UpdateShoulderProxyVisibility(EntityAI item, string slot_name)
int GetCraftingRecipeID()
override bool IsRestrained()
void OnSpawnedFromConsole()
void ShowUnconsciousScreen(bool show)
override bool PredictiveTakeEntityToTargetAttachment(notnull EntityAI target, notnull EntityAI item)
ref array< int > m_ProcessAddEffectWidgets
Definition PlayerBase.c:278
override void SwitchItemSelectionTexture(EntityAI item, string slot_name)
bool m_InsideEffectAreaPrev
Definition PlayerBase.c:157
bool ReadLiftWeaponRequest(int userDataType, ParamsReadContext ctx)
EStatLevels GetStatLevelEnergy()
bool CanBeRestrained()
bool m_AreHandsLocked
Definition PlayerBase.c:108
bool m_AllowQuickRestrain
Definition PlayerBase.c:118
override bool IsFighting()
ref EffectRadial m_EffectRadial
Definition PlayerBase.c:67
void SpreadAgents()
void OnHoldBreathEnd()
ref Environment m_Environment
Definition PlayerBase.c:41
void SetNVGLowered(bool state)
void SetLocalProjectionOrientation(vector local_orientation)
bool IsPersistentFlag(PersistentFlag bit)
override void EOnFrame(IEntity other, float timeSlice)
int m_ContaminatedAreaCount
Definition PlayerBase.c:154
int m_HealingsCount
Definition PlayerBase.c:117
PlayerStat< float > GetStatEnergy()
void OnUnconsciousUpdate(float pDt, int last_command)
bool IsQBControl()
override void OnCommandLadderStart()
GameplayEffectWidgets_base m_EffectWidgets
effect widgets
Definition PlayerBase.c:277
void DecreaseEffectAreaCount()
Definition PlayerBase.c:621
override void RemoveAgent(int agent_id)
override vector GetDefaultHitPosition()
float m_OriginalSlidePoseAngle
Definition PlayerBase.c:55
override EntityAI SpawnEntityOnGroundPos(string object_name, vector pos)
PlayerStomach GetStomach()
ref PlayerStomach m_PlayerStomach
Definition PlayerBase.c:259
int GetNVType()
void OnQuickbarSetEntityRequest(ParamsReadContext ctx)
int m_RecipePick
Definition PlayerBase.c:89
void IncreaseDiseaseCount()
Definition PlayerBase.c:775
void SetMapOpen(bool state)
bool m_SoundEventSent
Definition PlayerBase.c:59
bool m_IsRestrained
Definition PlayerBase.c:104
CraftingManager GetCraftingManager()
void AdjustBandana(EntityAI item, string slot_name)
void SetLastMapInfo(float scale, vector pos)
override string GetDefaultHitComponent()
returns default hit component (fallback)
bool m_IsRestrainStarted
Definition PlayerBase.c:105
int m_SoundEvent
Definition PlayerBase.c:56
void SwitchItemTypeAttach(EntityAI item, string slot)
bool m_BrokenLegsJunctureReceived
Definition PlayerBase.c:139
override void CommandHandler(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
void CheckForGag()
override WeaponManager GetWeaponManager()
bool IsInWater()
ModifiersManager GetModifiersManager()
void IncreaseAntibioticsCount()
Definition PlayerBase.c:520
float GetStatLevelBorders(float stat_value, float critical, float low, float normal, float high, float max)
void RequestUnconsciousness(bool enable)
UndergroundHandlerClient GetUndergroundHandler()
string m_CachedPlayerName
Definition PlayerBase.c:163
override void EEItemDetached(EntityAI item, string slot_name)
void RemoveAction(typename actionName, out TInputActionMap InputActionMap)
bool ResetADSPlayerSync(int userDataType, ParamsReadContext ctx)
server only
void CheckForBurlap()
void SetHairLevelToHide(int level, bool state, bool was_debug=false)
Dynamic hair hiding.
void SpawnDrowningBubbles()
void IncreaseHealingsCount()
Definition PlayerBase.c:785
void SetActionsRemoteTarget(out TInputActionMap InputActionMap)
override bool CanChangeStance(int previousStance, int newStance)
void SetSoundCategoryHash(int hash)
Definition PlayerBase.c:540
override bool CanDropEntity(notnull EntityAI item)
Definition PlayerBase.c:698
ref SoundObject m_SaySoundObject
Definition PlayerBase.c:206
EffectTrigger m_CurrentEffectTrigger
Definition PlayerBase.c:158
ItemBase m_CheckMeleeItem
Definition PlayerBase.c:246
void HandleBrokenLegsSync()
void OnVoiceEventPlayback(PlayerSoundEventBase voice_event, AbstractWave callback, float playback_time)
called every cmd handler tick during a playback of PlayerSoundEvent, m_ProcessPlaybackEvent needs to ...
void TogglePlacingLocal(ItemBase item=null)
ref ShockDealtEffect m_ShockDealtEffect
Definition PlayerBase.c:69
void OnJumpOutVehicleFinish(float carSpeed)
void SetUnderground(EUndergroundPresence presence)
int GetQuickBarSize()
bool m_IsHoldingBreath
Definition PlayerBase.c:90
void QueueRemoveGlassesEffect(int id)
Definition PlayerBase.c:832
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:547
bool m_ProcessUIWarning
Definition PlayerBase.c:16
bool m_MapClosingSyncSent
Definition PlayerBase.c:229
bool m_CanPlayBrokenLegSound
Definition PlayerBase.c:142
override void OnStanceChange(int previousStance, int newStance)
void PlacingCancelLocal()
string m_DatabaseID
Definition PlayerBase.c:240
void SetInWater(bool pState)
water contact (driven by Environment)
void SetLastFirePointRot(float last_fire_point_rot)
void OnVoiceEvent(PlayerSoundEventBase voice_event)
void SetFirstRecipe()
void SetEnableQuickBarEntityShortcut(EntityAI entity, bool value)
EntityAI CreateInInventory(string item_name, string cargo_type="", bool full_quantity=false)
void AntibioticsAttack(float value)
ActionManagerBase GetActionManager()
bool IsItemInInventory(EntityAI entity)
int m_StaminaState
Definition PlayerBase.c:100
void AddActiveNV(int type)
int m_RefreshAnimStateIdx
Definition PlayerBase.c:18
void SetLoadedQuickBarItemBind(EntityAI entity, int index)
void CheckSendSoundEvent()
int m_BleedingBits
Definition PlayerBase.c:113
void SetLifeSpanStateVisible(int show_state)
override void OnJumpStart()
void RemoveQuickBarEntityShortcut(EntityAI entity)
vector SetDefaultHitPosition(string pSelection)
override bool IsHoldingBreath()
void UpdateTranslatedSelections(SelectionTranslation stt)
ref DebugMonitorValues m_DebugMonitorValues
Definition PlayerBase.c:51
bool m_InventorySoftLocked
Definition PlayerBase.c:235
void MessageImportant(string text)
void SetHitPPEEnabled(bool enabled)
bool m_CanDisplayHitEffectPPE
Definition PlayerBase.c:161
vector m_LastMapPos
Definition PlayerBase.c:231
int GetStoreLoadVersion()
SoftSkillsManager GetSoftSkillsManager()
void ShavePlayer()
bool Consume(ItemBase source, float amount, EConsumeType consume_type)
bool CanSprint()
Hologram GetHologramLocal()
ref Param2< int, int > m_UAParam
Definition PlayerBase.c:61
int m_FliesIndex
Definition PlayerBase.c:58
override void OnGameplayDataHandlerSync()
void OnQuickBarContinuousUseStart(int slotClicked)
float GetHealthRegenSpeed()
void SaveAreaPersistenceFlag(ParamsWriteContext ctx)
override bool PredictiveTakeEntityToTargetInventory(notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
float m_LastFirePointRot
Definition PlayerBase.c:215
void RemovePossibleCoverFaceForShave()
DEPRECATED!
void SetBloodyHandsEx(eBloodyHandsTypes type)
void UnsetMixedSoundState(eMixedSoundStates state)
Definition PlayerBase.c:722
void OnVehicleSeatDriverLeft()
void IncreaseEffectAreaCount()
Definition PlayerBase.c:610
void UpdateMaskBreathWidget(notnull MaskBase mask, bool is_start=false)
bool IsNVGWorking()
override void OnCommandMoveStart()
override void RequestSoundEvent(EPlayerSoundEventID id, bool from_server_and_client=false)
ref Hologram m_HologramLocal
Definition PlayerBase.c:188
int GetSingleAgentCount(int agent_id)
override bool PredictiveTakeEntityToInventory(FindInventoryLocationType flags, notnull EntityAI item)
void QueueAddEffectWidget(array< int > effects)
Definition PlayerBase.c:817
void SetQuickFishing(bool enable)
override bool CanPickupHeavyItem(notnull EntityAI item)
PluginPresenceNotifier m_PresenceNotifier
Definition PlayerBase.c:28
void DecreaseContaminatedAreaCount()
Definition PlayerBase.c:601
bool IsQuickRestrain()
bool IsFalling()
void OnPlayerReceiveFlashbangHitEnd()
EmoteManager GetEmoteManager()
void RunFightBlendTimer()
void SetFlagTendencyRaise(bool state)
DEPRECATED.
void CheckZeroSoundEvent()
ref EffectSound m_SoundFliesEffect
Definition PlayerBase.c:85
void HandleGlassesEffect()
int SimplifyShock()
int GetShakeLevel()
int m_Shakes
Definition PlayerBase.c:120
void SendSoundEvent(EPlayerSoundEventID id)
float GetVisibilityCoef()
DayZPlayerCamera GetCurrentPlayerCamera()
EStatLevels GetStatLevelBlood()
override bool IsManagingArrows()
void OnPlayerIsNowInsideEffectAreaEndClient()
Definition PlayerBase.c:661
PlayerStat< float > m_StatTremor
Definition PlayerBase.c:268
EntityAI FindCargoByBaseType(string searched_item)
void UpdateDelete()
static set< int > GetFaceCoverageShaveValues()
returns a set of face covering values
bool IsPlayerLoaded()
vector m_DefaultHitPosition
Definition PlayerBase.c:115
void OnBleedingBegin()
override void OnCommandLadderFinish()
ref BleedingSourcesManagerServer m_BleedingManagerServer
Definition PlayerBase.c:33
override void JunctureDeleteItem(EntityAI item)
bool IsMale()
int GetBleedingSourceCount()
override void OnCommandMelee2Finish()
override void OnCommandSwimStart()
bool IsSurrendered()
bool m_IsVehicleSeatDriver
Definition PlayerBase.c:126
void TestSend()
void CloseInventoryMenu()
int m_BleedingSourceCount
Definition PlayerBase.c:128
bool CheckMeleeItemDamage(ItemBase item)
int FindQuickBarEntityIndex(EntityAI entity)
void SetToDelete(ParamsReadContext pCtx)
override bool PredictiveTakeEntityToTargetAttachmentEx(notnull EntityAI target, notnull EntityAI item, int slot)
bool m_FlagRaisingTendency
Definition PlayerBase.c:10
int GetBleedingBits()
Definition PlayerBase.c:770
override bool CanRoll()
void SetActions()
int m_MixedSoundStates
Definition PlayerBase.c:124
bool IsStance(int stance, int stanceMask)
void SetModifiers(bool enable)
bool IsCurrentCameraAimedAtGround()
ref Timer m_UALastMessageTimer
Definition PlayerBase.c:250
void OnSelectPlayer()
override bool PredictiveTakeEntityToTargetCargo(notnull EntityAI target, notnull EntityAI item)
void OnVehicleSwitchSeat(int seatIndex)
ref InventoryActionHandler m_InventoryActionHandler
Definition PlayerBase.c:80
int m_BreathVapour
Definition PlayerBase.c:122
EStatLevels GetImmunityLevel()
returns player's immunity level
int m_PersistentFlags
Definition PlayerBase.c:99
bool m_WorkingNVGHeadset
Definition PlayerBase.c:252
ref TransferValues m_TrasferValues
Definition PlayerBase.c:50
EStatLevels GetStatLevelToxicity()
bool IsJumpInProgress()
void ProcessHoldBreath(float dT)
void KillUndergroundHandler()
PlayerStat< float > GetStatTremor()
bool m_HasBloodTypeVisible
Definition PlayerBase.c:8
bool IsInRasedProne()
void AddAction(typename actionName)
Hud m_Hud
Definition PlayerBase.c:88
void SpawnBreathVaporEffect()
bool IsMapOpen()
void BreakLegSound()
void ApplySplint()
ref Param1< float > m_DeathDarkeningParam
Definition PlayerBase.c:65
void SetMapClosingSyncSet(bool state)
void OnPlayerIsNowInsideEffectAreaBeginClient()
Definition PlayerBase.c:656
bool TogglePlacingServer(int userDataType, ParamsReadContext ctx)
override bool PredictiveTakeToDst(notnull InventoryLocation src, notnull InventoryLocation dst)
ref VirtualHud m_VirtualHud
Definition PlayerBase.c:44
ref Timer m_AnalyticsTimer
Definition PlayerBase.c:241
void OnVehicleSeatDriverEnter()
void UpdateCorpseStateVisual()
bool IsRestrainPrelocked()
override bool IsAlreadyInFallingCommand(int pCurrentCommandID)
ref TInputActionMap m_InputActionMapControled
Definition PlayerBase.c:72
override void OnCommandClimbFinish()
ref HiddenSelectionsData m_EmptyGloves
Definition PlayerBase.c:76
NotifiersManager GetNotifiersManager()
bool HasStaminaRemaining()
DEPRECATED.
bool IsQuickFishing()
void SetLastFirePoint(vector last_fire_point)
eBloodyHandsTypes HasBloodyHandsEx()
float m_LastPostFrameTickTime
Definition PlayerBase.c:92
string m_CachedPlayerID
Definition PlayerBase.c:164
float GetStatBordersToxicity()
void DecreaseDiseaseCount()
Definition PlayerBase.c:780
void SetActions(out TInputActionMap InputActionMap)
void SetActionsRemoteTarget()
bool GetLastMapInfo(out float scale, out vector pos)
int GetStaminaState()
void ProcessADDModifier()
void FreezeCheck()
override int GetAgents()
void SetRestrained(bool is_restrained)
int GetLifeSpanState()
void SetLocalProjectionPosition(vector local_position)
int GetVoiceType()
void InitEditor()
ref Param2< float, float > m_UAProgressParam
Definition PlayerBase.c:60
void OnRestrainStart()
int m_HealthLevel
Definition PlayerBase.c:123
void OnDrowningEnd()
ref SoftSkillsManager m_SoftSkillsManager
Definition PlayerBase.c:48
override string GetHitComponentForAI()
Melee helpers.
override vector GetCenter()
float GetWeightSpecialized(bool forceRecalc=false)
override void EEItemAttached(EntityAI item, string slot_name)
bool CheckAndExecuteStackSplitToInventoryLocation(InventoryLocation il, notnull EntityAI item)
BleedingSourcesManagerRemote GetBleedingManagerRemote()
PlayerStat< float > GetStatHeatComfort()
bool TakeEntityToTargetInventoryImpl(InventoryMode mode, notnull EntityAI target, FindInventoryLocationType flags, notnull EntityAI item)
override void OnCommandSwimFinish()
bool Save()
override void OnCommandVehicleStart()
bool IsSyncedModifierActive(eModifierSyncIDs modifier)
Checks whether modifier (which has syncing enabled) is currently active, works on both Client and Ser...
FlashbangEffect GetFlashbangEffect()
Definition PlayerBase.c:859
override bool PhysicalPredictiveDropItem(EntityAI entity, bool heavy_item_only=true)
ref ModifiersManager m_ModifiersManager
Definition PlayerBase.c:35
void PrintAgents()
string GetPlayerClass()
string m_DecayedTexture
Definition PlayerBase.c:135
int m_LastFirePointIndex
Definition PlayerBase.c:216
void CloseMap()
DEPRECATED; terminates map animation callback and re-enables controls.
void OnDrowningStart()
ShockDealtEffect GetShockEffect()
Definition PlayerBase.c:875
void PlacingStartServer(ItemBase item)
ref array< EntityAI > m_ItemsToDelete
Definition PlayerBase.c:136
override void DepleteStamina(EStaminaModifiers modifier, float dT=-1)
override void ProcessFeetDamageServer(int pUserInt)
override void InsertAgent(int agent, float count=1)
void OnReconnect()
void SetQuickBarEntityShortcut(EntityAI entity, int index, bool force=false)
PlayerStat< float > m_StatToxicity
Definition PlayerBase.c:265
bool m_ActionQBControl
Definition PlayerBase.c:209
bool m_PlayerDisconnectProcessed
Definition PlayerBase.c:15
bool GetDrowningWaterLevelCheck()
int m_AnimCommandStarting
Definition PlayerBase.c:22
bool m_IsRestrainPrelocked
Definition PlayerBase.c:106
int m_ForceInjuryAnimMask
Definition PlayerBase.c:132
ref EffectSound m_BrokenLegSound
Definition PlayerBase.c:140
void SetPlayerDisconnected(bool state)
PlayerStat< float > GetStatWater()
override void OnCommandVehicleFinish()
PlayerStat< int > GetStatBloodType()
void SetLastUAMessage(string pMsg)
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
void SetShakesForced(int value)
bool CanManipulateInventory()
float GetLastFirePointRot()
void SpawnDamageDealtEffect2(Param param1=null, Param param2=null)
Definition PlayerBase.c:851
int m_DebugMonitorEnabled
Definition PlayerBase.c:223
EntityAI GetQuickBarEntity(int index)
StaminaHandler GetStaminaHandler()
override bool CanReceiveItemIntoCargo(EntityAI item)
ref SoundObjectBuilder m_SaySoundBuilder
Definition PlayerBase.c:205
int m_LifeSpanState
Definition PlayerBase.c:5
ref NotifiersManager m_NotifiersManager
Definition PlayerBase.c:36
override bool PlaySoundEvent(EPlayerSoundEventID id, bool from_anim_system=false, bool is_from_server=false)
override void EOnPostFrame(IEntity other, int extra)
ref StanceIndicator m_StanceIndicator
Definition PlayerBase.c:49
float ConvertNonlethalDamage(float damage, DamageType damageType)
ItemBase GetItemInHands()
void OnUnconsciousStop(int pCurrentCommandID)
float GetPlayerLoad()
int GetLastFirePointIndex()
void SetCheckMeleeItem(ItemBase item=null)
void OnStoreSaveLifespan(ParamsWriteContext ctx)
void SetDecayEffects(int effect=-1)
bool GetHitPPEEnabled()
PluginAdminLog m_AdminLog
Definition PlayerBase.c:258
bool CanRedirectToWeaponManager(notnull EntityAI item, out bool isActionPossible)
bool HasCoveredFaceForShave()
bool m_PlayerLoaded
Definition PlayerBase.c:14
void DealShock(float dmg)
void SetPulseType(EPulseType pulse_type)
Definition PlayerBase.c:812
void SetDrowning(bool enable)
void SetRestrainPrelocked(bool restrain_prelock)
ActionUnfoldMapCB m_hac
Definition PlayerBase.c:226
PlayerStats GetPlayerStats()
int m_LifespanLevelLocal
Definition PlayerBase.c:21
void OnCameraChanged(DayZPlayerCameraBase new_camera)
override void OnCommandFallStart()
ref SoundParams m_SaySoundParams
Definition PlayerBase.c:204
bool m_MapOpen
Definition PlayerBase.c:227
PlayerSoundEventHandler GetPlayerSoundEventHandler()
EntityAI GetMagazineToReload(EntityAI weapon)
void QueueAddGlassesEffect(int id)
Definition PlayerBase.c:827
void OnDisconnect()
bool m_HideHairAnimated
Definition PlayerBase.c:134
override bool IsInventoryVisible()
void CalculateVisibilityForAI()
bool IsSprinting()
void SetBloodyHandsPenalty()
float m_CurrentShock
Definition PlayerBase.c:103
RandomGeneratorSyncManager GetRandomGeneratorSyncManager()
void OnScheduledTick(float deltaTime)
void AddAction(typename actionName, out TInputActionMap InputActionMap)
void SetLastFirePointIndex(int last_fire_point_index)
PluginRecipesManager m_ModuleRecipesManager
Definition PlayerBase.c:32
void CheckSoundEvent()
vector m_CraftingInitialPos
Definition PlayerBase.c:201
PlayerStat< int > GetStatWet()
override void HideClothing(ItemOptics optic, bool state)
state 'true' == hide
vector GetLocalProjectionPosition()
ItemBase CreateCopyOfItemInInventoryOrGround(ItemBase src)
ref array< int > m_ActiveNVTypes
Definition PlayerBase.c:254
Head_Default m_CharactersHead
Definition PlayerBase.c:129
override bool HeadingModel(float pDt, SDayZPlayerHeadingModel pModel)
EStatLevels GetStatLevelWater()
void OnBleedingEnd()
PluginLifespan m_ModuleLifespan
Definition PlayerBase.c:27
int m_SoundEventParam
Definition PlayerBase.c:57
PlayerStat< float > GetStatStamina()
override void AfterStoreLoad()
void OnQuickBarContinuousUseEnd(int slotClicked)
bool DropItem(ItemBase item)
Spawn item on server side.
void ProcessHandDamage(float delta_time, HumanMovementState pState)
float GetStatBordersHealth()
float GetTotalAgentCount()
override bool IsInventorySoftLocked()
void PlacingStartLocal(ItemBase item)
void CheckDeath()
void ForceUpdateInjuredState()
update injured state immediately
void OnPlayerIsNowInsideEffectAreaBeginServer()
Definition PlayerBase.c:646
bool IsPlayerDisconnected()
ref WeaponManager m_WeaponManager
Definition PlayerBase.c:77
bool GetFlagTendencyRaise()
DEPRECATED.
override void RequestSoundEventEx(EPlayerSoundEventID id, bool from_server_and_client=false, int param=0)
void OnQuickBarSingleUse(int slotClicked)
void MovingShock(float legHealth, float highShock, float midShock, float lowShock)
void BrokenLegWalkShock()
void OnBleedingSourceRemoved()
void OnInventoryMenuOpen()
ref StaminaHandler m_StaminaHandler
Definition PlayerBase.c:45
int m_Agents
Definition PlayerBase.c:40
override void OnCommandMelee2Start()
ref DamageDealtEffect m_DamageDealtEffect
Definition PlayerBase.c:66
bool IsNVGLowered()
override void ClearInventory()
PlayerStat< float > m_StatWater
Definition PlayerBase.c:264
bool m_ContaminatedAreaEffectEnabled
Definition PlayerBase.c:151
bool HasDisease()
Definition PlayerBase.c:801
override void RPC(int rpc_type, array< ref Param > params, bool guaranteed, PlayerIdentity recipient=NULL)
void ResetConstructionActionData()
void Init()
Definition PlayerBase.c:290
ref ConstructionActionData m_ConstructionActionData
Definition PlayerBase.c:212
MapNavigationBehaviour GetMapNavigationBehaviour()
ItemBase CreateCopyOfItemInInventory(ItemBase src)
RandomGeneratorSyncManager m_RGSManager
Definition PlayerBase.c:147
bool IsPlacingLocal()
override bool IsIgnoredByConstruction()
int m_HasBloodyHandsVisible
Definition PlayerBase.c:11
void DecreaseAntibioticsCount()
Definition PlayerBase.c:525
static Particle m_ContaminatedAroundPlayer
Definition PlayerBase.c:261
ref Timer m_DeathCheckTimer
Definition PlayerBase.c:94
ref Param1< float > m_UnconParam
Definition PlayerBase.c:64
override void OnSyncJuncture(int pJunctureID, ParamsReadContext pCtx)
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
array< int > GetNVTypesArray()
bool m_ImmunityBoosted
Definition PlayerBase.c:107
int m_DiseaseCount
Definition PlayerBase.c:116
string m_SaySoundLastSetName
Definition PlayerBase.c:207
ConstructionActionData GetConstructionActionData()
string GetCachedID()
int m_StoreLoadVersion
Definition PlayerBase.c:19
EntityAI SpawnEntityOnGroundOnCursorDir(string object_name, float distance)
override void TakeEntityToHandsImpl(InventoryMode mode, EntityAI item)
static ref TStringArray m_QBarItems
Definition PlayerBase.c:237
override bool OnLand(int pCurrentCommandID, FallDamageData fallDamageData)
ref HeatComfortAnimHandler m_HCAnimHandler
Definition PlayerBase.c:84
override void RemoveAllAgents()
override bool CanSaveItemInHands(EntityAI item_in_hands)
bool m_IsCraftingReady
Definition PlayerBase.c:199
int GetLastShavedSeconds()
bool m_InsideEffectArea
Definition PlayerBase.c:156
void SetLegHealth()
void SpreadAgentsEx(float distance=3, float chance=0.25)
chance between [0..1] , distance in meters
void SetLiftWeapon(int pJunctureID, ParamsReadContext ctx)
bool HandleRemoteItemManipulation(int userDataType, ParamsReadContext ctx)
void DamageAllLegs(float inputDmg)
int GetBloodType()
float m_VisibilityCoef
Definition PlayerBase.c:54
void RequestResetADSSync()
void RemoveActiveNV(int type)
bool GetMapClosingSyncSent()
bool m_QuickBarHold
Definition PlayerBase.c:86
void BrokenLegForceProne(bool forceOverride=false)
bool CanShave()
void UpdateQuickBarExtraSlots()
override bool CanBeTargetedByAI(EntityAI ai)
override bool CanPlaceItem(EntityAI item)
void DropAllItems()
Drops all clothes/wearables this character is carrying on themselves.
void RemoveAllItems()
override bool PlaySoundEventEx(EPlayerSoundEventID id, bool from_anim_system=false, bool is_from_server=false, int param=0)
void SpawnFlashbangEffect(PlayerBase player, bool visual)
Definition PlayerBase.c:864
void PlayerBase()
Definition PlayerBase.c:285
PluginConfigEmotesProfile m_ConfigEmotesProfile
Definition PlayerBase.c:26
void HideHairSelections(ItemBase item, bool state)
ref FlashbangEffect m_FlashbangEffect
Definition PlayerBase.c:68
override void CheckAnimationOverrides()
bool IsItemsToDelete()
bool OnStoreLoadLifespan(ParamsReadContext ctx, int version)
void SetVisibilityCoef(float pVisibility)
EStatLevels GetStatLevelHealth()
float GetStatBordersBlood()
bool TakeEntityAsAttachmentImpl(InventoryMode mode, notnull EntityAI item)
override void OnParticleEvent(string pEventType, string pUserString, int pUserInt)
void OnContaminatedAreaExitServer()
Definition PlayerBase.c:640
void PlacingCompleteLocal()
void SetNewCharName()
EUndergroundPresence m_UndergroundPresence
Definition PlayerBase.c:23
vector GetAimPosition()
override void SetInventorySoftLock(bool status)
'soft lock' meaning inventory screen cannot be displayed, but mechanically, inventory operations are ...
bool TakeEntityToTargetCargoImpl(InventoryMode mode, notnull EntityAI target, notnull EntityAI item)
AbstractWave SaySoundSet(string name)
void PlacingCompleteServer()
override bool IsInFBEmoteState()
void SetRestrainStarted(bool restrain_started)
QuickBarBase m_QuickBarBase
Definition PlayerBase.c:81
bool m_AllowQuickFishing
Definition PlayerBase.c:119
void ProcessDrowning(float dT)
override void OnRollStart(bool isToTheRight)
eBrokenLegs GetBrokenLegs()
void ShockRefill(float pDt)
functionality moved to ShockMdfr::OnTick
void TryHideItemInHands(bool hide, bool force=false)
tries to hide item in player's hands, some exceptions for various movement states
float m_RecipeAnimLength
Definition PlayerBase.c:200
ref Param1< string > m_UAParamMessage
Definition PlayerBase.c:63
bool TakeEntityToCargoImpl(InventoryMode mode, notnull EntityAI item)
override void CheckLiftWeapon()
void InitializeActions()
void SetQuickRestrain(bool enable)
void AddPlayerLoad(float addedload)
void RequestHandAnimationStateRefresh()
ActionManagerBase m_ActionManager
Definition PlayerBase.c:37
override bool CanJump()
override void OnJumpEnd(int pLandType=0)
override void OnCommandFallFinish()
bool IsOverloaded()
ref ShockHandler m_ShockHandler
Definition PlayerBase.c:47
int m_LocalRefreshAnimStateIdx
Definition PlayerBase.c:17
bool m_HasHeatBuffer
Definition PlayerBase.c:13
bool IsMapCallbackEndInput()
float GetFeetDamageMoveModifier()
bool HasBloodTypeVisible()
int m_EffectAreaCount
Definition PlayerBase.c:155
void OnHoldBreathExhausted()
ref TInputActionMap m_InputActionMapAsTarget
Definition PlayerBase.c:73
override bool PredictiveForceSwapEntities(notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
PlayerStat< float > GetStatHeatBuffer()
void SetBleedingBits(int bits)
Definition PlayerBase.c:757
void ContaminatedParticleAdjustment()
void OnTick()
void LockHandsUntilItemHeld()
void ResetActionEndInput()
void ~PlayerBase()
void SetLiquidTendencyDrain(bool state)
void UpdateMovementInertia()
Update movement inertia based on stamina available.
override bool CanReceiveItemIntoHands(EntityAI item_to_hands)
override bool CanConsumeStamina(EStaminaConsumers consumer)
void SetNextRecipe()
ref InjuryAnimationHandler m_InjuryHandler
Definition PlayerBase.c:46
void UpdatePlayerMeasures()
void OnContaminatedAreaEnterServer()
Definition PlayerBase.c:634
void ToggleHeatBufferVisibility(bool show)
int m_AntibioticsActive
Definition PlayerBase.c:148
void SetLastShavedSeconds(int last_shaved_seconds)
int m_CorpseState
Definition PlayerBase.c:96
override void AddItemToDelete(EntityAI item)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override bool CanClimb(int climbType, SHumanCommandClimbResult climbRes)
bool IsWearingSplint()
ref PlayerSoundManagerClient m_PlayerSoundManagerClient
Definition PlayerBase.c:83
bool IsRestrainStarted()
override void EEHitByRemote(int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos)
ref EmoteManager m_EmoteManager
Definition PlayerBase.c:42
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)
int m_CorpseStateLocal
Definition PlayerBase.c:97
override ArrowManagerBase GetArrowManager()
float m_CargoLoad
Definition PlayerBase.c:53
void GiveShock(float shock)
override void SetProcessUIWarning(bool state)
bool TakeToDstImpl(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
void SetBrokenLegs(int stateId)
bool m_IsInWater
Definition PlayerBase.c:91
int m_SyncedModifiers
Definition PlayerBase.c:256
override void SimulateDeath(bool state)
int GetNoisePresenceInAI()
Return actual noise presence of player.
bool HasHealings()
Definition PlayerBase.c:796
void CheckHairClippingOnCharacterLoad()
helper method for re-checking hairhiding on character load
void SetBloodyHandsBase(int type)
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)
override void EEDelete(EntityAI parent)
bool IsFacingTarget(Object target)
override void SetDeathDarknessLevel(float duration, float tick_time)
int m_ShakesForced
Definition PlayerBase.c:121
void StaminaHUDNotifier(bool show)
vector GetLastFirePoint()
static ref array< string > m_BleedingSourcesUp
Definition PlayerBase.c:145
Hologram GetHologramServer()
override void AddArrow(Object arrow, int componentIndex, vector closeBonePosWS, vector closeBoneRotWS)
void RemoveAction(typename actionName)
override bool CanReleaseCargo(EntityAI cargo)
EStatLevels GetStatLevel(float stat_value, float critical, float low, float normal, float high)
void MessageStatus(string text)
void PlayAttachmentDropSound()
PlayerStat< float > GetStatDiet()
Definition EnMath.c:7
Mission class.
Definition gameplay.c:668
WorldLighting GetWorldLighting()
Definition gameplay.c:728
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
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
Legacy way of using particles in the game.
Definition Particle.c:7
void SetParameter(int emitter, int parameter, float value)
Set the value of a parameter of an emitor in the particle.
Definition Particle.c:603
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Definition Particle.c:262
static const int BREATH_VAPOUR_MEDIUM
static const int BREATH_VAPOUR_LIGHT
static const int DROWNING_BUBBLES
static const int CONTAMINATED_AREA_GAS_AROUND
static const int CONTAMINATED_AREA_GAS_TINY
static const int BREATH_VAPOUR_HEAVY
override void OnGameplayDataHandlerSync()
static const float HEALTH_REGEN_MAX
static const float SL_HEALTH_CRITICAL
static const int LAST_UA_MSG_LIFETIME
static const float BROKEN_LEGS_HIGH_HEALTH_THRESHOLD
static const float SL_WATER_HIGH
static const float SHOES_MOVEMENT_DAMAGE_PER_STEP
static const float IMMUNITY_THRESHOLD_LEVEL_CRITICAL
static const int CORPSE_STATE_MEDIUM
static const float THRESHOLD_HEAT_COMFORT_MINUS_WARNING
static const float SL_ENERGY_HIGH
static const float BROKEN_LEGS_SHOCK_SWIM
static const float BROKEN_LEGS_INITIAL_SHOCK
static const float FULL_SPRINT_DELAY_FROM_CROUCH
[seconds]
static const float SL_ENERGY_LOW
static const float THRESHOLD_HEAT_COMFORT_MINUS_CRITICAL
static const float SL_BLOOD_LOW
static const float BROKEN_LEGS_ROLL_SHOCK
static const int CORPSE_STATE_DECAYED
static const float BROKEN_LEGS_LOW_SHOCK_WALK
static const float SL_WATER_NORMAL
static const float SL_BLOOD_CRITICAL
static const float FULL_SPRINT_DELAY_FROM_PRONE
[seconds]
static const float SL_ENERGY_MAX
static const float SL_HEALTH_LOW
static const float GLOVES_DAMAGE_SLIDING_LADDER_PER_SEC
static const float UNCONSCIOUS_IN_WATER_TIME_LIMIT_TO_DEATH
static const float SL_HEALTH_NORMAL
static const float BROKEN_LEGS_STAND_SHOCK
static const float SL_WATER_LOW
static const float BROKEN_LEGS_MID_SHOCK_WALK
static const float BROKEN_CROUCH_MODIFIER
static const float SL_ENERGY_CRITICAL
static const float HEALTH_REGEN_MIN
static const int CHECK_EVERY_N_STEP
static const int DROWNING_BUBBLE_FREQUENCY_MIN
static const float IMMUNITY_THRESHOLD_LEVEL_LOW
static const float CHANCE_TO_BLEED_SLIDING_LADDER_PER_SEC
static const float IMMUNITY_THRESHOLD_LEVEL_HIGH
static const float DROWNING_DEFAULT_THRESHOLD
static const int DROWNING_BUBBLE_FREQUENCY_MAX
static const float BAREFOOT_MOVEMENT_BLEED_MODIFIER
[seconds]
static const float SL_BLOOD_NORMAL
static const float MELEE2_MOVEMENT_BLEND_DELAY
static const float SL_BLOOD_HIGH
static const float DROWNING_UNCONSCIOUS_THRESHOLD
static const int BLOOD_THRESHOLD_FATAL
static const float SL_ENERGY_NORMAL
static const float SL_WATER_CRITICAL
static const float IMMUNITY_THRESHOLD_LEVEL_NORMAL
static const float BROKEN_LEGS_LOW_HEALTH_THRESHOLD
static const float DROWNING_SWIMMING_THRESHOLD
static const float CAMERA_THRESHOLD_PITCH
static const float SL_WATER_MAX
static const float SL_HEALTH_HIGH
static const float BROKEN_LEGS_HIGH_SHOCK_WALK
The class that will be instanced (moddable)
Definition gameplay.c:376
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 bool IsEffectExist(int effect_id)
Checks whether an Effect ID is registered in SEffectManager.
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
proto static native bool CanStoreInputUserData()
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
void OnSyncJuncture(int pJunctureID, ParamsReadContext pCtx)
called from PlayerBase - syncs stamina values on server with client AND sets the value to match on se...
void SetStamina(float stamina_value)
void Update(float deltaT, int pCurrentCommandID)
static float GetParamFloat(string surface_name, string param_name)
Definition Surface.c:3
static void SendEntityKilled(EntityAI victim, EntityAI killer, EntityAI source, bool is_headshot)
Definition SyncEvents.c:54
Base native class for all motorized wheeled vehicles.
Definition Car.c:75
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static const vector Zero
Definition EnConvert.c:110
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
const int SIMPLE_SELECTION_SHOULDER_RIFLE
const int SIMPLE_SELECTION_SHOULDER_MELEE
override string GetDebugName()
void SDayZPlayerHeadingModel()
cannot be created from script
void ForceStandUpForHeavyItemsSwap(notnull EntityAI item1, notnull EntityAI item2)
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:597
proto native void SendSyncJuncture(int pJunctureID, ParamsWriteContext ctx)
-------------— sync stuff ----------------------—
class SDayZPlayerAimingModel SIMPLE_SELECTION_MELEE_RIFLE
float GetCurrentWaterLevel()
const int SIMPLE_SELECTION_MELEE_MELEE
string GetDefaultHitPositionComponent()
Definition dayzplayer.c:497
bool IsPlayerInStance(int pStanceMask)
-------------— camera additiona functions ----------------------—
class DayZPlayerCameraResult DayZPlayerCamera(DayZPlayer pPlayer, HumanInputController pInput)
Definition dayzplayer.c:56
eModifiers
Definition eModifiers.c:2
proto native float GetMax()
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Definition gameplay.c:6
proto native CGame GetGame()
const int AGT_UACTION_CONSUME
Definition constants.c:468
const int AGT_AIRBOURNE_BIOLOGICAL
Definition constants.c:472
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:420
ShapeFlags
Definition EnDebug.c:126
static proto void SetValue(int id, int value)
Set value at the given script id.
static proto bool GetBool(int id, bool reverse=false)
Get value as bool from the given script id.
class DiagMenu Shape
don't call destructor directly. Use Destroy() instead
const int INVENTORY_ENTITY_DROP_OVERLAP_DEPTH
Definition constants.c:908
const float DZPLAYER_CAMERA_FOV_IRONSIGHTS
Definition constants.c:836
const float REFRESHER_RADIUS
Definition constants.c:881
const int DEFAULT_CHARACTER_MENU_ID
Definition constants.c:840
const float NL_DAMAGE_FIREARM_CONVERSION_PLAYERS
Definition constants.c:861
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:666
void PrintString(string s)
Helper for printing out string expression. Example: PrintString("Hello " + var);.
Definition EnScript.c:344
EntityEvent
Entity events for event-mask, or throwing event from code.
Definition EnEntity.c:44
const int STATE_RUINED
Definition constants.c:757
const int LIQUID_WATER
Definition constants.c:504
static proto void YawPitchRollMatrix(vector ang, out vector mat[3])
Creates rotation matrix from angles.
static proto void MatrixInvMultiply4(vector mat0[4], vector mat1[4], out vector res[4])
Invert-transforms matrix.
static void MatrixIdentity4(out vector mat[4])
Creates identity matrix.
Definition EnMath3D.c:233
static proto void MatrixOrthogonalize4(vector mat[4])
Orthogonalizes matrix.
static const float PI2
Definition EnMath.c:13
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:126
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto int AbsInt(int i)
Returns absolute value.
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
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 Sin(float angle)
Returns sinus of angle in radians.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static const float RAD2DEG
Definition EnMath.c:16
static proto float AbsFloat(float f)
Returns absolute value.
const string CFG_AMMO
Definition constants.c:212
const int MENU_WARNING_TELEPORT
Definition constants.c:200
const int MENU_INSPECT
Definition constants.c:169
const int MENU_MAP
Definition constants.c:181
const int MENU_WARNING_ITEMDROP
Definition constants.c:198
const int MENU_RESPAWN_DIALOGUE
Definition constants.c:199
const int MENU_INVENTORY
Definition constants.c:170
EmitorParam
Definition EnVisual.c:114
const int SAT_DEBUG_ACTION
Definition constants.c:424
const float STAMINA_MAX
Definition constants.c:663
proto void GetHourMinuteSecond(out int hour, out int minute, out int second)
Returns world time.
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10
bool IsRunning()
Definition tools.c:252
const int CALL_CATEGORY_GUI
Definition tools.c:9
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
proto native void AddChild(Widget child, bool immedUpdate=true)
bool IsRaised()
Definition human.c:1176
proto native bool IsModifierActive()
is modifier active
proto native int GetRunningAction()
returns -1 when no action is running or RELOAD,MECHANISM, ....
proto native HumanCommandVehicle StartCommand_Vehicle(Transport pTransport, int pTransportPositionIndex, int pVehicleSeat, bool fromUnconscious=false)
--— VEHICLE --—
proto native void PhysicsGetVelocity(out vector pVelocity)
outs pVelocity - linear velocity of PHYSICS CONTROLLER
HumanMoveCommandID
do not process rotations !
Definition human.c:1230
proto native HumanCommandMove GetCommand_Move()
proto native HumanCommandActionCallback GetCommand_Action()
is human is in command action - returns its callback, if current command is action
proto native HumanCommandMelee GetCommand_Melee()
proto native HumanCommandMove StartCommand_Move()
--— MOVE --—
proto native bool PhysicsIsFalling(bool pValidate)
returns true if physics controller is falling
proto native HumanCommandWeapons GetCommandModifier_Weapons()
returns interface for handling weapons
proto native HumanCommandVehicle GetCommand_Vehicle()
proto native bool IsInWater()
proto native HumanCommandUnconscious GetCommand_Unconscious()
proto native HumanCommandLadder GetCommand_Ladder()
enum HumanMoveCommandID GetTransformWS(out vector pTm[4])
gets human transform in World Space
proto native HumanCommandUnconscious StartCommand_Unconscious(float pType)
starts command - unconscious
class HumanCommandMelee2 HumanCommandFall()
Definition human.c:571
proto native HumanInputController GetInputController()
returns human input controller
proto native HumanItemAccessor GetItemAccessor()
proto native HumanCommandAdditives GetCommandModifier_Additives()
default (always-on modifiers)
class HumanCommandWeapons HumanCommandAdditives()
Definition human.c:1086
void HumanItemAccessor()
Definition humanitems.c:135
class HumanItemBehaviorCfg OnItemInHandsChanged(bool pInstant=false)
signalization from script to engine that item in hands changed