mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
32 lines
800 B
Plaintext
32 lines
800 B
Plaintext
|
#include "script_component.hpp"
|
||
|
/*
|
||
|
* Author: 654wak654
|
||
|
* Adds a loadout to the "Default Loadouts" list.
|
||
|
* If a loadout with the same name exists, it is overwritten.
|
||
|
*
|
||
|
* Arguments:
|
||
|
* 0: Name of loadout <STRING>
|
||
|
* 1: getUnitLoadout array <ARRAY>
|
||
|
*
|
||
|
* Return Value:
|
||
|
* None
|
||
|
*
|
||
|
* Example:
|
||
|
* ["Squad Leader", getUnitLoadout sql1] call ace_arsenal_fnc_addDefaultLoadout
|
||
|
*
|
||
|
* Public: Yes
|
||
|
*/
|
||
|
|
||
|
params [["_name", "", [""]], ["_loadout", [], [[]], 10]];
|
||
|
|
||
|
if (isNil QGVAR(defaultLoadoutsList)) then {
|
||
|
GVAR(defaultLoadoutsList) = [];
|
||
|
};
|
||
|
|
||
|
private _loadoutIndex = (+(GVAR(defaultLoadoutsList))) findIf {(_x select 0) == _name};
|
||
|
if (_loadoutIndex == -1) then {
|
||
|
GVAR(defaultLoadoutsList) pushBack [_name, _loadout];
|
||
|
} else {
|
||
|
GVAR(defaultLoadoutsList) set [_loadoutIndex, [_name, _loadout]];
|
||
|
};
|