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