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.
|
|
|
|
* Marks players in a different colour.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: side <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2015-02-03 20:47:48 +00:00
|
|
|
* [[west, east]] call FUNC(markAiOnMap)
|
2015-02-02 22:28:27 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-01-12 14:47:22 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-02-02 22:28:27 +00:00
|
|
|
private "_sidesToShow";
|
2015-01-11 16:42:31 +00:00
|
|
|
_sidesToShow = _this select 0;
|
|
|
|
|
2015-02-02 22:28:27 +00:00
|
|
|
GVAR(AllMarkerNames) = [];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-02-02 22:28:27 +00:00
|
|
|
DFUNC(pfhMarkAiOnMap) = {
|
|
|
|
private ["_args", "_sides"];
|
|
|
|
_args = _this select 0;
|
|
|
|
_sides = _args select 0;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-07-26 07:19:09 +00:00
|
|
|
|
2015-02-02 22:28:27 +00:00
|
|
|
// delete markers
|
|
|
|
{
|
|
|
|
deleteMarkerLocal _x;
|
|
|
|
} forEach 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 {
|
|
|
|
private ["_markerName", "_marker", "_markerColor"];
|
2015-07-26 07:19:09 +00:00
|
|
|
|
2015-02-02 22:28:27 +00:00
|
|
|
_markerName = str _x;
|
2015-01-27 08:01:57 +00:00
|
|
|
|
2015-02-02 22:28:27 +00:00
|
|
|
_marker = createMarkerLocal [_markerName, position _x];
|
|
|
|
_markerName setMarkerTypeLocal "mil_triangle";
|
|
|
|
_markerName setMarkerShapeLocal "ICON";
|
|
|
|
_markerName setMarkerSizeLocal [0.5,0.7];
|
|
|
|
_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
|
|
|
|
_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;
|
|
|
|
};
|
|
|
|
} forEach allUnits;
|
2015-01-27 08:01:57 +00:00
|
|
|
};
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
2015-02-02 22:28:27 +00:00
|
|
|
|
2015-02-03 19:33:15 +00:00
|
|
|
[FUNC(pfhMarkAiOnMap), 1.5, [_sidesToShow]] call CBA_fnc_addPerFrameHandler;
|