-
Notifications
You must be signed in to change notification settings - Fork 737
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attach - Optimize creating children actions (#6345)
* Optimize attach get children actions * Store CfgMagazines and CfgWeapons config lookups
- Loading branch information
1 parent
b1c969c
commit ac3642d
Showing
4 changed files
with
51 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Author: Garth de Wet (LH), PabstMirror, mharis001 | ||
* Returns children actions for attachable items. | ||
* | ||
* Arguments: | ||
* 0: Target <OBJECT> | ||
* 1: Player <OBJECT> | ||
* | ||
* Return Value: | ||
* Actions <ARRAY> | ||
* | ||
* Example: | ||
* [_target, _player] call ace_attach_fnc_getChildrenActions | ||
* | ||
* Public: No | ||
*/ | ||
#include "script_component.hpp" | ||
|
||
params ["_target", "_player"]; | ||
TRACE_2("params",_target,_player); | ||
|
||
private _cfgMagazines = configFile >> "CfgMagazines"; | ||
private _cfgWeapons = configFile >> "CfgWeapons"; | ||
|
||
private _actions = []; | ||
|
||
private _magazines = magazines _player; | ||
{ | ||
private _config = _cfgMagazines >> _x; | ||
if (getText (_config >> "ACE_Attachable") != "") then { | ||
private _displayName = getText (_config >> "displayName"); | ||
private _picture = getText (_config >> "picture"); | ||
private _action = [_x, _displayName, _picture, {[{_this call FUNC(attach)}, _this] call CBA_fnc_execNextFrame}, {true}, {}, _x] call EFUNC(interact_menu,createAction); | ||
_actions pushBack [_action, [], _target]; | ||
}; | ||
} forEach (_magazines arrayIntersect _magazines); | ||
|
||
{ | ||
private _config = _cfgWeapons >> _x; | ||
if (getText (_config >> "ACE_Attachable") != "") then { | ||
private _displayName = getText (_config >> "displayName"); | ||
private _picture = getText (_config >> "picture"); | ||
private _action = [_x, _displayName, _picture, {[{_this call FUNC(attach)}, _this] call CBA_fnc_execNextFrame}, {true}, {}, _x] call EFUNC(interact_menu,createAction); | ||
_actions pushBack [_action, [], _target]; | ||
}; | ||
} forEach ([_player, false] call CBA_fnc_uniqueUnitItems); | ||
|
||
_actions |
This file was deleted.
Oops, something went wrong.