Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common - Filter for ACRE radio IDs when serializing objects #640

Merged
merged 15 commits into from
Feb 9, 2022
Merged
6 changes: 6 additions & 0 deletions addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -399,3 +399,9 @@ if (isServer) then {
[QGVAR(createZeus), LINKFUNC(createZeus)] call CBA_fnc_addEventHandler;
[QGVAR(deserializeObjects), LINKFUNC(deserializeObjects)] call CBA_fnc_addEventHandler;
};

// Check for installed mods
GVAR(hasACRE) = false;
if (isClass(configFile >> "CfgPatches" >> "acre_main")) then {
GVAR(hasACRE) = true;
};
mjc4wilton marked this conversation as resolved.
Show resolved Hide resolved
7 changes: 6 additions & 1 deletion addons/common/functions/fnc_exportMissionSQF.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ private _fnc_processInventory = {
_outputObjects pushBack ["['%1', 'onEachFrame', {", _nextFrameHandle];
_outputObjects pushBack " params [""_unit""];";
if !(_object call FUNC(hasDefaultInventory)) then {
_outputObjects pushBack [" _unit setUnitLoadout %1;", getUnitLoadout _object];
// Check for ACRE, if so replace radio IDs with base radios
private _loadout = getUnitLoadout _object;
if (GVAR(hasACRE)) then {
_loadout = [_loadout] call acre_api_fnc_filterUnitLoadout;
};
_outputObjects pushBack [" _unit setUnitLoadout %1;", _loadout];
};
_outputObjects pushBack " _unit call BIN_fnc_CBRNHoseInit;";
_outputObjects pushBack [" ['%1', 'onEachFrame'] call BIS_fnc_removeStackedEventHandler;", _nextFrameHandle];
Expand Down
6 changes: 6 additions & 0 deletions addons/common/functions/fnc_serializeObjects.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ private _fnc_serializeUnit = {
private _stance = unitPos _unit;

private _loadout = getUnitLoadout _unit;

// Check for ACRE, if so replace radio IDs with base radios
if (GVAR(hasACRE)) then {
_loadout = [_loadout] call acre_api_fnc_filterUnitLoadout;
};

private _identity = [name _unit, face _unit, speaker _unit, pitch _unit, nameSound _unit, _unit call BIS_fnc_getUnitInsignia];
private _flagTexture = getForcedFlagTexture _unit;

Expand Down
2 changes: 1 addition & 1 deletion addons/context_actions/CfgContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class EGVAR(context_menu,actions) {
};
class Copy {
displayName = "$STR_3DEN_Display3DEN_MenuBar_EntityCopy_text";
statement = QUOTE(GVAR(loadout) = getUnitLoadout _hoveredEntity);
statement = QUOTE(if !(GVAR(hasACRE)) then {GVAR(loadout) = getUnitLoadout _hoveredEntity;} else {GVAR(loadout) = [getUnitLoadout _hoveredEntity] call acre_api_fnc_filterUnitLoadout;});
mjc4wilton marked this conversation as resolved.
Show resolved Hide resolved
icon = QPATHTOF(ui\copy_ca.paa);
};
class Paste {
Expand Down