Created
May 12, 2021 03:13
-
-
Save indig0fox/f299d7903f5bb5f1d0bc108fb109c304 to your computer and use it in GitHub Desktop.
Label staff, 'officer' class men, and assets during safe start. Incl ACE Spectator compat check that won't overdraw the ACE Spectator names/group icons.
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
{ | |
staffIconHelper = [{ | |
{ | |
// skip if not safe start | |
if (!phx_safetyEnabled) exitWith {}; | |
// skip if ACE spectator is drawing group/name icons so as not to clash | |
if (missionNamespace getVariable "ace_spectator_drawunits") exitWith {}; | |
_staff = missionNamespace getVariable["staffInfo", nil]; | |
if (isNil "_staff") exitWith {}; | |
_staffInfo = _staff getOrDefault[getPlayerUID _x, nil]; | |
if (isNil "_staffInfo") exitWith {}; | |
_staffInfo = parseSimpleArray _staffInfo; | |
_name = _staffInfo# 1# 0; | |
_role = _staffInfo# 1# 1; | |
_text = format["STAFF | %1 | %2", _name, _role]; | |
_pos = visiblePosition _x; | |
if (player distance _x >= 15) then { | |
drawIcon3D[getMissionPath "fnf.paa", [1, 1, 1, 0.3], [(_pos select 0), (_pos select 1), 3], 0.6, 0.6, 0, "", true, 0.05, "PuristaBold", "center"]; | |
} else { | |
drawIcon3D[getMissionPath "fnf.paa", [1, 1, 1, 1], [(_pos select 0), (_pos select 1), 3], 1, 1, 0, _text, true, 0.05, "PuristaBold", "center"]; | |
}; | |
} | |
forEach(units playerSide); | |
}, 0] call CBA_fnc_addPerFrameHandler; | |
unitIconsHelper = [{ | |
// skip if not safe start | |
if (!phx_safetyEnabled) exitWith {}; | |
// skip if spectating or dead | |
if ((typeOf player == "ace_spectator_virtual") || ace_spectator_isset) exitWith {}; | |
_cmdUnits = (units playerSide) select { | |
["officer", typeOf _x] call BIS_fnc_inString | |
}; | |
_playersSide = (units playerSide) select { | |
!(_x in _cmdUnits) | |
}; | |
{ | |
// if (!phx_safetyEnabled) then {}; | |
_iconType = getText(configFile >> "CfgVehicles" >> (typeOf(vehicle _x)) >> "icon"); | |
// label vehicles w DisplayName | |
_thisName = getText(configFile >> "CfgVehicles" >> (typeOf _x) >> "DisplayName"); | |
_pos = visiblePosition _x; | |
if (player distance _x >= 30) then { | |
drawIcon3D[_iconType, [1, 1, 1, 0.45], [(_pos select 0), (_pos select 1), 3.5], 0.7, 0.7, (_x getRelDir player) + 180, "", true, 0.02, "PuristaMedium", "right"]; | |
} else { | |
drawIcon3D[_iconType, [1, 1, 1, 0.75], [(_pos select 0), (_pos select 1), 3.5], 1, 1, (_x getRelDir player) + 180, _thisName, true, 0.03, "PuristaMedium", "right"]; | |
}; | |
} | |
forEach(getPos player nearEntities[["Air", "Car", "Truck", "Motorcycle", "Tank", "StaticWeapon"], 750]); | |
{ | |
// address group members (works dynamically, ACE join group) | |
if ((group _x) == (group player)) then { | |
_iconType = getText(configFile >> "CfgVehicles" >> (typeOf(vehicle _x)) >> "icon"); | |
_thisName = name _x; | |
if (!(_thisName isEqualType "")) then {_thisName = ""}; | |
_pos = visiblePosition _x; | |
drawIcon3D[_iconType, [1, 1, 1, 0.7], [(_pos select 0), (_pos select 1), 2.3], 0.6, 0.6, (_x getRelDir player) + 180, _thisName, true, 0.03, "PuristaMedium", "right"]; | |
}; | |
} | |
forEach _playersSide; | |
// address officers (CMD, PL) | |
{ | |
_iconType = getText(configFile >> "CfgVehicles" >> (typeOf(vehicle _x)) >> "icon"); | |
_thisName = format["%1: %2", ((roleDescription _x) splitString "@")# 0, name _x]; | |
_pos = visiblePosition _x; | |
drawIcon3D[_iconType, [1, 1, 1, 0.7], [(_pos select 0), (_pos select 1), 2.3], 0.6, 0.6, (_x getRelDir player) + 180, _thisName, true, 0.03, "PuristaBold", "center"]; | |
} | |
forEach _cmdUnits; | |
}, 0] call CBA_fnc_addPerFrameHandler; | |
unitIconsHelperSpec = [{ | |
// skip if not safe start | |
if (!phx_safetyEnabled) exitWith {}; | |
// skip if not spectating or dead | |
if (!((typeOf player == "ace_spectator_virtual") || ace_spectator_isset)) exitWith {}; | |
// skip if ACE spectator is drawing group/name icons so as not to clash | |
if (missionNamespace getVariable "ace_spectator_drawunits") exitWith {}; | |
_myPos = positionCameraToWorld[0, 0, 0]; | |
_cmdUnits = allUnits select { | |
["officer", typeOf _x] call BIS_fnc_inString | |
}; | |
{ | |
_iconType = getText(configFile >> "CfgVehicles" >> (typeOf(vehicle _x)) >> "icon"); | |
// label vehicles w DisplayName | |
// if (!((vehicle _x) isKindOf "Man")) then { | |
_thisName = getText(configFile >> "CfgVehicles" >> (typeOf _x) >> "DisplayName"); | |
_pos = visiblePosition _x; | |
if (_myPos distance _x >= 75) then { | |
drawIcon3D[_iconType, [1, 1, 1, 0.45], [(_pos select 0), (_pos select 1), 3.5], 0.7, 0.7, 0, "", true, 0.02, "PuristaMedium", "right"]; | |
} else { | |
drawIcon3D[_iconType, [1, 1, 1, 0.75], [(_pos select 0), (_pos select 1), 3.5], 1, 1, 0, _thisName, true, 0.03, "PuristaMedium", "right"]; | |
}; | |
// }; | |
} | |
forEach(entities[["Air", "Truck", "Car", "Motorcycle", "Tank", "StaticWeapon"], [], false, true]); | |
// address officers (CMD, PL) | |
{ | |
_iconType = getText(configFile >> "CfgVehicles" >> (typeOf(vehicle _x)) >> "icon"); | |
_thisName = format["%1: %2", ((roleDescription _x) splitString "@")# 0, name _x]; | |
_pos = visiblePosition _x; | |
drawIcon3D[_iconType, [1, 1, 1, 0.7], [(_pos select 0), (_pos select 1), 2.3], 0.6, 0.6, 0, _thisName, true, 0.03, "PuristaBold", "center"]; | |
} | |
forEach _cmdUnits; | |
}, | |
0 | |
] call CBA_fnc_addPerFrameHandler; | |
} | |
remoteExec["call", 0, true]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment