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 <pabstmirror@gmail.com>

* Update addons/safemode/functions/fnc_lockSafety.sqf

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

Co-authored-by: jonpas <jonpas33@gmail.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
Cyruz 2022-12-03 19:57:16 +00:00 committed by GitHub
parent 5693edc96d
commit 7f5a8e4099
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 10 deletions

View File

@ -7,6 +7,7 @@
* 0: Unit <OBJECT>
* 1: Weapon <STRING>
* 2: Muzzle <STRING>
* 3: Show hint <BOOL>
*
* 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);
};

View File

@ -7,6 +7,7 @@
* 0: Unit <OBJECT>
* 1: Weapon <STRING>
* 2: State <BOOL>
* 3: Show hint <BOOL> (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);
};

View File

@ -7,6 +7,7 @@
* 0: Unit <OBJECT>
* 1: Weapon <STRING>
* 2: Muzzle <STRING>
* 3: Show hint <BOOL>
*
* 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);
};