-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filtered Loadouts #1270
Filtered Loadouts #1270
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "script_component.hpp" | ||
/* ---------------------------------------------------------------------------- | ||
Function: CBA_fnc_addLoadoutFilter | ||
Description: | ||
Add a filter for CBA_fnc_getUnitLoadout. | ||
Parameters: | ||
_function - The function you wish to execute. <CODE> | ||
Passed Arguments: | ||
_this <ARRAY> | ||
0: _loadout - A getUnitLoadout array | ||
Returns: | ||
Nothing. | ||
Examples: | ||
Remove the radio from loadouts | ||
(begin example) | ||
[{ | ||
params ["_loadout"]; | ||
if ((_loadout select 9) select 2 == "ItemRadio") then { | ||
(_loadout select 9) set [2, ""]; | ||
}; | ||
_loadout | ||
}] call CBA_fnc_addLoadoutFilter; | ||
(end) | ||
Author: | ||
SynixeBrett | ||
---------------------------------------------------------------------------- */ | ||
|
||
params [["_function", {}, [{}]]]; | ||
|
||
if (_function isEqualTo {}) exitWith {-1}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It could return false, and true if it worked. |
||
|
||
GVAR(loadoutFilters) pushBack [_function]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "script_component.hpp" | ||
/* ---------------------------------------------------------------------------- | ||
Function: CBA_fnc_filterLoadout | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should add blank lines between different header sections. |
||
Description: | ||
Used to filter a getUnitLoadout array. | ||
Parameters: | ||
_loadout - getUnitLoadout array <ARRAY> | ||
Example: | ||
(begin example) | ||
_loadout = [getUnitLoadout player] call CBA_fnc_filterLoadout; | ||
(end) | ||
Returns: | ||
filtered getUnitLoadout array <ARRAY> | ||
Author: | ||
SynixeBrett | ||
---------------------------------------------------------------------------- */ | ||
SCRIPT(filterLoadout); | ||
|
||
params [["_loadout", [], [[]]]]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should handle receiving the different inputs (OBJECT, STRING, CONFIG) for the |
||
|
||
{ | ||
_loadout = [_loadout] call _x; | ||
} forEach GVAR(loadoutFilters); | ||
|
||
_loadout |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#include "script_component.hpp" | ||
|
||
GVAR(loadoutFilters) = []; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Put this directly in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should add blank lines between different header sections.