DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ HandleWeapons()

void DayZPlayer::HandleWeapons ( float pDt,
Entity pInHands,
HumanInputController pInputs,
out bool pExitIronSights )
inlineprotected

HandleWeapons

fire

См. определение в файле DayZPlayerImplement.c строка 976

977 {
978 HumanCommandWeapons hcw = GetCommandModifier_Weapons();
979 GetDayZPlayerInventory().HandleWeaponEvents(pDt, pExitIronSights);
980
981 Weapon_Base weapon;
982 Class.CastTo(weapon, pInHands);
983 ItemOptics optic = weapon.GetAttachedOptics();
984
987
988 GetMovementState(m_MovementState);
989
990 // hold breath
991 if (pInputs.IsHoldBreath() && m_MovementState.IsRaised() && (IsInIronsights() || IsInOptics()))
992 {
994 }
995 else
996 {
997 m_IsTryingHoldBreath = false;
998 }
999
1000 if (pInputs.IsFireModeChange())
1001 {
1003 }
1004 if (pInputs.IsZeroingUp())
1005 {
1006 if (optic && (optic.IsInOptics() || optic.IsUsingWeaponIronsightsOverride()))
1007 {
1008 optic.StepZeroingUp();
1009 }
1010 else
1011 {
1012 weapon.StepZeroingUpAllMuzzles();
1013 }
1014 }
1015 if (pInputs.IsZeroingDown())
1016 {
1017 if (optic && (optic.IsInOptics() || optic.IsUsingWeaponIronsightsOverride()))
1018 {
1019 optic.StepZeroingDown();
1020 }
1021 else
1022 {
1023 weapon.StepZeroingDownAllMuzzles();
1024 }
1025 }
1026
1027 if (!m_LiftWeapon_player && (m_CameraIronsight || !weapon.CanEnterIronsights() || m_CameraOptics/*m_ForceHandleOptics*/)) // HACK straight to optics, if ironsights not allowed
1028 {
1029 if (optic)
1030 HandleOptic(optic, false, pInputs, pExitIronSights);
1031 }
1032
1033 if (!m_MovementState.IsRaised())
1034 {
1035 m_IsFireWeaponRaised = false; //legacy reasons
1036 if (weapon && weapon.IsInOptics())
1037 {
1038 weapon.ExitOptics();
1039 }
1040
1042
1043 return; // if not raised => return
1044 }
1045 else
1046 {
1047 m_IsFireWeaponRaised = true; //legacy reasons
1049 {
1050 m_WeaponRaiseTime += pDt;
1051 }
1052
1053 if (m_WeaponRaiseTime >= PlayerConstants.WEAPON_RAISE_BLEND_DELAY)
1054 {
1056 }
1057 }
1058
1060 if (GetWeaponManager().CanFire(weapon))
1061 {
1062 bool autofire = weapon.GetCurrentModeAutoFire(weapon.GetCurrentMuzzle()) && weapon.IsChamberEjectable(weapon.GetCurrentMuzzle());
1063 int burst = weapon.GetCurrentModeBurstSize(weapon.GetCurrentMuzzle());
1064 int burst_count = weapon.GetBurstCount();
1065 if (!autofire && (burst < 2 || burst_count < 1))
1066 {
1067 if (pInputs.IsAttackButtonDown() && GetInputInterface().SyncedValue("UAWeaponMeleeAttack") == 0 && GetInputInterface().SyncedValue("UAHeavyMeleeAttack") == 0)
1068 {
1069 GetWeaponManager().Fire(weapon);
1070 }
1071 }
1072 else if (autofire || burst > 1)
1073 {
1074#ifdef DIAG_DEVELOPER
1075 int burst_option = GetWeaponManager().GetBurstOption();
1076 if (burst_option == 0)
1077 {
1078#endif
1079 if (pInputs.IsAttackButton() && GetInputInterface().SyncedValue("UAWeaponMeleeAttack") == 0 && GetInputInterface().SyncedValue("UAHeavyMeleeAttack") == 0)
1080 {
1081 if (autofire || burst_count < burst)
1082 {
1083 GetWeaponManager().Fire(weapon);
1084 }
1085 }
1086 else
1087 {
1088 weapon.ResetBurstCount();
1089 }
1090#ifdef DIAG_DEVELOPER
1091 }
1092 else if (burst_option == 1)
1093 {
1094 if (burst > 1 && burst_count == burst)
1095 {
1096 weapon.ResetBurstCount();
1097 }
1098 else if (burst > 1 && burst_count < burst)
1099 {
1100 GetWeaponManager().Fire(weapon);
1101 }
1102 else
1103 {
1104 //Autofire
1105 if (pInputs.IsAttackButton())
1106 {
1107 GetWeaponManager().Fire(weapon);
1108 }
1109 }
1110 }
1111#endif
1112 }
1113 }
1114
1115 #ifdef PLATFORM_CONSOLE
1116 if (GetGame().GetInput().LocalRelease("UAFire", false) || m_ShouldReload)
1117 {
1118 if (!weapon.IsWaitingForActionFinish() && !IsFighting())
1119 {
1120 int muzzle_index = weapon.GetCurrentMuzzle();
1121
1122 if (weapon.IsChamberFiredOut(muzzle_index))
1123 {
1124 if (weapon.CanProcessWeaponEvents())
1125 {
1126 if (GetWeaponManager().CanEjectBullet(weapon))
1127 {
1129 pExitIronSights = true;
1130 m_ShouldReload = false;
1131 }
1132 }
1133 }
1134 }
1135 else
1136 {
1137 m_ShouldReload = true;
1138 }
1139 }
1140 #endif
1141 }
void ProcessLiftWeapon()
void ResetWeaponRaiseProgress()
Определения DayZPlayerImplement.c:888
WeaponManager GetWeaponManager()
Определения DayZPlayerImplement.c:970
float m_WeaponRaiseTime
Определения DayZPlayerImplement.c:136
bool IsWeaponRaiseCompleted()
Определения DayZPlayerImplement.c:894
void CompleteWeaponRaise()
Определения DayZPlayerImplement.c:879
bool m_CameraIronsight
Определения DayZPlayerImplement.c:139
bool m_IsFireWeaponRaised
Определения DayZPlayerImplement.c:3844
bool IsInIronsights()
Определения DayZPlayerImplement.c:304
bool m_CameraOptics
Определения DayZPlayerImplement.c:140
bool IsFighting()
ref HumanMovementState m_MovementState
time step for gradual update of dead screen visibilibty up to full visbility [s]
Определения DayZPlayerImplement.c:116
bool IsInOptics()
Определения DayZPlayerImplement.c:309
bool m_IsTryingHoldBreath
Определения DayZPlayerImplement.c:144
bool m_LiftWeapon_player
Определения DayZPlayerImplement.c:158
DayZPlayerInventory GetDayZPlayerInventory()
Определения DayZPlayerImplement.c:899
void CheckLiftWeapon()
void HandleOptic(notnull ItemOptics optic, bool inHands, HumanInputController pInputs, out bool pExitOptics)
Определения DayZPlayerImplement.c:1143
bool m_ShouldReload
Определения DayZPlayerImplement.c:132
proto native bool IsZeroingDown()
zeroing down
proto native bool IsAttackButton()
returns true if 'UAFire' button is pressed (== true for multiple ticks). Synced.
proto native bool IsHoldBreath()
holding breath
proto native bool IsFireModeChange()
fire mode has changed
proto native bool IsZeroingUp()
zeroing up
proto native bool IsAttackButtonDown()
returns true if 'UAFire' button has just been pressed (== true for 1 tick only). Synced.
proto native bool StepZeroingUp()
sets zeroing to next defined (respective to current) value in zeroing config array
proto native bool IsInOptics()
is weapon in optics mode or not
proto native bool IsUsingWeaponIronsightsOverride()
is optics using ironsights override settings or not
proto native bool StepZeroingDown()
sets zeroing to previous (respective to current) defined value in zeroing config array
bool SetNextMuzzleMode()
Определения WeaponManager.c:479
void Fire(Weapon_Base wpn)
Определения WeaponManager.c:484
bool EjectBullet(ActionBase control_action=NULL)
Определения WeaponManager.c:442
proto native CGame GetGame()
void HumanCommandWeapons()
Определения human.c:1113

Перекрестные ссылки Class::CastTo(), CheckLiftWeapon(), CompleteWeaponRaise(), GetDayZPlayerInventory(), GetGame(), GetWeaponManager(), HandleOptic(), HumanInputController::IsAttackButton(), HumanInputController::IsAttackButtonDown(), IsFighting(), HumanInputController::IsFireModeChange(), HumanInputController::IsHoldBreath(), IsInIronsights(), IsInOptics(), ItemOptics::IsInOptics(), ItemOptics::IsUsingWeaponIronsightsOverride(), IsWeaponRaiseCompleted(), HumanInputController::IsZeroingDown(), HumanInputController::IsZeroingUp(), m_CameraIronsight, m_CameraOptics, m_IsFireWeaponRaised, m_IsTryingHoldBreath, m_LiftWeapon_player, m_MovementState, m_ShouldReload, m_WeaponRaiseTime, ProcessLiftWeapon(), ResetWeaponRaiseProgress(), ItemOptics::StepZeroingDown(), ItemOptics::StepZeroingUp() и PlayerConstants::WEAPON_RAISE_BLEND_DELAY.

Используется в CommandHandler().