Nametags - Cleanup unused crew info component (#9333)

This commit is contained in:
PabstMirror 2023-08-19 21:20:27 -05:00 committed by GitHub
parent 42101e8fa2
commit 4b7ee55588
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 0 additions and 237 deletions

View File

@ -1,9 +1,5 @@
PREP(canShow);
PREP(doShow);
PREP(drawNameTagIcon);
PREP(getCachedFlags);
PREP(getVehicleData);
PREP(initIsSpeaking);
PREP(moduleNameTags);
PREP(onDraw3d);

View File

@ -15,7 +15,6 @@ GVAR(showNamesTime) = -10;
// Statement
GVAR(showNamesTime) = CBA_missionTime;
// if (call FUNC(canShow)) then{ call FUNC(doShow); }; // This code doesn't work (canShow has a nil / has never worked??)
// Return false so it doesn't block other actions
false
},

View File

@ -1,22 +0,0 @@
/*
* Author: aeroson
* Images, index in images and order of roles.
* Defined number also implies order, lower number shows more on top of the list.
*/
#define PILOT 0
#define DRIVER 1
#define COPILOT PILOT
#define COMMANDER 2
#define GUNNER 3
#define FFV 4
#define CARGO 5
#define ROLE_IMAGES [ \
"a3\ui_f\data\IGUI\Cfg\Actions\getinpilot_ca.paa", \
"a3\ui_f\data\IGUI\Cfg\Actions\getindriver_ca.paa", \
"a3\ui_f\data\IGUI\Cfg\Actions\getincommander_ca.paa", \
"a3\ui_f\data\IGUI\Cfg\Actions\getingunner_ca.paa", \
QPATHTOF(UI\icon_position_ffv.paa), \
"a3\ui_f\data\IGUI\Cfg\Actions\getincargo_ca.paa" \
]

View File

@ -1,21 +0,0 @@
#include "script_component.hpp"
/*
* Author: aeroson
* Checks if crew info can be shown.
* Might be called several times a second.
*
* Arguments:
* None
*
* Return Value:
* Can show Crew Info <BOOL>
*
* Example:
* call ace_nametags_fnc_canShow
*
* Public: No
*/
((vehicle ACE_player) != ACE_player) &&
{GVAR(ShowCrewInfo)} &&
{!(vehicle ACE_player isKindOf "ParachuteBase")};

View File

@ -1,86 +0,0 @@
#include "script_component.hpp"
#include "common.hpp"
/*
* Author: aeroson
* Shows the actual text and sets text the crew info.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* call ace_nametags_fnc_doShow
*
* Public: No
*/
private _player = ACE_player;
private _vehicle = vehicle _player;
private _type = typeOf _vehicle;
private _config = configOf _vehicle;
private _text = format["<t size='1.4'><img image='%1'></t> <t size='1.7' shadow='true'>%2</t><br/>", getText(_config>>"picture"), getText (_config >> "DisplayName")];
private _data = [_type] call FUNC(getVehicleData);
private _isAir = _data select 0;
private _data = _data select 1;
private _turretUnits = _data apply {_vehicle turretUnit (_x select 0)};
private _turretRoles = _data apply {_x select 1};
private _roleType = CARGO;
private _toShow = [];
{
switch (_x) do {
case commander _vehicle: {
_roleType = COMMANDER;
};
case gunner _vehicle: {
_roleType = GUNNER;
};
case driver _vehicle: {
_roleType = if(_isAir) then { PILOT } else { DRIVER };
};
default {
_index = _turretUnits find _x;
if(_index !=-1 ) then {
_roleType = _turretRoles select _index;
} else {
_roleType = CARGO;
};
};
};
_toShow pushBack [_x, _roleType];
} forEach crew _vehicle;
_toShow = [
_toShow,
[],
{
_x select 1
},
"ASCEND",
{
_unit = _x select 0;
alive _unit
}
] call BIS_fnc_sortBy;
private _roleImages = ROLE_IMAGES;
{
private _unit = _x select 0;
private _roleType = _x select 1;
_text = _text + format["<t size='1.5' shadow='true'>%1</t> <t size='1.3'><img image='%2'></t><br/>", [_unit] call EFUNC(common,getName), _roleImages select _roleType];
} forEach _toShow;
("ACE_CrewInfo_CrewInfo" call BIS_fnc_rscLayer) cutRsc ["ACE_CrewInfo_dialog", "PLAIN", 1, false];
terminate (missionNamespace getVariable [QGVAR(hideCrewInfoHandle), scriptNull]);
GVAR(hideCrewInfoHandle) = 0 spawn {
sleep 2;
("ACE_CrewInfo_CrewInfo" call BIS_fnc_rscLayer) cutFadeOut 2;
};
[_text] call FUNC(setText);

View File

@ -1,103 +0,0 @@
#include "script_component.hpp"
#include "common.hpp"
/*
* Author: aeroson
* Gathers and caches data needed by ace_nametags_fnc_doShow.
* What really does make difference for the engine is simulation of CfgAmmo.
* Priority of roles is: driver/pilot, gunner, copilot, commander, FFV, cargo.
*
* Arguments:
* None
*
* Return Value:
* Data <ARRAY>
* 0: Vehicle inherits from Air <BOOL>
* 1: Categorized vehicle's turrets <ARRAY>
*
* Example:
* call ace_nametags_fnc_getVehicleData
*
* Public: No
*/
params ["_type"];
private _varName = format ["ACE_CrewInfo_Cache_%1", _type];
private _data = + (uiNamespace getVariable _varName);
if (!isNil "_data") exitWith {_data};
_data = [];
private _isAir = _type isKindOf "Air";
private _fnc_addTurretUnit = {
params ["_config", "_path"];
private _role = CARGO;
private _simulationEmpty = 0;
private _simulationLaserDesignate = 0;
private _simulationOther = 0;
{
{
private _magazine = configFile >> "CfgMagazines" >> _x;
private _ammo = configFile >> "CfgAmmo" >> getText (_magazine >> "ammo");
private _simulation = getText (_ammo >> "simulation");
if(_simulation=="") then {
_simulationEmpty = _simulationEmpty + 1;
} else {
if(_simulation=="laserDesignate") then {
_simulationLaserDesignate = _simulationLaserDesignate + 1;
} else {
_simulationOther = _simulationOther + 1;
};
};
} forEach getArray (configFile >> "CfgWeapons" >> _x >> "magazines");
} forEach getArray (_config >> "weapons");
if(_simulationOther>0) then {
_role = GUNNER;
};
if (_role == CARGO && {getNumber (_config >> "isCopilot") == 1}) then {
_role = COPILOT;
};
if (_role == CARGO && {_simulationLaserDesignate>0 || getNumber (_config >> "primaryObserver") == 1}) then {
_role = COMMANDER;
};
if (_role == CARGO && {getNumber (_config >> "isPersonTurret") == 1}) then {
_role = FFV;
};
_data pushBack [_path, _role];
};
private _fnc_addTurret = {
params ["_config", "_path"];
_config = _config >> "Turrets";
private _count = count _config;
private _offset = 0;
for "_index" from 0 to (_count - 1) do {
private _turretPath = _path + [_index - _offset];
private _turretConfig = _config select _index;
if (isClass _turretConfig) then {
[_turretConfig, _turretPath] call _fnc_addTurretUnit;
[_turretConfig, _turretPath] call _fnc_addTurret;
} else {
_offset = _offset + 1;
};
};
};
_config = configFile >> "CfgVehicles" >> _type;
[_config, []] call _fnc_addTurret;
_data = [_isAir, _data];
uiNamespace setVariable [_varName, _data];
_data