Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Author: Thomas Ryan
- Description:
- Simple handling of the Support Team's scripted IFF.
- Must be executed locally.
- Notes:
- - To always show the icon and name of a unit, use: <unit> setVariable ["BIS_iconAlways", true]
- - Otherwise, icons can be hidden with: <unit> setVariable ["BIS_iconShow", false]
- - And names can be hidden with: <unit> setVariable ["BIS_iconName", false]
- Parameters:
- _this select 0: ARRAY - Array of Support Team units.
- _this select 1: ARRAY - Array of RGB values used for the icon/text color.
- Returns:
- True if successfully initialized, false if not.
- */
- params [["_units", [], [[]]],["_iconColor",[0,125,255],[[]],3]];
- if (isNil "BIS_iconUnits") then {
- BIS_iconUnits = [];
- };
- {
- _x setVariable ["BIS_iconColor",_iconColor];
- }forEach _units;
- BIS_iconUnits append _units;
- // Display units
- {
- private _unit = _x;
- {if (isNil {_unit getVariable _x}) then {_unit setVariable [_x, true]}} forEach ["BIS_iconShow", "BIS_iconName"];
- } forEach BIS_iconUnits;
- if (!(isNil "BIS_fakeTexture")) exitWith {
- true
- //Draw3D already exists, quitting.
- };
- // Global icon variables
- BIS_fakeTexture = [1,1,1,0] call BIS_fnc_colorRGBAtoTexture;
- //BIS_iconColor = [0,125,255];
- // Icon eventhandler
- addMissionEventHandler [
- "Draw3D",
- {
- {
- private _unit = _x;
- private _showAlways = _unit getVariable ["BIS_iconAlways", false];
- private _showIcon = _unit getVariable ["BIS_iconShow", false];
- private _showName = _unit getVariable ["BIS_iconName", false];
- private _iconColor = _unit getVariable ["BIS_iconColor",[0,125,255]];
- // Determine if icon should be shown
- if (_showAlways || { _showIcon }) then {
- if (_showAlways || { vehicle player distance _unit < 300 }) then {
- // Calculate position
- private _pos = _unit selectionPosition "Spine3";
- _pos = _unit modelToWorldVisual _pos;
- // Draw hex icon
- drawIcon3D [
- "a3\ui_f\data\igui\cfg\cursors\select_ca.paa",
- _iconColor + [0.15],
- _pos,
- 1,
- 1,
- 0
- ];
- if (_showAlways) then {
- // Draw arrow if icon goes out of the screen
- drawIcon3D [
- BIS_fakeTexture,
- _iconColor + [0.5],
- _pos,
- 1,
- 1,
- 0,
- "",
- 0,
- 0.03, "PuristaLight", "center", // Redundant font params, required to make the arrow work
- true
- ];
- };
- if (
- // Icon is forced
- _showAlways
- ||
- {
- // Name is allowed
- _showName
- &&
- // Unit is highlighted
- { cursorTarget == vehicle _unit }
- }
- ) then {
- // Determine name
- private _name = name _unit;
- // Draw name
- drawIcon3D [
- BIS_fakeTexture,
- _iconColor + [0.5],
- _pos,
- 1,
- -1.8,
- 0,
- _name,
- 0,
- 0.025
- ];
- };
- };
- };
- } forEach BIS_iconUnits;
- }
- ];
- true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement