2016-05-03 08:21:21 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
ADDON = false;
|
|
|
|
|
2016-11-23 19:35:25 +00:00
|
|
|
PREP_RECOMPILE_START;
|
2016-05-03 08:21:21 +00:00
|
|
|
#include "XEH_PREP.hpp"
|
2016-11-23 19:35:25 +00:00
|
|
|
PREP_RECOMPILE_END;
|
2016-05-03 08:21:21 +00:00
|
|
|
|
2020-06-19 15:35:19 +00:00
|
|
|
#include "initSettings.sqf"
|
|
|
|
|
2016-06-12 11:51:23 +00:00
|
|
|
// restore gunbag info after respawn
|
|
|
|
["CAManBase", "respawn", {
|
|
|
|
[{
|
|
|
|
params ["_unit", "_corpse"];
|
|
|
|
|
|
|
|
private _newBackpack = backpackContainer _unit;
|
|
|
|
private _oldBackpack = backpackContainer _corpse;
|
|
|
|
|
2021-02-27 17:05:05 +00:00
|
|
|
if (typeOf _newBackpack isNotEqualTo typeOf _oldBackpack) exitWith {};
|
2016-06-12 11:51:23 +00:00
|
|
|
|
|
|
|
private _state = _oldBackpack getVariable [QGVAR(gunbagWeapon), []];
|
|
|
|
|
2021-02-27 17:05:05 +00:00
|
|
|
if (_state isNotEqualTo []) then {
|
2016-06-12 11:51:23 +00:00
|
|
|
_newBackpack setVariable [QGVAR(gunbagWeapon), _state, true];
|
|
|
|
};
|
|
|
|
}, _this] call CBA_fnc_execNextFrame;
|
|
|
|
}] call CBA_fnc_addClassEventHandler;
|
|
|
|
|
2018-04-12 15:44:23 +00:00
|
|
|
[QEGVAR(arsenal,displayOpened), {
|
|
|
|
|
|
|
|
private _center = EGVAR(arsenal,center);
|
|
|
|
|
|
|
|
if (_center call FUNC(hasGunBag)) then {
|
|
|
|
GVAR(arsenalCache) = (backpackContainer _center) getVariable [QGVAR(gunbagWeapon), []];
|
|
|
|
};
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
|
|
|
[QEGVAR(arsenal,displayClosed), {
|
|
|
|
|
2020-02-11 22:42:34 +00:00
|
|
|
if (!isNil QGVAR(arsenalCache)) then {
|
2018-04-12 15:44:23 +00:00
|
|
|
(backpackContainer EGVAR(arsenal,center)) setVariable [QGVAR(gunbagWeapon),GVAR(arsenalCache), true];
|
|
|
|
};
|
|
|
|
|
|
|
|
GVAR(arsenalCache) = nil;
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
2022-08-25 16:56:54 +00:00
|
|
|
["CBA_loadoutSet", {
|
|
|
|
params ["_unit", "_loadout", "_extendedInfo"];
|
|
|
|
private _gunbagWeapon = _extendedInfo getOrDefault [QGVAR(gunbagWeapon), []];
|
|
|
|
if (_gunbagWeapon isNotEqualTo []) then {
|
|
|
|
(backpackContainer _unit) setVariable [QGVAR(gunbagWeapon), _gunbagWeapon, true];
|
2023-07-09 21:13:43 +00:00
|
|
|
|
|
|
|
// Prevent the arsenal closed event from overwriting new info
|
|
|
|
if (!isNil QGVAR(arsenalCache)) then {
|
|
|
|
GVAR(arsenalCache) = _gunbagWeapon;
|
|
|
|
};
|
2022-08-25 16:56:54 +00:00
|
|
|
};
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
|
|
|
["CBA_loadoutGet", {
|
|
|
|
params ["_unit", "_loadout", "_extendedInfo"];
|
|
|
|
private _gunbagWeapon = (backpackContainer _unit) getVariable [QGVAR(gunbagWeapon), []];
|
|
|
|
if (_gunbagWeapon isNotEqualTo []) then {
|
|
|
|
_extendedInfo set [QGVAR(gunbagWeapon), _gunbagWeapon];
|
|
|
|
};
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
2016-05-03 08:21:21 +00:00
|
|
|
ADDON = true;
|