From 7f5a8e40996d362d244be8c335940e7e51e377e8 Mon Sep 17 00:00:00 2001 From: Cyruz Date: Sat, 3 Dec 2022 19:57:16 +0000 Subject: [PATCH] Safety - Add optional flag to hide hint (#9086) * Add optional flag to hide hint * Update addons/safemode/functions/fnc_setWeaponSafety.sqf * Update addons/safemode/functions/fnc_unlockSafety.sqf Co-authored-by: PabstMirror * Update addons/safemode/functions/fnc_lockSafety.sqf Co-authored-by: PabstMirror Co-authored-by: jonpas Co-authored-by: PabstMirror --- addons/safemode/functions/fnc_lockSafety.sqf | 12 ++++++++---- addons/safemode/functions/fnc_setWeaponSafety.sqf | 6 ++++-- addons/safemode/functions/fnc_unlockSafety.sqf | 11 +++++++---- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/addons/safemode/functions/fnc_lockSafety.sqf b/addons/safemode/functions/fnc_lockSafety.sqf index 44c7208b43..dcc40a497a 100644 --- a/addons/safemode/functions/fnc_lockSafety.sqf +++ b/addons/safemode/functions/fnc_lockSafety.sqf @@ -7,6 +7,7 @@ * 0: Unit * 1: Weapon * 2: Muzzle + * 3: Show hint * * Return Value: * None @@ -17,7 +18,7 @@ * Public: No */ -params ["_unit", "_weapon", "_muzzle"]; +params ["_unit", "_weapon", "_muzzle", ["_hint", true, [true]]]; private _safedWeapons = _unit getVariable [QGVAR(safedWeapons), []]; @@ -75,6 +76,9 @@ if (_muzzle isEqualType "") then { // play fire mode selector sound [_unit, _weapon, _muzzle] call FUNC(playChangeFiremodeSound); -// show info box -private _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); -[localize LSTRING(PutOnSafety), _picture] call EFUNC(common,displayTextPicture); +// show info box unless disabled +if (_hint) then { + private _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); + [localize LSTRING(PutOnSafety), _picture] call EFUNC(common,displayTextPicture); +}; + diff --git a/addons/safemode/functions/fnc_setWeaponSafety.sqf b/addons/safemode/functions/fnc_setWeaponSafety.sqf index 54732857af..0dd2dbf55d 100644 --- a/addons/safemode/functions/fnc_setWeaponSafety.sqf +++ b/addons/safemode/functions/fnc_setWeaponSafety.sqf @@ -7,6 +7,7 @@ * 0: Unit * 1: Weapon * 2: State + * 3: Show hint (default: true) * * Return Value: * None @@ -20,7 +21,8 @@ params [ ["_unit", objNull, [objNull]], ["_weapon", "", [""]], - ["_state", true, [true]] + ["_state", true, [true]], + ["_hint", true, [true]] ]; if (_weapon == "") exitWith {}; @@ -32,5 +34,5 @@ _weapon = configName (configFile >> "CfgWeapons" >> _weapon); private _muzzle = currentMuzzle _unit; if (_state isNotEqualTo (_weapon in _safedWeapons)) then { - [_unit, _weapon, _muzzle] call FUNC(lockSafety); + [_unit, _weapon, _muzzle, _hint] call FUNC(lockSafety); }; diff --git a/addons/safemode/functions/fnc_unlockSafety.sqf b/addons/safemode/functions/fnc_unlockSafety.sqf index 3194de6f14..e6b50ab6f5 100644 --- a/addons/safemode/functions/fnc_unlockSafety.sqf +++ b/addons/safemode/functions/fnc_unlockSafety.sqf @@ -7,6 +7,7 @@ * 0: Unit * 1: Weapon * 2: Muzzle + * 3: Show hint * * Return Value: * None @@ -17,7 +18,7 @@ * Public: No */ -params ["_unit", "_weapon", "_muzzle"]; +params ["_unit", "_weapon", "_muzzle", ["_hint", true, [true]]]; private _safedWeapons = _unit getVariable [QGVAR(safedWeapons), []]; _safedWeapons deleteAt (_safedWeapons find _weapon); @@ -77,6 +78,8 @@ if (inputAction "nextWeapon" > 0) then { // player hud [true] call FUNC(setSafeModeVisual); -// show info box -private _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); -[localize LSTRING(TookOffSafety), _picture] call EFUNC(common,displayTextPicture); +// show info box unless disabled +if (_hint) then { + private _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); + [localize LSTRING(TookOffSafety), _picture] call EFUNC(common,displayTextPicture); +};