1246 {
1247 UAInterface input = GetInputInterface();
1248 if (!input)
1249 {
1250 return;
1251 }
1252
1253 Weapon_Base weapon;
1254 int FOVcount;
1255 bool controllerPressIn;
1256 bool controllerPressOut;
1257
1259 {
1260 weapon = Weapon_Base.Cast(optic.GetHierarchyParent());
1261 FOVcount = optic.GetStepFOVCount();
1262 controllerPressIn = input.
SyncedPress_ID(UAZoomInOpticsControllerHelper);
1263
1265 {
1268 optic.SetStepFOVIndex(0);
1269 }
1271 {
1272 if (controllerPressIn)
1273 {
1274 if (!optic.StepFOVUp())
1275 {
1276 if (FOVcount > 0)
1277 {
1278 optic.SetStepFOVIndex(0);
1279 }
1280
1281 if (weapon && weapon.CanEnterIronsights())
1282 {
1285 }
1286 }
1287 }
1288 else
1289 {
1290 optic.StepFOVUp();
1291 }
1292 }
1293 }
1294
1296 {
1297 weapon = Weapon_Base.Cast(optic.GetHierarchyParent());
1298 FOVcount = optic.GetStepFOVCount();
1299 controllerPressOut = input.
SyncedPress_ID(UAZoomOutOpticsControllerHelper);
1301 {
1302 if (!optic.StepFOVDown())
1303 {
1304 if (controllerPressOut)
1305 {
1306 if (FOVcount > 0 && (!weapon || !weapon.CanEnterIronsights()))
1307 {
1308 optic.SetStepFOVIndex(FOVcount - 1);
1309 }
1310 }
1311
1312 if (weapon && weapon.CanEnterIronsights())
1313 {
1316 }
1317 }
1318 }
1320 {
1322 if (FOVcount > 0)
1323 {
1324 optic.SetStepFOVIndex(FOVcount - 1);
1325 }
1326 }
1327 }
1328 }
void SetIronsights(bool value)
void SwitchOptics(ItemOptics optic, bool state)
proto native bool SyncedPress_ID(int action, bool check_focus=true)
Returns true just in frame, when action was invoked (button was pressed)