mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #2148 from acemod/nameTagFixes
nametag cleanup and fix cursortarget distance
This commit is contained in:
commit
ef5a3d69f5
@ -66,8 +66,8 @@ GVAR(showNamesTime) = -10;
|
||||
|
||||
// Change settings accordingly when they are changed
|
||||
["SettingChanged", {
|
||||
PARAMS_1(_name);
|
||||
if (_name == QGVAR(showPlayerNames)) then {
|
||||
params ["_name"];
|
||||
if (_name == QGVAR(showPlayerNames)) then {
|
||||
call FUNC(updateSettings);
|
||||
};
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
|
@ -10,16 +10,12 @@
|
||||
* Can show Crew Info <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* call ace_nametags_fnc_doShow
|
||||
* call ace_nametags_fnc_canShow
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_player"];
|
||||
|
||||
_player = ACE_player;
|
||||
|
||||
vehicle _player != _player &&
|
||||
((vehicle ACE_player) != ACE_player) &&
|
||||
{GVAR(ShowCrewInfo)} &&
|
||||
{!(vehicle _player isKindOf "ParachuteBase")};
|
||||
{!(vehicle ACE_player isKindOf "ParachuteBase")};
|
||||
|
@ -13,26 +13,26 @@
|
||||
* None
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_5(_player,_target,_alpha,_heightOffset,_iconType);
|
||||
|
||||
private ["_position", "_color", "_name", "_rank", "_size", "_icon", "_scale"];
|
||||
params ["_player", "_target", "_alpha", "_heightOffset", "_iconType"];
|
||||
|
||||
if (_iconType == ICON_NONE) exitWith {}; //Don't waste time if not visable
|
||||
|
||||
private ["_position", "_color", "_name", "_size", "_icon", "_scale"];
|
||||
|
||||
//Set Icon:
|
||||
_icon = "";
|
||||
_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";
|
||||
_size = 1;
|
||||
_alpha = _alpha max 0.6;//Boost alpha when speaking
|
||||
_alpha = (_alpha max 0.2) + 0.2;//Boost alpha when speaking
|
||||
} else {
|
||||
if (_iconType == ICON_NAME_RANK) then {
|
||||
_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:
|
||||
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 set [3, (_color select 3) * _alpha];
|
||||
} else {
|
||||
@ -58,7 +58,7 @@ if !(group _target == group _player) then {
|
||||
};
|
||||
|
||||
// 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);
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
private ["_type", "_varName", "_data", "_isAir", "_config", "_fnc_addTurret", "_fnc_addTurretUnit"];
|
||||
|
||||
PARAMS_1(_type);
|
||||
params ["_type"];
|
||||
|
||||
_varName = format ["ACE_CrewInfo_Cache_%1", _type];
|
||||
_data = + (uiNamespace getVariable _varName);
|
||||
|
@ -19,7 +19,7 @@
|
||||
if (isServer) then {
|
||||
//If someone disconnects while speaking, reset their variable
|
||||
addMissionEventHandler ["HandleDisconnect", {
|
||||
PARAMS_1(_disconnectedPlayer);
|
||||
params ["_disconnectedPlayer"];
|
||||
if (_disconnectedPlayer getVariable [QGVAR(isSpeakingInGame), false]) then {
|
||||
_disconnectedPlayer setVariable [QGVAR(isSpeakingInGame), false, true];
|
||||
};
|
||||
@ -30,7 +30,7 @@ if (!hasInterface) exitWith {};
|
||||
|
||||
["playerChanged", {
|
||||
//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 {
|
||||
_oldUnit setVariable [QGVAR(isSpeakingInGame), false, true];
|
||||
};
|
||||
@ -40,14 +40,14 @@ if (!hasInterface) exitWith {};
|
||||
if (isClass (configFile >> "cfgPatches" >> "acre_api")) then {
|
||||
diag_log text format ["[ACE_nametags] - ACRE Detected"];
|
||||
DFUNC(isSpeaking) = {
|
||||
PARAMS_1(_unit);
|
||||
(([_unit] call acre_api_fnc_isSpeaking) || ([ACE_player] call acre_api_fnc_isBroadcasting)) && {!(_unit getVariable ["ACE_isUnconscious", false])}
|
||||
params ["_unit"];
|
||||
(([_unit] call acre_api_fnc_isSpeaking) || {[ACE_player] call acre_api_fnc_isBroadcasting}) && {!(_unit getVariable ["ACE_isUnconscious", false])}
|
||||
};
|
||||
} else {
|
||||
if (isClass (configFile >> "cfgPatches" >> "task_force_radio")) then {
|
||||
diag_log text format ["[ACE_nametags] - TFR Detected"];
|
||||
DFUNC(isSpeaking) = {
|
||||
PARAMS_1(_unit);
|
||||
params ["_unit"];
|
||||
(_unit getVariable ["tf_isSpeaking", false]) && {!(_unit getVariable ["ACE_isUnconscious", false])}
|
||||
};
|
||||
} else {
|
||||
@ -64,7 +64,7 @@ if (isClass (configFile >> "cfgPatches" >> "acre_api")) then {
|
||||
} , 0.1, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
DFUNC(isSpeaking) = {
|
||||
PARAMS_1(_unit);
|
||||
params ["_unit"];
|
||||
(_unit getVariable [QGVAR(isSpeakingInGame), false]) && {!(_unit getVariable ["ACE_isUnconscious", false])}
|
||||
};
|
||||
};
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Author: esteldunedain
|
||||
*
|
||||
* Initializes the name tags module.
|
||||
*
|
||||
* Arguments:
|
||||
@ -14,7 +13,7 @@
|
||||
|
||||
if !(isServer) exitWith {};
|
||||
|
||||
PARAMS_3(_logic,_units,_activated);
|
||||
params ["_logic", "", "_activated"];
|
||||
|
||||
if !(_activated) exitWith {};
|
||||
|
||||
|
@ -63,6 +63,7 @@ if ((GVAR(showPlayerNames) in [2,4]) && {_onKeyPressAlphaMax > 0}) then {
|
||||
{GVAR(showNamesForAI) || {[_target] call EFUNC(common,isPlayer)}} &&
|
||||
{!(_target getVariable ["ACE_hideName", false])}) then {
|
||||
_distance = ACE_player distance _target;
|
||||
if (_distance > (_maxDistance + 5)) exitWith {};
|
||||
_alpha = (((1 - 0.2 * (_distance - _maxDistance)) min 1) * GVAR(playerNamesMaxAlpha)) min _onKeyPressAlphaMax;
|
||||
_icon = ICON_NONE;
|
||||
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);
|
||||
};
|
||||
} forEach _targets;
|
||||
nil
|
||||
} count _targets;
|
||||
};
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#define TextIDC 11123
|
||||
|
||||
PARAMS_1(_text);
|
||||
params ["_text"];
|
||||
|
||||
private["_ctrl"];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user