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
|
|
|
|
2023-12-07 03:20:47 +00:00
|
|
|
#include "initSettings.inc.sqf"
|
2020-06-19 15:35:19 +00:00
|
|
|
|
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;
|
|
|
|
|
2024-02-11 23:25:12 +00:00
|
|
|
[QEGVAR(arsenal,loadoutVerified), {
|
2024-02-13 19:22:27 +00:00
|
|
|
params ["_loadout", "_extendedInfo", "", "", "_missingExtendedInfo"];
|
2024-02-11 23:25:12 +00:00
|
|
|
private _gunbagInfo = _extendedInfo getOrDefault [QGVAR(gunbagWeapon), []];
|
|
|
|
if (_gunbagInfo isEqualTo []) exitWith {};
|
|
|
|
|
|
|
|
private _weapon = (_gunbagInfo select 0) call EFUNC(arsenal,baseWeapon);
|
|
|
|
if !(_weapon in EGVAR(arsenal,virtualItemsFlat)) exitWith {
|
2024-02-13 19:22:27 +00:00
|
|
|
_missingExtendedInfo pushBack [QGVAR(gunbagWeapon), _weapon];
|
2024-02-11 23:25:12 +00:00
|
|
|
_extendedInfo deleteAt QGVAR(gunbagWeapon);
|
|
|
|
};
|
2024-02-13 19:22:27 +00:00
|
|
|
private _missingItems = [];
|
|
|
|
private _attachments = _gunbagInfo select 1;
|
|
|
|
{
|
|
|
|
if (_x != "" && {!(_x call EFUNC(arsenal,baseWeapon) in EGVAR(arsenal,virtualItemsFlat))}) then {
|
|
|
|
_missingItems pushBack _x;
|
|
|
|
_attachments set [_forEachIndex, ""];
|
|
|
|
};
|
|
|
|
} forEach _attachments;
|
|
|
|
private _magazines = _gunbagInfo select 2;
|
2024-02-11 23:25:12 +00:00
|
|
|
{
|
|
|
|
private _class = _x param [0, ""];
|
2024-03-02 17:29:20 +00:00
|
|
|
if (_class != "" && {!(_class in EGVAR(arsenal,virtualItemsFlat))}) then {
|
2024-02-13 19:22:27 +00:00
|
|
|
_missingItems pushBack _class;
|
|
|
|
_magazines set [_forEachIndex, ["", 0]];
|
2024-02-11 23:25:12 +00:00
|
|
|
};
|
2024-02-13 19:22:27 +00:00
|
|
|
} forEach _magazines;
|
|
|
|
if (_missingItems isNotEqualTo []) then {
|
|
|
|
_missingExtendedInfo pushBack [QGVAR(gunbagWeapon), _missingItems];
|
|
|
|
};
|
2024-02-11 23:25:12 +00:00
|
|
|
}] 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];
|
|
|
|
};
|
|
|
|
}] 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;
|