2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-02-02 22:28:27 +00:00
|
|
|
* Author: bux578
|
|
|
|
* Creates markers for AI units for given sides.
|
2015-08-07 07:18:42 +00:00
|
|
|
* Marks players in a different colour.
|
2015-02-02 22:28:27 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: side <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2015-08-07 07:18:42 +00:00
|
|
|
* [[west, east]] call ace_switchunits_fnc_markAiOnMap
|
2015-02-02 22:28:27 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-12 14:47:22 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-07 07:18:42 +00:00
|
|
|
params ["_sidesToShow"];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-02-02 22:28:27 +00:00
|
|
|
GVAR(AllMarkerNames) = [];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-08-08 11:34:35 +00:00
|
|
|
[{
|
2015-08-07 07:18:42 +00:00
|
|
|
params ["_args"];
|
|
|
|
_args params ["_sides"];
|
2015-07-26 07:19:09 +00:00
|
|
|
|
2015-02-02 22:28:27 +00:00
|
|
|
// delete markers
|
|
|
|
{
|
2015-08-07 07:18:42 +00:00
|
|
|
deleteMarkerLocal _x;
|
|
|
|
} count GVAR(AllMarkerNames);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-07-26 07:19:09 +00:00
|
|
|
// reset the array
|
|
|
|
GVAR(AllMarkerNames) = [];
|
|
|
|
|
|
|
|
if (alive ACE_player && {GVAR(OriginalUnit) getVariable ["ACE_CanSwitchUnits", false]}) then {
|
|
|
|
|
2015-02-02 22:28:27 +00:00
|
|
|
// create markers
|
|
|
|
{
|
|
|
|
if (([_x] call FUNC(isValidAi) && (side group _x in _sides)) || (_x getVariable [QGVAR(IsPlayerControlled), false])) then {
|
2016-05-03 00:32:44 +00:00
|
|
|
|
2016-01-10 18:08:28 +00:00
|
|
|
private _markerName = str _x;
|
2015-07-26 07:19:09 +00:00
|
|
|
|
2016-01-10 18:08:28 +00:00
|
|
|
private _marker = createMarkerLocal [_markerName, position _x];
|
2015-02-02 22:28:27 +00:00
|
|
|
_markerName setMarkerTypeLocal "mil_triangle";
|
|
|
|
_markerName setMarkerShapeLocal "ICON";
|
2015-08-07 07:18:42 +00:00
|
|
|
_markerName setMarkerSizeLocal [0.5, 0.7];
|
2015-02-02 22:28:27 +00:00
|
|
|
_markerName setMarkerDirLocal getDir _x;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-02-02 22:28:27 +00:00
|
|
|
// commy's one liner magic
|
2016-01-10 18:08:28 +00:00
|
|
|
private _markerColor = format ["Color%1", side group _x];
|
2015-01-27 08:01:57 +00:00
|
|
|
|
2015-02-02 22:28:27 +00:00
|
|
|
if ((_x getVariable [QGVAR(IsPlayerControlled), false])) then {
|
|
|
|
_markerName setMarkerColorLocal "ColorOrange";
|
|
|
|
_markerName setMarkerTextLocal (_x getVariable [QGVAR(PlayerControlledName), ""]);
|
|
|
|
} else {
|
|
|
|
_markerName setMarkerColorLocal _markerColor;
|
|
|
|
_markerName setMarkerTextLocal (getText (configFile >> "CfgVehicles" >> typeOf _x >> "displayName"));
|
2015-01-27 08:01:57 +00:00
|
|
|
};
|
2015-02-02 22:28:27 +00:00
|
|
|
|
|
|
|
GVAR(AllMarkerNames) pushBack _markerName;
|
2015-08-07 07:18:42 +00:00
|
|
|
nil
|
2015-02-02 22:28:27 +00:00
|
|
|
};
|
2015-08-07 07:18:42 +00:00
|
|
|
} count allUnits;
|
2015-01-27 08:01:57 +00:00
|
|
|
};
|
2015-08-08 11:34:35 +00:00
|
|
|
}, 1.5, [_sidesToShow]] call CBA_fnc_addPerFrameHandler;
|