-
Notifications
You must be signed in to change notification settings - Fork 40
Custom namelist sorting
In the radar module it is possible to implement your own sorting algorithm for the namelist.
In order to activate the sorting, choose the sorting option "Custom" in the radar module CBA settings. The internal value of it is diwako_dui_radar_sortType = "custom"
. Also keep in mind diwako_dui_radar_sortType
is a global setting!
DUI will look into the missionNamespace
variable diwako_dui_radar_customSort
if a custom sorting function is defined. As return value DUI expects an array of units and will display them in the order of appearance.
Example for a sorting algorithm:
diwako_dui_radar_customSort = {
// _grp: array of units that needs sorting (careful SQL could be removed from the array)
// _player: the current unit the player is controling
// DUI expects an array as return value. e.g. [_unit1, _unit2, etc]
params ["_grp", "_player"];
_grp = _grp apply { [_x getVariable ["ACE_Name", name _x], _x] };
_grp sort false;
_grp apply { _x select 1 };
};
If something else than code is found in the variable, DUI will not sort the names at all. If a wrong output format is found for the return value it will display a message using CBA notify and will not sort the names in the list.