File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ class cScripts {
4242 class setCargo {};
4343 class setCargoAttributes {};
4444 class checkItemValidity {};
45+ class getFilteredItem {};
4546 class createCargoCrate {};
4647
4748 class doStarterCrateSupplies {};
Original file line number Diff line number Diff line change 1+ #include " ..\script_component.hpp" ;
2+ /*
3+ * Author: Whitsel.M
4+ * This function checks if the item is in the item ace replace array and
5+ * return the ace filterd item. Based on the inputed item. if item is array it return input item.
6+ *
7+ *
8+ * Arguments:
9+ * 0: Item <OBJECT>
10+ *
11+ * Return Value:
12+ * item <STRING>
13+ *
14+ * Example:
15+ * ["ACE_EarPlugs"] call cScripts_fnc_getFilteredItem;
16+ *
17+ * Public: No
18+ */
19+ params[[" _item" , " " , [" " ]]];
20+
21+ if (_item isEqualTo " " ) exitWith {
22+ SHOW_WARN(" getFilteredItem" ," No item provided" );
23+ " " ;
24+ };
25+
26+ private _fn_testItem = {
27+ params[" _item" ," _array" ];
28+ _array params [" _oldItem" , " _newItem" ];
29+ if (_item isEqualTo _oldItem ) then {
30+ if (_newItem isEqualType []) exitWith {_oldItem };
31+ _newItem ;
32+ };
33+ _item ;
34+ };
35+
36+ // FIXME: CHECK ace_common_itemReplacements i hope the format is this: [[oldItem,ReplaceItem]]
37+ {
38+ _x parmas [" _item" , " _array" ];
39+ [_item , _array ] call _fn_testItem ;
40+ if (_item isNotEqualTo _array #0 ) exitWith { _array #1 };
41+ } forEach ace_common_itemReplacements;
42+
43+ _item ;
You can’t perform that action at this time.
0 commit comments