fn_arsenalSaveLoadoutHandler.sqf 1.0 KB

123456789101112131415161718192021222324
  1. #include "function_macros.hpp"
  2. if(!local this || isServer || player != this) exitWith{};
  3. if(hasInterface && ACE_Player == this) then {
  4. _id = ["ace_arsenal_onLoadoutSave", {
  5. params["_index", "_savedLoadout"];
  6. //sadly this event is only called AFTER saving, cant modify/inject while save is happening
  7. //LOGF_2("Loadout: %1 ::: %2", _loadoutIndex, _savedLoadout);
  8. //get all loadouts
  9. if(!GVAR(enabled)) exitWith {};
  10. _loadouts = profileNamespace getVariable ["ace_arsenal_saved_loadouts", []];
  11. //grab index for our loadout so we can update it
  12. _items = _savedLoadout select 1;
  13. _miscItems = _items select 9;
  14. _selectedRadio = _miscItems select 2;
  15. _miscItems set [2, GVAR(radio)];
  16. LOGF_1("Added Radio to Misc Items: '%1'", _miscItems);
  17. _loadouts set [_index, _savedLoadout];
  18. _success = profileNamespace setVariable ["ace_arsenal_saved_loadouts", _loadouts];
  19. }
  20. ] call CBA_fnc_addEventHandler;
  21. LOGF_2("Registered and loaded for '%1' with id '%2'", [this] call ace_common_fnc_getName, _id);
  22. };