fn_arsenalSaveLoadoutHandler.sqf 980 B

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