Skip to content

Commit

Permalink
Safe Mode - Fix disabled laser on safety switch (#6639)
Browse files Browse the repository at this point in the history
* Fix disabled laser on safety switch

* Add workaround for switching to primary weapon

* Add UGL check
  • Loading branch information
Dystopian authored and PabstMirror committed Mar 12, 2019
1 parent 842f9e5 commit 2ff614c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions addons/safemode/functions/fnc_lockSafety.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions addons/safemode/functions/fnc_unlockSafety.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2ff614c

Please sign in to comment.