2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2019-10-08 01:19:04 +00:00
|
|
|
/*
|
|
|
|
* Author: Brostrom.A
|
|
|
|
* Safe or unsafe the given weapon based on weapon state; locked or unlocked.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Weapon <STRING>
|
|
|
|
* 2: State <BOOL>
|
2022-12-03 19:57:16 +00:00
|
|
|
* 3: Show hint <BOOL> (default: true)
|
2019-10-08 01:19:04 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [ACE_player, currentWeapon ACE_player, true] call ace_safemode_fnc_setWeaponSafety
|
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
|
|
|
params [
|
|
|
|
["_unit", objNull, [objNull]],
|
|
|
|
["_weapon", "", [""]],
|
2022-12-03 19:57:16 +00:00
|
|
|
["_state", true, [true]],
|
|
|
|
["_hint", true, [true]]
|
2019-10-08 01:19:04 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
if (_weapon == "") exitWith {};
|
|
|
|
|
|
|
|
private _safedWeapons = _unit getVariable [QGVAR(safedWeapons), []];
|
|
|
|
|
|
|
|
_weapon = configName (configFile >> "CfgWeapons" >> _weapon);
|
|
|
|
|
|
|
|
private _muzzle = currentMuzzle _unit;
|
|
|
|
|
2021-02-27 17:05:05 +00:00
|
|
|
if (_state isNotEqualTo (_weapon in _safedWeapons)) then {
|
2022-12-03 19:57:16 +00:00
|
|
|
[_unit, _weapon, _muzzle, _hint] call FUNC(lockSafety);
|
2019-10-08 01:19:04 +00:00
|
|
|
};
|