Safe Mode - Fix disabled laser on safety switch (#6639)

* Fix disabled laser on safety switch

* Add workaround for switching to primary weapon

* Add UGL check
This commit is contained in:
Dystopian 2019-03-12 20:26:20 +04:00 committed by PabstMirror
parent 842f9e5d3b
commit 2ff614c3a2
2 changed files with 24 additions and 0 deletions

View File

@ -60,7 +60,19 @@ if (_unit getVariable [QGVAR(actionID), -1] == -1) then {
};
if (_muzzle isEqualType "") then {
private _laserEnabled = _unit isIRLaserOn _weapon || {_unit isFlashlightOn _weapon};
_unit selectWeapon _muzzle;
if (
_laserEnabled
&& {
_muzzle == primaryWeapon _unit // prevent UGL switch
|| {"" == primaryWeapon _unit} // Arma switches to primary weapon if exists
}
) then {
{_unit action [_x, _unit]} forEach ["GunLightOn", "IRLaserOn"];
};
};
// play fire mode selector sound

View File

@ -30,8 +30,20 @@ if (_safedWeapons isEqualTo []) then {
_unit setVariable [QGVAR(actionID), -1];
};
private _laserEnabled = _unit isIRLaserOn _weapon || {_unit isFlashlightOn _weapon};
_unit selectWeapon _muzzle;
if (
_laserEnabled
&& {
_muzzle == primaryWeapon _unit // prevent UGL switch
|| {"" == primaryWeapon _unit} // Arma switches to primary weapon if exists
}
) then {
{_unit action [_x, _unit]} forEach ["GunLightOn", "IRLaserOn"];
};
if (inputAction "nextWeapon" > 0) then {
// switch to the last mode to roll over to first after the default nextWeapon action
// get weapon modes