1144 {
1145 UAInterface input = GetInputInterface();
1146 if (!input)
1147 {
1148 return;
1149 }
1150
1151 Weapon_Base weapon;
1152 int FOVcount;
1153 bool controllerPressIn;
1154 bool controllerPressOut;
1155
1157 {
1158 weapon = Weapon_Base.Cast(optic.GetHierarchyParent());
1159 FOVcount = optic.GetStepFOVCount();
1160 controllerPressIn = input.
SyncedPress_ID(UAZoomInOpticsControllerHelper);
1161
1163 {
1166 optic.SetStepFOVIndex(0);
1167 }
1169 {
1170 if (controllerPressIn)
1171 {
1172 if (!optic.StepFOVUp())
1173 {
1174 if (FOVcount > 0)
1175 {
1176 optic.SetStepFOVIndex(0);
1177 }
1178
1179 if (weapon && weapon.CanEnterIronsights())
1180 {
1183 }
1184 }
1185 }
1186 else
1187 {
1188 optic.StepFOVUp();
1189 }
1190 }
1191 }
1192
1194 {
1195 weapon = Weapon_Base.Cast(optic.GetHierarchyParent());
1196 FOVcount = optic.GetStepFOVCount();
1197 controllerPressOut = input.
SyncedPress_ID(UAZoomOutOpticsControllerHelper);
1199 {
1200 if (!optic.StepFOVDown())
1201 {
1202 if (controllerPressOut)
1203 {
1204 if (FOVcount > 0 && (!weapon || !weapon.CanEnterIronsights()))
1205 {
1206 optic.SetStepFOVIndex(FOVcount - 1);
1207 }
1208 }
1209
1210 if (weapon && weapon.CanEnterIronsights())
1211 {
1214 }
1215 }
1216 }
1218 {
1220 if (FOVcount > 0)
1221 {
1222 optic.SetStepFOVIndex(FOVcount - 1);
1223 }
1224 }
1225 }
1226 }
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)