15 override void OnSimulationEnd()
21 EntityAI itemInHands = m_pPlayer.GetHumanInventory().GetEntityInHands();
24 int boneIndex = m_pPlayer.GetBoneIndexByName(
"RightHand_Dummy");
27 m_pPlayer.GetBoneTransformWS(boneIndex, m4);
29 m_pPlayer.GetInventory().DropEntityWithTransform(
InventoryMode.SERVER, m_pPlayer, itemInHands, m4);
33 int deadBodyLifetime =
GetCEApi().GetCEGlobalInt(
"CleanupLifetimeDeadPlayer");
34 if (deadBodyLifetime <= 0)
36 deadBodyLifetime = 3600;
38 itemInHands.SetLifetime(deadBodyLifetime);
44 override bool ShouldSimulationBeDisabled()
46 return m_pPlayer.m_WasInVehicle ==
false;
62 class DeathEffectTimer
extends Timer
68 PPERequesterBank.GetRequester(PPERequester_DeathDarkening).Stop();
74 static const int DEAD_SCREEN_DELAY = 1000;
75 static const float DEFAULT_DYING_TIME = 2.5;
76 static const float DYING_PROGRESSION_TIME = 0.05;
89 protected float m_FallYDiff;
90 protected float m_SprintedTime;
91 protected float m_SprintedTimePerStanceMin;
92 protected bool m_SprintFull;
93 protected bool m_IsRaised;
94 protected bool m_ShouldReload;
95 protected bool m_Camera3rdPerson;
96 protected bool m_CameraZoomToggle;
97 protected bool m_bADS;
98 private float m_WeaponRaiseTime;
99 protected bool m_WeaponRaiseCompleted;
101 protected bool m_WasIronsight;
102 protected bool m_CameraIronsight;
103 protected bool m_CameraOptics;
105 protected float m_DeathDarkeningCurrentTime;
106 protected bool m_IsTryingHoldBreath;
107 protected bool m_IsShootingFromCamera;
108 protected bool m_PlayerSelected;
109 protected bool m_Suicide;
110 protected bool m_IsUnconscious;
111 protected bool m_ShouldBeUnconscious;
112 protected bool m_IsUnconsciousFalling;
113 bool m_UnconsciousDebug;
114 protected int m_LastCommandBeforeUnconscious;
116 ref DeathEffectTimer m_DeathEffectTimer;
117 ref
Timer m_FightEndBlendTimer;
118 protected bool m_ProcessFirearmMeleeHit;
119 protected bool m_ContinueFirearmMelee;
120 protected bool m_LiftWeapon_player;
121 protected bool m_ProcessLiftWeapon;
122 protected bool m_ProcessLiftWeaponState;
123 protected int m_LastSurfaceUnderHash;
125 protected string m_ClimbingLadderType;
126 bool m_isFBsymptomPlaying;
127 protected bool m_HandheldOpticsInUse;
128 protected bool m_ResetADS;
129 protected int m_StepCounter;
130 protected int m_NextVoNNoiseTime;
134 protected bool m_RaiseStarted =
false;
135 protected bool m_AimingFinisherStarted =
false;
136 protected bool m_IsWeapon;
138 private float m_CurrentWaterLevel;
141 protected bool m_TriggerPullPlayerOutOfVehicleSynch;
142 protected bool m_PullPlayerOutOfVehicleKeepsInLocalSpace =
false;
143 protected int m_PullPlayerOutOfVehicleState = -1;
144 int m_ActionSoundCategoryHash;
146 protected float m_dT;
151 m_SprintFull =
false;
153 m_SprintedTimePerStanceMin =
PlayerConstants.FULL_SPRINT_DELAY_DEFAULT;
161 m_ADSAutomationTimer =
new Timer();
163 m_WeaponRaiseCompleted =
false;
165 m_IsShootingFromCamera =
true;
166 m_ProcessFirearmMeleeHit =
false;
167 m_ContinueFirearmMelee =
false;
168 m_WasIronsight =
true;
169 #ifdef PLATFORM_CONSOLE
170 m_Camera3rdPerson = !
GetGame().GetWorld().Is3rdPersonDisabled();
172 m_LastSurfaceUnderHash = (
"cp_gravel").Hash();
173 m_NextVoNNoiseTime = 0;
175 m_CurrentWaterLevel = 0;
176 m_WeaponRaiseTime = 0;
178 RegisterNetSyncVariableBoolSignal(
"m_TriggerPullPlayerOutOfVehicleSynch");
183 return m_AimingModel;
193 return m_MeleeFightLogic;
218 return m_CameraEyeZoomLevel;
223 return m_IsShootingFromCamera;
226 void OverrideShootFromCamera(
bool pState)
228 m_IsShootingFromCamera = pState;
231 bool IsInIronsights()
233 return m_CameraIronsight;
238 return m_CameraOptics;
243 return m_Camera3rdPerson;
246 void SetIsInThirdPerson(
bool state)
248 m_Camera3rdPerson = state;
251 bool IsFireWeaponRaised()
260 bool IsTryingHoldBreath()
262 return m_IsTryingHoldBreath;
270 void ShowWeaponDebug(
bool show)
278 m_WeaponDebug =
null;
282 bool IsWeaponDebugEnabled()
284 return m_WeaponDebug !=
null;
287 void SetFallYDiff(
float value)
294 return m_CurrentWaterLevel;
299 m_CurrentWaterLevel = pWaterLevel;
302 void SetIronsights(
bool value)
307 m_WasIronsight = m_CameraIronsight;
310 m_CameraIronsight = value;
322 void SetOptics(
bool value)
324 m_CameraOptics = value;
331 hcw.SetADS(!IsHandheldOpticsInUse());
339 EntityAI entityInHands = GetHumanInventory().GetEntityInHands();
343 optics = weapon.GetAttachedOptics();
350 SetIronsights(
false);
355 SwitchOptics(optics,
false);
365 void SwitchOptics(
ItemOptics optic,
bool state)
371 if (optic.HasEnergyManager())
372 optic.GetCompEM().SwitchOn();
374 optic.OnOpticEnter();
380 if (optic.HasEnergyManager())
381 optic.GetCompEM().SwitchOff();
385 if (m_CameraOptics != state)
391 void SetClimbingLadderType(
string value)
393 m_ClimbingLadderType = value;
411 bool IsClimbingLadder()
417 bool PlaySoundEvent(
EPlayerSoundEventID id,
bool from_anim_system =
false,
bool is_from_server =
false) {};
418 bool PlaySoundEventEx(
EPlayerSoundEventID id,
bool from_anim_system =
false,
bool is_from_server =
false,
int param = 0) {};
420 bool IsFBSymptomPlaying()
422 return m_isFBsymptomPlaying;
435 int m_DeathAnimType = -2;
436 float m_DeathHitDir = 0;
437 bool m_DeathJuctureSent =
false;
441 string text = super.GetDebugText();
443 text +=
"IsSimulationDisabled: " + GetIsSimulationDisabled() +
"\n";
454 void TriggerPullPlayerOutOfVehicle()
468 for (
int i = 0; i < transport.CrewSize(); ++i)
470 if (transport.CrewMember(i) ==
this)
482 transport.CrewGetOut(crewIdx);
483 TriggerPullPlayerOutOfVehicleImpl();
488 void TriggerPullPlayerOutOfVehicleImpl()
494 DisableSimulation(
false);
502 m_PullPlayerOutOfVehicleState = 0;
503 m_TriggerPullPlayerOutOfVehicleSynch =
true;
508 override void OnVariablesSynchronized()
510 if (m_TriggerPullPlayerOutOfVehicleSynch && !
GetGame().IsDedicatedServer())
512 TriggerPullPlayerOutOfVehicleImpl();
515 super.OnVariablesSynchronized();
518 bool HandleDeath(
int pCurrentCommandID)
522 switch (m_PullPlayerOutOfVehicleState)
527 m_PullPlayerOutOfVehicleState = -1;
532 DayZPlayerVehicleCommandDeathCallback callbackVeh;
534 Class.CastTo(callbackVeh.m_pPlayer,
this);
541 if (m_DeathAnimType != -2 &&
g_Game.GetMissionState() ==
g_Game.MISSION_STATE_GAME)
543 if (!CommitedSuicide())
545 int type = m_DeathAnimType;
547 type = GetTypeOfDeath(pCurrentCommandID);
549 m_WasInVehicle =
false;
553 m_TransportCache = hcv.GetTransport();
554 m_WasInVehicle = !hcv.IsGettingIn() && !hcv.IsGettingOut();
557 bool keepInLocalSpace =
false;
558 if (IsUnconscious() || m_WasInVehicle)
560 if (m_TransportCache)
562 m_TransportCache.CrewDeath(m_TransportCache.CrewMemberIndex(
this));
563 m_TransportCache.MarkCrewMemberDead(m_TransportCache.CrewMemberIndex(
this));
568 if (m_TransportCache)
570 m_TransportCache.CrewGetOut(m_TransportCache.CrewMemberIndex(
this));
571 m_TransportCache.MarkCrewMemberDead(m_TransportCache.CrewMemberIndex(
this));
574 keepInLocalSpace = m_PullPlayerOutOfVehicleKeepsInLocalSpace;
577 DisableSimulation(
false);
579 m_TransportCache =
null;
583 Class.CastTo(callback.m_pPlayer,
this);
591 GetGame().GetWorld().SetVoiceOn(
false,
false);
599 void ResetDeathStartTime()
604 int GetTypeOfDeath(
int pCurrentCommandID)
606 switch (pCurrentCommandID)
628 void SendDeathJuncture(
int pAnimTypeDeath,
float pAnimHitDirDeath)
630 if (m_DeathJuctureSent)
634 m_DeathJuctureSent =
true;
639 SendDeathJuncture(-1, 0);
641 super.EEKilled(killer);
644 void ShowDeadScreen(
bool show,
float duration)
647 if (show && IsPlayerSelected())
654 if (!
GetGame().GetMission().IsPlayerRespawning())
656 message =
"#dayz_implement_dead";
659 #ifdef PLATFORM_CONSOLE
660 GetGame().GetUIManager().ScreenFadeIn(duration, message, FadeColors.DARK_RED, FadeColors.WHITE);
662 GetGame().GetUIManager().ScreenFadeIn(duration, message, FadeColors.BLACK, FadeColors.WHITE);
667 GetGame().GetUIManager().ScreenFadeOut(duration);
677 override void StopDeathDarkeningEffect()
679 if (m_DeathEffectTimer && m_DeathEffectTimer.IsRunning())
681 m_DeathEffectTimer.Stop();
682 m_DeathEffectTimer =
null;
686 void SimulateDeath(
bool state)
688 if (
g_Game.GetMissionState() != DayZGame.MISSION_STATE_GAME)
695 float duration = DEFAULT_DYING_TIME;
696 if (m_KilledByHeadshot)
701 if (duration > DYING_PROGRESSION_TIME && !m_IsUnconscious)
703 if (!m_DeathEffectTimer)
704 m_DeathEffectTimer =
new DeathEffectTimer();
707 m_DeathEffectTimer.Run(DYING_PROGRESSION_TIME,
this,
"SetDeathDarknessLevel", par,
true);
710 ShowDeadScreen(state, duration);
712 GetGame().GetSoundScene().SetSoundVolume(0,0);
713 GetGame().GetSoundScene().SetSpeechExVolume(0,0);
714 GetGame().GetSoundScene().SetMusicVolume(0,0);
715 GetGame().GetSoundScene().SetVOIPVolume(0,0);
716 GetGame().GetSoundScene().SetRadioVolume(0,0);
720 StopDeathDarkeningEffect();
721 ShowDeadScreen(state, 0);
725 void LockControls(
bool state)
735 GetGame().GetUIManager().ShowUICursor(
true);
736 if (
GetGame().GetUIManager().IsDialogVisible())
737 GetGame().GetUIManager().CloseDialog();
748 if (
GetGame().GetUIManager().GetMenu())
750 GetGame().GetUIManager().ShowUICursor(
true);
754 GetGame().GetUIManager().ShowUICursor(
false);
760 void SetDeathDarknessLevel(
float duration,
float tick_time);
762 void SendCompleteWeaponRaiseJuncture();
764 void CompleteWeaponRaise()
766 m_WeaponRaiseTime = 0;
767 m_WeaponRaiseCompleted =
true;
770 void ResetWeaponRaiseProgress()
772 m_WeaponRaiseTime = 0;
773 m_WeaponRaiseCompleted =
false;
776 bool IsWeaponRaiseCompleted()
778 return m_WeaponRaiseCompleted;
789 int userDataType = 0;
790 if (!ctx.Read(userDataType))
792 Error(
"DayZPlayer: OnInputForRemote - cannot read input type");
796 switch (userDataType)
799 GetDayZPlayerInventory().OnEventForRemoteWeapon(ctx);
802 GetDayZPlayerInventory().OnHandEventForRemote(ctx);
805 GetDayZPlayerInventory().OnInputUserDataForRemote(ctx);
808 Error(
"OnInputForRemote - unknown userDataType=" + userDataType);
815 int userDataType = 0;
816 if (!ctx.Read(userDataType))
818 Error(
"DayZPlayer: OnInputFromServer - cannot read input type");
822 switch (userDataType)
825 GetDayZPlayerInventory().OnServerInventoryCommand(ctx);
828 Error(
"OnInputFromServer - unknown userDataType=" + userDataType);
833 void RequestSoundEventEx(
EPlayerSoundEventID id,
bool from_server_and_client =
false,
int param = 0);
859 GetDayZPlayerInventory().HandleWeaponEvents(pDt, pExitIronSights);
862 Class.CastTo(weapon, pInHands);
863 ItemOptics optic = weapon.GetAttachedOptics();
871 if (pInputs.IsHoldBreath() &&
m_MovementState.IsRaised() && (IsInIronsights() || IsInOptics()))
873 m_IsTryingHoldBreath =
true;
877 m_IsTryingHoldBreath =
false;
880 if (pInputs.IsFireModeChange())
882 GetWeaponManager().SetNextMuzzleMode();
884 if (pInputs.IsZeroingUp())
886 if (optic && (optic.IsInOptics() || optic.IsUsingWeaponIronsightsOverride()))
888 optic.StepZeroingUp();
892 weapon.StepZeroingUpAllMuzzles();
895 if (pInputs.IsZeroingDown())
897 if (optic && (optic.IsInOptics() || optic.IsUsingWeaponIronsightsOverride()))
899 optic.StepZeroingDown();
903 weapon.StepZeroingDownAllMuzzles();
907 if (!m_LiftWeapon_player && (m_CameraIronsight || !weapon.CanEnterIronsights() || m_CameraOptics))
910 HandleOptic(optic,
false, pInputs, pExitIronSights);
915 m_IsFireWeaponRaised =
false;
916 if (weapon && weapon.IsInOptics())
921 ResetWeaponRaiseProgress();
927 m_IsFireWeaponRaised =
true;
928 if (!IsWeaponRaiseCompleted())
930 m_WeaponRaiseTime += pDt;
935 CompleteWeaponRaise();
940 if (GetWeaponManager().CanFire(weapon))
942 bool autofire = weapon.GetCurrentModeAutoFire(weapon.GetCurrentMuzzle()) && weapon.IsChamberEjectable(weapon.GetCurrentMuzzle());
943 int burst = weapon.GetCurrentModeBurstSize(weapon.GetCurrentMuzzle());
944 int burst_count = weapon.GetBurstCount();
945 if (!autofire && (burst < 2 || burst_count < 1))
947 if (pInputs.IsAttackButtonDown() && GetInputInterface().
SyncedValue(
"UAWeaponMeleeAttack") == 0 && GetInputInterface().
SyncedValue(
"UAHeavyMeleeAttack") == 0)
949 GetWeaponManager().Fire(weapon);
952 else if (autofire || burst > 1)
954 #ifdef DIAG_DEVELOPER
955 int burst_option = GetWeaponManager().GetBurstOption();
956 if (burst_option == 0)
959 if (pInputs.IsAttackButton() && GetInputInterface().
SyncedValue(
"UAWeaponMeleeAttack") == 0 && GetInputInterface().
SyncedValue(
"UAHeavyMeleeAttack") == 0)
961 if (autofire || burst_count < burst)
963 GetWeaponManager().Fire(weapon);
968 weapon.ResetBurstCount();
970 #ifdef DIAG_DEVELOPER
972 else if (burst_option == 1)
974 if (burst > 1 && burst_count == burst)
976 weapon.ResetBurstCount();
978 else if (burst > 1 && burst_count < burst)
980 GetWeaponManager().Fire(weapon);
985 if (pInputs.IsAttackButton())
987 GetWeaponManager().Fire(weapon);
995 #ifdef PLATFORM_CONSOLE
996 if (
GetGame().
GetInput().LocalRelease(
"UAFire",
false) || m_ShouldReload)
998 if (!weapon.IsWaitingForActionFinish() && !IsFighting())
1000 int muzzle_index = weapon.GetCurrentMuzzle();
1002 if (weapon.IsChamberFiredOut(muzzle_index))
1004 if (weapon.CanProcessWeaponEvents())
1006 if (GetWeaponManager().CanEjectBullet(weapon))
1008 GetWeaponManager().EjectBullet();
1009 pExitIronSights =
true;
1010 m_ShouldReload =
false;
1017 m_ShouldReload =
true;
1033 bool controllerPressIn;
1034 bool controllerPressOut;
1036 if (input.SyncedPress_ID(UAZoomInOptics))
1038 weapon =
Weapon_Base.Cast(optic.GetHierarchyParent());
1039 FOVcount = optic.GetStepFOVCount();
1040 controllerPressIn = input.SyncedPress_ID(UAZoomInOpticsControllerHelper);
1042 if (weapon && m_CameraIronsight && !m_CameraOptics)
1044 SetIronsights(
false);
1045 SwitchOptics(optic,
true);
1046 optic.SetStepFOVIndex(0);
1048 else if (m_CameraOptics)
1050 if (controllerPressIn)
1052 if (!optic.StepFOVUp())
1056 optic.SetStepFOVIndex(0);
1059 if (weapon && weapon.CanEnterIronsights())
1061 SwitchOptics(optic,
false);
1062 pInputs.ResetFreeLookToggle();
1063 SetIronsights(
true);
1074 if (input.SyncedPress_ID(UAZoomOutOptics))
1076 weapon =
Weapon_Base.Cast(optic.GetHierarchyParent());
1077 FOVcount = optic.GetStepFOVCount();
1078 controllerPressOut = input.SyncedPress_ID(UAZoomOutOpticsControllerHelper);
1081 if (!optic.StepFOVDown())
1083 if (controllerPressOut)
1085 if (FOVcount > 0 && (!weapon || !weapon.CanEnterIronsights()))
1087 optic.SetStepFOVIndex(FOVcount - 1);
1091 if (weapon && weapon.CanEnterIronsights())
1093 SwitchOptics(optic,
false);
1094 pInputs.ResetFreeLookToggle();
1095 SetIronsights(
true);
1099 else if (controllerPressOut && weapon && m_CameraIronsight)
1101 SwitchOptics(optic,
true);
1104 optic.SetStepFOVIndex(FOVcount - 1);
1115 bool m_DamageHitFullbody =
false;
1116 int m_DamageHitAnimType = -1.0;
1117 float m_DamageHitDir = 0.0;
1118 float m_DamageHealth = 0.0;
1120 const float HIT_INTERVAL_MIN = 0.3;
1121 float m_HitElapsedTime = HIT_INTERVAL_MIN;
1123 bool IsInFullbodyDamageAnimation()
1125 return (m_DamageHitFullbody && m_DamageHitAnimType != -1) ||
GetCommand_Damage() !=
null;
1129 void EvaluateDamageHit(
int pCurrentCommandID)
1132 m_DamageHitAnimType = -1;
1134 if (!m_SyncedHitDataArray || m_SyncedHitDataArray.Count() == 0)
1141 SyncHitInfo greatest_hit;
1142 for (
int i = 0; i < m_SyncedHitDataArray.Count(); i++)
1144 data = m_SyncedHitDataArray[i];
1145 m_DamageHitDir = data.m_HitDir;
1149 if (IsAlive() && !IsUnconscious() && data.m_HasSource &&
GetGame().GetMission().GetHud() &&
GetGame().
GetPlayer() ==
this)
1151 m_DamageHealth = data.m_HealthDamage;
1152 if (m_DamageHealth > 0.0)
1154 float rel = m_DamageHealth / (GetMaxHealth(
"",
"Health") *
PlayerConstants.HEAVY_HIT_THRESHOLD);
1155 GetGame().GetMission().GetHud().SpawnHitDirEffect(
this,m_DamageHitDir,rel);
1162 greatest_hit = data;
1165 else if (data.m_Fullbody)
1167 greatest_hit = data;
1171 m_SyncedHitDataArray.Clear();
1172 m_DamageHealth = 0.0;
1181 m_DamageHitFullbody = greatest_hit.m_Fullbody;
1182 m_DamageHitAnimType = greatest_hit.m_AnimType;
1183 m_DamageHitDir = greatest_hit.m_HitDir;
1186 bool HandleDamageHit(
int pCurrentCommandID)
1192 if ( m_HitElapsedTime < HIT_INTERVAL_MIN )
1194 m_HitElapsedTime += m_dT;
1195 ResetDamageHitState(
false);
1201 if (m_DamageHitAnimType != -1 && m_TransportCache ==
null && !CommitedSuicide())
1204 if (m_DamageHitFullbody && (!vehCommand || vehCommand.IsGettingIn() || vehCommand.IsGettingOut()))
1207 ResetDamageHitState(
true);
1213 ResetDamageHitState(
false);
1221 void ResetDamageHitState(
bool resetTimer)
1223 m_DamageHitAnimType = -1;
1224 m_DamageHitFullbody =
false;
1228 m_HitElapsedTime = 0;
1233 bool EvaluateDeathAnimation(
int pDamageType,
EntityAI pSource,
string pAmmoType, out
int pAnimType, out
float pAnimHitDir)
1235 bool doPhxImpulse =
GetGame().ConfigGetInt(
"cfgAmmo " + pAmmoType +
" doPhxImpulse") > 0;
1242 vector targetDirection = GetDirection();
1245 targetDirection[1] = 0;
1246 toSourceDirection[1] = 0;
1248 targetDirection.Normalize();
1249 toSourceDirection.Normalize();
1251 float cosFi =
vector.Dot(targetDirection, toSourceDirection);
1252 vector cross = targetDirection * toSourceDirection;
1254 pAnimHitDir =
Math.Acos(cosFi) *
Math.RAD2DEG;
1256 pAnimHitDir = -pAnimHitDir;
1262 bool EvaluateDamageHitAnimation(
TotalDamageResult pDamageResult,
int pDamageType,
EntityAI pSource,
string pComponent,
string pAmmoType,
vector pModelPos, out
int pAnimType, out
float pAnimHitDir, out
bool pAnimHitFullbody)
1264 int invertHitDir = 0;
1267 pAnimHitFullbody =
false;
1270 switch (pDamageType)
1272 case DT_CLOSE_COMBAT:
1277 pAnimType =
GetGame().ConfigGetInt(
"cfgAmmo " + pAmmoType +
" hitAnimation");
1278 invertHitDir =
GetGame().ConfigGetInt(
"cfgAmmo " + pAmmoType +
" invertHitDir");
1279 if (!IsUnconscious() && pAnimType == 1 && !m_MeleeFightLogic.IsInBlock())
1280 pAnimHitFullbody =
true;
1284 int impactBehaviour = 0;
1286 if (!IsUnconscious() && GetHealth(
"",
"Shock") > 25)
1289 if (pComponent ==
"Torso" || pComponent ==
"Head")
1291 impactBehaviour =
GetGame().ConfigGetInt(
"cfgAmmo " + pAmmoType +
" impactBehaviour");
1292 float fireDamage = pDamageResult.GetHighestDamage(
"Health");
1293 float shockDamage = pDamageResult.GetHighestDamage(
"Shock");
1294 if ((fireDamage > 80.0 || shockDamage > 40.0) && impactBehaviour == 1)
1295 pAnimHitFullbody =
true;
1305 pAnimType =
GetGame().ConfigGetInt(
"cfgAmmo " + pAmmoType +
" hitAnimation");
1307 pAnimHitFullbody =
true;
1315 vector targetDirection = GetDirection();
1318 targetDirection[1] = 0;
1319 toSourceDirection[1] = 0;
1321 targetDirection.Normalize();
1322 toSourceDirection.Normalize();
1324 float cosFi =
vector.Dot(targetDirection, toSourceDirection);
1325 vector cross = targetDirection * toSourceDirection;
1327 pAnimHitDir =
Math.Acos(cosFi) *
Math.RAD2DEG;
1330 if (invertHitDir > 0)
1334 pAnimHitDir = -pAnimHitDir;
1342 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
1344 m_TransportHitRegistered =
false;
1349 float animHitDirDeath;
1350 if (EvaluateDeathAnimation(damageType, source, ammo, animTypeDeath, animHitDirDeath))
1352 SendDeathJuncture(animTypeDeath, animHitDirDeath);
1355 if (!m_DeathSyncSent)
1357 Man killer = source.GetHierarchyRootPlayer();
1362 m_KillerData.m_Killer = killer;
1363 m_KillerData.m_MurderWeapon = source;
1366 if (killer && killer.IsPlayer())
1369 if (dmgZone ==
"Brain")
1371 m_KilledByHeadshot =
true;
1372 if (m_KillerData.m_Killer == killer)
1373 m_KillerData.m_KillerHiTheBrain =
true;
1382 bool animHitFullbody;
1383 if (EvaluateDamageHitAnimation(damageResult, damageType, source, dmgZone, ammo, modelPos, animType, animHitDir, animHitFullbody))
1384 DayZPlayerSyncJunctures.SendDamageHitEx(
this, animType, animHitDir, animHitFullbody, damageResult, damageType, source, dmgZone, ammo, modelPos);
1387 bool skipSoundRequest =
false;
1389 skipSoundRequest = GetFallDamage().GetLandType() <
HumanCommandFall.LANDTYPE_MEDIUM;
1391 if (!skipSoundRequest)
1397 if (animHitFullbody)
1409 float m_fLastHeadingDiff = 0;
1424 m_fLastHeadingDiff = 0;
1430 if (hmv.IsGettingOut() || hmv.IsGettingIn())
1435 m_fLastHeadingDiff = 0;
1441 if (!hcu.IsWakingUp())
1443 m_fLastHeadingDiff = 0;
1451 m_fLastHeadingDiff = 0;
1457 if (actMenuValue != 0)
1466 m_fLastHeadingDiff = 0;
1474 if (hcm.IsStandingFromBack())
1476 m_fLastHeadingDiff = 0;
1506 if (hcm.IsFinisher())
1508 if (!m_AimingFinisherStarted)
1510 m_AimingModel.OnFinisherBegin(pModel.m_fCurrentAimY);
1511 m_AimingFinisherStarted =
true;
1513 m_AimingModel.ProcessStealthFilters(pDt, pModel);
1521 if (!m_RaiseStarted)
1523 m_AimingModel.OnRaiseBegin(
this);
1524 m_RaiseStarted =
true;
1526 m_AimingModel.ProcessAimFilters(pDt, pModel,
m_MovementState.m_iStanceIdx);
1531 m_RaiseStarted =
false;
1532 m_AimingFinisherStarted =
false;
1546 if (IsFBSymptomPlaying() || IsRestrained() || IsUnconscious() || IsInFBEmoteState())
1552 if (
IsRaised() && GetInputInterface().SyncedPress(
"UAGetOverControllerHelper"))
1558 if (!hibcfg.m_bJumpAllowed)
1567 if (hcm.IsChangingStance())
1574 bool CanClimb(
int climbType, SHumanCommandClimbResult climbRes)
1576 if (IsFBSymptomPlaying() || IsRestrained() || IsUnconscious() || IsInFBEmoteState())
1582 if (
IsRaised() && GetInputInterface().SyncedPress(
"UAGetOverControllerHelper"))
1588 if (!hibcfg.m_bJumpAllowed)
1594 if (
Class.CastTo(entity,climbRes.m_GrabPointParent) && entity.IsHologram())
1596 if (
Class.CastTo(entity,climbRes.m_ClimbStandPointParent) && entity.IsHologram())
1598 if (
Class.CastTo(entity,climbRes.m_ClimbOverStandPointParent) && entity.IsHologram())
1610 void OnJumpEnd(
int pLandType = 0)
1614 void StopHandEvent()
1616 GetDayZPlayerInventory().CancelHandEvent();
1619 void StopWeaponEvent()
1621 GetDayZPlayerInventory().CancelWeaponEvent();
1626 GetDayZPlayerInventory().AbortWeaponEvent();
1637 if (m_CameraIronsight || m_CameraOptics)
1644 bool bADSToggle =
false;
1645 bool exitSights =
false;
1652 if (playerPB.IsRolling())
1657 if (m_ResetADS || !hia.IsItemInHandsWeapon())
1665 ResetWeaponRaiseProgress();
1670 if (m_bADS != hic.WeaponADS())
1672 m_bADS = hic.WeaponADS();
1676 if (m_bADS && !m_CameraIronsight && !m_CameraOptics)
1679 if (!IsWeaponRaiseCompleted())
1691 if (bADSToggle && !
GetCommand_Melee2() && !GetThrowing().IsThrowingModeEnabled())
1693 if (hia.IsItemInHandsWeapon() && playerPB.GetItemInHands() && playerPB.GetItemInHands().IsWeapon() && playerPB.GetWeaponManager() && !playerPB.GetWeaponManager().IsRunning())
1696 ItemOptics optic = weapon.GetAttachedOptics();
1697 bool switchToADS =
false;
1698 bool canUseIronsights = weapon.CanEnterIronsights();
1699 bool canUseOptics = optic != NULL;
1701 if (canUseIronsights || canUseOptics)
1702 switchToADS = m_bADS;
1709 switchToADS =
false;
1713 if (IsLiftWeapon() || !
IsRaised() || GetDayZPlayerInventory().
IsProcessing() || !IsWeaponRaiseCompleted() || IsFighting())
1717 else if (switchToADS)
1720 if (m_WasIronsight && !canUseIronsights)
1722 m_WasIronsight =
false;
1724 else if (!m_WasIronsight && !canUseOptics)
1726 m_WasIronsight =
true;
1731 hic.ResetFreeLookToggle();
1732 SwitchOptics(optic,
false);
1733 SetIronsights(
true);
1735 else if (!m_WasIronsight || (!canUseIronsights && canUseOptics))
1737 SetIronsights(
false);
1738 SwitchOptics(optic,
true);
1745 if (hcw && (m_CameraOptics))
1758 if (exitSights && !IsHandheldOpticsInUse() && (m_CameraIronsight || m_CameraOptics) ||
GetCommand_Melee2())
1768 if (m_CameraIronsight || m_CameraOptics)
1777 bool camChange = hic.CameraViewChanged();
1788 if (
GetGame().GetWorld().Is3rdPersonDisabled())
1790 m_Camera3rdPerson =
false;
1794 m_Camera3rdPerson = !m_Camera3rdPerson;
1798 if (m_LiftWeapon_player && (m_CameraOptics || m_CameraIronsight))
1802 GetDayZPlayerType().SetVerticalMinimumAimLimit(DayZPlayerCameraIronsights.CONST_UD_MIN_BACK);
1804 GetDayZPlayerType().SetVerticalMinimumAimLimit(DayZPlayerCameraIronsights.CONST_UD_MIN);
1813 else if (!IsClimbingLadder() && !IsSwimming() && !IsInVehicle())
1817 hic.GetMovement(pSpeed ,pLocalDirection);
1832 float headingAngle = MiscGameplayFunctions.GetHeadingAngle(
this);
1833 float headingAngleDiffBlock =
Math.AbsFloat(m_LastHeadingAngleBlock - headingAngle);
1834 float headingAngleDiffBlock2 =
Math.AbsFloat(m_LastHeadingAngleBlock2 - headingAngle);
1835 float headingAngleDiff = 0.0;
1837 if (m_LastHeadingAngle * headingAngle < 0.0)
1839 headingAngleDiff =
Math.AbsFloat(m_LastHeadingAngle + headingAngle);
1843 headingAngleDiff =
Math.AbsFloat(m_LastHeadingAngle - headingAngle);
1846 if (headingAngleDiff > 0.2)
1848 int time =
GetGame().GetTime();
1850 float timefilterconstant = 400 - (headingAngleDiff * 100);
1852 if (headingAngleDiffBlock > 0.8 && time - m_LastBackSoundTime > timefilterconstant)
1854 float volume = headingAngleDiff / 0.5;
1864 m_SoundOffset = headingAngleDiff / 2;
1865 if (m_SoundOffset > 0.25)
1867 m_SoundOffset = 0.25;
1870 string soundSetName =
"Cloth_Body_longmove_TShirt_Soundset";
1872 string bodyClothName =
"";
1876 bodyClothName = attachment.GetAttachmentSoundType();
1879 if (bodyClothName !=
"")
1881 string path =
"CfgSoundTables CfgAttachmentSoundTables Cloth_Body_Longmove_LookupTable";
1882 int soundCount =
GetGame().ConfigGetChildrenCount(
path);
1884 for (
int i = 0; i < soundCount; i++)
1889 if (
name == bodyClothName)
1892 GetGame().ConfigGetTextArray(
path +
" " +
name +
" soundSets", stringArray);
1893 soundSetName = stringArray.Get(0);
1903 if (soundObjectBuilder != NULL)
1905 SoundObject soundObject = soundObjectBuilder.BuildSoundObject();
1907 if (soundObject != NULL)
1912 wave.SetStartOffset(m_SoundOffset);
1913 wave.SetVolumeRelative(volume);
1915 m_LastBackSoundTime =
GetGame().GetTime();
1916 m_LastHeadingAngleBlock = headingAngle;
1921 if (headingAngleDiffBlock2 > 1.5 && time - m_LastBackSoundTime2 > (timefilterconstant * 2))
1923 float volume2 = headingAngleDiff * 2;
1929 m_SoundOffset = headingAngleDiff / 1.8;
1930 if (m_SoundOffset < 0.1)
1932 m_SoundOffset = 0.1;
1934 if (m_SoundOffset > 0.3)
1936 m_SoundOffset = 0.3;
1939 string soundSetName2 =
"walkProne_noHS_asphalt_ext_Char_SoundSet";
1940 string surfaceType = GetSurfaceType();
1942 if (surfaceType !=
"")
1944 string movementSurfaceType =
"walkProne_" + surfaceType;
1946 string path2 =
"CfgSoundTables CfgStepSoundTables walkProne_noHS_Char_LookupTable";
1947 int soundCount2 =
GetGame().ConfigGetChildrenCount(path2);
1949 for (
int i2 = 0; i2 < soundCount2; i2++)
1952 GetGame().ConfigGetChildName(path2, i2, name2);
1954 if (name2 == movementSurfaceType)
1957 GetGame().ConfigGetTextArray(path2 +
" " + name2 +
" soundSets", stringArray2);
1958 soundSetName2 = stringArray2.Get(0);
1960 delete stringArray2;
1968 if (soundObjectBuilder2 != NULL)
1970 SoundObject soundObject2 = soundObjectBuilder2.BuildSoundObject();
1972 if (soundObject2 != NULL)
1977 wave2.SetStartOffset(m_SoundOffset);
1978 wave2.SetVolumeRelative(volume2);
1980 m_LastBackSoundTime2 =
GetGame().GetTime();
1981 m_LastHeadingAngleBlock2 = headingAngle;
1986 m_LastHeadingAngle = headingAngle;
1991 float m_LastHeadingAngleBlock;
1992 float m_LastHeadingAngleBlock2;
1993 float m_LastHeadingAngle;
1994 int m_LastBackSoundTime;
1995 int m_LastBackSoundTime2;
1996 float m_SoundOffset;
2027 override void CommandHandler(
float pDt,
int pCurrentCommandID,
bool pCurrentCommandFinished)
2037 EntityAI entityInHands = GetHumanInventory().GetEntityInHands();
2041 bool isWeapon = entityInHands && entityInHands.IsInherited(
Weapon);
2043 bool updateAimingMdfr =
false;
2044 if (isWeapon != m_IsWeapon)
2046 m_IsWeapon = isWeapon;
2047 updateAimingMdfr =
true;
2050 if (isRaisedNow != m_IsRaised)
2052 updateAimingMdfr =
true;
2056 if (updateAimingMdfr)
2058 if (isRaisedNow && isWeapon)
2059 GetUApi().ActivateModificator(
"aiming");
2061 GetUApi().DeactivateModificator(
"aiming");
2071 if (isWeapon && (!m_ProcessFirearmMeleeHit || !m_ContinueFirearmMelee))
2073 m_ProcessFirearmMeleeHit =
false;
2074 bool exitIronSights =
false;
2075 HandleWeapons(pDt, entityInHands, hic, exitIronSights);
2077 else if (IsHandheldOpticsInUse() && m_CameraOptics && opticInHands)
2079 bool exitOptic =
false;
2080 HandleOptic(opticInHands,
true, hic, exitOptic);
2089 OnMovementChanged();
2094 if (HandleDeath(pCurrentCommandID))
2100 if (pCurrentCommandFinished)
2104 if ((m_LastCommandBeforeUnconscious ==
DayZPlayerConstants.COMMANDID_VEHICLE) && (m_TransportCache !=
null))
2106 int crew_index = m_TransportCache.CrewMemberIndex(
this);
2107 int seat = m_TransportCache.GetSeatAnimationType(crew_index);
2109 m_TransportCache =
null;
2124 if (m_Swimming.m_bWasSwimming)
2132 if (GetHumanInventory().GetEntityInHands())
2153 if (hcv.WasGearChange())
2156 cb.SetVehicleCommand(hcv);
2167 m_SprintedTime += pDt;
2168 if (m_SprintedTime > m_SprintedTimePerStanceMin)
2170 m_SprintFull =
true;
2171 m_SprintedTimePerStanceMin =
PlayerConstants.FULL_SPRINT_DELAY_DEFAULT;
2174 m_SprintFull =
false;
2178 m_SprintedTime = 0.0;
2179 m_SprintFull =
false;
2184 if (m_Swimming.HandleSwimming(pCurrentCommandID, hcm,
m_MovementState))
2186 m_JumpClimb.CheckAndFinishJump();
2208 if (IsAlreadyInFallingCommand(pCurrentCommandID))
2210 if (IsLanded(pCurrentCommandID))
2216 fallDamageData.m_Height = m_FallYDiff -
GetPosition()[1];
2219 if (fallDamageData.m_Height < 0.5)
2222 OnLand(pCurrentCommandID, fallDamageData);
2223 npar = type.GetNoiseParamsLandLight();
2226 else if (fallDamageData.m_Height < 3.0)
2233 OnLand(pCurrentCommandID, fallDamageData);
2234 npar = type.GetNoiseParamsLandLight();
2237 else if (fallDamageData.m_Height < 5.0)
2240 OnLand(pCurrentCommandID, fallDamageData);
2241 npar = type.GetNoiseParamsLandHeavy();
2247 OnLand(pCurrentCommandID, fallDamageData);
2248 npar = type.GetNoiseParamsLandHeavy();
2254 OnPlayerRecievedHit();
2257 m_FallDamage.HandleFallDamage(fallDamageData);
2258 m_JumpClimb.CheckAndFinishJump(fallDamageData.m_LandType);
2287 hcls.m_fFwMaxDistance = 3;
2289 hcls.m_fFwMaxDistance = 1.2;
2291 SHumanCommandClimbResult ret;
2301 if (hic.IsJumpClimb())
2303 m_JumpClimb.JumpOrClimb();
2305 if (m_JumpClimb.WasSuccessful())
2322 if (amplitude > 0.1 || force)
2325 ad.SetTalking(
true);
2330 int now =
GetGame().GetTime();
2331 if (now >= m_NextVoNNoiseTime)
2333 m_NextVoNNoiseTime = now + 1000;
2335 int voiceLevel =
GetGame().GetVoiceLevel(
this);
2342 case VoiceLevelWhisper:
2343 vonpar = pt.GetNoiseParamsWhisper();
2345 case VoiceLevelTalk:
2346 vonpar = pt.GetNoiseParamsTalk();
2348 case VoiceLevelShout:
2349 vonpar = pt.GetNoiseParamsShout();
2359 ad.SetTalking(
false);
2371 m_Throwing.HandleThrowing(hic, hcw, entityInHands, pDt);
2374 if (m_MeleeFightLogic.CanFight())
2376 if (m_MeleeFightLogic.HandleFightLogic(pCurrentCommandID, hic, entityInHands,
m_MovementState, m_ContinueFirearmMelee))
2378 m_ProcessFirearmMeleeHit = isWeapon && (hic.IsMeleeWeaponAttack() || m_ProcessFirearmMeleeHit) || m_ContinueFirearmMelee;
2392 void HideClothing(
ItemOptics optic,
bool state) {}
2399 float m_TestDamageCounter = -1;
2400 float m_DebugDirectionVal = -180;
2401 bool m_DebugTypeVal =
false;
2403 int m_DebugWeaponChangeStage = 0;
2404 string m_DebugWeaponChangeItem;
2405 int m_DebugWeaponChangeShowSlot;
2408 void CommandHandlerDebug(
float pDt,
int pCurrentCommandID,
bool pCurrentCommandFinished)
2415 playerDebug.CommandHandler();
2418 if (m_DebugWeaponChangeStage == 0)
2424 if (playerDebug.IsWeaponChange(m_DebugWeaponChangeItem, hideSlot, m_DebugWeaponChangeShowSlot))
2431 m_DebugWeaponChangeStage = 1;
2434 else if (m_DebugWeaponChangeStage == 1)
2447 EntityAI item_in_hands = player.GetHumanInventory().GetEntityInHands();
2448 if (item_in_hands != NULL && player.CanDropEntity(item_in_hands) &&
GetGame().
GetPlayer().GetHumanInventory().CanRemoveEntityInHands())
2450 player.PredictiveDropEntity(item_in_hands);
2453 if (m_DebugWeaponChangeItem !=
"")
2456 dst.SetHands(
this, NULL);
2463 m_DebugWeaponChangeStage = 2;
2467 else if (m_DebugWeaponChangeStage == 2)
2470 if (w3 && w3.IsActionFinished())
2472 m_DebugWeaponChangeStage = 0;
2480 if (m_TestDamageCounter >= 0)
2482 if (m_TestDamageCounter > 3)
2484 m_DebugDirectionVal = m_DebugDirectionVal + 90;
2485 m_TestDamageCounter = 0;
2487 if (m_DebugDirectionVal > 90)
2489 m_DebugDirectionVal = -180;
2490 m_DebugTypeVal = !m_DebugTypeVal;
2507 m_TestDamageCounter += pDt;
2522 ad.SetInjured(v,
true);
2529 ad.SetExhaustion(v,
true);
2546 if (!m_LiftWeapon_player)
2549 EntityAI entityInHands = GetHumanInventory().GetEntityInHands();
2552 optics = weapon.GetAttachedOptics();
2553 else if (entityInHands)
2554 Class.CastTo(optics,entityInHands);
2556 if (m_CameraOptics && optics)
2560 else if (m_CameraIronsight && weapon)
2570 if (m_Camera3rdPerson && m_IsWeapon && m_IsRaised && hic && hic.WeaponADS())
2583 if (!m_Camera3rdPerson)
2596 Transport transport = vehicleCommand.GetTransport();
2599 return transport.Get3rdPersonCameraType();
2619 if (m_JumpClimb.m_bIsJumpInProgress)
2628 if (commandMove && commandMove.IsChangingStance() &&
m_MovementState.IsRaised())
2676 void OnMovementChanged()
2747 void OnSprintStart()
2751 GetUApi().GetInputByID(UALeanLeft).Lock();
2752 GetUApi().GetInputByID(UALeanRight).Lock();
2760 GetUApi().GetInputByID(UALeanLeft).Unlock();
2761 GetUApi().GetInputByID(UALeanRight).Unlock();
2771 int userDataTypeParam = 0;
2772 if (!ctx.Read(userDataTypeParam))
2774 Error(
"DayZPlayerImplement: cannot read input type");
2791 if (ctx.Read(target))
2797 if (ctx.Read(hitPos))
2802 int hitZoneIdx = -1;
2803 if (ctx.Read(hitZoneIdx))
2808 int finisherType = -1;
2809 if (ctx.Read(finisherType))
2826 switch (pJunctureID)
2829 if (m_DeathAnimType == -2)
2834 SyncHitInfo data =
new SyncHitInfo;
2837 m_SyncedHitDataArray.Insert(data);
2848 switch (boots.GetAttachmentSoundType())
2861 AnimUpperBodyType GetBodyAttachmentType()
2866 switch (attachment.GetAttachmentSoundType())
2869 return AnimUpperBodyType.NylonJacket;
2871 return AnimUpperBodyType.TShirt;
2873 return AnimUpperBodyType.WoolShirt;
2875 return AnimUpperBodyType.HeavyJacket;
2876 case "LeatherJacket":
2877 return AnimUpperBodyType.LeatherJacket;
2879 return AnimUpperBodyType.Coat;
2880 case "ChemlonDress":
2881 return AnimUpperBodyType.ChemlonDress;
2883 return AnimUpperBodyType.Ghillie;
2885 return AnimUpperBodyType.Chainmail;
2889 return AnimUpperBodyType.None;
2892 AnimBackType GetBackAttachmentType()
2897 switch (back.GetAttachmentSoundType())
2900 return AnimBackType.Small;
2902 return AnimBackType.Military;
2904 return AnimBackType.Outdoor;
2906 return AnimBackType.Ghillie;
2910 return AnimBackType.None;
2914 AnimRangedWeaponType GetShoulderAttachmentType()
2919 AnimRangedWeaponType shoulderAttType = AnimRangedWeaponType.None;
2920 AnimRangedWeaponType meleeAttType = AnimRangedWeaponType.None;
2922 if (shoulderAttachment)
2924 switch (shoulderAttachment.GetAttachmentSoundType())
2928 shoulderAttType = AnimRangedWeaponType.Shotgun;
2933 shoulderAttType = AnimRangedWeaponType.Rifle;
2938 if (meleeAttachment)
2940 switch (meleeAttachment.GetAttachmentSoundType())
2944 meleeAttType = AnimRangedWeaponType.Shotgun;
2949 meleeAttType = AnimRangedWeaponType.Rifle;
2955 if (shoulderAttType == AnimRangedWeaponType.Shotgun || meleeAttType == AnimRangedWeaponType.Shotgun)
2956 return AnimRangedWeaponType.Shotgun;
2958 if (shoulderAttType == AnimRangedWeaponType.Rifle || meleeAttType == AnimRangedWeaponType.Rifle)
2959 return AnimRangedWeaponType.Rifle;
2961 return AnimRangedWeaponType.None;
2964 string GetSurfaceType(SurfaceAnimationBone limbType)
2969 g_Game.SurfaceUnderObjectByBone(
this, limbType, surfaceType, liquidType);
2991 if (noisePar !=
null)
2992 GetGame().GetNoiseSystem().AddNoise(
this, noisePar, noiseMultiplier);
3000 void OnStepEvent(
string pEventType,
string pUserString,
int pUserInt)
3012 if (pUserInt % 2 == 1)
3014 surface = GetSurfaceType(SurfaceAnimationBone.LeftBackLimb);
3015 if (surface.Length() == 0)
3016 surface = GetSurfaceType(SurfaceAnimationBone.RightBackLimb);
3020 surface = GetSurfaceType(SurfaceAnimationBone.RightBackLimb);
3021 if (surface.Length() == 0)
3022 surface = GetSurfaceType(SurfaceAnimationBone.LeftBackLimb);
3025 if (surface.Length() != 0)
3026 m_LastSurfaceUnderHash = surface.Hash();
3028 soundBuilder = table.GetSoundBuilder(pUserInt, state.m_iMovement, m_LastSurfaceUnderHash, GetBootsType());
3032 string surface2 = GetSurfaceType();
3033 if (surface2.Length() != 0)
3034 m_LastSurfaceUnderHash = surface2.Hash();
3036 soundBuilder = table.GetSoundBuilder(pUserInt, state.m_iMovement, m_LastSurfaceUnderHash, GetBootsType());
3046 if (
GetGame().IsBoxColliding(
GetPosition(), orientation, edgeLength, excludedObjects, collidedObjects))
3048 for (
int i = 0; i < collidedObjects.Count(); ++i)
3050 string objectClass = collidedObjects.Get(i).GetType();
3052 if (objectClass.Contains(
"BushSoft") || objectClass.Contains(
"BushHard"))
3054 for (
int j = 0; j < type.GetVegetationSounds().
Count(); ++j)
3058 if (vegetationSound.GetAnimEventIds().Find(pUserInt) >= 0)
3061 SoundObject vegSoundObject = vegetationSound.GetSoundObjectBuilder().BuildSoundObject();
3063 if (vegSoundObject != NULL)
3065 AttenuateSoundIfNecessary(vegSoundObject);
3066 PlaySound(vegSoundObject, vegSoundObjectBuilder);
3078 SoundObject soundObject = soundBuilder.BuildSoundObject();
3079 if (soundObject != NULL)
3081 AttenuateSoundIfNecessary(soundObject);
3091 float noiseMultiplier = 0;
3095 noiseParams = type.GetNoiseParamsStand();
3097 noiseParams = type.GetNoiseParamsCrouch();
3099 noiseParams = type.GetNoiseParamsProne();
3102 Debug.Log(
string.Format(
"Wrong stance, id: %1 using backup with stand stance (id: 0)", state.m_iStanceIdx));
3103 noiseParams = type.GetNoiseParamsStand();
3108 AddNoise(noiseParams, noiseMultiplier);
3112 ProcessFeetDamageServer(pUserInt);
3117 void OnSoundEvent(
string pEventType,
string pUserString,
int pUserInt)
3119 if (pEventType ==
"Sound")
3121 ProcessSoundEvent(pEventType, pUserString, pUserInt);
3123 else if (pEventType ==
"SoundWeapon")
3125 ProcessWeaponEvent(pEventType, pUserString, pUserInt);
3127 else if (pEventType ==
"SoundAttachment")
3129 ProcessAttachmentEvent(pEventType, pUserString, pUserInt);
3131 else if (pEventType ==
"SoundVoice")
3135 int event_id = m_PlayerSoundEventHandler.ConvertAnimIDtoEventID(pUserInt);
3138 PlaySoundEvent(event_id);
3142 ProcessVoiceEvent(pEventType, pUserString, pUserInt);
3146 Debug.Log(
"OnSoundEvent: Unknown sound event \"" + pEventType +
"\"");
3150 void OnParticleEvent(
string pEventType,
string pUserString,
int pUserInt)
3156 void ProcessWeaponEvent(
string pEventType,
string pUserString,
int pUserInt)
3159 AnimSoundEvent soundEvent =
null;
3163 EntityAI entityInHands = GetHumanInventory().GetEntityInHands();
3164 if (entityInHands && entityInHands.IsInherited(
ItemBase))
3167 Class.CastTo(item, entityInHands);
3168 if (item.HasQuantity())
3169 quantity = (
float)item.GetQuantity() / (item.GetQuantityMax() - item.GetQuantityMin());
3171 soundEvent = invItemType.GetSoundEvent(pUserInt);
3174 if (soundEvent ==
null)
3177 soundEvent = type.GetSoundWeaponEvent(pUserInt);
3180 if (soundEvent !=
null)
3182 if (!
GetGame().IsDedicatedServer())
3184 SoundObjectBuilder builder = soundEvent.GetSoundBuilderEx(m_ActionSoundCategoryHash);
3187 builder.AddVariable(
"quantity", quantity);
3188 builder.AddVariable(
"interior", IsSoundInsideBuilding());
3190 SoundObject soundObject = builder.BuildSoundObject();
3191 if (soundObject != NULL)
3193 AttenuateSoundIfNecessary(soundObject);
3205 AddNoise(soundEvent.m_NoiseParams);
3210 void ProcessAttachmentEvent(
string pEventType,
string pUserString,
int pUserInt)
3216 pUserString.Split(
",", attachments);
3217 for (
int i = 0; i < attachments.Count(); i++)
3219 int attachmentHash = -1;
3220 if (attachments[i] ==
"shoulder")
3221 attachmentHash = GetShoulderAttachmentType();
3222 else if (attachments[i] ==
"body")
3223 attachmentHash = GetBodyAttachmentType();
3224 else if (attachments[i] ==
"back")
3225 attachmentHash = GetBackAttachmentType();
3227 SoundObjectBuilder soundBuilder = table.GetSoundBuilder(pUserInt, attachments[i], attachmentHash);
3229 if (soundBuilder != NULL)
3231 SoundObject soundObject = soundBuilder.BuildSoundObject();
3232 if (soundObject != NULL)
3234 AttenuateSoundIfNecessary(soundObject);
3243 if (m_ClimbingLadderType ==
"wood")
3245 soundObjectBuilder.AddVariable(
"laddertype", 1);
3249 soundObjectBuilder.AddVariable(
"laddertype", 0);
3256 soundObjectBuilder.AddVariable(
"bare", 1);
3257 soundObjectBuilder.AddVariable(
"sneakers", 0);
3258 soundObjectBuilder.AddVariable(
"boots", 0);
3262 soundObjectBuilder.AddVariable(
"bare", 0);
3263 soundObjectBuilder.AddVariable(
"sneakers", 1);
3264 soundObjectBuilder.AddVariable(
"boots", 0);
3268 soundObjectBuilder.AddVariable(
"bare", 0);
3269 soundObjectBuilder.AddVariable(
"sneakers", 0);
3270 soundObjectBuilder.AddVariable(
"boots", 1);
3274 void ProcessSoundEvent(
string pEventType,
string pUserString,
int pUserInt)
3277 DayZPlayerTypeAnimTable table = type.GetSoundTable();
3278 AnimSoundEvent soundEvent;
3281 soundEvent = table.GetSoundEvent(pUserInt);
3284 if (soundEvent != NULL)
3286 if (!
GetGame().IsDedicatedServer())
3291 SetVariablesLadderSoundObjectBuilder(objectBuilder);
3293 objectBuilder.AddEnvSoundVariables(
GetPosition());
3295 SoundObject soundObject = objectBuilder.BuildSoundObject();
3296 if (soundObject != NULL)
3298 AttenuateSoundIfNecessary(soundObject);
3305 if (soundEvent.m_NoiseParams != NULL)
3306 GetGame().GetNoiseSystem().AddNoise(
this, soundEvent.m_NoiseParams);
3313 AbstractWave ProcessVoiceEvent(
string pEventType,
string pUserString,
int pUserInt)
3315 #ifdef SERVER//none of this code needs to run on server, ifdef put here rather than before the method call to maintain mod compatibility
3327 if (mask || head_gear)
3329 string category_mask;
3330 string category_headgear;
3333 int priority_headgear;
3337 category_mask = mask.ConfigGetString(
"soundVoiceType");
3338 priority_mask = mask.ConfigGetInt(
"soundVoicePriority");
3342 category_headgear = head_gear.ConfigGetString(
"soundVoiceType");
3343 priority_headgear = head_gear.ConfigGetInt(
"soundVoicePriority");
3346 if (priority_headgear >= priority_mask && category_headgear !=
"")
3348 category = category_headgear;
3352 category = category_mask;
3367 int maleVoiceType = 0;
3368 int femaleVoiceType = 0;
3369 if (player.IsMale())
3371 maleVoiceType = player.GetVoiceType();
3375 femaleVoiceType = player.GetVoiceType();
3378 soundBuilder.AddVariable(
"male", maleVoiceType);
3379 soundBuilder.AddVariable(
"female", femaleVoiceType);
3382 SoundObject soundObject = soundBuilder.BuildSoundObject();
3383 if (soundObject != NULL)
3385 AttenuateSoundIfNecessary(soundObject);
3386 wave =
PlaySound(soundObject, soundBuilder);
3394 void ProcessFeetDamageServer(
int pUserInt);
3402 bool CheckForTakeItem(
EntityAI item)
3404 bool restrained = IsRestrained();
3405 bool unconscious = IsUnconscious();
3408 if (ib && (
PlayerBase.DEBUG_INVENTORY_ACCESS || !IsAlive() || restrained || unconscious || ib.CanBeMovedOverride()))
3413 bool CheckForDropItem(
EntityAI item)
3424 return CheckForTakeItem(item);
3431 bool CheckForRespawn(
EntityAI item)
3437 if (!IsAlive() || player.IsUnconscious())
3447 super.OnRPC(sender, rpc_type, ctx);
3449 if (rpc_type ==
ERPCs.RPC_DAYZPLAYER_DEBUGSERVERWALK)
3451 Print(
"ERPCs.RPC_DAYZPLAYER_DEBUGSERVERWALK");
3453 Param1<bool> rp =
new Param1<bool>(
false);
3464 bool IsLanded(
int pCurrentCommandID)
3472 return fall.PhysicsLanded();
3479 bool OnLand(
int pCurrentCommandID,
FallDamageData fallDamageData)
3487 fall.Land(fallDamageData.m_LandType);
3495 bool IsAlreadyInFallingCommand(
int pCurrentCommandID)
3501 void OverrideSlidePoseAngle(
float value)
3503 if (!m_MoveSettings)
3505 if (m_MoveSettings.m_fSlidingPoseAngle != value)
3507 m_MoveSettings.m_fSlidingPoseAngle = value;
3512 float GetSlidePoseAngle()
3517 void CheckAnimationOverrides()
3521 bool IsPlayerSelected()
3523 return m_PlayerSelected;
3526 bool IsRestrained();
3529 bool IsInFBEmoteState();
3531 void SetSuicide(
bool state)
3536 bool CommitedSuicide()
3562 RegisterTransportHit(transport);
3567 protected void AttenuateSoundIfNecessary(
SoundObject soundObject)
3571 soundObject.SetKind(
WaveKind.WAVEATTALWAYS);
3575 soundObject.SetKind(
WaveKind.WAVEEFFECTEX);
3579 void CheckLiftWeapon();
3580 void ProcessLiftWeapon();
3582 void SetHandheldOpticsInUse(
bool state)
3584 m_HandheldOpticsInUse = state;
3587 bool IsHandheldOpticsInUse()
3589 return m_HandheldOpticsInUse;
3592 bool IsLiftWeapon();
3602 bool CanPickupHeavyItem(notnull
EntityAI item)
3607 bool CanPickupHeavyItemSwap(notnull
EntityAI item1, notnull
EntityAI item2)
3609 return CanPickupHeavyItem(item1) && CanPickupHeavyItem(item2);
3612 #ifdef DIAG_DEVELOPER
3615 return Weapon_Base.Cast(GetHumanInventory().CreateInHands(type));
3623 protected bool m_CameraEyeZoom;
3624 ref
Timer m_ADSAutomationTimer;
3625 protected bool m_ADSTimerLaunched;
3626 protected bool m_ProcessWeaponRaiseCompleted;
3627 protected bool m_IsFireWeaponRaised;
3628 void SetReturnToOptics(
bool state);
3630 void StopADSTimer();