Skip to content

Commit

Permalink
Merge branch 'main' into Kit-Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pool011 authored Apr 7, 2024
2 parents 5ea3e33 + 90393cb commit 449ec2b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
1 change: 1 addition & 0 deletions cScripts/cScripts_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ EGVAR(patches,usesACRE) = isClass (configFile >> "CfgPatches" >> "acre_s
EGVAR(patches,usesTFAR) = isClass (configFile >> "CfgPatches" >> "task_force_radio");
EGVAR(patches,usesAlive) = isClass (configFile >> "CfgPatches" >> "ALiVE_main");
EGVAR(patches,usesZen) = isClass (configFile >> "CfgPatches" >> "zen_main");
EGVAR(patches,usesACEAX) = isCLass (configFile >> "CfgPatches" >> "aceax_main");

// Global Variables
EGVAR(Staging,ZoneStatus) = false;
Expand Down
5 changes: 2 additions & 3 deletions cScripts/functions/gear/fn_gear_saveLoadout.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@

params [["_unit", objNull, [objNull]]];

private _loadout = getUnitLoadout _unit;
if (EGVAR(patches,usesACRE)) then { _loadout = [_loadout] call acre_api_fnc_filterUnitLoadout; };
_loadout = [_unit] call CBA_fnc_getLoadout;
private _loadout = [_unit] call CBA_fnc_getLoadout;
_loadout = [_loadout] call FUNC(filterUnitLoadout);

_unit setVariable [QEGVAR(Gear,Loadout), _loadout];
_unit setVariable [QEGVAR(Gear,SavedLoadout), true];
Expand Down
37 changes: 24 additions & 13 deletions cScripts/functions/systems/fn_filterUnitLoadout.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,44 +20,55 @@
params [["_loadout", getUnitLoadout player, [[], objNull, "", configNull]]];

if !(_loadout isEqualType []) then {
_loadout = getUnitLoadout _loadout;
_loadout = [_loadout] call CBA_fnc_getLoadout;
};

if (_loadout isEqualTo []) exitWith {
_loadout
_loadout;
};

private _baseLoadout = _loadout;
if (EGVAR(Patches,usesACEAX)) then {
_baseLoadout = _loadout#0;
};

// Remove "ItemRadioAcreFlagged"
if ((_loadout select 9) select 2 == "ItemRadioAcreFlagged") then {
(_loadout select 9) set [2, ""];
if (_baseLoadout#9#2 == "ItemRadioAcreFlagged") then {
_baseLoadout#9 set [2, ""];
};

// Set ACRE base classes
private _replaceRadio = {
params ["_item"];
if (EGVAR(Patches,usesACRE)) then {
if (EGVAR(Patches,usesACRE)) then {
// Replace only if string (array can be eg. weapon inside container) and an ACRE radio
if (!(_item isEqualType []) && {[_item] call acre_api_fnc_isRadio}) then {
_this set [0, [_item] call acre_api_fnc_getBaseRadio];
};
};
if (EGVAR(Patches,usesTFAR)) then {
// Replace only if string (array can be eg. weapon inside container) and an TFAR radio
if (!(_item isEqualType []) && {[_item] call TFAR_fnc_isRadio}) then {
if (!(_item isEqualType []) && {_item call TFAR_fnc_isRadio}) then {
private _baseClassRadio = getText (configFile >> "CfgWeapons" >> _item >> "ace_arsenal_uniqueBase");
_this set [0, _baseClassRadio];
};
};
};
if ((_loadout select 3) isNotEqualTo []) then {
{_x call _replaceRadio} forEach ((_loadout select 3) select 1); // Uniform items

if ((_baseLoadout#3) isNotEqualTo []) then {
{_x call _replaceRadio} forEach (_baseLoadout#3#1); // Uniform items
};
if ((_loadout select 4) isNotEqualTo []) then {
{_x call _replaceRadio} forEach ((_loadout select 4) select 1); // Vest items

if ((_baseLoadout#4) isNotEqualTo []) then {
{_x call _replaceRadio} forEach (_baseLoadout#4#1); // Vest items
};
if ((_loadout select 5) isNotEqualTo []) then {
{_x call _replaceRadio} forEach ((_loadout select 5) select 1); // Backpack items

if ((_baseLoadout#5) isNotEqualTo []) then {
{_x call _replaceRadio} forEach (_baseLoadout#5#1); // Backpack items
};

if (EGVAR(Patches,usesACEAX)) then {
_loadout set [0,_baseLoadout];
};

_loadout
_loadout

0 comments on commit 449ec2b

Please sign in to comment.