1010 {
1013
1014 Weapon_Base weapon;
1015 Class.CastTo(weapon, pInHands);
1016 ItemOptics optic = weapon.GetAttachedOptics();
1017
1020
1022
1023
1026 if (wantedLift != currentLift)
1027 {
1029
1030
1032 }
1033
1036 if (wantedObstruction != currentObstruction)
1037 {
1038
1039
1040 const float outTime = 0.150;
1041 const float inTime = 0.010;
1042 const float inTimeLift = 0.100;
1043
1044 float smoothTime;
1045 if (wantedLift)
1046 {
1047 wantedObstruction = 0.0;
1048 smoothTime = inTimeLift;
1049 }
1050 else
1051 {
1052 float t = Math.Clamp(Math.AbsFloat(wantedObstruction-currentObstruction), 0, 1);
1053 smoothTime = Math.Lerp(outTime, inTime, t);
1054 }
1055
1056
1059 {
1061 }
1062
1063 #ifdef DIAG_DEVELOPER
1064 if (DiagMenu.GetValue(
DiagMenuIDs.WEAPON_DISABLE_OBSTRUCTION_INTERPOLATION))
1066 #endif
1067
1069
1070 #ifndef SERVER
1071 #ifdef DIAG_DEVELOPER
1072 PluginDiagMenuClient.GetWeaponLiftDiag().Data().SetInterpolation( inTime, inTimeLift, outTime, smoothTime,
m_fObstructionSmooth, currentObstruction, wantedObstruction );
1073 #endif
1074 #endif
1075 }
1076
1077
1078
1080 {
1082 }
1083 else
1084 {
1086 }
1087
1089 {
1091 }
1093 {
1095 {
1097 }
1098 else
1099 {
1100 weapon.StepZeroingUpAllMuzzles();
1101 }
1102 }
1104 {
1106 {
1108 }
1109 else
1110 {
1111 weapon.StepZeroingDownAllMuzzles();
1112 }
1113 }
1114
1116 {
1117 if (optic)
1118 HandleOptic(optic,
false, pInputs, pExitIronSights);
1119 }
1120
1122 {
1124 if (weapon && weapon.IsInOptics())
1125 {
1126 weapon.ExitOptics();
1127 }
1128
1130
1131 return;
1132 }
1133 else
1134 {
1137 {
1139 }
1140
1142 {
1144 }
1145 }
1146
1149 {
1150 bool autofire = weapon.GetCurrentModeAutoFire(weapon.GetCurrentMuzzle()) && weapon.IsChamberEjectable(weapon.GetCurrentMuzzle());
1151 int burst = weapon.GetCurrentModeBurstSize(weapon.GetCurrentMuzzle());
1152 int burst_count = weapon.GetBurstCount();
1153 if (!autofire && (burst < 2 || burst_count < 1))
1154 {
1155 if (pInputs.
IsAttackButtonDown() && GetInputInterface().SyncedValue(
"UAWeaponMeleeAttack") == 0 && GetInputInterface().SyncedValue(
"UAHeavyMeleeAttack") == 0)
1156 {
1158 }
1159 }
1160 else if (autofire || burst > 1)
1161 {
1162#ifdef DIAG_DEVELOPER
1164 if (burst_option == 0)
1165 {
1166#endif
1167 if (pInputs.
IsAttackButton() && GetInputInterface().SyncedValue(
"UAWeaponMeleeAttack") == 0 && GetInputInterface().SyncedValue(
"UAHeavyMeleeAttack") == 0)
1168 {
1169 if (autofire || burst_count < burst)
1170 {
1172 }
1173 }
1174 else
1175 {
1176 weapon.ResetBurstCount();
1177 }
1178#ifdef DIAG_DEVELOPER
1179 }
1180 else if (burst_option == 1)
1181 {
1182 if (burst > 1 && burst_count == burst)
1183 {
1184 weapon.ResetBurstCount();
1185 }
1186 else if (burst > 1 && burst_count < burst)
1187 {
1189 }
1190 else
1191 {
1192
1194 {
1196 }
1197 }
1198 }
1199#endif
1200 }
1201 }
1202
1203 #ifdef PLATFORM_CONSOLE
1205 {
1206 if (!weapon.IsWaitingForActionFinish() && !
IsFighting())
1207 {
1208 int muzzle_index = weapon.GetCurrentMuzzle();
1209
1210 if (weapon.IsChamberFiredOut(muzzle_index))
1211 {
1212 if (weapon.CanProcessWeaponEvents())
1213 {
1215 {
1217 pExitIronSights = true;
1219 }
1220 }
1221 }
1222 }
1223 else
1224 {
1226 }
1227 }
1228 #endif
1229 }
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)
void HumanCommandWeapons()