mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
db6a40f91d
* Add addDefaultLoadout function
* Initialize defaultLoadoutsList by default
* Close params bracket
* Revert "Initialize defaultLoadoutsList by default"
This reverts commit a53d21046e
.
* Add isNil check
* Remove tab
* Overwrite loadout if it exists
* Fix file name typo
* Use findIf and copy array
* Add override note to header
* Make btnImport use new function instead of duplicating code
* Use GVAR
* Use findIf
* Fix spacing
* Add documentation
* Improve documentation
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]];
|
|
};
|