1024 {
1027
1028 Weapon_Base weapon;
1029 Class.CastTo(weapon, pInHands);
1030 ItemOptics optic = weapon.GetAttachedOptics();
1031
1034
1036
1037
1040 if (wantedLift != currentLift)
1041 {
1043
1044
1046 }
1047
1050 if (wantedObstruction != currentObstruction)
1051 {
1052
1053
1054 const float outTime = 0.150;
1055 const float inTime = 0.010;
1056 const float inTimeLift = 0.100;
1057
1058 float smoothTime;
1059 if (wantedLift)
1060 {
1061 wantedObstruction = 0.0;
1062 smoothTime = inTimeLift;
1063 }
1064 else
1065 {
1066 float t = Math.Clamp(Math.AbsFloat(wantedObstruction-currentObstruction), 0, 1);
1067 smoothTime = Math.Lerp(outTime, inTime, t);
1068 }
1069
1070
1073 {
1075 }
1076
1077 #ifdef DIAG_DEVELOPER
1078 if (DiagMenu.GetValue(
DiagMenuIDs.WEAPON_DISABLE_OBSTRUCTION_INTERPOLATION))
1080 #endif
1081
1083
1084 #ifndef SERVER
1085 #ifdef DIAG_DEVELOPER
1086 PluginDiagMenuClient.GetWeaponLiftDiag().Data().SetInterpolation( inTime, inTimeLift, outTime, smoothTime,
m_fObstructionSmooth, currentObstruction, wantedObstruction );
1087 #endif
1088 #endif
1089 }
1090
1091
1092
1094 {
1096 }
1097 else
1098 {
1100 }
1101
1103 {
1105 }
1107 {
1109 {
1111 }
1112 else
1113 {
1114 weapon.StepZeroingUpAllMuzzles();
1115 }
1116 }
1118 {
1120 {
1122 }
1123 else
1124 {
1125 weapon.StepZeroingDownAllMuzzles();
1126 }
1127 }
1128
1130 {
1131 if (optic)
1132 HandleOptic(optic,
false, pInputs, pExitIronSights);
1133 }
1134
1136 {
1138 if (weapon && weapon.IsInOptics())
1139 {
1140 weapon.ExitOptics();
1141 }
1142
1144
1145 return;
1146 }
1147 else
1148 {
1151 {
1153 }
1154
1156 {
1158 }
1159 }
1160
1163 {
1164 bool autofire = weapon.GetCurrentModeAutoFire(weapon.GetCurrentMuzzle()) && weapon.IsChamberEjectable(weapon.GetCurrentMuzzle());
1165 int burst = weapon.GetCurrentModeBurstSize(weapon.GetCurrentMuzzle());
1166 int burst_count = weapon.GetBurstCount();
1167 if (!autofire && (burst < 2 || burst_count < 1))
1168 {
1169 if (pInputs.
IsAttackButtonDown() && GetInputInterface().SyncedValue(
"UAWeaponMeleeAttack") == 0 && GetInputInterface().SyncedValue(
"UAHeavyMeleeAttack") == 0)
1170 {
1172 }
1173 }
1174 else if (autofire || burst > 1)
1175 {
1176#ifdef DIAG_DEVELOPER
1178 if (burst_option == 0)
1179 {
1180#endif
1181 if (pInputs.
IsAttackButton() && GetInputInterface().SyncedValue(
"UAWeaponMeleeAttack") == 0 && GetInputInterface().SyncedValue(
"UAHeavyMeleeAttack") == 0)
1182 {
1183 if (autofire || burst_count < burst)
1184 {
1186 }
1187 }
1188 else
1189 {
1190 weapon.ResetBurstCount();
1191 }
1192#ifdef DIAG_DEVELOPER
1193 }
1194 else if (burst_option == 1)
1195 {
1196 if (burst > 1 && burst_count == burst)
1197 {
1198 weapon.ResetBurstCount();
1199 }
1200 else if (burst > 1 && burst_count < burst)
1201 {
1203 }
1204 else
1205 {
1206
1208 {
1210 }
1211 }
1212 }
1213#endif
1214 }
1215 }
1216
1217 #ifdef PLATFORM_CONSOLE
1219 {
1220 if (!weapon.IsWaitingForActionFinish() && !
IsFighting())
1221 {
1222 int muzzle_index = weapon.GetCurrentMuzzle();
1223
1224 if (weapon.IsChamberFiredOut(muzzle_index))
1225 {
1226 if (weapon.CanProcessWeaponEvents())
1227 {
1229 {
1231 pExitIronSights = true;
1233 }
1234 }
1235 }
1236 }
1237 else
1238 {
1240 }
1241 }
1242 #endif
1243 }
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()