diff --git a/cScripts/functions/gear/fn_gear_applyCosmetics.sqf b/cScripts/functions/gear/fn_gear_applyCosmetics.sqf index 87acf6b87..7a59624f3 100644 --- a/cScripts/functions/gear/fn_gear_applyCosmetics.sqf +++ b/cScripts/functions/gear/fn_gear_applyCosmetics.sqf @@ -41,13 +41,13 @@ if (!isNil{GETVAR(_unit,EGVAR(Unit,TeamColor),nil)}) then { // Apply squad insignia if (EGVAR(Settings,allowInsigniaApplication)) then { - private _insignia = if (call EFUNC(player,loadInsignia) != "") then { - call EFUNC(player,loadInsignia); + private _insignia = if (call EFUNC(profile,loadInsignia) != "") then { + call EFUNC(profile,loadInsignia); } else { call EFUNC(unit,getSquadInsignia); }; [{ params ["_unit", "_insignia"]; - [_unit, _insignia] call EFUNC(unit,setInsignia); + [_unit, _insignia, false] call EFUNC(unit,setInsignia); }, [_unit, _insignia], 2] call CBA_fnc_waitAndExecute; }; \ No newline at end of file diff --git a/cScripts/functions/init/fn_init_aceArsenal.sqf b/cScripts/functions/init/fn_init_aceArsenal.sqf index e795de4fd..83d0d2440 100644 --- a/cScripts/functions/init/fn_init_aceArsenal.sqf +++ b/cScripts/functions/init/fn_init_aceArsenal.sqf @@ -26,7 +26,7 @@ GVAR(StagingArsenalOpen) = false; // Save insignia private _insigniaClass = [player] call BIS_fnc_getUnitInsignia; - [_insigniaClass] call cScripts_fnc_profile_saveInsignia; + [_insigniaClass] call EFUNC(profile,saveInsignia); // Reset default loadouts call FUNC(addDefaultArsenalLoadouts); diff --git a/cScripts/functions/players/fn_profile_loadInsignia.sqf b/cScripts/functions/players/fn_profile_loadInsignia.sqf index ceb4824b8..ce37bc208 100644 --- a/cScripts/functions/players/fn_profile_loadInsignia.sqf +++ b/cScripts/functions/players/fn_profile_loadInsignia.sqf @@ -14,17 +14,7 @@ * * Public: No */ - -if (!GVAR(isPlayer)) exitWith {""}; - -// TODO: Legacy handler, remove later -if (!isNil{profileNamespace getVariable [QEGVAR(Cav,Insignia), nil];}) then { - private _legacy = profileNamespace getVariable [QEGVAR(Cav,Insignia), nil]; - // Save New - profileNamespace setVariable [QEGVAR(Profile,Insignia), _legacy]; - // Remove Legacy - profileNamespace setVariable [QEGVAR(Cav,Insignia), nil]; -}; +if (!isPlayer _unit) exitWith {}; private _insignia = GETPRVAR(EGVAR(Profile,Insignia), ""); diff --git a/cScripts/functions/players/fn_profile_saveInsignia.sqf b/cScripts/functions/players/fn_profile_saveInsignia.sqf index 4245f401c..7dfbda2b7 100644 --- a/cScripts/functions/players/fn_profile_saveInsignia.sqf +++ b/cScripts/functions/players/fn_profile_saveInsignia.sqf @@ -17,12 +17,7 @@ params [["_insignia", "", [""]]]; -if (!GVAR(isPlayer)) exitWith {}; - -// TODO: Legacy handler, remove later -if (!isNil{ GETPRVAR(EGVAR(Cav,Insignia), nil); }) then { - SETPRVAR(EGVAR(Cav,Insignia), nil); -}; +if (!isPlayer _unit) exitWith {}; SETPRVAR(EGVAR(Profile,Insignia), _insignia); diff --git a/cScripts/functions/players/fn_unit_setInsignia.sqf b/cScripts/functions/players/fn_unit_setInsignia.sqf index 38b6fe6c3..058c0c7c2 100644 --- a/cScripts/functions/players/fn_unit_setInsignia.sqf +++ b/cScripts/functions/players/fn_unit_setInsignia.sqf @@ -17,8 +17,14 @@ params [ ["_unit", objNull, [objNull]], - ["_insignia", "", [""]] + ["_insignia", "", [""]], + ["_save", true, [true]] + ]; [_unit, _insignia] call BIS_fnc_setUnitInsignia; -if (GVAR(isPlayer)) then {[_insignia] call EFUNC(player,saveInsignia);}; \ No newline at end of file + +if (!isPlayer _unit) exitWith {}; +if (!_save) exitWith {}; + +[_insignia] call EFUNC(profile,saveInsignia); \ No newline at end of file