2015-03-24 04:18:00 +00:00
|
|
|
// by esteldunedain
|
2015-01-18 20:56:12 +00:00
|
|
|
#include "script_component.hpp"
|
2018-10-27 20:13:40 +00:00
|
|
|
#include "\a3\ui_f\hpp\defineDIKCodes.inc"
|
2015-01-17 20:32:34 +00:00
|
|
|
|
2015-04-13 03:44:19 +00:00
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
|
2024-08-02 11:59:18 +00:00
|
|
|
["ACE3 Weapons", QGVAR(safeMode), LLSTRING(SafeMode), {
|
2015-03-05 07:32:26 +00:00
|
|
|
// Conditions: canInteract
|
2017-08-22 18:30:56 +00:00
|
|
|
if !([ACE_player, objNull, ["isNotEscorting", "isNotInside", "isNotSwimming"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
2024-08-02 11:59:18 +00:00
|
|
|
|
|
|
|
(weaponState ACE_player) params ["_currentWeapon", "_currentMuzzle"];
|
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
// Conditions: specific
|
2024-08-02 11:59:18 +00:00
|
|
|
if !(ACE_player call CBA_fnc_canUseWeapon && {_currentWeapon != ""} && {_currentWeapon != binocular ACE_player}) exitWith {false};
|
|
|
|
|
|
|
|
// Statement: Toggle weapon safety
|
|
|
|
[ACE_player, _currentWeapon, _currentMuzzle] call FUNC(lockSafety);
|
2015-01-18 20:01:18 +00:00
|
|
|
|
2015-03-05 07:32:26 +00:00
|
|
|
true
|
2018-10-27 20:13:40 +00:00
|
|
|
}, {false}, [DIK_GRAVE, [false, true, false]], false] call CBA_fnc_addKeybind;
|
|
|
|
|
|
|
|
["unit", {
|
2024-08-02 11:59:18 +00:00
|
|
|
(weaponState ACE_player) params ["_currentWeapon", "_currentMuzzle"];
|
|
|
|
|
|
|
|
private _weaponSafe = [ACE_player, _currentWeapon, _currentMuzzle] call FUNC(getWeaponSafety);
|
|
|
|
|
|
|
|
// Player HUD
|
|
|
|
!_weaponSafe call FUNC(setSafeModeVisual);
|
2018-10-27 20:13:40 +00:00
|
|
|
}] call CBA_fnc_addPlayerEventHandler;
|
2024-08-26 16:33:40 +00:00
|
|
|
|
|
|
|
// Variables are transferred from corpse to new body and EH above triggers on respawn, which desyncs safeties
|
|
|
|
// Therefore, clear variables and remove mouse button input blocking upon respawn
|
|
|
|
[QUOTE(ADDON), "Respawn", {
|
|
|
|
params ["_unit"];
|
|
|
|
|
|
|
|
_unit setVariable [QGVAR(safedWeapons), nil];
|
|
|
|
|
|
|
|
private _ehID = _unit getVariable QGVAR(actionID);
|
|
|
|
|
|
|
|
if (isNil "_ehID") exitWith {};
|
|
|
|
|
|
|
|
[_unit, "DefaultAction", _ehID] call EFUNC(common,removeActionEventHandler);
|
|
|
|
|
|
|
|
_unit setVariable [QGVAR(actionID), nil];
|
2024-08-28 15:03:32 +00:00
|
|
|
}] call CBA_fnc_addBISPlayerEventHandler;
|