DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл DayZPlayerImplement.c

См. исходные тексты.

Структуры данных

class  DayZPlayerCommandDeathCallback
 
class  Timer
 
class  DayZPlayer
 

Функции

override bool ShouldSimulationBeDisabled ()
 

Переменные

PlayerBase m_pPlayer
 
class DeathEffectTimer extends Timer OnSimulationEnd
 

Функции

◆ ShouldSimulationBeDisabled()

override bool ShouldSimulationBeDisabled ( )
94{
95 protected override event void Write(PawnMoveWriter ctx, PawnMove prev)
96 {
97 super.Write(ctx, prev);
98
99 }
100
101 protected override event void Read(PawnMoveReader ctx, PawnMove prev)
102 {
103 super.Read(ctx, prev);
104
105 }
106};
107
108#endif
109
111{
112 static const int DEAD_SCREEN_DELAY = 1000;
113 static const float DEFAULT_DYING_TIME = 2.5;
114 static const float DYING_PROGRESSION_TIME = 0.05;
115
116
118 protected ref DayZPlayerImplementAiming m_AimingModel;
120 protected ref DayZPlayerMeleeFightLogic_LightHeavy m_MeleeFightLogic;
121 protected ref DayZPlayerImplementSwimming m_Swimming;
122 protected ref DayZPlayerImplementThrowing m_Throwing;
123 protected ref DayZPlayerImplementJumpClimb m_JumpClimb;
124 protected ref DayZPlayerImplementFallDamage m_FallDamage;
125 protected ref PlayerSoundEventHandler m_PlayerSoundEventHandler;
126 protected ref ReplaceSoundEventHandler m_ReplaceSoundEventHandler;
127 protected SHumanCommandMoveSettings m_MoveSettings;
128 protected float m_FallYDiff;
129 protected float m_SprintedTime;
130 protected float m_SprintedTimePerStanceMin;
131 protected bool m_SprintFull;
132 protected bool m_IsRaised;
133 protected bool m_ShouldReload;
134 protected bool m_Camera3rdPerson;
135 protected bool m_CameraZoomToggle;
136 protected bool m_bADS;
137 private float m_WeaponRaiseTime;
138 protected bool m_WeaponRaiseCompleted;
139 protected ECameraZoomType m_CameraEyeZoomLevel;
140 protected bool m_WasIronsight; // was previously ironsights. Only used on weapons
141 protected bool m_CameraIronsight; // Ironsight NOW!
142 protected bool m_CameraOptics; // Optics NOW!
143 protected bool m_CameraOpticsAimOverride; // for tracking if aim limit is currently overriden by optics
144
145 protected float m_DeathDarkeningCurrentTime;
146 protected bool m_IsTryingHoldBreath;
147 protected bool m_IsShootingFromCamera;
148 protected bool m_PlayerSelected;
149 protected bool m_Suicide;
150 protected bool m_IsUnconscious;
151 protected bool m_ShouldBeUnconscious;
152 protected bool m_IsUnconsciousFalling;
153 bool m_UnconsciousDebug;
154 protected int m_LastCommandBeforeUnconscious;
155 ref WeaponDebug m_WeaponDebug;
156 ref DeathEffectTimer m_DeathEffectTimer;
157 ref Timer m_FightEndBlendTimer;
158 protected bool m_ProcessFirearmMeleeHit;
159 protected bool m_ContinueFirearmMelee;
160 protected bool m_LiftWeapon_player;
161 protected bool m_ProcessLiftWeapon;
162 protected bool m_ProcessLiftWeaponState;
163 protected int m_LastSurfaceUnderHash;
164 protected Transport m_TransportCache;
165 protected string m_ClimbingLadderType;
166 bool m_isFBsymptomPlaying;
167 protected bool m_HandheldOpticsInUse;
168 protected bool m_ResetADS;
169 protected int m_StepCounter;
170 protected int m_NextVoNNoiseTime;
171 protected ref array<ref SyncHitInfo> m_SyncedHitDataArray;
172 protected ref array<AbstractWave> m_PerformedActionSounds;
173
174 // aiming model helpers
175 protected bool m_RaiseStarted = false;
176 protected bool m_AimingFinisherStarted = false;
177 protected bool m_IsWeapon;
178
179 private float m_CurrentWaterLevel;
180
181 bool m_WasInVehicle;
182 protected bool m_TriggerPullPlayerOutOfVehicleSynch;
183 protected bool m_PullPlayerOutOfVehicleKeepsInLocalSpace = false;
184 protected int m_PullPlayerOutOfVehicleState = -1;
185 int m_ActionSoundCategoryHash;
186
187 protected float m_dT;
188
191 {
192 m_SprintFull = false;
193 m_SprintedTime = 0;
194 m_SprintedTimePerStanceMin = PlayerConstants.FULL_SPRINT_DELAY_DEFAULT;
195 m_AimingModel = new DayZPlayerImplementAiming(this);
197 m_MeleeFightLogic = new DayZPlayerMeleeFightLogic_LightHeavy(this);
198 m_Swimming = new DayZPlayerImplementSwimming(this);
199 m_Throwing = new DayZPlayerImplementThrowing(this);
200 m_JumpClimb = new DayZPlayerImplementJumpClimb(this);
201 m_FallDamage = new DayZPlayerImplementFallDamage(this);
202 m_ADSAutomationTimer = new Timer();
203 m_bADS = false;
204 m_WeaponRaiseCompleted = false;
205 SetOptics(false);
206 m_IsShootingFromCamera = true;
207 m_ProcessFirearmMeleeHit = false;
208 m_ContinueFirearmMelee = false;
209 m_WasIronsight = true; //initially uses ironsights by default
210 #ifdef PLATFORM_CONSOLE
211 m_Camera3rdPerson = !GetGame().GetWorld().Is3rdPersonDisabled();
212 #endif
213 m_LastSurfaceUnderHash = ("cp_gravel").Hash();
214 m_NextVoNNoiseTime = 0;
215 m_SyncedHitDataArray = new array<ref SyncHitInfo>;
216 m_PerformedActionSounds = new array<AbstractWave>();
217 m_CurrentWaterLevel = 0;
218 m_WeaponRaiseTime = 0;
219
220 RegisterNetSyncVariableBoolSignal("m_TriggerPullPlayerOutOfVehicleSynch");
221 }
222
223#ifdef FEATURE_NETWORK_RECONCILIATION
224 protected override event typename GetOwnerStateType()
225 {
227 }
228
229 protected override event typename GetMoveType()
230 {
232 }
233
234 protected override event void ObtainState(/*inout*/ PawnOwnerState pState)
235 {
236 super.ObtainState(pState);
237
239
240 state.m_fLastHeadingDiff = m_fLastHeadingDiff;
241 }
242
243 protected override event void RewindState(PawnOwnerState pState, /*inout*/ PawnMove pMove, inout NetworkRewindType pRewindType)
244 {
245 super.RewindState(pState, pMove, pRewindType);
246
248
249 if (pRewindType != NetworkRewindType.ADDITIVE)
250 {
251 m_fLastHeadingDiff = state.m_fLastHeadingDiff;
252 }
253 }
254#endif
255
256 DayZPlayerImplementAiming GetAimingModel()
257 {
258 return m_AimingModel;
259 }
260
261 DayZPlayerImplementMeleeCombat GetMeleeCombat()
262 {
263 return m_MeleeCombat;
264 }
265
266 DayZPlayerMeleeFightLogic_LightHeavy GetMeleeFightLogic()
267 {
268 return m_MeleeFightLogic;
269 }
270
271 DayZPlayerImplementThrowing GetThrowing()
272 {
273 return m_Throwing;
274 }
275
276 DayZPlayerImplementFallDamage GetFallDamage()
277 {
278 return m_FallDamage;
279 }
280
282 {
283 }
284
286 override bool IsEyeZoom()
287 {
288 return GetEyeZoomLevel() > 0;
289 }
290
291 override int GetEyeZoomLevel()
292 {
293 return m_CameraEyeZoomLevel;
294 }
295
296 override bool IsShootingFromCamera()
297 {
298 return m_IsShootingFromCamera;
299 }
300
301 void OverrideShootFromCamera(bool pState)
302 {
303 m_IsShootingFromCamera = pState;
304 }
305
306 bool IsInIronsights()
307 {
308 return m_CameraIronsight;
309 }
310
311 bool IsInOptics()
312 {
313 return m_CameraOptics;
314 }
315
316 override bool IsInThirdPerson()
317 {
318 return m_Camera3rdPerson;
319 }
320
321 void SetIsInThirdPerson(bool state)
322 {
323 m_Camera3rdPerson = state;
324 }
325
326 bool IsFireWeaponRaised()
327 {
329 if (m_MovementState)
330 return m_MovementState.IsRaised();
331
332 return false;
333 }
334
335 bool IsTryingHoldBreath()
336 {
337 return m_IsTryingHoldBreath;
338 }
339
340 bool IsSprintFull()
341 {
342 return m_SprintFull;
343 }
344
345 void ShowWeaponDebug(bool show)
346 {
347 if (show)
348 {
349 m_WeaponDebug = new WeaponDebug;
350 }
351 else
352 {
353 m_WeaponDebug = null;
354 }
355 }
356
357 bool IsWeaponDebugEnabled()
358 {
359 return m_WeaponDebug != null;
360 }
361
362 void SetFallYDiff(float value)
363 {
364 m_FallYDiff = value;
365 }
366
367 override float GetCurrentWaterLevel()
368 {
369 return m_CurrentWaterLevel;
370 }
371
372 override void SetCurrentWaterLevel(float pWaterLevel)
373 {
374 m_CurrentWaterLevel = pWaterLevel;
375 }
376
377 void SetIronsights(bool value)
378 {
379 Weapon_Base weapon = Weapon_Base.Cast(GetHumanInventory().GetEntityInHands());
380 if (weapon)
381 {
382 m_WasIronsight = m_CameraIronsight;
383 }
384
385 m_CameraIronsight = value;
386
387 if (value)
388 {
390 if (hcw)
391 {
392 hcw.SetADS(true);
393 }
394 }
395 }
396
397 void SetOptics(bool value)
398 {
399 m_CameraOptics = value;
400
401 if (value)
402 {
404 if (hcw)
405 {
406 hcw.SetADS(!IsHandheldOpticsInUse());
407 }
408 }
409 }
410
411 void ExitSights()
412 {
414 EntityAI entityInHands = GetHumanInventory().GetEntityInHands();
416 if (weapon)
417 {
418 optics = weapon.GetAttachedOptics();
419 }
420 else
421 {
423 }
424
425 SetIronsights(false);
426 SetOptics(false);
427
428 if (optics)
429 {
430 SwitchOptics(optics,false);
431 }
432
434 if (hcw)
435 {
436 hcw.SetADS(false);
437 }
438 }
439
440 void SwitchOptics(ItemOptics optic, bool state)
441 {
442 if (optic)
443 {
444 if (state)
445 {
446 if (optic.HasEnergyManager())
447 optic.GetCompEM().SwitchOn();
448 optic.EnterOptics();
449 optic.OnOpticEnter();
450 }
451 else
452 {
453 optic.ExitOptics();
454 optic.OnOpticExit();
455 if (optic.HasEnergyManager())
456 optic.GetCompEM().SwitchOff();
457 }
458 }
459
460 if (m_CameraOptics != state)
461 {
462 SetOptics(state);
463 }
464 }
465
466 void SetClimbingLadderType(string value)
467 {
468 m_ClimbingLadderType = value;
469 }
470
472 bool CanConsumeStamina(EStaminaConsumers consumer) {};
473 bool CanStartConsumingStamina(EStaminaConsumers consumer) {};
474 void DepleteStamina(EStaminaModifiers modifier, float dT = -1) {};
475
476 bool IsInVehicle()
477 {
478 return m_MovementState.m_CommandTypeId == DayZPlayerConstants.COMMANDID_VEHICLE || (GetParent() != null && GetParent().IsInherited(Transport));
479 }
480
481 bool IsSwimming()
482 {
483 return m_MovementState.m_CommandTypeId == DayZPlayerConstants.COMMANDID_SWIM;
484 }
485
486 bool IsClimbingLadder()
487 {
488 return m_MovementState.m_CommandTypeId == DayZPlayerConstants.COMMANDID_LADDER;
489 }
490
492 bool PlaySoundEventType(ESoundEventType soundType, int soundEventID, int param = 0) {};
493 bool PlaySoundEvent(EPlayerSoundEventID id, bool from_anim_system = false, bool is_from_server = false) {};
494 bool PlaySoundEventEx(EPlayerSoundEventID id, bool from_anim_system = false, bool is_from_server = false, int param = 0) {};
495
496 bool IsFBSymptomPlaying()
497 {
498 return m_isFBsymptomPlaying;
499 }
500
501 float GetDeltaT()
502 {
503 return m_dT;
504 }
505
506 //-------------------------------------------------------------
510
511 int m_DeathAnimType = -2;
512 float m_DeathHitDir = 0;
513 bool m_DeathJuctureSent = false;
514
516 Transport GetTransportCache()
517 {
518 return m_TransportCache;
519 }
520
521 override string GetDebugText()
522 {
523 string text = super.GetDebugText();
524 text += "Parent: " + Object.GetDebugName(Object.Cast(GetParent())) + "\n";//keep
525 text += "IsSimulationDisabled: " + GetIsSimulationDisabled() + "\n";//keep
526 /*
527 text += "DamageDestroyed: " + IsDamageDestroyed() + "\n";
528 text += "DeathProcessed: " + IsDeathProcessed() + "\n";
529 text += "DeathConditionMet: " + IsDeathConditionMet() + "\n";
530 text += "PullOutOfVehicleState: " + m_PullPlayerOutOfVehicleState + "\n";
531 text += "PullOutOfVehicleSynch: " + m_TriggerPullPlayerOutOfVehicleSynch + "\n";
532 text += "Position: " + GetPosition() + "\n";*/
533 return text;
534 }
535
536 void TriggerPullPlayerOutOfVehicle()
537 {
538 if (!GetGame().IsServer())
539 {
540 return;
541 }
542
545 {
546 return;
547 }
548
549 int crewIdx = -1;
550 for (int i = 0; i < transport.CrewSize(); ++i)
551 {
552 if (transport.CrewMember(i) == this)
553 {
554 crewIdx = i;
555 break;
556 }
557 }
558
559 if (crewIdx == -1)
560 {
561 return;
562 }
563
564 transport.CrewGetOut(crewIdx);
565 TriggerPullPlayerOutOfVehicleImpl();
566
567 if (crewIdx == DayZPlayerConstants.VEHICLESEAT_DRIVER)
568 {
570
571#ifdef FEATURE_NETWORK_RECONCILIATION
572 PlayerIdentity identity = GetIdentity();
573
574 if (identity)
575 {
577 identity.Possess(this);
578 }
579#endif
580 }
581
582 SetSynchDirty();
583 }
584
585 void TriggerPullPlayerOutOfVehicleImpl()
586 {
589
591 DisableSimulation(false);
592
593 switch (GetInstanceType())
594 {
595 case DayZPlayerInstanceType.INSTANCETYPE_SERVER:
596 case DayZPlayerInstanceType.INSTANCETYPE_CLIENT:
597 case DayZPlayerInstanceType.INSTANCETYPE_AI_SERVER:
598 case DayZPlayerInstanceType.INSTANCETYPE_AI_SINGLEPLAYER:
599 m_PullPlayerOutOfVehicleState = 0;
600 m_TriggerPullPlayerOutOfVehicleSynch = true;
601 break;
602 }
603 }
604
605 override void OnVariablesSynchronized()
606 {
607 if (m_TriggerPullPlayerOutOfVehicleSynch && !GetGame().IsDedicatedServer())
608 {
609 TriggerPullPlayerOutOfVehicleImpl();
610 }
611
612 super.OnVariablesSynchronized();
613 }
614
615 bool HandleDeath(int pCurrentCommandID)
616 {
617 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_DEATH)
618 {
619 switch (m_PullPlayerOutOfVehicleState)
620 {
621 case -1:
622 break;
623 case 0:
624 m_PullPlayerOutOfVehicleState = -1;
625
626 PhysicsSetSolid(true);
627
630 Class.CastTo(callbackVeh, StartCommand_Death(DayZPlayerConstants.DEATH_PULL_OUT_TRANSPORT, 0, DayZPlayerVehicleCommandDeathCallback, m_PullPlayerOutOfVehicleKeepsInLocalSpace));
631 Class.CastTo(callbackVeh.m_pPlayer, this);
632 break;
633 }
634
635 return true;
636 }
637
638 if (m_DeathAnimType != -2 && g_Game.GetMissionState() == g_Game.MISSION_STATE_GAME)
639 {
640 if (!CommitedSuicide())
641 {
642 int type = m_DeathAnimType;
643 if (type == DayZPlayerConstants.DEATH_DEFAULT)
644 type = GetTypeOfDeath(pCurrentCommandID);
645
646 m_WasInVehicle = false;
648 if (hcv)
649 {
650 m_TransportCache = hcv.GetTransport();
651 m_WasInVehicle = !hcv.IsGettingIn() && !hcv.IsGettingOut();
652 }
653
654 int seatIndex = -1;
655 if (m_TransportCache)
656 {
657 seatIndex = m_TransportCache.CrewMemberIndex(this);
658 }
659
661 m_ShouldBeUnconscious = false;
662
663 bool keepInLocalSpace = m_PullPlayerOutOfVehicleKeepsInLocalSpace;
664 if (m_TransportCache)
665 {
666 if (IsUnconscious() || m_WasInVehicle)
667 {
668 keepInLocalSpace = true;
669 m_TransportCache.CrewDeath(seatIndex);
670 }
671 else
672 {
673 m_TransportCache.CrewGetOut(seatIndex);
674 }
675
676 m_TransportCache.MarkCrewMemberDead(seatIndex);
677
678 if (seatIndex == DayZPlayerConstants.VEHICLESEAT_DRIVER)
679 {
681
682#ifdef FEATURE_NETWORK_RECONCILIATION
683 PlayerIdentity identity = GetIdentity();
684
685 if (identity)
686 {
688 identity.Possess(this);
689 }
690#endif
691 }
692 }
693
694 DisableSimulation(false);
695 GetItemAccessor().HideItemInHands(false);
696 m_TransportCache = null;
697
699 Class.CastTo(callback, StartCommand_Death(type, m_DeathHitDir, DayZPlayerCommandDeathCallback, keepInLocalSpace));
700 Class.CastTo(callback.m_pPlayer, this);
701 }
702 else
703 {
704 PhysicsSetRagdoll(true);
705 }
706
707 // disable voice communication
708 GetGame().GetWorld().SetVoiceOn(false, false);
709
710 return true;
711 }
712
713 return false;
714 }
715
716 void ResetDeathStartTime()
717 {
719 }
720
721 int GetTypeOfDeath(int pCurrentCommandID)
722 {
723 switch (pCurrentCommandID)
724 {
725 case DayZPlayerConstants.COMMANDID_SWIM:
726 return DayZPlayerConstants.DEATH_WATER;
727 case DayZPlayerConstants.COMMANDID_FALL:
728 return DayZPlayerConstants.DEATH_FALL;
729 case DayZPlayerConstants.COMMANDID_UNCONSCIOUS:
731 if (hcu)
732 {
733 if (hcu.IsOnLand())
734 return DayZPlayerConstants.DEATH_UNCON_ON_LAND;
735 if (hcu.IsInWater())
736 return DayZPlayerConstants.DEATH_UNCON_IN_WATER;
737 }
738
739 break;
740 }
741
742 return DayZPlayerConstants.DEATH_BODY;
743 }
744
745 void SendDeathJuncture(int pAnimTypeDeath, float pAnimHitDirDeath)
746 {
747 if (m_DeathJuctureSent)
748 return;
749
751 m_DeathJuctureSent = true;
752 }
753
754 override void EEKilled(Object killer)
755 {
756 SendDeathJuncture(-1, 0);
757
758 super.EEKilled(killer);
759 }
760
761 void ShowDeadScreen(bool show, float duration)
762 {
763 #ifndef NO_GUI
764 if (show && IsPlayerSelected())
765 {
766 #ifdef PLATFORM_PS4
768 #endif
769
770 string message = "";
771 if (!GetGame().GetMission().IsPlayerRespawning())
772 {
773 message = "#dayz_implement_dead";
774 }
775
776 #ifdef PLATFORM_CONSOLE
777 GetGame().GetUIManager().ScreenFadeIn(duration, message, FadeColors.DARK_RED, FadeColors.WHITE);
778 #else
779 GetGame().GetUIManager().ScreenFadeIn(duration, message, FadeColors.BLACK, FadeColors.WHITE);
780 #endif
781 }
782 else
783 {
784 GetGame().GetUIManager().ScreenFadeOut(duration);
785
786 if (duration > 0)
787 GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(StopDeathDarkeningEffect, duration*1000, false);
788 else
789 GetGame().GetCallQueue(CALL_CATEGORY_GUI).Call(StopDeathDarkeningEffect);
790 }
791 #endif
792 }
793
794 override void StopDeathDarkeningEffect()
795 {
796 if (m_DeathEffectTimer && m_DeathEffectTimer.IsRunning())
797 {
798 m_DeathEffectTimer.Stop();
799 m_DeathEffectTimer = null;
800 }
801 }
802
803 void SimulateDeath(bool state)
804 {
805 if (g_Game.GetMissionState() != DayZGame.MISSION_STATE_GAME)
806 return;
807
808 LockControls(state);
809
810 if (state)
811 {
812 float duration = DEFAULT_DYING_TIME;
813 if (m_KilledByHeadshot)
814 {
815 duration = 0;
816 }
817
818 if (duration > DYING_PROGRESSION_TIME && !m_IsUnconscious)
819 {
820 if (!m_DeathEffectTimer)
821 m_DeathEffectTimer = new DeathEffectTimer();
822
823 Param2<float,float> par = new Param2<float,float>(duration, DYING_PROGRESSION_TIME);
824 m_DeathEffectTimer.Run(DYING_PROGRESSION_TIME, this, "SetDeathDarknessLevel", par, true);
825 }
826
827 ShowDeadScreen(state, duration);
828
829 GetGame().GetSoundScene().SetSoundVolume(0,0);
830 GetGame().GetSoundScene().SetSpeechExVolume(0,0);
831 GetGame().GetSoundScene().SetMusicVolume(0,0);
832 GetGame().GetSoundScene().SetVOIPVolume(0,0);
833 GetGame().GetSoundScene().SetRadioVolume(0,0);
834 }
835 else
836 {
837 StopDeathDarkeningEffect();
838 ShowDeadScreen(state, 0);
839 }
840 }
841
842 void LockControls(bool state)
843 {
844 if (state == true)
845 {
846 GetGame().GetInput().ChangeGameFocus(1, INPUT_DEVICE_MOUSE);
847 GetGame().GetInput().ChangeGameFocus(1, INPUT_DEVICE_KEYBOARD);
848 GetGame().GetInput().ChangeGameFocus(1, INPUT_DEVICE_GAMEPAD);
849
850 if (GetGame().GetUIManager())
851 {
852 GetGame().GetUIManager().ShowUICursor(true);
853 if (GetGame().GetUIManager().IsDialogVisible())
854 GetGame().GetUIManager().CloseDialog();
855 }
856 }
857 else
858 {
859 GetGame().GetInput().ChangeGameFocus(-1, INPUT_DEVICE_MOUSE);
860 GetGame().GetInput().ChangeGameFocus(-1, INPUT_DEVICE_KEYBOARD);
861 GetGame().GetInput().ChangeGameFocus(-1, INPUT_DEVICE_GAMEPAD);
862
863 if (GetGame().GetUIManager())
864 {
865 if (GetGame().GetUIManager().GetMenu())
866 {
867 GetGame().GetUIManager().ShowUICursor(true);
868 }
869 else
870 {
871 GetGame().GetUIManager().ShowUICursor(false);
872 }
873 }
874 }
875 }
876
877 void SetDeathDarknessLevel(float duration, float tick_time);
878
879 void SendCompleteWeaponRaiseJuncture();
880
881 void CompleteWeaponRaise()
882 {
883 m_WeaponRaiseTime = 0;
884 m_WeaponRaiseCompleted = true;
885 }
886
887 void ResetWeaponRaiseProgress()
888 {
889 m_WeaponRaiseTime = 0;
890 m_WeaponRaiseCompleted = false;
891 }
892
893 bool IsWeaponRaiseCompleted()
894 {
895 return m_WeaponRaiseCompleted;
896 }
897
898 DayZPlayerInventory GetDayZPlayerInventory()
899 {
900 DayZPlayerInventory inv = DayZPlayerInventory.Cast(GetInventory());
901 return inv;
902 }
903
905 {
906 int userDataType = 0;
907 if (!ctx.Read(userDataType))
908 {
909 Error("DayZPlayer: OnInputForRemote - cannot read input type");
910 return;
911 }
912
913 switch (userDataType)
914 {
916 GetDayZPlayerInventory().OnEventForRemoteWeapon(ctx);
917 break;
919 GetDayZPlayerInventory().OnHandEventForRemote(ctx);
920 break;
922 GetDayZPlayerInventory().OnInputUserDataForRemote(ctx);
923 break;
924 default:
925 Error("OnInputForRemote - unknown userDataType=" + userDataType);
926 break;
927 }
928 }
929
931 {
932 int userDataType = 0;
933 if (!ctx.Read(userDataType))
934 {
935 Error("DayZPlayer: OnInputFromServer - cannot read input type");
936 return;
937 }
938
939 switch (userDataType)
940 {
942 GetDayZPlayerInventory().OnServerInventoryCommand(ctx);
943 break;
944 default:
945 Error("OnInputFromServer - unknown userDataType=" + userDataType);
946 break;
947 }
948 }
949 void RequestSoundEvent(EPlayerSoundEventID id, bool from_server_and_client = false);
950 void RequestSoundEventEx(EPlayerSoundEventID id, bool from_server_and_client = false, int param = 0);
951 protected void SendSoundEvent(EPlayerSoundEventID id);
952 protected void SendSoundEventEx(EPlayerSoundEventID id, int param = 0);
953
954 override void OnItemInHandsChanged()
955 {
956 //Print("inv: DayZPlayerImplement::OnItemInHandsChanged: "/* + GetHumanInventory().GetEntityInHands()*/);
957 StopWeaponEvent();
958 GetItemAccessor().OnItemInHandsChanged();
959
960 if (!IsAlive())
961 {
962 //Print("inv: DayZPlayerImplement::OnItemInHandsChanged - human not alive! calling ResetWeaponInHands");
963 GetItemAccessor().ResetWeaponInHands();
964 }
965 }
966
967 WeaponManager GetWeaponManager() { return null; }
968
969 //-------------------------------------------------------------
973 void HandleWeapons(float pDt, Entity pInHands, HumanInputController pInputs, out bool pExitIronSights)
974 {
976 GetDayZPlayerInventory().HandleWeaponEvents(pDt, pExitIronSights);
977
980 ItemOptics optic = weapon.GetAttachedOptics();
981
982 CheckLiftWeapon();
983 ProcessLiftWeapon();
984
986
987 // hold breath
988 if (pInputs.IsHoldBreath() && m_MovementState.IsRaised() && (IsInIronsights() || IsInOptics()))
989 {
990 m_IsTryingHoldBreath = true;
991 }
992 else
993 {
994 m_IsTryingHoldBreath = false;
995 }
996
997 if (pInputs.IsFireModeChange())
998 {
999 GetWeaponManager().SetNextMuzzleMode();
1000 }
1001 if (pInputs.IsZeroingUp())
1002 {
1003 if (optic && (optic.IsInOptics() || optic.IsUsingWeaponIronsightsOverride()))
1004 {
1005 optic.StepZeroingUp();
1006 }
1007 else
1008 {
1009 weapon.StepZeroingUpAllMuzzles();
1010 }
1011 }
1012 if (pInputs.IsZeroingDown())
1013 {
1014 if (optic && (optic.IsInOptics() || optic.IsUsingWeaponIronsightsOverride()))
1015 {
1016 optic.StepZeroingDown();
1017 }
1018 else
1019 {
1020 weapon.StepZeroingDownAllMuzzles();
1021 }
1022 }
1023
1024 if (!m_LiftWeapon_player && (m_CameraIronsight || !weapon.CanEnterIronsights() || m_CameraOptics/*m_ForceHandleOptics*/)) // HACK straight to optics, if ironsights not allowed
1025 {
1026 if (optic)
1027 HandleOptic(optic, false, pInputs, pExitIronSights);
1028 }
1029
1030 if (!m_MovementState.IsRaised())
1031 {
1032 m_IsFireWeaponRaised = false; //legacy reasons
1033 if (weapon && weapon.IsInOptics())
1034 {
1035 weapon.ExitOptics();
1036 }
1037
1038 ResetWeaponRaiseProgress();
1039
1040 return; // if not raised => return
1041 }
1042 else
1043 {
1044 m_IsFireWeaponRaised = true; //legacy reasons
1045 if (!IsWeaponRaiseCompleted())
1046 {
1047 m_WeaponRaiseTime += pDt;
1048 }
1049
1050 if (m_WeaponRaiseTime >= PlayerConstants.WEAPON_RAISE_BLEND_DELAY)
1051 {
1052 CompleteWeaponRaise();
1053 }
1054 }
1055
1057 if (GetWeaponManager().CanFire(weapon))
1058 {
1059 bool autofire = weapon.GetCurrentModeAutoFire(weapon.GetCurrentMuzzle()) && weapon.IsChamberEjectable(weapon.GetCurrentMuzzle());
1060 int burst = weapon.GetCurrentModeBurstSize(weapon.GetCurrentMuzzle());
1061 int burst_count = weapon.GetBurstCount();
1062 if (!autofire && (burst < 2 || burst_count < 1))
1063 {
1064 if (pInputs.IsAttackButtonDown() && GetInputInterface().SyncedValue("UAWeaponMeleeAttack") == 0 && GetInputInterface().SyncedValue("UAHeavyMeleeAttack") == 0)
1065 {
1066 GetWeaponManager().Fire(weapon);
1067 }
1068 }
1069 else if (autofire || burst > 1)
1070 {
1071#ifdef DIAG_DEVELOPER
1072 int burst_option = GetWeaponManager().GetBurstOption();
1073 if (burst_option == 0)
1074 {
1075#endif
1076 if (pInputs.IsAttackButton() && GetInputInterface().SyncedValue("UAWeaponMeleeAttack") == 0 && GetInputInterface().SyncedValue("UAHeavyMeleeAttack") == 0)
1077 {
1078 if (autofire || burst_count < burst)
1079 {
1080 GetWeaponManager().Fire(weapon);
1081 }
1082 }
1083 else
1084 {
1085 weapon.ResetBurstCount();
1086 }
1087#ifdef DIAG_DEVELOPER
1088 }
1089 else if (burst_option == 1)
1090 {
1091 if (burst > 1 && burst_count == burst)
1092 {
1093 weapon.ResetBurstCount();
1094 }
1095 else if (burst > 1 && burst_count < burst)
1096 {
1097 GetWeaponManager().Fire(weapon);
1098 }
1099 else
1100 {
1101 //Autofire
1102 if (pInputs.IsAttackButton())
1103 {
1104 GetWeaponManager().Fire(weapon);
1105 }
1106 }
1107 }
1108#endif
1109 }
1110 }
1111
1112 #ifdef PLATFORM_CONSOLE
1113 if (GetGame().GetInput().LocalRelease("UAFire", false) || m_ShouldReload)
1114 {
1115 if (!weapon.IsWaitingForActionFinish() && !IsFighting())
1116 {
1117 int muzzle_index = weapon.GetCurrentMuzzle();
1118
1119 if (weapon.IsChamberFiredOut(muzzle_index))
1120 {
1121 if (weapon.CanProcessWeaponEvents())
1122 {
1123 if (GetWeaponManager().CanEjectBullet(weapon))
1124 {
1125 GetWeaponManager().EjectBullet();
1126 pExitIronSights = true;
1127 m_ShouldReload = false;
1128 }
1129 }
1130 }
1131 }
1132 else
1133 {
1134 m_ShouldReload = true;
1135 }
1136 }
1137 #endif
1138 }
1139
1141 {
1142 UAInterface input = GetInputInterface();
1143 if (!input)
1144 {
1145 return;
1146 }
1147
1149 int FOVcount;
1150 bool controllerPressIn;
1151 bool controllerPressOut;
1152
1153 if (input.SyncedPress_ID(UAZoomInOptics))
1154 {
1155 weapon = Weapon_Base.Cast(optic.GetHierarchyParent());
1156 FOVcount = optic.GetStepFOVCount();
1158
1159 if (weapon && m_CameraIronsight && !m_CameraOptics)
1160 {
1161 SetIronsights(false);
1162 SwitchOptics(optic,true);
1163 optic.SetStepFOVIndex(0);
1164 }
1165 else if (m_CameraOptics)
1166 {
1167 if (controllerPressIn) //controller
1168 {
1169 if (!optic.StepFOVUp())
1170 {
1171 if (FOVcount > 0)
1172 {
1173 optic.SetStepFOVIndex(0); //loop to minimum magnification
1174 }
1175
1176 if (weapon && weapon.CanEnterIronsights()) //loop into ironsights
1177 {
1178 SwitchOptics(optic,false);
1179 pInputs.ResetFreeLookToggle();
1180 SetIronsights(true);
1181 }
1182 }
1183 }
1184 else //m&k
1185 {
1186 optic.StepFOVUp();
1187 }
1188 }
1189 }
1190
1191 if (input.SyncedPress_ID(UAZoomOutOptics))
1192 {
1193 weapon = Weapon_Base.Cast(optic.GetHierarchyParent());
1194 FOVcount = optic.GetStepFOVCount();
1196 if (m_CameraOptics)
1197 {
1198 if (!optic.StepFOVDown())
1199 {
1201 {
1202 if (FOVcount > 0 && (!weapon || !weapon.CanEnterIronsights()))
1203 {
1204 optic.SetStepFOVIndex(FOVcount - 1); //loop to maximum magnification
1205 }
1206 }
1207
1208 if (weapon && weapon.CanEnterIronsights())
1209 {
1210 SwitchOptics(optic,false);
1211 pInputs.ResetFreeLookToggle();
1212 SetIronsights(true);
1213 }
1214 }
1215 }
1216 else if (controllerPressOut && weapon && m_CameraIronsight)
1217 {
1218 SwitchOptics(optic,true);
1219 if (FOVcount > 0)
1220 {
1221 optic.SetStepFOVIndex(FOVcount - 1); //loop to maximum magnification
1222 }
1223 }
1224 }
1225 }
1226
1227 //-------------------------------------------------------------
1231
1232 bool m_DamageHitFullbody = false;
1233 int m_DamageHitAnimType = -1.0;
1234 float m_DamageHitDir = 0.0;
1235 float m_DamageHealth = 0.0;
1236
1237 const float HIT_INTERVAL_MIN = 0.3; // Minimum time in seconds before a COMMANDID_HIT to COMMANDID_HIT transition is allowed
1238 float m_HitElapsedTime = HIT_INTERVAL_MIN;
1239
1240 bool IsInFullbodyDamageAnimation()
1241 {
1242 return (m_DamageHitFullbody && m_DamageHitAnimType != -1) || GetCommand_Damage() != null;
1243 }
1244
1246 void EvaluateDamageHit(int pCurrentCommandID)
1247 {
1249 m_DamageHitAnimType = -1;
1250
1251 if (!m_SyncedHitDataArray || m_SyncedHitDataArray.Count() == 0)
1252 {
1253 return;
1254 }
1255
1256 //evaluate all hit data
1259 for (int i = 0; i < m_SyncedHitDataArray.Count(); i++)
1260 {
1261 data = m_SyncedHitDataArray[i];
1262 m_DamageHitDir = data.m_HitDir;
1263
1264 //client-side effects
1265 #ifndef SERVER
1266 if (IsAlive() && !IsUnconscious() && data.m_HasSource && GetGame().GetMission().GetHud() && GetGame().GetPlayer() == this) //only for controlled players
1267 {
1268 m_DamageHealth = data.m_HealthDamage;
1269 if (m_DamageHealth > 0.0)
1270 {
1271 float rel = m_DamageHealth / (GetMaxHealth("","Health") * PlayerConstants.HEAVY_HIT_THRESHOLD);
1272 GetGame().GetMission().GetHud().SpawnHitDirEffect(this,m_DamageHitDir,rel);
1273 }
1274 }
1275 #endif
1276
1277 if (!greatest_hit)
1278 {
1280 }
1281 //else if (data.m_HealthDamage > greatest_hit.m_HealthDamage || (data.m_Fullbody && !greatest_hit.m_Fullbody)) //TODO - revisit cumulative calculation for animation evaluation purposes (stagger on shotgun to the chest)
1282 else if (data.m_Fullbody) //temporary solution; last fullbody hit is used for animation purposes, some light hit otherwise
1283 {
1285 }
1286 }
1287
1288 m_SyncedHitDataArray.Clear();
1289 m_DamageHealth = 0.0;
1290
1292 if (m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_PRONE || m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDPRONE || IsUnconscious())
1293 {
1294 return;
1295 }
1296
1297 //general effects
1298 m_DamageHitFullbody = greatest_hit.m_Fullbody;
1299 m_DamageHitAnimType = greatest_hit.m_AnimType;
1300 m_DamageHitDir = greatest_hit.m_HitDir;
1301 }
1302
1303 bool HandleDamageHit(int pCurrentCommandID)
1304 {
1305 // Update elapsed time since hit first
1306 if ( pCurrentCommandID == DayZPlayerConstants.COMMANDID_DAMAGE )
1307 {
1308 // Throttle heavy hit command up to a fixed rate
1309 if ( m_HitElapsedTime < HIT_INTERVAL_MIN )
1310 {
1311 m_HitElapsedTime += m_dT;
1312 ResetDamageHitState(false);
1313 return false;
1314 }
1315 }
1316
1317 // If transportcache is not null, player is unconscious inside of a car and should not head into a damage command
1318 if (m_DamageHitAnimType != -1 && m_TransportCache == null && !CommitedSuicide())
1319 {
1321 if (m_DamageHitFullbody && (!vehCommand || vehCommand.IsGettingIn() || vehCommand.IsGettingOut()))
1322 {
1323 StartCommand_Damage(m_DamageHitAnimType, m_DamageHitDir);
1324 ResetDamageHitState(true);
1325 return true;
1326 }
1327 else
1328 {
1329 AddCommandModifier_Damage(m_DamageHitAnimType, m_DamageHitDir);
1330 ResetDamageHitState(false);
1331 return false;
1332 }
1333 }
1334
1335 return pCurrentCommandID == DayZPlayerConstants.COMMANDID_DAMAGE;
1336 }
1337
1338 void ResetDamageHitState(bool resetTimer)
1339 {
1340 m_DamageHitAnimType = -1;
1341 m_DamageHitFullbody = false;
1342
1343 if (resetTimer)
1344 {
1345 m_HitElapsedTime = 0;
1346 }
1347 }
1348
1350 bool EvaluateDeathAnimation(int pDamageType, EntityAI pSource, string pAmmoType, out int pAnimType, out float pAnimHitDir)
1351 {
1352 bool doPhxImpulse = GetGame().ConfigGetInt("cfgAmmo " + pAmmoType + " doPhxImpulse") > 0;
1353
1354 pAnimType = DayZPlayerConstants.DEATH_DEFAULT;
1355 if (doPhxImpulse)
1356 pAnimType = DayZPlayerConstants.DEATH_FAST;
1357
1359 vector targetDirection = GetDirection();
1360 vector toSourceDirection = (pSource.GetPosition() - GetPosition());
1361
1362 targetDirection[1] = 0;
1363 toSourceDirection[1] = 0;
1364
1365 targetDirection.Normalize();
1366 toSourceDirection.Normalize();
1367
1370
1372 if (cross[1] < 0)
1374
1375 return true;
1376 }
1377
1379 bool EvaluateDamageHitAnimation(TotalDamageResult pDamageResult, int pDamageType, EntityAI pSource, string pComponent, string pAmmoType, vector pModelPos, out int pAnimType, out float pAnimHitDir, out bool pAnimHitFullbody)
1380 {
1381 int invertHitDir = 0; //Used to flip the heavy hit animation direction
1382
1383 pAnimType = 0;
1384 pAnimHitFullbody = false; // additive anm
1386
1387 switch (pDamageType)
1388 {
1389 case DT_CLOSE_COMBAT:
1391 if (pSource.IsInherited(DayZInfected))
1392 break;
1393
1394 pAnimType = GetGame().ConfigGetInt("cfgAmmo " + pAmmoType + " hitAnimation");
1395 invertHitDir = GetGame().ConfigGetInt("cfgAmmo " + pAmmoType + " invertHitDir");
1396 if (!IsUnconscious() && pAnimType == 1 && !m_MeleeFightLogic.IsInBlock())
1397 pAnimHitFullbody = true;
1398 break;
1399
1400 case DT_FIRE_ARM:
1401 int impactBehaviour = 0;
1402
1403 if (!IsUnconscious() && GetHealth("", "Shock") > 25)
1404 {
1406 if (pComponent == "Torso" || pComponent == "Head")
1407 {
1408 impactBehaviour = GetGame().ConfigGetInt("cfgAmmo " + pAmmoType + " impactBehaviour");
1409 float fireDamage = pDamageResult.GetHighestDamage("Health");
1410 float shockDamage = pDamageResult.GetHighestDamage("Shock");
1411 if ((fireDamage > 80.0 || shockDamage > 40.0) && impactBehaviour == 1)
1412 pAnimHitFullbody = true;
1413 }
1414 }
1415
1416 break;
1417
1418 case DT_EXPLOSION:
1419 break;
1420
1421 case DT_CUSTOM:
1422 pAnimType = GetGame().ConfigGetInt("cfgAmmo " + pAmmoType + " hitAnimation");
1423 if (pAnimType == 1)
1424 pAnimHitFullbody = true;
1425 else if (pAmmoType != "HeatDamage" || IsSwimming())
1426 return false;
1427
1428 break;
1429 }
1430
1432 vector targetDirection = GetDirection();
1433 vector toSourceDirection = (pSource.GetPosition() - GetPosition());
1434
1435 targetDirection[1] = 0;
1436 toSourceDirection[1] = 0;
1437
1438 targetDirection.Normalize();
1439 toSourceDirection.Normalize();
1440
1443
1445
1446 // We will invert direction of the hit
1447 if (invertHitDir > 0)
1448 pAnimHitDir -= 180;
1449
1450 if (cross[1] < 0)
1452
1453 return true;
1454 }
1455
1458 {
1460
1461 m_TransportHitRegistered = false;
1462
1463 if (!IsAlive())
1464 {
1465 int animTypeDeath;
1466 float animHitDirDeath;
1467 if (EvaluateDeathAnimation(damageType, source, ammo, animTypeDeath, animHitDirDeath))
1468 {
1469 SendDeathJuncture(animTypeDeath, animHitDirDeath);
1470 }
1471
1472 if (!m_DeathSyncSent) //checked until the death is evaluated by 'OnCommandHandlerTick' higher up the road
1473 {
1474 Man killer = source.GetHierarchyRootPlayer();
1475
1476 if (!m_KillerData) //only one player is considered killer in the event of crossfire
1477 {
1478 m_KillerData = new KillerData();
1479 m_KillerData.m_Killer = killer;
1480 m_KillerData.m_MurderWeapon = source;
1481 }
1482
1483 if (killer && killer.IsPlayer())
1484 {
1485 // was player killed by headshot?
1486 if (dmgZone == "Brain")
1487 {
1488 m_KilledByHeadshot = true;
1489 if (m_KillerData.m_Killer == killer)
1490 m_KillerData.m_KillerHiTheBrain = true;
1491 }
1492 }
1493 }
1494 }
1495 else
1496 {
1497 int animType;
1498 float animHitDir;
1499 bool animHitFullbody;
1500 if (EvaluateDamageHitAnimation(damageResult, damageType, source, dmgZone, ammo, modelPos, animType, animHitDir, animHitFullbody))
1502 else
1503 {
1504 bool skipSoundRequest = false;
1505 if (damageType == DamageType.CUSTOM && GetCommand_Fall())
1506 skipSoundRequest = GetFallDamage().GetLandType() < HumanCommandFall.LANDTYPE_MEDIUM;
1507
1508 if (!skipSoundRequest)
1509 RequestSoundEvent(EPlayerSoundEventID.TAKING_DMG_LIGHT);
1510 }
1511 }
1512
1513 // interupt melee for non-blocked hit or heavy hit
1514 if (animHitFullbody)
1515 {
1517 if (hcm)
1518 hcm.Cancel();
1519 }
1520 }
1521
1522 //-------------------------------------------------------------
1526 float m_fLastHeadingDiff = 0;
1527
1529 override bool HeadingModel(float pDt, SDayZPlayerHeadingModel pModel)
1530 {
1531 if (!IsAlive())
1532 {
1533 return false;
1534 }
1535
1537
1539 if (m_MovementState.m_CommandTypeId == DayZPlayerConstants.COMMANDID_LADDER)
1540 {
1541 m_fLastHeadingDiff = 0;
1542 return false;
1543 }
1544 if (m_MovementState.m_CommandTypeId == DayZPlayerConstants.COMMANDID_VEHICLE)
1545 {
1547 if (hmv.IsGettingOut() || hmv.IsGettingIn())
1548 {
1549 return DayZPlayerImplementHeading.NoHeading(pDt, pModel, m_fLastHeadingDiff);
1550 }
1551
1552 m_fLastHeadingDiff = 0;
1553 return false;
1554 }
1555 if (m_MovementState.m_CommandTypeId == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
1556 {
1558 if (!hcu.IsWakingUp())
1559 {
1560 m_fLastHeadingDiff = 0;
1561 //pModel.m_iCamMode = DayZPlayerConstants.CAMERAMODE_HEAD;
1562 return false;
1563 }
1564 }
1565
1566 if (m_MovementState.m_CommandTypeId == DayZPlayerConstants.COMMANDID_CLIMB)
1567 {
1568 m_fLastHeadingDiff = 0;
1569 return false;
1570 }
1571
1572#ifdef DEVELOPER
1574 if (actMenuValue != 0)
1575 {
1577 return DayZPlayerImplementHeading.ClampHeading(pDt, pModel, m_fLastHeadingDiff);
1578 }
1579#endif
1580
1581 if (m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
1582 {
1583 m_fLastHeadingDiff = 0;
1584 return false;
1585 }
1586
1588 if (m_MovementState.m_CommandTypeId == DayZPlayerConstants.COMMANDID_MOVE)
1589 {
1591 if (hcm.IsStandingFromBack())
1592 {
1593 m_fLastHeadingDiff = 0;
1594 return false;
1595 }
1596 }
1597
1599 HumanItemBehaviorCfg hibcfg = hia.GetItemInHandsBehaviourCfg();
1600 if (hibcfg && hibcfg.m_StanceRotation[m_MovementState.m_iStanceIdx] == DayZPlayerConstants.ROTATION_DISABLE)
1601 {
1602 return DayZPlayerImplementHeading.NoHeading(pDt, pModel, m_fLastHeadingDiff);
1603 }
1604 if (IsUnconscious() || (GetCommand_Move() && GetCommand_Move().IsLeavingUncon()))
1605 {
1606 return DayZPlayerImplementHeading.NoHeading(pDt, pModel, m_fLastHeadingDiff);
1607 }
1608
1609 return DayZPlayerImplementHeading.RotateOrient(pDt, pModel, m_fLastHeadingDiff);
1610 }
1611
1612
1613 //-------------------------------------------------------------
1617 override bool AimingModel(float pDt, SDayZPlayerAimingModel pModel)
1618 {
1620 if (m_MovementState.m_CommandTypeId == DayZPlayerConstants.COMMANDID_MELEE2)
1621 {
1623 if (hcm.IsFinisher())
1624 {
1625 if (!m_AimingFinisherStarted)
1626 {
1627 m_AimingModel.OnFinisherBegin(pModel.m_fCurrentAimY);
1628 m_AimingFinisherStarted = true;
1629 }
1630 m_AimingModel.ProcessStealthFilters(pDt, pModel);
1631 }
1632
1633 return true;
1634 }
1635
1636 if (m_MovementState.IsRaised())
1637 {
1638 if (!m_RaiseStarted)
1639 {
1640 m_AimingModel.OnRaiseBegin(this);
1641 m_RaiseStarted = true;
1642 }
1643 m_AimingModel.ProcessAimFilters(pDt, pModel, m_MovementState.m_iStanceIdx);
1644
1645 return true;
1646 }
1647
1648 m_RaiseStarted = false;
1649 m_AimingFinisherStarted = false;
1650
1651 return true;
1652 }
1653
1654 //-------------------------------------------------------------
1658
1660 bool ProcessJumpOrClimb(float pDt, int pCurrentCommandID)
1661 {
1662 HumanInputController hic = GetInputController();
1663 if (!hic || !hic.IsJumpClimb())
1664 {
1665 return false;
1666 }
1667
1668 m_JumpClimb.JumpOrClimb();
1669
1670 if (!m_JumpClimb.WasSuccessful())
1671 {
1672 return false;
1673 }
1674
1675 return true;
1676 }
1677
1679 bool CanJump()
1680 {
1681 if (IsFBSymptomPlaying() || IsRestrained() || IsUnconscious() || IsInFBEmoteState())
1682 return false;
1683
1684 if (m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_PRONE || m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
1685 return false;
1686
1687 if (IsRaised() && GetInputInterface().SyncedPress("UAGetOverControllerHelper")) //no raised jump on cotroller
1688 {
1689 return false;
1690 }
1691
1692 HumanItemBehaviorCfg hibcfg = GetItemAccessor().GetItemInHandsBehaviourCfg();
1693 if (!hibcfg.m_bJumpAllowed)
1694 return false;
1695
1696 if (!DayZPlayerUtils.PlayerCanChangeStance(this, DayZPlayerConstants.STANCEIDX_ERECT) || !DayZPlayerUtils.PlayerCanChangeStance(this, DayZPlayerConstants.STANCEIDX_RAISEDERECT))
1697 return false;
1698
1700 if (hcm)
1701 {
1702 if (hcm.IsChangingStance())
1703 return false;
1704 }
1705
1707 if (hcs)
1708 {
1709 return false;
1710 }
1711
1712 return true;
1713 }
1714
1715 bool CanClimb(int climbType, SHumanCommandClimbResult climbRes)
1716 {
1717 if (IsFBSymptomPlaying() || IsRestrained() || IsUnconscious() || IsInFBEmoteState())
1718 return false;
1719
1720 if (m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_PRONE || m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
1721 return false;
1722
1723 if (IsRaised() && GetInputInterface().SyncedPress("UAGetOverControllerHelper")) //no raised climb on cotroller
1724 {
1725 return false;
1726 }
1727
1728 HumanItemBehaviorCfg hibcfg = GetItemAccessor().GetItemInHandsBehaviourCfg();
1729 if (!hibcfg.m_bJumpAllowed)
1730 return false;
1731
1732 if (climbRes)
1733 {
1735 if (Class.CastTo(entity,climbRes.m_GrabPointParent) && entity.IsHologram())
1736 return false;
1737 if (Class.CastTo(entity,climbRes.m_ClimbStandPointParent) && entity.IsHologram())
1738 return false;
1739 if (Class.CastTo(entity,climbRes.m_ClimbOverStandPointParent) && entity.IsHologram())
1740 return false;
1741 }
1742
1743 return true;
1744 }
1745
1746
1747 void OnJumpStart()
1748 {
1749 }
1750
1751 void OnJumpEnd(int pLandType = 0)
1752 {
1753 }
1754
1755 void StopHandEvent()
1756 {
1757 GetDayZPlayerInventory().CancelHandEvent();
1758 }
1759
1760 void StopWeaponEvent()
1761 {
1762 GetDayZPlayerInventory().CancelWeaponEvent();
1763 }
1764
1765 void AbortWeaponEvent()
1766 {
1767 GetDayZPlayerInventory().AbortWeaponEvent();
1768 }
1769
1770 //-------------------------------------------------------------
1774 void HandleADS()
1775 {
1776 if (!IsAlive())
1777 {
1778 if (m_CameraIronsight || m_CameraOptics)
1779 {
1780 ExitSights();
1781 }
1782 return;
1783 }
1784
1785 bool bADSToggle = false;
1786 bool exitSights = false;
1787 HumanInputController hic = GetInputController();
1790 PlayerBase playerPB = PlayerBase.Cast(this);
1792
1793 if (playerPB.IsRolling())
1794 {
1795 exitSights = true;
1796 }
1797
1798 if (m_ResetADS || (!hia.IsItemInHandsWeapon() && hic.WeaponADS()))
1799 {
1800 hic.ResetADS();
1801 m_ResetADS = false;
1802 }
1803
1804 if (!m_MovementState.IsRaised() || m_LiftWeapon_player)
1805 {
1806 ResetWeaponRaiseProgress();
1807 exitSights = true;
1808 }
1809 else
1810 {
1811 if (m_bADS != hic.WeaponADS())
1812 {
1813 m_bADS = hic.WeaponADS();
1814 bADSToggle = true;
1815 }
1816
1817 if (m_bADS && !m_CameraIronsight && !m_CameraOptics)
1818 {
1820 if (!IsWeaponRaiseCompleted())
1821 {
1822 bADSToggle = false;
1823 exitSights = true;
1824 }
1825 else
1826 {
1827 bADSToggle = true;
1828 }
1829 }
1830 }
1831
1832 if (bADSToggle && !GetCommand_Melee2() && !GetThrowing().IsThrowingModeEnabled())
1833 {
1834 if (hia.IsItemInHandsWeapon() && playerPB.GetItemInHands() && playerPB.GetItemInHands().IsWeapon() && playerPB.GetWeaponManager() && !playerPB.GetWeaponManager().IsRunning())
1835 {
1836 Weapon_Base weapon = Weapon_Base.Cast(GetHumanInventory().GetEntityInHands());
1837 ItemOptics optic = weapon.GetAttachedOptics();
1838 bool switchToADS = false;
1839 bool canUseIronsights = weapon.CanEnterIronsights();
1840 bool canUseOptics = optic != NULL;
1841
1843 switchToADS = m_bADS;
1844
1845 // go to ironsights - disable ironsights when
1848 if (!m_MovementState.IsRaised() || m_MovementState.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_SPRINT)
1849 {
1850 switchToADS = false;
1851 }
1852
1853 // fixes camera switching during item transitions
1854 if (IsLiftWeapon() || !IsRaised() || GetDayZPlayerInventory().IsProcessing() || !IsWeaponRaiseCompleted() || IsFighting())
1855 {
1856 exitSights = true;
1857 }
1858 else if (switchToADS) // enter ironsights or optics
1859 {
1860 // filter by usability
1861 if (m_WasIronsight && !canUseIronsights)
1862 {
1863 m_WasIronsight = false;
1864 }
1865 else if (!m_WasIronsight && !canUseOptics)
1866 {
1867 m_WasIronsight = true;
1868 }
1869
1870 if (m_WasIronsight)
1871 {
1872 hic.ResetFreeLookToggle();
1873 SwitchOptics(optic,false);
1874 SetIronsights(true);
1875 }
1876 else if (!m_WasIronsight || (!canUseIronsights && canUseOptics))
1877 {
1878 SetIronsights(false);
1879 SwitchOptics(optic,true);
1880 }
1881 else
1882 {
1883 exitSights = true;
1884 }
1885
1886 if (hcw && (m_CameraOptics/* || m_CameraIronsight*/))
1887 {
1888 hcw.SetADS(true);
1889 }
1890 }
1891 else
1892 {
1893 exitSights = true;
1894 }
1895 }
1896 }
1897
1898 // leave ironsight and/ or optics
1899 if (exitSights && !IsHandheldOpticsInUse() && (m_CameraIronsight || m_CameraOptics) || GetCommand_Melee2())
1900 {
1901 ExitSights();
1902 }
1903 }
1904
1905 void HandleView()
1906 {
1907 if (!IsAlive())
1908 {
1909 if (m_CameraIronsight || m_CameraOptics)
1910 {
1911 ExitSights();
1912 }
1913 return;
1914 }
1915
1916 HumanInputController hic = GetInputController();
1917
1918 bool camChange = hic.CameraViewChanged();
1919
1920 if (IsRaised())
1921 {
1922 if (m_IsWeapon)
1923 {
1924 camChange = false;
1925 }
1926 }
1927
1929 if (GetGame().GetWorld().Is3rdPersonDisabled())
1930 {
1931 m_Camera3rdPerson = false;
1932 }
1933 else if (camChange)
1934 {
1935 m_Camera3rdPerson = !m_Camera3rdPerson;
1936 }
1937
1938 // exits optics completely, comment to return to ADS
1939 if (m_LiftWeapon_player && (m_CameraOptics || m_CameraIronsight))
1940 ExitSights();
1941
1942 if (IsPlayerInStance(DayZPlayerConstants.STANCEMASK_RAISEDPRONE) && (m_CameraOptics || m_CameraIronsight))
1943 {
1944 SetVerticalMinimumAimLimit(DayZPlayerCameraIronsights.CONST_UD_MIN_BACK);
1945 m_CameraOpticsAimOverride = true;
1946 }
1947 else if (m_CameraOpticsAimOverride)
1948 {
1949 SetVerticalMinimumAimLimit(DayZPlayerCameraIronsights.CONST_UD_MIN);
1950 m_CameraOpticsAimOverride = false;
1951 }
1952
1953 if (hic.IsZoomToggle() && !m_MovementState.IsRaised())
1954 {
1955 m_CameraEyeZoomLevel = ECameraZoomType.NORMAL;
1956 if ((IsClimbingLadder() && Math.AbsInt(m_MovementState.m_iMovement) == 2) || (IsSwimming() && m_MovementState.m_iMovement == 3))
1957 {
1958 m_CameraEyeZoomLevel = ECameraZoomType.SHALLOW;
1959 }
1960 else if (!IsClimbingLadder() && !IsSwimming() && !IsInVehicle())
1961 {
1962 float pSpeed;
1964 hic.GetMovement(pSpeed ,pLocalDirection);
1965
1966 if (m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_ERECT && pSpeed == 3)
1967 {
1968 m_CameraEyeZoomLevel = ECameraZoomType.SHALLOW;
1969 }
1970 }
1971 }
1972 else
1973 {
1974 m_CameraEyeZoomLevel = ECameraZoomType.NONE;
1975 }
1976
1977 if (m_MovementState.IsRaisedInProne())
1978 {
1979 float headingAngle = MiscGameplayFunctions.GetHeadingAngle(this);
1980 float headingAngleDiffBlock = Math.AbsFloat(m_LastHeadingAngleBlock - headingAngle);
1981 float headingAngleDiffBlock2 = Math.AbsFloat(m_LastHeadingAngleBlock2 - headingAngle);
1982 float headingAngleDiff = 0.0;
1983
1984 if (m_LastHeadingAngle * headingAngle < 0.0)
1985 {
1986 headingAngleDiff = Math.AbsFloat(m_LastHeadingAngle + headingAngle);
1987 }
1988 else
1989 {
1990 headingAngleDiff = Math.AbsFloat(m_LastHeadingAngle - headingAngle);
1991 }
1992
1993 if (headingAngleDiff > 0.2)
1994 {
1995 int time = GetGame().GetTime();
1996
1997 float timefilterconstant = 400 - (headingAngleDiff * 100);
1998
1999 if (headingAngleDiffBlock > 0.8 && time - m_LastBackSoundTime > timefilterconstant)
2000 {
2001 float volume = headingAngleDiff / 0.5;
2002 if (volume > 1)
2003 {
2004 volume = 1;
2005 }
2006 if (volume < 0.25)
2007 {
2008 volume = 0.25;
2009 }
2010
2011 m_SoundOffset = headingAngleDiff / 2;
2012 if (m_SoundOffset > 0.25)
2013 {
2014 m_SoundOffset = 0.25;
2015 }
2016
2017 string soundSetName = "Cloth_Body_longmove_TShirt_Soundset";
2018
2019 string bodyClothName = "";
2020 EntityAI attachment = GetInventory().FindAttachment(InventorySlots.BODY);
2021 if (attachment)
2022 {
2023 bodyClothName = attachment.GetAttachmentSoundType();
2024 }
2025
2026 if (bodyClothName != "")
2027 {
2028 string path = "CfgSoundTables CfgAttachmentSoundTables Cloth_Body_Longmove_LookupTable";
2029 int soundCount = GetGame().ConfigGetChildrenCount(path);
2030
2031 for (int i = 0; i < soundCount; i++)
2032 {
2033 string name = "";
2034 GetGame().ConfigGetChildName(path, i, name);
2035
2036 if (name == bodyClothName)
2037 {
2039 GetGame().ConfigGetTextArray(path + " " + name + " soundSets", stringArray);
2040 soundSetName = stringArray.Get(0);
2041
2042 delete stringArray;
2043 }
2044 }
2045 }
2046
2049
2050 if (soundObjectBuilder != NULL)
2051 {
2052 SoundObject soundObject = soundObjectBuilder.BuildSoundObject();
2053
2054 if (soundObject != NULL)
2055 {
2056 soundObject.SetPosition(GetPosition());
2057
2058 AbstractWave wave = GetGame().GetSoundScene().Play3D(soundObject, soundObjectBuilder);
2059 wave.SetStartOffset(m_SoundOffset);
2060 wave.SetVolumeRelative(volume);
2061
2062 m_LastBackSoundTime = GetGame().GetTime();
2063 m_LastHeadingAngleBlock = headingAngle;
2064 }
2065 }
2066 }
2067
2068 if (headingAngleDiffBlock2 > 1.5 && time - m_LastBackSoundTime2 > (timefilterconstant * 2))
2069 {
2070 float volume2 = headingAngleDiff * 2;
2071 if (volume2 > 1)
2072 {
2073 volume2 = 1;
2074 }
2075
2076 m_SoundOffset = headingAngleDiff / 1.8;
2077 if (m_SoundOffset < 0.1)
2078 {
2079 m_SoundOffset = 0.1;
2080 }
2081 if (m_SoundOffset > 0.3)
2082 {
2083 m_SoundOffset = 0.3;
2084 }
2085
2086 string soundSetName2 = "walkProne_noHS_asphalt_ext_Char_SoundSet";
2087 string surfaceType = GetSurfaceType();
2088
2089 if (surfaceType != "")
2090 {
2091 string movementSurfaceType = "walkProne_" + surfaceType;
2092
2093 string path2 = "CfgSoundTables CfgStepSoundTables walkProne_noHS_Char_LookupTable";
2094 int soundCount2 = GetGame().ConfigGetChildrenCount(path2);
2095
2096 for (int i2 = 0; i2 < soundCount2; i2++)
2097 {
2098 string name2 = "";
2099 GetGame().ConfigGetChildName(path2, i2, name2);
2100
2102 {
2104 GetGame().ConfigGetTextArray(path2 + " " + name2 + " soundSets", stringArray2);
2105 soundSetName2 = stringArray2.Get(0);
2106
2107 delete stringArray2;
2108 }
2109 }
2110 }
2111
2114
2116 {
2117 SoundObject soundObject2 = soundObjectBuilder2.BuildSoundObject();
2118
2119 if (soundObject2 != NULL)
2120 {
2121 soundObject2.SetPosition(GetPosition());
2122
2123 AbstractWave wave2 = GetGame().GetSoundScene().Play3D(soundObject2, soundObjectBuilder2);
2124 wave2.SetStartOffset(m_SoundOffset);
2125 wave2.SetVolumeRelative(volume2);
2126
2127 m_LastBackSoundTime2 = GetGame().GetTime();
2128 m_LastHeadingAngleBlock2 = headingAngle;
2129 }
2130 }
2131 }
2132
2133 m_LastHeadingAngle = headingAngle;
2134 }
2135 }
2136 }
2137
2138 float m_LastHeadingAngleBlock;
2139 float m_LastHeadingAngleBlock2;
2140 float m_LastHeadingAngle;
2141 int m_LastBackSoundTime;
2142 int m_LastBackSoundTime2;
2143 float m_SoundOffset;
2144
2145
2146 //-------------------------------------------------------------
2150 // these functions are for modded overide in script command mods
2151
2153 {
2154 return false;
2155 }
2156
2158 {
2159 return false;
2160 }
2161
2163 {
2164 return false;
2165 }
2166
2167 //-------------------------------------------------------------
2171
2172
2174 override void CommandHandler(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
2175 {
2176 m_dT = pDt;
2177
2179
2181 {
2182 return;
2183 }
2184
2185 HumanInputController hic = GetInputController();
2186 EntityAI entityInHands = GetHumanInventory().GetEntityInHands();
2188
2189 bool isRaisedNow = m_MovementState.IsRaised();
2190 bool isWeapon = entityInHands && entityInHands.IsInherited(Weapon);
2191
2192 bool updateAimingMdfr = false;
2193 if (isWeapon != m_IsWeapon)
2194 {
2195 m_IsWeapon = isWeapon;
2196 updateAimingMdfr = true;
2197 }
2198
2199 if (isRaisedNow != m_IsRaised)
2200 {
2201 updateAimingMdfr = true;
2202 m_IsRaised = m_MovementState.IsRaised();
2203 }
2204
2205 if (updateAimingMdfr)
2206 {
2207 if (isRaisedNow && isWeapon)
2208 GetUApi().ActivateModificator("aiming");
2209 else
2210 GetUApi().DeactivateModificator("aiming");
2211 }
2212
2213 // handle ADS ironsights/optics transition logic
2214 HandleADS();
2215
2216 // handle weapons
2217 if (hic)
2218 {
2220 if (isWeapon && (!m_ProcessFirearmMeleeHit || !m_ContinueFirearmMelee))
2221 {
2222 m_ProcessFirearmMeleeHit = false;
2223 bool exitIronSights = false;
2224 HandleWeapons(pDt, entityInHands, hic, exitIronSights);
2225 }
2226 else if (IsHandheldOpticsInUse() && m_CameraOptics && opticInHands)
2227 {
2228 bool exitOptic = false;
2229 HandleOptic(opticInHands, true, hic, exitOptic);
2230 }
2231 }
2232
2234 HandleView();
2235
2236 if (m_MovementState.m_iMovement != m_MovementState.m_LocalMovement)
2237 {
2238 OnMovementChanged();
2239 m_MovementState.m_LocalMovement = m_MovementState.m_iMovement;
2240 }
2241
2243 if (HandleDeath(pCurrentCommandID))
2244 {
2245 return;
2246 }
2247
2250 if ( pCurrentCommandID == DayZPlayerConstants.COMMANDID_VEHICLE )
2251 {
2253 if ( cmdVehicle && cmdVehicle.IsGettingOut() )
2254 {
2256 if ( m_Swimming.CheckSwimmingStart( waterLevel ) )
2257 {
2258 // not all the events may have been called as getting out could have occurred while under water
2259 cmdVehicle.ProcessLeaveEvents();
2260
2262 return;
2263 }
2264 }
2265 }
2266
2269 {
2270 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_UNCONSCIOUS)
2271 {
2272 if ((m_LastCommandBeforeUnconscious == DayZPlayerConstants.COMMANDID_VEHICLE) && (m_TransportCache != null))
2273 {
2274 int crew_index = m_TransportCache.CrewMemberIndex(this);
2275 int seat = m_TransportCache.GetSeatAnimationType(crew_index);
2276 StartCommand_Vehicle(m_TransportCache, crew_index, seat, true);
2277 m_TransportCache = null;
2278 return;
2279 }
2280 }
2281 // start moving
2282
2283 // start falling ? (could happen after climbing)
2284 if (PhysicsIsFalling(true))
2285 {
2287 SetFallYDiff(playerPosition[1]);
2288 return;
2289 }
2290
2292 if (m_Swimming.m_bWasSwimming)
2293 {
2295 return;
2296 }
2297
2298 StartCommand_Move();
2299
2300 if (GetHumanInventory().GetEntityInHands())
2301 ForceStandUpForHeavyItems(GetHumanInventory().GetEntityInHands());
2302
2303 return;
2304 }
2305
2306
2307 //--------------------------------------------
2309
2311 {
2312 return;
2313 }
2314
2315
2316 //--------------------------------------------
2317 // vehicle handling
2318 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_VEHICLE)
2319 {
2321 if (hcv.WasGearChange())
2322 {
2324 cb.SetVehicleCommand(hcv);
2325 }
2326
2327 return;
2328 }
2329
2331 //--------------------------------------------
2333 if (hcm && hcm.GetCurrentMovementSpeed() > 2.99 && m_MovementState.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_SPRINT)
2334 {
2335 m_SprintedTime += pDt;
2336 if (m_SprintedTime > m_SprintedTimePerStanceMin)
2337 {
2338 m_SprintFull = true;
2339 m_SprintedTimePerStanceMin = PlayerConstants.FULL_SPRINT_DELAY_DEFAULT;
2340 }
2341 else
2342 m_SprintFull = false;
2343 }
2344 else
2345 {
2346 m_SprintedTime = 0.0;
2347 m_SprintFull = false;
2348 }
2349
2350 //--------------------------------------------
2351 // swimming handling
2352 if (m_Swimming.HandleSwimming(pCurrentCommandID, hcm, m_MovementState))
2353 {
2354 if (ProcessJumpOrClimb(pDt, pCurrentCommandID))
2355 {
2356 return;
2357 }
2358
2359 m_JumpClimb.CheckAndFinishJump();
2360 return;
2361 }
2362
2363 //--------------------------------------------
2364 // ladder handling
2365 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_LADDER)
2366 {
2367 OnLadder(pDt, m_MovementState);
2368 return;
2369 }
2370
2371 //--------------------------------------------
2372 // climb handling
2373 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_CLIMB)
2374 {
2375 return;
2376 }
2377
2378 //--------------------------------------------
2379 // fall handling
2380
2381 if (IsAlreadyInFallingCommand(pCurrentCommandID))
2382 {
2383 if (IsLanded(pCurrentCommandID))
2384 {
2387
2389 fallDamageData.m_Height = m_FallYDiff - playerPosition[1];
2390
2391 // land
2392 if (fallDamageData.m_Height < 0.5)
2393 {
2394 fallDamageData.m_LandType = HumanCommandFall.LANDTYPE_NONE;
2396 npar = type.GetNoiseParamsLandLight();
2398 }
2399 else if (fallDamageData.m_Height < 3.0)
2400 {
2401 if (m_MovementState.IsInProne() || m_MovementState.IsInRaisedProne())
2402 fallDamageData.m_LandType = HumanCommandFall.LANDTYPE_NONE;
2403 else
2404 fallDamageData.m_LandType = HumanCommandFall.LANDTYPE_LIGHT;
2405
2407 npar = type.GetNoiseParamsLandLight();
2409 }
2410 else if (fallDamageData.m_Height < 5.0)
2411 {
2412 fallDamageData.m_LandType = HumanCommandFall.LANDTYPE_MEDIUM;
2414 npar = type.GetNoiseParamsLandHeavy();
2416 }
2417 else
2418 {
2419 fallDamageData.m_LandType = HumanCommandFall.LANDTYPE_HEAVY;
2421 npar = type.GetNoiseParamsLandHeavy();
2423 }
2424
2425 if (fallDamageData.m_Height >= DayZPlayerImplementFallDamage.HEALTH_HEIGHT_LOW && GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
2426 {
2427 OnPlayerRecievedHit();
2428 }
2429
2430 m_FallDamage.HandleFallDamage(fallDamageData);
2431 m_JumpClimb.CheckAndFinishJump(fallDamageData.m_LandType);
2432 }
2433
2435 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_FALL)
2436 {
2437 return;
2438 }
2439 }
2440 else if (PhysicsIsFalling(false))
2441 {
2442 // Not in a falling command but the controller is falling, start default fall
2444 SetFallYDiff(playerPosition[1]);
2445 return;
2446 }
2447
2448 //--------------------------------------------
2449 // handle jumping
2450
2451#ifndef NO_GUI
2452#ifdef DEVELOPER
2454
2455 if (DiagMenu.GetEngineValue(DayZPlayerConstants.DEBUG_ENABLEJUMP))
2456 {
2457 SHumanCommandClimbSettings hcls = GetDayZPlayerType().CommandClimbSettingsW();
2458
2459 if (m_MovementState.m_iMovement != DayZPlayerConstants.MOVEMENTIDX_IDLE)
2460 hcls.m_fFwMaxDistance = 3;
2461 else
2462 hcls.m_fFwMaxDistance = 1.2;
2463
2465
2467 HumanCommandClimb.DoClimbTest(this, ret, 0x3);
2468 }
2469
2470#endif
2471#endif
2472
2473 // start jump
2474 if (ProcessJumpOrClimb(pDt, pCurrentCommandID))
2475 {
2476 return;
2477 }
2478
2480
2481 bool force = false;
2482#ifndef NO_GUI
2483#ifdef DEVELOPER
2485 force = DiagMenu.GetEngineValue(DayZPlayerConstants.DEBUG_ENABLETALKING);
2486#endif
2487#endif
2488 float amplitude = IsPlayerSpeaking();
2489
2490 if (amplitude > 0.1 || force)
2491 {
2492 if (ad)
2493 ad.SetTalking(true);
2494
2495 // add noises on server
2496 if (GetGame().IsServer())
2497 {
2498 int now = GetGame().GetTime();
2499 if (now >= m_NextVoNNoiseTime)
2500 {
2501 m_NextVoNNoiseTime = now + 1000;
2502
2503 int voiceLevel = GetGame().GetVoiceLevel(this);
2505
2506 // add noise every second while talking
2508 switch (voiceLevel)
2509 {
2510 case VoiceLevelWhisper:
2511 vonpar = pt.GetNoiseParamsWhisper();
2512 break;
2513 case VoiceLevelTalk:
2514 vonpar = pt.GetNoiseParamsTalk();
2515 break;
2516 case VoiceLevelShout:
2517 vonpar = pt.GetNoiseParamsShout();
2518 break;
2519 }
2521 }
2522 }
2523 }
2524 else
2525 {
2526 if (ad)
2527 ad.SetTalking(false);
2528 }
2529
2530 //--------------------------------------------
2531 // anything whats handled by InputController
2532
2534
2535 if (hic)
2536 {
2539 m_Throwing.HandleThrowing(hic, hcw, entityInHands, pDt);
2540
2542 if (m_MeleeFightLogic.CanFight())
2543 {
2544 if (m_MeleeFightLogic.HandleFightLogic(pCurrentCommandID, hic, entityInHands, m_MovementState, m_ContinueFirearmMelee))
2545 {
2546 m_ProcessFirearmMeleeHit = isWeapon && (hic.IsMeleeWeaponAttack() || m_ProcessFirearmMeleeHit) || m_ContinueFirearmMelee;
2547 return;
2548 }
2549 }
2550 }
2551
2552
2555 {
2556 return;
2557 }
2558 }
2559
2560 void HideClothing(ItemOptics optic, bool state) {}
2561
2562 //-------------------------------------------------------------
2566
2567 float m_TestDamageCounter = -1;
2568 float m_DebugDirectionVal = -180;
2569 bool m_DebugTypeVal = false;
2570
2571 int m_DebugWeaponChangeStage = 0;
2572 string m_DebugWeaponChangeItem;
2573 int m_DebugWeaponChangeShowSlot;
2574
2576 void CommandHandlerDebug(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
2577 {
2578 if (GetPluginManager())
2579 {
2581 if (playerDebug)
2582 {
2583 playerDebug.CommandHandler();
2584
2586 if (m_DebugWeaponChangeStage == 0)
2587 {
2588
2589 // debug weapon change
2590 int hideSlot;
2591
2592 if (playerDebug.IsWeaponChange(m_DebugWeaponChangeItem, hideSlot, m_DebugWeaponChangeShowSlot))
2593 {
2594 //Print("Change Weapon started: " + m_DebugWeaponChangeItem + "," + hideSlot.ToString() + "," + m_DebugWeaponChangeShowSlot.ToString());
2595
2597 w.StartAction(WeaponActions.HIDE, hideSlot);
2598
2599 m_DebugWeaponChangeStage = 1;
2600 }
2601 }
2602 else if (m_DebugWeaponChangeStage == 1)
2603 {
2604 // wait for weapon hide to meet event
2606 if (w2 && w2.GetRunningAction() == WeaponActions.HIDE)
2607 {
2608 if (w2.IsEvent() == WeaponEvents.CHANGE_HIDE)
2609 {
2611 //Print("Change Weapon - hidden: ");
2612
2614 PlayerBase player = PlayerBase.Cast(this);
2615 EntityAI item_in_hands = player.GetHumanInventory().GetEntityInHands();
2616 if (item_in_hands != NULL && player.CanDropEntity(item_in_hands) && GetGame().GetPlayer().GetHumanInventory().CanRemoveEntityInHands())
2617 {
2618 player.PredictiveDropEntity(item_in_hands);
2619 }
2620
2621 if (m_DebugWeaponChangeItem != "")
2622 {
2624 dst.SetHands(this, NULL);
2625 EntityAI item = SpawnEntity(m_DebugWeaponChangeItem, dst,ECE_IN_INVENTORY,RF_DEFAULT);
2626 }
2627
2629 w2.StartAction(WeaponActions.SHOW, 3);
2630
2631 m_DebugWeaponChangeStage = 2;
2632 }
2633 }
2634 }
2635 else if (m_DebugWeaponChangeStage == 2)
2636 {
2638 if (w3 && w3.IsActionFinished())
2639 {
2640 m_DebugWeaponChangeStage = 0;
2641 }
2642 }
2643 }
2644 }
2645
2646
2648 if (m_TestDamageCounter >= 0)
2649 {
2650 if (m_TestDamageCounter > 3)
2651 {
2652 m_DebugDirectionVal = m_DebugDirectionVal + 90;
2653 m_TestDamageCounter = 0;
2654
2655 if (m_DebugDirectionVal > 90)
2656 {
2657 m_DebugDirectionVal = -180;
2658 m_DebugTypeVal = !m_DebugTypeVal;
2659 }
2660
2661 if (m_DebugTypeVal)
2662 {
2663 AddCommandModifier_Damage(0, m_DebugDirectionVal); // starts light
2664 }
2665 else
2666 {
2667 StartCommand_Damage(0, m_DebugDirectionVal); // starts heavy (full body)
2668 }
2669 // 0.. types
2670 // from: -180 back, -90 left, 0 front, 90 right, 180 back
2671 //AddCommandModifier_Damage(0, directionVal); // starts light
2672 //StartCommand_Damage(0, 0); // starts heavy (full body)
2673 }
2674
2675 m_TestDamageCounter += pDt;
2676 }
2677
2678
2679#ifndef NO_GUI
2680#ifdef DEVELOPER
2681
2682 // injury / exhaustion
2683 {
2685
2687 float v = DiagMenu.GetEngineRangeValue(DayZPlayerConstants.DEBUG_SHOWINJURY);
2688 if (v > 0)
2689 {
2690 ad.SetInjured(v, true);
2691 }
2692
2694 v = DiagMenu.GetEngineRangeValue(DayZPlayerConstants.DEBUG_SHOWEXHAUSTION);
2695 if (v > 0)
2696 {
2697 ad.SetExhaustion(v, true);
2698 }
2699 }
2700#endif
2701#endif
2702
2703 }
2704
2705
2706
2707 //-------------------------------------------------------------
2711 override int CameraHandler(int pCameraMode)
2712 {
2714 if (!m_LiftWeapon_player)
2715 {
2717 EntityAI entityInHands = GetHumanInventory().GetEntityInHands();
2719 if (weapon)
2720 optics = weapon.GetAttachedOptics();
2721 else if (entityInHands)
2723
2724 if (m_CameraOptics && optics)
2725 {
2727 }
2728 else if (m_CameraIronsight && weapon)
2729 {
2731 }
2732 }
2733
2734 // If the logic above doesn't reach optics nor ironsights camera,
2735 // yet weapon is still raised and ads is wanted, enforce 1pv camera
2736 // as this will reduce erratic behaviour of camera switching in 3pv
2737 HumanInputController hic = GetInputController();
2738 if (m_Camera3rdPerson && m_IsWeapon && m_IsRaised && hic && hic.WeaponADS())
2739 {
2741 }
2742
2743 //uncon
2744 if ( GetCurrentCommandID() == DayZPlayerConstants.COMMANDID_UNCONSCIOUS )
2745 {
2747 }
2748
2750
2751 if (!m_Camera3rdPerson)
2752 {
2753 if (vehicleCommand)
2754 {
2756 }
2757
2759 }
2760 else
2761 {
2762 if (vehicleCommand)
2763 {
2764 Transport transport = vehicleCommand.GetTransport();
2765 if (transport && GetParent())
2766 {
2767 return transport.Get3rdPersonCameraType();
2768 }
2769 }
2770
2773
2777
2779
2781
2782 if (m_MovementState.m_CommandTypeId == DayZPlayerConstants.COMMANDID_CLIMB)
2783 {
2785 }
2786
2787 if (m_JumpClimb.m_bIsJumpInProgress)
2788 {
2790 }
2791
2792 int targetStanceIndex = m_MovementState.m_iStanceIdx;
2793
2796 if (commandMove && commandMove.IsChangingStance() && m_MovementState.IsRaised())
2797 {
2798 targetStanceIndex = m_MovementState.m_iStanceIdx - DayZPlayerConstants.STANCEIDX_RAISED;
2799 }
2800
2801 //
2802 // normal movement cameras
2803 if (targetStanceIndex == DayZPlayerConstants.STANCEIDX_CROUCH)
2804 {
2806 }
2807 else if (targetStanceIndex == DayZPlayerConstants.STANCEIDX_RAISEDCROUCH)
2808 {
2810 }
2811 else if (targetStanceIndex == DayZPlayerConstants.STANCEIDX_PRONE)
2812 {
2814 }
2815 else if (targetStanceIndex == DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
2816 {
2818 }
2819
2820 if (targetStanceIndex == DayZPlayerConstants.STANCEIDX_RAISEDERECT)
2821 {
2822 if (m_IsWeapon)
2823 {
2825 }
2826 else
2827 {
2829 }
2830 }
2831 else if (targetStanceIndex == DayZPlayerConstants.MOVEMENTIDX_SPRINT)
2832 {
2834 }
2835
2836 // DayZPlayerConstants.STANCEIDX_ERECT
2838 }
2839
2841 }
2842
2844 void OnMovementChanged()//(int state_old, int state_new)
2845 {
2846 switch (m_MovementState.m_LocalMovement)
2847 {
2848 case DayZPlayerConstants.MOVEMENTIDX_CROUCH_RUN:
2849 {
2850 //OnCrouchRunEnd();
2851 break;
2852 }
2853 case DayZPlayerConstants.MOVEMENTIDX_SPRINT:
2854 {
2855 OnSprintEnd();
2856 break;
2857 }
2858 case DayZPlayerConstants.MOVEMENTIDX_RUN:
2859 {
2860 //OnRunEnd();
2861 break;
2862 }
2863 case DayZPlayerConstants.MOVEMENTIDX_WALK:
2864 {
2865 //OnWalkEnd();
2866 break;
2867 }
2868 case DayZPlayerConstants.MOVEMENTIDX_IDLE:
2869 {
2870 //OnIdleEnd();
2871 break;
2872 }
2873 case DayZPlayerConstants.MOVEMENTIDX_SLIDE:
2874 {
2875 //OnSlideEnd();
2876 break;
2877 }
2878 }
2879
2880 switch (m_MovementState.m_iMovement)
2881 {
2882 case DayZPlayerConstants.MOVEMENTIDX_CROUCH_RUN:
2883 {
2884 //OnCrouchRunStart();
2885 break;
2886 }
2887 case DayZPlayerConstants.MOVEMENTIDX_SPRINT:
2888 {
2889 OnSprintStart();
2890 break;
2891 }
2892 case DayZPlayerConstants.MOVEMENTIDX_RUN:
2893 {
2894 //OnRunStart();
2895 break;
2896 }
2897 case DayZPlayerConstants.MOVEMENTIDX_WALK:
2898 {
2899 //OnWalkStart();
2900 break;
2901 }
2902 case DayZPlayerConstants.MOVEMENTIDX_IDLE:
2903 {
2904 //OnIdleStart();
2905 break;
2906 }
2907 case DayZPlayerConstants.MOVEMENTIDX_SLIDE:
2908 {
2909 //OnSlideStart();
2910 break;
2911 }
2912 }
2913 }
2914
2915 void OnSprintStart()
2916 {
2917 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
2918 {
2919 GetUApi().GetInputByID(UALeanLeft).Lock();
2920 GetUApi().GetInputByID(UALeanRight).Lock();
2921 }
2922 }
2923
2924 void OnSprintEnd()
2925 {
2926 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
2927 {
2928 GetUApi().GetInputByID(UALeanLeft).Unlock();
2929 GetUApi().GetInputByID(UALeanRight).Unlock();
2930 }
2931 }
2932 //-------------------------------------------------------------
2936
2937 void OnInputUserDataReceived(ParamsReadContext ctx)
2938 {
2939 int userDataTypeParam = 0;
2940 if (!ctx.Read(userDataTypeParam))
2941 {
2942 Error("DayZPlayerImplement: cannot read input type");
2943 return;
2944 }
2945
2947 }
2948
2950 {
2951 m_MeleeCombat.SetTargetObject(null);
2952 m_MeleeCombat.SetHitPos(vector.Zero);
2953 m_MeleeCombat.SetHitZoneIdx(-1);
2954 m_MeleeCombat.SetFinisherType(-1);
2955
2957 {
2959 if (ctx.Read(target))
2960 {
2961 m_MeleeCombat.SetTargetObject(target);
2962 }
2963
2965 if (ctx.Read(hitPos))
2966 {
2967 m_MeleeCombat.SetHitPos(hitPos);
2968 }
2969
2970 int hitZoneIdx = -1;
2971 if (ctx.Read(hitZoneIdx))
2972 {
2973 m_MeleeCombat.SetHitZoneIdx(hitZoneIdx);
2974 }
2975
2976 int finisherType = -1;
2977 if (ctx.Read(finisherType))
2978 {
2979 m_MeleeCombat.SetFinisherType(finisherType);
2980 }
2981
2982 return true;
2983 }
2984
2985 return false;
2986 }
2987
2988 //-------------------------------------------------------------
2993 {
2994 switch (pJunctureID)
2995 {
2997 if (m_DeathAnimType == -2)
2998 DayZPlayerSyncJunctures.ReadDeathParams(pCtx, m_DeathAnimType, m_DeathHitDir);
2999 break;
3000
3004 {
3005 m_SyncedHitDataArray.Insert(data);
3006 }
3007 break;
3008 }
3009 }
3010
3011 AnimBootsType GetBootsType()
3012 {
3013 EntityAI boots = GetInventory().FindAttachment(InventorySlots.FEET);
3014 if (boots)
3015 {
3016 switch (boots.GetAttachmentSoundType())
3017 {
3018 case "Sneakers":
3019 return AnimBootsType.Sneakers;
3020 case "Boots":
3021 return AnimBootsType.Boots;
3022 }
3023 }
3024
3025 return AnimBootsType.None;
3026 }
3027
3028 //Get top body clothes
3029 AnimUpperBodyType GetBodyAttachmentType()
3030 {
3031 EntityAI attachment = GetInventory().FindAttachment(InventorySlots.BODY);
3032 if (attachment)
3033 {
3034 switch (attachment.GetAttachmentSoundType())
3035 {
3036 case "NylonJacket":
3037 return AnimUpperBodyType.NylonJacket;
3038 case "TShirt":
3039 return AnimUpperBodyType.TShirt;
3040 case "WoolShirt":
3041 return AnimUpperBodyType.WoolShirt;
3042 case "HeavyJacket":
3043 return AnimUpperBodyType.HeavyJacket;
3044 case "LeatherJacket":
3045 return AnimUpperBodyType.LeatherJacket;
3046 case "Coat":
3047 return AnimUpperBodyType.Coat;
3048 case "ChemlonDress":
3049 return AnimUpperBodyType.ChemlonDress;
3050 case "Ghillie":
3051 return AnimUpperBodyType.Ghillie;
3052 case "Chainmail":
3053 return AnimUpperBodyType.Chainmail;
3054 }
3055 }
3056
3057 return AnimUpperBodyType.None;
3058 }
3059
3060 AnimBackType GetBackAttachmentType()
3061 {
3062 EntityAI back = GetInventory().FindAttachment(InventorySlots.BACK);
3063 if (back)
3064 {
3065 switch (back.GetAttachmentSoundType())
3066 {
3067 case "Small":
3068 return AnimBackType.Small;
3069 case "Military":
3070 return AnimBackType.Military;
3071 case "Outdoor":
3072 return AnimBackType.Outdoor;
3073 case "Ghillie":
3074 return AnimBackType.Ghillie;
3075 }
3076 }
3077
3078 return AnimBackType.None;
3079 }
3080
3081 //Get weapon on back
3082 AnimRangedWeaponType GetShoulderAttachmentType()
3083 {
3084 EntityAI shoulderAttachment = GetInventory().FindAttachment(InventorySlots.SHOULDER);
3085 EntityAI meleeAttachment = GetInventory().FindAttachment(InventorySlots.MELEE);
3086
3089
3091 {
3092 switch (shoulderAttachment.GetAttachmentSoundType())
3093 {
3094 case "Shotgun":
3095 {
3097 break;
3098 }
3099 case "Rifle":
3100 {
3102 break;
3103 }
3104 }
3105 }
3106 if (meleeAttachment)
3107 {
3108 switch (meleeAttachment.GetAttachmentSoundType())
3109 {
3110 case "Shotgun":
3111 {
3113 break;
3114 }
3115 case "Rifle":
3116 {
3118 break;
3119 }
3120 }
3121 }
3122
3124 return AnimRangedWeaponType.Shotgun;
3125
3127 return AnimRangedWeaponType.Rifle;
3128
3129 return AnimRangedWeaponType.None;
3130 }
3131
3132 string GetSurfaceType(SurfaceAnimationBone limbType)
3133 {
3134 string surfaceType;
3135 int liquidType;
3136
3137 g_Game.SurfaceUnderObjectByBoneCorrectedLiquid(this, limbType, surfaceType, liquidType);
3138
3139 return surfaceType;
3140 }
3141
3142 //-------------------------------------------------------------
3146
3148 {
3149 if (so == null)
3150 return null;
3151
3152 so.SetPosition(GetPosition());
3153 AbstractWave wave = GetGame().GetSoundScene().Play3D(so, sob);
3154 return wave;
3155 }
3156
3157 void AddNoise(NoiseParams noisePar, float noiseMultiplier = 1.0)
3158 {
3159 if (noisePar != null)
3160 GetGame().GetNoiseSystem().AddNoise(this, noisePar, noiseMultiplier);
3161 }
3162
3163 //-------------------------------------------------------------
3167
3168 void OnStepEvent(string pEventType, string pUserString, int pUserInt)
3169 {
3173
3174 #ifndef SERVER
3175 DayZPlayerTypeStepSoundLookupTable table = type.GetStepSoundLookupTable();
3177 if (pUserInt < 100)
3178 {
3179 string surface;
3180 if (pUserInt % 2 == 1)
3181 {
3182 surface = GetSurfaceType(SurfaceAnimationBone.LeftBackLimb);
3183 if (surface.Length() == 0)//if no surface found, try other leg
3184 surface = GetSurfaceType(SurfaceAnimationBone.RightBackLimb);
3185 }
3186 else
3187 {
3188 surface = GetSurfaceType(SurfaceAnimationBone.RightBackLimb);
3189 if (surface.Length() == 0)//if no surface found, try other leg
3190 surface = GetSurfaceType(SurfaceAnimationBone.LeftBackLimb);
3191 }
3192
3193 if (surface.Length() != 0)
3194 m_LastSurfaceUnderHash = surface.Hash();
3195
3196 if (state.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_SPRINT)
3197 {
3199
3200 if (stepParticleID > 0)
3201 {
3202 ParticleManager.GetInstance().PlayInWorld(stepParticleID, GetPosition());
3203 }
3204 }
3205
3206 soundBuilder = table.GetSoundBuilder(pUserInt, state.m_iMovement, m_LastSurfaceUnderHash, GetBootsType());
3207 }
3208 else
3209 {
3210 string surface2 = GetSurfaceType();
3211 if (surface2.Length() != 0)
3212 m_LastSurfaceUnderHash = surface2.Hash();
3213
3214 soundBuilder = table.GetSoundBuilder(pUserInt, state.m_iMovement, m_LastSurfaceUnderHash, GetBootsType());
3215 }
3216
3217 if (soundBuilder != NULL && GetGame().GetPlayer())
3218 {
3219 vector orientation = Vector(0, 0, 0);
3220 vector edgeLength = Vector(1.5, 3.0, 1.5);
3223
3225 {
3226 for (int i = 0; i < collidedObjects.Count(); ++i)
3227 {
3229 string objectClass = colObject.GetType();
3230
3231 if (objectClass.Contains("BushSoft") || objectClass.Contains("BushHard"))
3232 {
3233 for (int j = 0; j < type.GetVegetationSounds().Count(); ++j)
3234 {
3235 VegetationSound vegetationSound = type.GetVegetationSounds().Get(j);
3236
3237 if (vegetationSound.GetAnimEventIds().Find(pUserInt) >= 0)
3238 {
3240 SoundObject vegSoundObject = vegetationSound.GetSoundObjectBuilder().BuildSoundObject();
3241
3242 if (vegSoundObject != NULL)
3243 {
3244 AttenuateSoundIfNecessary(vegSoundObject);
3246 }
3247
3248 break;
3249 }
3250 }
3251
3252 break;
3253 }
3254 }
3255 }
3256
3257 SoundObject soundObject = soundBuilder.BuildSoundObject();
3258 if (soundObject != NULL)
3259 {
3260 AttenuateSoundIfNecessary(soundObject);
3262 }
3263 }
3264 #endif
3265
3266 if (GetGame().IsServer())
3267 {
3268 m_StepCounter++;//move outside of server condition if needed on client as well
3269
3270 float noiseMultiplier = 0;
3271
3273 if (state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_ERECT || state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDERECT)
3274 noiseParams = type.GetNoiseParamsStand();
3275 else if (state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_CROUCH || state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDCROUCH)
3276 noiseParams = type.GetNoiseParamsCrouch();
3277 else if (state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_PRONE || state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
3278 noiseParams = type.GetNoiseParamsProne();
3279 else
3280 {
3281 Debug.Log(string.Format("Wrong stance, id: %1 using backup with stand stance (id: 0)", state.m_iStanceIdx));
3282 noiseParams = type.GetNoiseParamsStand();
3283 }
3284
3286
3288
3289 if ((m_StepCounter % PlayerConstants.CHECK_EVERY_N_STEP) == 0)
3290 {
3291 ProcessFeetDamageServer(pUserInt);
3292 }
3293 }
3294 }
3295
3296 void OnSoundEvent(string pEventType, string pUserString, int pUserInt)
3297 {
3298 int eventReplaceID;
3299
3300 if (pEventType == "Sound")
3301 {
3302 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT || GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_REMOTE)
3303 {
3304 eventReplaceID = m_ReplaceSoundEventHandler.GetSoundEventID(pUserInt, ESoundEventType.SOUND_COMMON);
3305 if (eventReplaceID > 0)
3306 {
3307 PlaySoundEventType(ESoundEventType.SOUND_COMMON, eventReplaceID);
3308 return;
3309 }
3310 }
3311
3312 ProcessSoundEvent(pEventType, pUserString, pUserInt);
3313 }
3314 else if (pEventType == "SoundWeapon")
3315 {
3316 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT || GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_REMOTE)
3317 {
3318 eventReplaceID = m_ReplaceSoundEventHandler.GetSoundEventID(pUserInt, ESoundEventType.SOUND_WEAPON);
3319 if (eventReplaceID > 0)
3320 {
3321 PlaySoundEventType(ESoundEventType.SOUND_WEAPON, eventReplaceID);
3322 return;
3323 }
3324 }
3325
3326 ProcessWeaponEvent(pEventType, pUserString, pUserInt);
3327 }
3328 else if (pEventType == "SoundAttachment")
3329 {
3330 ProcessAttachmentEvent(pEventType, pUserString, pUserInt);
3331 }
3332 else if (pEventType == "SoundVoice")
3333 {
3334 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT || GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_REMOTE)
3335 {
3336 int event_id = m_PlayerSoundEventHandler.ConvertAnimIDtoEventID(pUserInt);
3337 if (event_id > 0)
3338 {
3339 PlaySoundEvent(event_id);
3340 return;
3341 }
3342 }
3343 ProcessVoiceEvent(pEventType, pUserString, pUserInt);
3344 }
3345 else
3346 {
3347 Debug.Log("OnSoundEvent: Unknown sound event \"" + pEventType + "\"");
3348 }
3349 }
3350
3351 void OnParticleEvent(string pEventType, string pUserString, int pUserInt)
3352 {
3353
3354 }
3355
3356
3357 void ProcessWeaponEvent(string pEventType, string pUserString, int pUserInt)
3358 {
3361
3362 float quantity = 0;
3363
3364 EntityAI entityInHands = GetHumanInventory().GetEntityInHands();
3365 if (entityInHands && entityInHands.IsInherited(ItemBase))
3366 {
3367 ItemBase item;
3369 if (item.HasQuantity())
3370 quantity = (float)item.GetQuantity() / (item.GetQuantityMax() - item.GetQuantityMin());
3371 InventoryItemType invItemType = item.GetInventoryItemType();
3372 soundEvent = invItemType.GetSoundEvent(pUserInt);
3373 }
3374
3375 if (soundEvent == null)
3376 {
3377 quantity = 0;
3378 soundEvent = type.GetSoundWeaponEvent(pUserInt);
3379 }
3380
3381 if (soundEvent != null)
3382 {
3383 if (!GetGame().IsDedicatedServer())
3384 {
3385 SoundObjectBuilder builder = soundEvent.GetSoundBuilderEx(m_ActionSoundCategoryHash);
3386 if (builder)
3387 {
3388 builder.AddVariable("quantity", quantity);
3389 builder.AddVariable("interior", IsSoundInsideBuilding());
3390
3391 SoundObject soundObject = builder.BuildSoundObject();
3392 if (soundObject != NULL)
3393 {
3394 AttenuateSoundIfNecessary(soundObject);
3396
3397 if (pUserString == "StopOnAnimEnd")
3398 m_PerformedActionSounds.Insert(sound);
3399 }
3400 }
3401 else
3402 {
3403 //TODO:Userful error message
3404 }
3405 }
3406
3407 if (GetGame().IsServer())
3408 {
3409 AddNoise(soundEvent.m_NoiseParams, NoiseAIEvaluate.GetNoiseReduction(GetGame().GetWeather()));
3410 }
3411 }
3412 }
3413
3414 void ProcessAttachmentEvent(string pEventType, string pUserString, int pUserInt)
3415 {
3417 DayZPlayerTypeAttachmentSoundLookupTable table = type.GetAttachmentSoundLookupTable();
3418
3420 pUserString.Split(",", attachments);
3421 for (int i = 0; i < attachments.Count(); i++)
3422 {
3423 int attachmentHash = -1;
3424 if (attachments[i] == "shoulder")
3425 attachmentHash = GetShoulderAttachmentType();
3426 else if (attachments[i] == "body")
3427 attachmentHash = GetBodyAttachmentType();
3428 else if (attachments[i] == "back")
3429 attachmentHash = GetBackAttachmentType();
3430
3432
3433 if (soundBuilder != NULL)
3434 {
3435 SoundObject soundObject = soundBuilder.BuildSoundObject();
3436 if (soundObject != NULL)
3437 {
3438 AttenuateSoundIfNecessary(soundObject);
3440 }
3441 }
3442 }
3443 }
3444
3445 void SetVariablesLadderSoundObjectBuilder(SoundObjectBuilder soundObjectBuilder)
3446 {
3447 if (m_ClimbingLadderType == "wood")
3448 {
3449 soundObjectBuilder.AddVariable("laddertype", 1);
3450 }
3451 else
3452 {
3453 soundObjectBuilder.AddVariable("laddertype", 0);
3454 }
3455
3456 AnimBootsType pBoots = GetBootsType();
3457
3458 if (pBoots == AnimBootsType.None)
3459 {
3460 soundObjectBuilder.AddVariable("bare", 1);
3461 soundObjectBuilder.AddVariable("sneakers", 0);
3462 soundObjectBuilder.AddVariable("boots", 0);
3463 }
3464 else if (pBoots == AnimBootsType.Sneakers)
3465 {
3466 soundObjectBuilder.AddVariable("bare", 0);
3467 soundObjectBuilder.AddVariable("sneakers", 1);
3468 soundObjectBuilder.AddVariable("boots", 0);
3469 }
3470 else if (pBoots == AnimBootsType.Boots)
3471 {
3472 soundObjectBuilder.AddVariable("bare", 0);
3473 soundObjectBuilder.AddVariable("sneakers", 0);
3474 soundObjectBuilder.AddVariable("boots", 1);
3475 }
3476 }
3477
3478 void ProcessSoundEvent(string pEventType, string pUserString, int pUserInt)
3479 {
3481 DayZPlayerTypeAnimTable table = type.GetSoundTable();
3483 if (table)
3484 {
3485 soundEvent = table.GetSoundEvent(pUserInt);
3486 }
3487
3488 if (soundEvent != NULL)
3489 {
3490 if (!GetGame().IsDedicatedServer())
3491 {
3492 SoundObjectBuilder objectBuilder = soundEvent.GetSoundBuilder();
3493 if (GetCommand_Ladder())
3494 {
3495 SetVariablesLadderSoundObjectBuilder(objectBuilder);
3496 }
3497 objectBuilder.AddEnvSoundVariables(GetPosition());
3498
3499 SoundObject soundObject = objectBuilder.BuildSoundObject();
3500 if (soundObject != NULL)
3501 {
3502 AttenuateSoundIfNecessary(soundObject);
3504
3505 if (pUserString == "StopOnAnimEnd")
3506 m_PerformedActionSounds.Insert(sound);
3507 }
3508 }
3509
3510 if (GetGame().IsServer())
3511 {
3512 if (soundEvent.m_NoiseParams != NULL)
3513 GetGame().GetNoiseSystem().AddNoise(this, soundEvent.m_NoiseParams, NoiseAIEvaluate.GetNoiseReduction(GetGame().GetWeather()));
3514 }
3515 }
3516 }
3517
3518
3519
3520 AbstractWave ProcessVoiceEvent(string pEventType, string pUserString, int pUserInt)
3521 {
3522 #ifdef SERVER//none of this code needs to run on server, ifdef put here rather than before the method call to maintain mod compatibility
3523 return null;
3524 #endif
3526 DayZPlayerTypeVoiceSoundLookupTable table = type.GetVoiceSoundLookupTable();
3527 if (!table)
3528 return null;
3530 EntityAI mask = GetInventory().FindAttachment(InventorySlots.MASK);
3531 EntityAI head_gear = GetInventory().FindAttachment(InventorySlots.HEADGEAR);
3532
3533 string category;
3534 if (mask || head_gear)
3535 {
3536 string category_mask;
3537 string category_headgear;
3538
3539 int priority_mask;
3541
3542 if (mask)
3543 {
3544 category_mask = mask.ConfigGetString("soundVoiceType");
3545 priority_mask = mask.ConfigGetInt("soundVoicePriority");
3546 }
3547 if (head_gear)
3548 {
3549 category_headgear = head_gear.ConfigGetString("soundVoiceType");
3550 priority_headgear = head_gear.ConfigGetInt("soundVoicePriority");
3551 }
3552
3554 {
3556 }
3557 else
3558 {
3560 }
3561 }
3562
3563 if (category == "")
3564 {
3565 category = "none";
3566 }
3567
3568 SoundObjectBuilder soundBuilder = table.GetSoundBuilder(pUserInt, category.Hash());
3569
3570 if (soundBuilder)
3571 {
3572 PlayerBase player = PlayerBase.Cast(this);
3573 //this code block looks super shady, but it's the only way the sounds play correctly, god knows what's going on on c++ side
3574 int maleVoiceType = 0;
3575 int femaleVoiceType = 0;
3576 if (player.IsMale())
3577 {
3578 maleVoiceType = player.GetVoiceType();
3579 }
3580 else
3581 {
3582 femaleVoiceType = player.GetVoiceType();
3583 }
3584
3585 soundBuilder.AddVariable("male", maleVoiceType);
3586 soundBuilder.AddVariable("female", femaleVoiceType);
3587
3588 // end of weirdness
3589 SoundObject soundObject = soundBuilder.BuildSoundObject();
3590 if (soundObject != NULL)
3591 {
3592 AttenuateSoundIfNecessary(soundObject);
3594 }
3595
3596 }
3597
3598 return wave;
3599 }
3600
3601 void ProcessFeetDamageServer(int pUserInt);
3602
3603
3604 //-------------------------------------------------------------
3608
3609 bool CheckForTakeItem(EntityAI item)
3610 {
3611 bool restrained = IsRestrained(); // IsRestrained()
3612 bool unconscious = IsUnconscious(); // IsRestrained()
3613
3614 ItemBase ib = ItemBase.Cast(item);
3615 if (ib && (PlayerBase.DEBUG_INVENTORY_ACCESS || !IsAlive() || restrained || unconscious || ib.CanBeMovedOverride()))
3616 return true;
3617 return false;
3618 }
3619
3620 bool CheckForDropItem(EntityAI item)
3621 {
3622 /*
3623 bool restrained = IsRestrained(); // IsRestrained()
3624 bool unconscious = IsUnconscious(); // IsRestrained()
3625
3626 ItemBase ib = ItemBase.Cast(item);
3627 if (!IsAlive() || restrained || unconscious || ib.CanBeMovedOverride())
3628 return true;
3629 return false;
3630 */
3631 return CheckForTakeItem(item); //the two functions are currently identical
3632 }
3633
3634 //-------------------------------------------------------------
3638 bool CheckForRespawn(EntityAI item)
3639 {
3640 PlayerBase player = PlayerBase.Cast(this);
3641 if (!player)
3642 return true;
3643
3644 if (!IsAlive() || player.IsUnconscious())
3645 return true;
3646 return false;
3647 }
3648
3649#ifdef DEVELOPER
3650
3651 // -------------------------------------------------------------------------
3653 {
3654 super.OnRPC(sender, rpc_type, ctx);
3655
3656 if (rpc_type == ERPCs.RPC_DAYZPLAYER_DEBUGSERVERWALK)
3657 {
3658 Print("ERPCs.RPC_DAYZPLAYER_DEBUGSERVERWALK");
3659
3660 Param1<bool> rp = new Param1<bool>(false);
3661 ctx.Read(rp);
3662
3663 GetInputController().OverrideMovementSpeed(rp.param1, 1);
3664 GetInputController().OverrideAimChangeX(rp.param1, 0.01);
3665
3666 }
3667 }
3668
3669#endif
3670
3671 bool IsLanded(int pCurrentCommandID)
3672 {
3673 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_FALL)
3674 {
3676
3677 if (fall)
3678 {
3679 return fall.PhysicsLanded();
3680 }
3681 }
3682
3683 return false;
3684 }
3685
3687 {
3688 if (pCurrentCommandID == DayZPlayerConstants.COMMANDID_FALL)
3689 {
3691
3692 if (fall)
3693 {
3694 fall.Land(fallDamageData.m_LandType);
3695 return true;
3696 }
3697 }
3698
3699 return false;
3700 }
3701
3702 bool IsAlreadyInFallingCommand(int pCurrentCommandID)
3703 {
3704 return pCurrentCommandID == DayZPlayerConstants.COMMANDID_FALL;
3705 }
3706
3708 void OverrideSlidePoseAngle(float value)
3709 {
3710 if (!m_MoveSettings)
3711 m_MoveSettings = GetDayZPlayerType().CommandMoveSettingsW();
3712 if (m_MoveSettings.m_fSlidingPoseAngle != value)
3713 {
3714 m_MoveSettings.m_fSlidingPoseAngle = value;
3715 StartCommand_Move(); //nescessary, re-initializes with adjusted values
3716 }
3717 }
3718
3719 float GetSlidePoseAngle()
3720 {
3721 return GetDayZPlayerType().CommandMoveSettingsW().m_fSlidingPoseAngle;
3722 }
3723
3724 void CheckAnimationOverrides()
3725 {
3726 }
3727
3728 bool IsPlayerSelected()
3729 {
3730 return m_PlayerSelected;
3731 }
3732
3733 bool IsRestrained();
3734
3736 bool IsInFBEmoteState();
3737
3738 void SetSuicide(bool state)
3739 {
3740 m_Suicide = state;
3741 }
3742
3743 bool CommitedSuicide()
3744 {
3745 return m_Suicide;
3746 }
3747
3749 void OnLadder(float delta_time, HumanMovementState pState);
3750
3751 //-------------------------------------------------------------
3755
3756 override protected void EOnContact(IEntity other, Contact extra)
3757 {
3758 if (!IsAlive())
3759 return;
3760
3761 if (GetParent() == other)
3762 return;
3763
3765 if (transport)
3766 {
3767 if (GetGame().IsServer())
3768 {
3769 RegisterTransportHit(transport);
3770 }
3771 }
3772 }
3773
3774 protected void AttenuateSoundIfNecessary(SoundObject soundObject)
3775 {
3776 if (GetGame().GetPlayer() != NULL && (IsSoundInsideBuilding() != GetGame().GetPlayer().IsSoundInsideBuilding() || IsCameraInsideVehicle() != GetGame().GetPlayer().IsCameraInsideVehicle()))
3777 {
3778 soundObject.SetKind(WaveKind.WAVEATTALWAYS);
3779 }
3780 else
3781 {
3782 soundObject.SetKind(WaveKind.WAVEEFFECTEX);
3783 }
3784 }
3785
3786 void CheckLiftWeapon();
3787 void ProcessLiftWeapon();
3788
3789 void SetHandheldOpticsInUse(bool state)
3790 {
3791 m_HandheldOpticsInUse = state;
3792 }
3793
3794 bool IsHandheldOpticsInUse()
3795 {
3796 return m_HandheldOpticsInUse;
3797 }
3798
3799 bool IsLiftWeapon();
3800 bool IsRaised()
3801 {
3802 return m_IsRaised;
3803 }
3804
3805 bool IsFighting();
3806
3808 // Will return true when the item is not heavy as well
3809 bool CanPickupHeavyItem(notnull EntityAI item)
3810 {
3811 return !item.IsHeavyBehaviour() || (item.IsHeavyBehaviour() && DayZPlayerUtils.PlayerCanChangeStance(this, DayZPlayerConstants.STANCEIDX_ERECT));
3812 }
3813
3814 bool CanPickupHeavyItemSwap(notnull EntityAI item1, notnull EntityAI item2)
3815 {
3816 return CanPickupHeavyItem(item1) && CanPickupHeavyItem(item2);
3817 }
3818
3819#ifdef DIAG_DEVELOPER
3820 Weapon_Base SpawnWeaponInHands(string type)
3821 {
3822 return Weapon_Base.Cast(GetHumanInventory().CreateInHands(type));
3823 }
3824#endif
3825
3827//Obsolete stuff below this point//
3829
3830 protected bool m_CameraEyeZoom; //DEPRECATED
3831 ref Timer m_ADSAutomationTimer; //DEPRECATED
3832 protected bool m_ADSTimerLaunched; //DEPRECATED
3833 protected bool m_ProcessWeaponRaiseCompleted; //DEPRECATED
3834 protected bool m_IsFireWeaponRaised; //DEPRECATED, value still set for legacy reasons
3835 void SetReturnToOptics(bool state); //DEPRECATED
3836 void RunADSTimer(); //DEPRECATED
3837 void StopADSTimer(); //DEPRECATED
3838}
const int INPUT_UDT_MELEE_TARGET
Definition _constants.c:6
const int INPUT_UDT_INVENTORY
Definition _constants.c:9
const int INPUT_UDT_WEAPON_REMOTE_EVENT
Definition _constants.c:12
const int INPUT_UDT_HAND_REMOTE_EVENT
Definition _constants.c:14
void OnJumpStart()
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
Definition CentralEconomy.c:36
const int RF_DEFAULT
Definition CentralEconomy.c:65
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
DamageType
exposed from C++ (do not change)
Definition DamageSystem.c:11
AnimBootsType
Definition DayZAnimEvents.c:98
bool ModCommandHandlerInside(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
Definition DayZAnimal.c:136
proto native void ResetDeathCooldown()
bool ModCommandHandlerBefore(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
Definition DayZAnimal.c:131
bool ModCommandHandlerAfter(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
Definition DayZAnimal.c:141
DayZGame g_Game
Definition DayZGame.c:3815
ref HumanMovementState m_MovementState
movement state
Definition DayZPlayerCamera3rdPerson.c:324
void DayZPlayerImplementFallDamage(DayZPlayer pPlayer)
Definition DayZPlayerImplementFallDamage.c:73
void DayZPlayerImplementMeleeCombat(DayZPlayerImplement player)
Definition DayZPlayerImplementMeleeCombat.c:90
bool IsProcessing()
Definition DayZPlayerInventory.c:2501
void AbortWeaponEvent()
Definition DayZPlayerInventory.c:282
ref DayZPlayerImplementMeleeCombat m_MeleeCombat
Definition DayZPlayerMeleeFightLogic_LightHeavy.c:20
void DayZPlayerMeleeFightLogic_LightHeavy(DayZPlayerImplement player)
Definition DayZPlayerMeleeFightLogic_LightHeavy.c:31
void DayZPlayerUtils()
cannot be instantiated
Definition DayZPlayerUtils.c:465
ECameraZoomType
Definition ECameraZoomType.c:2
ERPCs
Definition ERPCs.c:2
EStaminaConsumers
Definition EStaminaConsumers.c:2
EStaminaModifiers
Definition EStaminaModifiers.c:2
bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
Definition EmoteManager.c:500
void OnSyncJuncture(int pJunctureID, ParamsReadContext pCtx)
Definition EmoteManager.c:532
override void EEKilled(Object killer)
Definition ExplosivesBase.c:93
void PlaySound()
Definition HungerSoundHandler.c:38
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
override void EOnContact(IEntity other, Contact extra)
Definition ItemBase.c:5950
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Definition ItemBase.c:6269
string GetDebugText()
Definition ModifierBase.c:71
PlayerBase GetPlayer()
Definition ModifierBase.c:51
proto void AddNoise(EntityAI source_entity, NoiseParams noise_params, float external_strenght_multiplier=1.0)
class NoiseSystem NoiseParams()
Definition Noise.c:15
string path
Definition OptionSelectorMultistate.c:142
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Definition ParticleManager.c:84
void PlayerSoundEventHandler(PlayerBase player)
Definition PlayerSoundEventHandler.c:52
EPlayerSoundEventID
Definition PlayerSoundEventHandler.c:2
override void OnRPC(ParamsReadContext ctx)
Definition PlayerStatBase.c:69
void PluginDayzPlayerDebug()
Definition PluginDayzPlayerDebug.c:275
void CommandHandler()
Definition PluginDayzPlayerDebug.c:1051
PluginManager GetPluginManager()
Returns registred plugin by class type, better is to use global funtion GetPlugin(typename plugin_typ...
Definition PluginManager.c:274
@ Count
Definition RandomGeneratorSyncManager.c:8
void ReplaceSoundEventHandler(PlayerBase player)
Definition ReplaceSoundEventHandler.c:25
ESoundEventType
Definition ReplaceSoundEventHandler.c:2
WaveKind
Definition Sound.c:2
class SoundObjectBuilder SoundObject(SoundParams soundParams)
void SoundObjectBuilder(SoundParams soundParams)
proto native UAInputAPI GetUApi()
class JsonUndergroundAreaTriggerData GetPosition
Definition UndergroundAreaLoader.c:9
Definition Sound.c:119
Super root of all classes in Enforce script.
Definition EnScript.c:11
Definition EnPhysics.c:305
Definition ZombieBase.c:2
Definition DayZPlayerCameras.c:2
static const int DAYZCAMERA_3RD_ERC_RAISED
3rd - standing raised
Definition DayZPlayerCameras.c:6
static const int DAYZCAMERA_3RD_CRO_RAISED
3rd - crouch
Definition DayZPlayerCameras.c:8
static const int DAYZCAMERA_IRONSIGHTS
ironsights camera
Definition DayZPlayerCameras.c:12
static const int DAYZCAMERA_3RD_CRO
3rd - crouch
Definition DayZPlayerCameras.c:7
static const int DAYZCAMERA_3RD_ERC_RAISED_MELEE
3rd - laying raised
Definition DayZPlayerCameras.c:11
static const int DAYZCAMERA_1ST
1st person camera
Definition DayZPlayerCameras.c:3
static const int DAYZCAMERA_1ST_VEHICLE
vehicle 1st person
Definition DayZPlayerCameras.c:18
static const int DAYZCAMERA_3RD_PRO_RAISED
3rd - laying raised
Definition DayZPlayerCameras.c:10
static const int DAYZCAMERA_3RD_PRO
3rd - laying
Definition DayZPlayerCameras.c:9
static const int DAYZCAMERA_3RD_JUMP
jump
Definition DayZPlayerCameras.c:15
static const int DAYZCAMERA_3RD_CLIMB
climb / vault
Definition DayZPlayerCameras.c:16
static const int DAYZCAMERA_3RD_ERC_SPR
3rd - standing sprint
Definition DayZPlayerCameras.c:5
static const int DAYZCAMERA_1ST_UNCONSCIOUS
unconscious
Definition DayZPlayerCameras.c:14
static const int DAYZCAMERA_3RD_ERC
3rd - standing
Definition DayZPlayerCameras.c:4
static const int DAYZCAMERA_OPTICS
optics
Definition DayZPlayerCameras.c:13
Definition DayZPlayerImplement.c:11
Definition DayZPlayerImplement.c:111
Definition DayZPlayerImplementAiming.c:32
Definition DayZPlayerImplementHeading.c:11
static bool NoHeading(float pDt, SDayZPlayerHeadingModel pModel, out float pLastHeadingDiff)
Definition DayZPlayerImplementHeading.c:187
static bool ClampHeading(float pDt, SDayZPlayerHeadingModel pModel, out float pLastHeadingDiff)
Definition DayZPlayerImplementHeading.c:19
static bool RotateOrient(float pDt, SDayZPlayerHeadingModel pModel, out float pLastHeadingDiff)
Definition DayZPlayerImplementHeading.c:67
Definition ManBase.c:2
override void OnVariablesSynchronized()
Definition ManBase.c:16
Definition DayZPlayerImplementJumpClimb.c:2
Definition DayZPlayerImplementSwimming.c:3
Definition DayZPlayerImplementThrowing.c:2
Definition DayZPlayerInventory.c:125
Definition DayZPlayerSyncJunctures.c:5
static bool ReadDeathParams(ParamsReadContext pCtx, out int pType, out float pHitDir)
Definition DayZPlayerSyncJunctures.c:74
static bool ReadDamageHitParamsEx(ParamsReadContext pCtx, out SyncHitInfo pData)
Definition DayZPlayerSyncJunctures.c:132
static void SendDeath(DayZPlayer pPlayer, int pType, float pHitDir)
Definition DayZPlayerSyncJunctures.c:65
static void SendDamageHitEx(DayZPlayer pPlayer, int pType, float pHitDir, bool pFullbody, TotalDamageResult pDamageResult, int pDamageType, EntityAI pSource, string pComponent, string pAmmoType, vector pModelPos)
Definition DayZPlayerSyncJunctures.c:99
static const int SJ_DAMAGE_HIT
Definition DayZPlayerSyncJunctures.c:6
static const int SJ_DEATH
Definition DayZPlayerSyncJunctures.c:18
Definition dayzplayer.c:171
Definition dayzplayer.c:147
Definition DayZPlayerCfgSounds.c:168
Definition Debug.c:14
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:136
Definition EnDebug.c:233
Definition Building.c:6
Definition Camera.c:2
Definition DayZPlayerImplementFallDamage.c:2
Definition DayZPlayerImplementVehicle.c:2
command itself
Definition human.c:773
proto static native bool DoClimbTest(Human pHuman, SHumanCommandClimbResult pResult, int pDebugDrawLevel)
Definition human.c:537
Definition human.c:434
Definition human.c:620
Definition human.c:690
Definition human.c:994
Definition human.c:18
Definition humanitems.c:6
Definition human.c:1139
Definition EnEntity.c:165
Definition InventoryItemType.c:2
InventoryLocation.
Definition InventoryLocation.c:29
provides access to slot configuration
Definition InventorySlots.c:6
Definition InventoryItem.c:731
Definition ItemOptics.c:2
Definition KillerData.c:2
Definition EnMath.c:7
Definition SensesAIEvaluate.c:2
static float GetNoiseMultiplier(DayZPlayerImplement playerImplement)
Definition SensesAIEvaluate.c:5
static float GetNoiseReduction(Weather weather)
Definition SensesAIEvaluate.c:18
Definition ObjectTyped.c:2
Definition OnlineServices.c:2
static void SetMultiplayState(bool state)
Definition OnlineServices.c:517
Definition EntityAI.c:95
Definition PlayerBaseClient.c:2
Definition PlayerConstants.c:2
static const float FULL_SPRINT_DELAY_DEFAULT
Definition PlayerConstants.c:7
static const float WEAPON_RAISE_BLEND_DELAY
Definition PlayerConstants.c:3
static const int CHECK_EVERY_N_STEP
Definition PlayerConstants.c:16
static const float HEAVY_HIT_THRESHOLD
Definition PlayerConstants.c:5
The class that will be instanced (moddable)
Definition gameplay.c:388
Definition dayzplayer.c:1098
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
Definition Sound.c:46
Definition Sound.c:101
Definition Surface.c:2
static int GetStepsParticleID(string surface_name)
Definition Surface.c:3
Definition SyncedValue.c:2
Definition DayZPlayerImplement.c:63
Definition DamageSystem.c:2
Base native class for all motorized wheeled vehicles.
Definition Boat.c:28
Definition UAInput.c:96
Definition dayzplayer.c:191
shorthand
Definition BoltActionRifle_Base.c:6
Definition WeaponDebug.c:12
script counterpart to engine's class Weapon
Definition InventoryItem.c:49
Definition WeaponManager.c:2
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition IsBoxCollidingGeometryProxyClasses.c:28
Definition EnConvert.c:97
Definition EnConvert.c:106
static const vector Zero
Definition EnConvert.c:110
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
Definition EnConvert.c:271
int CameraHandler(int pCameraMode)
-------------— camera handling ----------------------—
bool IsInThirdPerson()
return true if player is currently in 3pp, otherwise false
void DayZPlayerType()
Definition dayzplayer.c:512
proto native void SetVerticalMinimumAimLimit(float value)
sets vertical minimum aim limit for a player
void SDayZPlayerHeadingModel()
cannot be created from script
Definition dayzplayer.c:1089
void ForceStandUpForHeavyItems(notnull EntityAI item)
-------------— Forces player to stand up when swapping to heavy item ----------------------—
Definition dayzplayer.c:1361
DayZPlayerInstanceType
defined in C++
Definition dayzplayer.c:1068
proto native DayZPlayerType GetDayZPlayerType()
returns appropriate DayZPlayerType
proto native DayZPlayerInstanceType GetInstanceType()
proto native float IsPlayerSpeaking()
-------------— speaking anim ----------------------—
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
void OnInputForRemote(ParamsReadContext ctx)
Definition dayzplayer.c:1332
void OnInputFromServer(ParamsReadContext ctx)
Definition dayzplayer.c:1333
float GetCurrentWaterLevel()
void SetCurrentWaterLevel(float pWaterLevel)
bool AimingModel(float pDt, SDayZPlayerAimingModel pModel)
-------------— aiming model ----------------------—
int GetEyeZoomLevel()
returns eye zoom level, uses ECameraZoomType values
bool IsShootingFromCamera()
return true if shots are fired from camere, otherwise false
bool IsPlayerInStance(int pStanceMask)
-------------— camera additiona functions ----------------------—
Definition dayzplayer.c:1323
bool IsEyeZoom()
DEPRICATED(use GetEyeZoomLevel()) returns true if player is using EyeZoom, otherwise false.
bool HeadingModel(float pDt, SDayZPlayerHeadingModel pModel)
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
proto void Print(void var)
Prints content of variable to console/log.
static proto float GetEngineRangeValue(int id)
Get range value at the given engine id.
static proto int GetEngineValue(int id)
Get value at the given engine id.
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
const int INPUT_DEVICE_MOUSE
Definition constants.c:24
const int INPUT_DEVICE_GAMEPAD
Definition constants.c:28
const int INPUT_DEVICE_KEYBOARD
Definition constants.c:23
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float Acos(float c)
Returns angle in radians from cosinus.
static proto float AbsFloat(float f)
Returns absolute value.
static const float RAD2DEG
Definition EnMath.c:16
static proto int AbsInt(int i)
Returns absolute value.
proto native int Hash()
Returns hash of string.
proto native int Length()
Returns length of string.
const int CALL_CATEGORY_GUI
Definition tools.c:9
proto native Widget GetParent()
Get parent of the Effect.
Definition Effect.c:407
class HumanCommandLadder HumanCommandSwim()
Definition human.c:673
WeaponActions
actions
Definition human.c:816
WeaponEvents
events
Definition human.c:963
class HumanCommandMelee2 HumanCommandFall()
Definition human.c:574
proto native bool IsLeavingUncon()
return true if character transitions out of uncon
class HumanCommandWeapons HumanCommandAdditives()
Definition human.c:1112
void HumanItemAccessor()
Definition humanitems.c:141
class HumanItemBehaviorCfg OnItemInHandsChanged(bool pInstant=false)
signalization from script to engine that item in hands changed
class SHumanGlobalSettings SHumanCommandMoveSettings()
Definition humansettings.c:12
class SHumanCommandSwimSettings SHumanCommandClimbSettings()
Definition humansettings.c:74

Переменные

◆ m_pPlayer

PlayerBase m_pPlayer

◆ OnSimulationEnd

override void OnSimulationEnd
55 {
56 m_pPlayer.PhysicsEnableGravity(true);
57 }
PlayerBase m_pPlayer
Definition DayZPlayerImplement.c:92