985 {
988
989 Weapon_Base weapon;
990 Class.CastTo(weapon, pInHands);
991 ItemOptics optic = weapon.GetAttachedOptics();
992
995
997
998
1001 if (wantedLift != currentLift)
1002 {
1004
1005
1007 }
1008
1011 if (wantedObstruction != currentObstruction)
1012 {
1013
1014
1015 const float outTime = 0.150;
1016 const float inTime = 0.010;
1017 const float inTimeLift = 0.100;
1018
1019 float smoothTime;
1020 if (wantedLift)
1021 {
1022 wantedObstruction = 0.0;
1023 smoothTime = inTimeLift;
1024 }
1025 else
1026 {
1027 float t = Math.Clamp(Math.AbsFloat(wantedObstruction-currentObstruction), 0, 1);
1028 smoothTime = Math.Lerp(outTime, inTime, t);
1029 }
1030
1031
1034 {
1036 }
1037
1038 #ifdef DIAG_DEVELOPER
1039 if (DiagMenu.GetValue(
DiagMenuIDs.WEAPON_DISABLE_OBSTRUCTION_INTERPOLATION))
1041 #endif
1042
1044
1045 #ifndef SERVER
1046 #ifdef DIAG_DEVELOPER
1047 PluginDiagMenuClient.GetWeaponLiftDiag().Data().SetInterpolation( inTime, inTimeLift, outTime, smoothTime,
m_fObstructionSmooth, currentObstruction, wantedObstruction );
1048 #endif
1049 #endif
1050 }
1051
1052
1053
1055 {
1057 }
1058 else
1059 {
1061 }
1062
1064 {
1066 }
1068 {
1070 {
1072 }
1073 else
1074 {
1075 weapon.StepZeroingUpAllMuzzles();
1076 }
1077 }
1079 {
1081 {
1083 }
1084 else
1085 {
1086 weapon.StepZeroingDownAllMuzzles();
1087 }
1088 }
1089
1091 {
1092 if (optic)
1093 HandleOptic(optic,
false, pInputs, pExitIronSights);
1094 }
1095
1097 {
1099 if (weapon && weapon.IsInOptics())
1100 {
1101 weapon.ExitOptics();
1102 }
1103
1105
1106 return;
1107 }
1108 else
1109 {
1112 {
1114 }
1115
1117 {
1119 }
1120 }
1121
1124 {
1125 bool autofire = weapon.GetCurrentModeAutoFire(weapon.GetCurrentMuzzle()) && weapon.IsChamberEjectable(weapon.GetCurrentMuzzle());
1126 int burst = weapon.GetCurrentModeBurstSize(weapon.GetCurrentMuzzle());
1127 int burst_count = weapon.GetBurstCount();
1128 if (!autofire && (burst < 2 || burst_count < 1))
1129 {
1130 if (pInputs.
IsAttackButtonDown() && GetInputInterface().SyncedValue(
"UAWeaponMeleeAttack") == 0 && GetInputInterface().SyncedValue(
"UAHeavyMeleeAttack") == 0)
1131 {
1133 }
1134 }
1135 else if (autofire || burst > 1)
1136 {
1137#ifdef DIAG_DEVELOPER
1139 if (burst_option == 0)
1140 {
1141#endif
1142 if (pInputs.
IsAttackButton() && GetInputInterface().SyncedValue(
"UAWeaponMeleeAttack") == 0 && GetInputInterface().SyncedValue(
"UAHeavyMeleeAttack") == 0)
1143 {
1144 if (autofire || burst_count < burst)
1145 {
1147 }
1148 }
1149 else
1150 {
1151 weapon.ResetBurstCount();
1152 }
1153#ifdef DIAG_DEVELOPER
1154 }
1155 else if (burst_option == 1)
1156 {
1157 if (burst > 1 && burst_count == burst)
1158 {
1159 weapon.ResetBurstCount();
1160 }
1161 else if (burst > 1 && burst_count < burst)
1162 {
1164 }
1165 else
1166 {
1167
1169 {
1171 }
1172 }
1173 }
1174#endif
1175 }
1176 }
1177
1178 #ifdef PLATFORM_CONSOLE
1180 {
1181 if (!weapon.IsWaitingForActionFinish() && !
IsFighting())
1182 {
1183 int muzzle_index = weapon.GetCurrentMuzzle();
1184
1185 if (weapon.IsChamberFiredOut(muzzle_index))
1186 {
1187 if (weapon.CanProcessWeaponEvents())
1188 {
1190 {
1192 pExitIronSights = true;
1194 }
1195 }
1196 }
1197 }
1198 else
1199 {
1201 }
1202 }
1203 #endif
1204 }
StarlightOptic ItemOptics
void ResetWeaponRaiseProgress()
WeaponManager GetWeaponManager()
bool IsWeaponRaiseCompleted()
void CompleteWeaponRaise()
bool m_IsFireWeaponRaised
float m_fObstructionSmooth
ref HumanMovementState m_MovementState
time step for gradual update of dead screen visibilibty up to full visbility [s]
bool m_IsTryingHoldBreath
DayZPlayerInventory GetDayZPlayerInventory()
float m_ObstructWeapon_player
void HandleOptic(notnull ItemOptics optic, bool inHands, HumanInputController pInputs, out bool pExitOptics)
float m_fObstructionSmoothVelocity[1]
proto native void LiftWeapon(bool pState)
command for lifting weapon near obstacles (works only when weapon is raised)
proto native void ObstructWeapon(float pState01)
command for obstruction weapon near obstacles
proto native float GetWeaponObstruction()
return obstruction value
proto native bool IsWeaponLifted()
return if lifting weapon is active
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
void Fire(Weapon_Base wpn)
bool EjectBullet(ActionBase control_action=NULL)
proto native CGame GetGame()
void HumanCommandWeapons()