mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
#2139 and nametag cleanup
This commit is contained in:
parent
2d8261ddb5
commit
68517756c4
@ -66,7 +66,7 @@ GVAR(showNamesTime) = -10;
|
|||||||
|
|
||||||
// Change settings accordingly when they are changed
|
// Change settings accordingly when they are changed
|
||||||
["SettingChanged", {
|
["SettingChanged", {
|
||||||
PARAMS_1(_name);
|
params ["_name"];
|
||||||
if (_name == QGVAR(showPlayerNames)) then {
|
if (_name == QGVAR(showPlayerNames)) then {
|
||||||
call FUNC(updateSettings);
|
call FUNC(updateSettings);
|
||||||
};
|
};
|
||||||
|
@ -10,16 +10,12 @@
|
|||||||
* Can show Crew Info <BOOL>
|
* Can show Crew Info <BOOL>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* call ace_nametags_fnc_doShow
|
* call ace_nametags_fnc_canShow
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_player"];
|
((vehicle ACE_player) != ACE_player) &&
|
||||||
|
|
||||||
_player = ACE_player;
|
|
||||||
|
|
||||||
vehicle _player != _player &&
|
|
||||||
{GVAR(ShowCrewInfo)} &&
|
{GVAR(ShowCrewInfo)} &&
|
||||||
{!(vehicle _player isKindOf "ParachuteBase")};
|
{!(vehicle ACE_player isKindOf "ParachuteBase")};
|
||||||
|
@ -13,26 +13,26 @@
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [ACE_player, _target, _alpha, _distance * 0.026, _icon] call ace_nametags_fnc_drawNameTagIcon
|
* [ACE_player, bob, 0.5, height, ICON_NAME_SPEAK] call ace_nametags_fnc_drawNameTagIcon
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
PARAMS_5(_player,_target,_alpha,_heightOffset,_iconType);
|
params ["_player", "_target", "_alpha", "_heightOffset", "_iconType"];
|
||||||
|
|
||||||
private ["_position", "_color", "_name", "_rank", "_size", "_icon", "_scale"];
|
|
||||||
|
|
||||||
if (_iconType == ICON_NONE) exitWith {}; //Don't waste time if not visable
|
if (_iconType == ICON_NONE) exitWith {}; //Don't waste time if not visable
|
||||||
|
|
||||||
|
private ["_position", "_color", "_name", "_size", "_icon", "_scale"];
|
||||||
|
|
||||||
//Set Icon:
|
//Set Icon:
|
||||||
_icon = "";
|
_icon = "";
|
||||||
_size = 0;
|
_size = 0;
|
||||||
if ((_iconType == ICON_NAME_SPEAK) || (_iconType == ICON_SPEAK)) then {
|
if (_iconType in [ICON_NAME_SPEAK, ICON_SPEAK]) then {
|
||||||
_icon = QUOTE(PATHTOF(UI\soundwave)) + str (floor (random 10)) + ".paa";
|
_icon = QUOTE(PATHTOF(UI\soundwave)) + str (floor (random 10)) + ".paa";
|
||||||
_size = 1;
|
_size = 1;
|
||||||
_alpha = _alpha max 0.6;//Boost alpha when speaking
|
_alpha = (_alpha max 0.2) + 0.2;//Boost alpha when speaking
|
||||||
} else {
|
} else {
|
||||||
if (_iconType == ICON_NAME_RANK) then {
|
if (_iconType == ICON_NAME_RANK) then {
|
||||||
_icon = format["\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa",(toLower(rank _target))];
|
_icon = format["\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa",(toLower(rank _target))];
|
||||||
@ -50,7 +50,7 @@ _name = if (_iconType in [ICON_NAME, ICON_NAME_RANK, ICON_NAME_SPEAK]) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//Set Color:
|
//Set Color:
|
||||||
if !(group _target == group _player) then {
|
if ((group _target) != (group _player)) then {
|
||||||
_color = +GVAR(defaultNametagColor); //Make a copy, then multiply both alpha values (allows client to decrease alpha in settings)
|
_color = +GVAR(defaultNametagColor); //Make a copy, then multiply both alpha values (allows client to decrease alpha in settings)
|
||||||
_color set [3, (_color select 3) * _alpha];
|
_color set [3, (_color select 3) * _alpha];
|
||||||
} else {
|
} else {
|
||||||
@ -58,7 +58,7 @@ if !(group _target == group _player) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Convert position to ASLW (expected by drawIcon3D) and add height offsets
|
// Convert position to ASLW (expected by drawIcon3D) and add height offsets
|
||||||
_position = _target modelToWorldVisual ((_target selectionPosition "pilot") vectorAdd [0,0,(_heightOffset + .35)]);
|
_position = _target modelToWorldVisual ((_target selectionPosition "pilot") vectorAdd [0,0,(_heightOffset + .3)]);
|
||||||
|
|
||||||
_scale = [0.333, 0.5, 0.666, 0.83333, 1] select GVAR(tagSize);
|
_scale = [0.333, 0.5, 0.666, 0.83333, 1] select GVAR(tagSize);
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
private ["_type", "_varName", "_data", "_isAir", "_config", "_fnc_addTurret", "_fnc_addTurretUnit"];
|
private ["_type", "_varName", "_data", "_isAir", "_config", "_fnc_addTurret", "_fnc_addTurretUnit"];
|
||||||
|
|
||||||
PARAMS_1(_type);
|
params ["_type"];
|
||||||
|
|
||||||
_varName = format ["ACE_CrewInfo_Cache_%1", _type];
|
_varName = format ["ACE_CrewInfo_Cache_%1", _type];
|
||||||
_data = + (uiNamespace getVariable _varName);
|
_data = + (uiNamespace getVariable _varName);
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
if (isServer) then {
|
if (isServer) then {
|
||||||
//If someone disconnects while speaking, reset their variable
|
//If someone disconnects while speaking, reset their variable
|
||||||
addMissionEventHandler ["HandleDisconnect", {
|
addMissionEventHandler ["HandleDisconnect", {
|
||||||
PARAMS_1(_disconnectedPlayer);
|
params ["_disconnectedPlayer"];
|
||||||
if (_disconnectedPlayer getVariable [QGVAR(isSpeakingInGame), false]) then {
|
if (_disconnectedPlayer getVariable [QGVAR(isSpeakingInGame), false]) then {
|
||||||
_disconnectedPlayer setVariable [QGVAR(isSpeakingInGame), false, true];
|
_disconnectedPlayer setVariable [QGVAR(isSpeakingInGame), false, true];
|
||||||
};
|
};
|
||||||
@ -30,7 +30,7 @@ if (!hasInterface) exitWith {};
|
|||||||
|
|
||||||
["playerChanged", {
|
["playerChanged", {
|
||||||
//When player changes, make sure to reset old unit's variable
|
//When player changes, make sure to reset old unit's variable
|
||||||
PARAMS_2(_newUnit,_oldUnit);
|
params ["", "_oldUnit"];
|
||||||
if ((!isNull _oldUnit) && {_oldUnit getVariable [QGVAR(isSpeakingInGame), false]}) then {
|
if ((!isNull _oldUnit) && {_oldUnit getVariable [QGVAR(isSpeakingInGame), false]}) then {
|
||||||
_oldUnit setVariable [QGVAR(isSpeakingInGame), false, true];
|
_oldUnit setVariable [QGVAR(isSpeakingInGame), false, true];
|
||||||
};
|
};
|
||||||
@ -40,14 +40,14 @@ if (!hasInterface) exitWith {};
|
|||||||
if (isClass (configFile >> "cfgPatches" >> "acre_api")) then {
|
if (isClass (configFile >> "cfgPatches" >> "acre_api")) then {
|
||||||
diag_log text format ["[ACE_nametags] - ACRE Detected"];
|
diag_log text format ["[ACE_nametags] - ACRE Detected"];
|
||||||
DFUNC(isSpeaking) = {
|
DFUNC(isSpeaking) = {
|
||||||
PARAMS_1(_unit);
|
params ["_unit"];
|
||||||
(([_unit] call acre_api_fnc_isSpeaking) || ([ACE_player] call acre_api_fnc_isBroadcasting)) && {!(_unit getVariable ["ACE_isUnconscious", false])}
|
(([_unit] call acre_api_fnc_isSpeaking) || {[ACE_player] call acre_api_fnc_isBroadcasting}) && {!(_unit getVariable ["ACE_isUnconscious", false])}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if (isClass (configFile >> "cfgPatches" >> "task_force_radio")) then {
|
if (isClass (configFile >> "cfgPatches" >> "task_force_radio")) then {
|
||||||
diag_log text format ["[ACE_nametags] - TFR Detected"];
|
diag_log text format ["[ACE_nametags] - TFR Detected"];
|
||||||
DFUNC(isSpeaking) = {
|
DFUNC(isSpeaking) = {
|
||||||
PARAMS_1(_unit);
|
params ["_unit"];
|
||||||
(_unit getVariable ["tf_isSpeaking", false]) && {!(_unit getVariable ["ACE_isUnconscious", false])}
|
(_unit getVariable ["tf_isSpeaking", false]) && {!(_unit getVariable ["ACE_isUnconscious", false])}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
@ -64,7 +64,7 @@ if (isClass (configFile >> "cfgPatches" >> "acre_api")) then {
|
|||||||
} , 0.1, []] call CBA_fnc_addPerFrameHandler;
|
} , 0.1, []] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
DFUNC(isSpeaking) = {
|
DFUNC(isSpeaking) = {
|
||||||
PARAMS_1(_unit);
|
params ["_unit"];
|
||||||
(_unit getVariable [QGVAR(isSpeakingInGame), false]) && {!(_unit getVariable ["ACE_isUnconscious", false])}
|
(_unit getVariable [QGVAR(isSpeakingInGame), false]) && {!(_unit getVariable ["ACE_isUnconscious", false])}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Author: esteldunedain
|
* Author: esteldunedain
|
||||||
*
|
|
||||||
* Initializes the name tags module.
|
* Initializes the name tags module.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
@ -14,7 +13,7 @@
|
|||||||
|
|
||||||
if !(isServer) exitWith {};
|
if !(isServer) exitWith {};
|
||||||
|
|
||||||
PARAMS_3(_logic,_units,_activated);
|
params ["_logic", "", "_activated"];
|
||||||
|
|
||||||
if !(_activated) exitWith {};
|
if !(_activated) exitWith {};
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ if ((GVAR(showPlayerNames) in [2,4]) && {_onKeyPressAlphaMax > 0}) then {
|
|||||||
{GVAR(showNamesForAI) || {[_target] call EFUNC(common,isPlayer)}} &&
|
{GVAR(showNamesForAI) || {[_target] call EFUNC(common,isPlayer)}} &&
|
||||||
{!(_target getVariable ["ACE_hideName", false])}) then {
|
{!(_target getVariable ["ACE_hideName", false])}) then {
|
||||||
_distance = ACE_player distance _target;
|
_distance = ACE_player distance _target;
|
||||||
|
if (_distance > (_maxDistance + 5)) exitWith {};
|
||||||
_alpha = (((1 - 0.2 * (_distance - _maxDistance)) min 1) * GVAR(playerNamesMaxAlpha)) min _onKeyPressAlphaMax;
|
_alpha = (((1 - 0.2 * (_distance - _maxDistance)) min 1) * GVAR(playerNamesMaxAlpha)) min _onKeyPressAlphaMax;
|
||||||
_icon = ICON_NONE;
|
_icon = ICON_NONE;
|
||||||
if (GVAR(showSoundWaves) == 2) then { //icon will be drawn below, so only show name here
|
if (GVAR(showSoundWaves) == 2) then { //icon will be drawn below, so only show name here
|
||||||
@ -116,5 +117,6 @@ if (((GVAR(showPlayerNames) in [1,3]) && {_onKeyPressAlphaMax > 0}) || {GVAR(sho
|
|||||||
|
|
||||||
[ACE_player, _target, _alpha, _distance * 0.026, _icon] call FUNC(drawNameTagIcon);
|
[ACE_player, _target, _alpha, _distance * 0.026, _icon] call FUNC(drawNameTagIcon);
|
||||||
};
|
};
|
||||||
} forEach _targets;
|
nil
|
||||||
|
} count _targets;
|
||||||
};
|
};
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#define TextIDC 11123
|
#define TextIDC 11123
|
||||||
|
|
||||||
PARAMS_1(_text);
|
params ["_text"];
|
||||||
|
|
||||||
private["_ctrl"];
|
private["_ctrl"];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user