Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disablable NameTags Module option #1204

Merged
merged 16 commits into from Jun 2, 2015
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions addons/nametags/ACE_Settings.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
class ACE_Settings {
class GVAR(defaultNametagColor) {
value[] = {0.77, 0.51, 0.08, 1};
typeName = "COLOR";
isClientSettable = 1;
displayName = "$STR_ACE_NameTags_DefaultNametagColor";
};
class GVAR(showPlayerNames) {
value = 1;
typeName = "SCALAR";
isClientSettable = 1;
displayName = "$STR_ACE_NameTags_ShowPlayerNames";
description = "$STR_ACE_NameTags_ShowPlayerNames_Desc";
values[] = {"$STR_ACE_NameTags_Disabled", "$STR_ACE_NameTags_Enabled", "$STR_ACE_NameTags_OnlyCursor", "$STR_ACE_NameTags_OnlyOnKeypress", "$STR_ACE_NameTags_OnlyCursorAndKeypress"};
};
class GVAR(showPlayerRanks) {
value = 1;
typeName = "BOOL";
isClientSettable = 1;
displayName = "$STR_ACE_NameTags_ShowPlayerRanks";
};
class GVAR(showVehicleCrewInfo) {
value = 1;
typeName = "BOOL";
isClientSettable = 1;
displayName = "$STR_ACE_NameTags_ShowVehicleCrewInfo";
};
class GVAR(showNamesForAI) {
value = 0;
typeName = "BOOL";
isClientSettable = 1;
displayName = "$STR_ACE_NameTags_ShowNamesForAI";
};
class GVAR(showCursorTagForVehicles) {
value = 0;
typeName = "BOOL";
isClientSettable = 0;
};
class GVAR(showSoundWaves) {
value = 1;
typeName = "SCALAR";
isClientSettable = 1;
displayName = "$STR_ACE_NameTags_ShowSoundWaves";
description = "$STR_ACE_NameTags_ShowSoundWaves_Desc";
values[] = {"$STR_ACE_NameTags_Disabled", "$STR_ACE_NameTags_NameTagSettings", "$STR_ACE_NameTags_AlwaysShowAll"};
};
class GVAR(playerNamesViewDistance) {
value = 5;
typeName = "SCALAR";
isClientSettable = 0;
};
class GVAR(playerNamesMaxAlpha) {
value = 0.8;
typeName = "SCALAR";
isClientSettable = 0;
};
};
31 changes: 30 additions & 1 deletion addons/nametags/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,36 @@ class CfgVehicles {
isGlobal = 1;
icon = QUOTE(PATHTOF(UI\Icon_Module_NameTags_ca.paa));
class Arguments {
class PlayerNamesViewDistance {
class showPlayerNames {
displayName = "$STR_ACE_NameTags_ShowPlayerNames";
description = "$STR_ACE_NameTags_ShowPlayerNames_Desc";
typeName = "SCALAR";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be number

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch:

typeName = "NUMBER" in modules equals typeName = "SCALAR" for variables

BIS consistency

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already fixed, will push with the rest of the stuff, thanks a lot @Glowbal for telling me this!

#BIS' fault

defaultValue = 1;
class values {
class Disabled {
name = "$STR_ACE_NameTags_Disabled";
value = 0;
};
class Enabled {
default = 1;
name = "$STR_ACE_NameTags_Enabled";
value = 1;
};
class OnlyCursor {
name = "$STR_ACE_NameTags_OnlyCursor";
value = 2;
};
class OnlyOnKeypress {
name = "$STR_ACE_NameTags_OnlyOnKeypress";
value = 3;
};
class OnlyCursorAndKeypress {
name = "$STR_ACE_NameTags_OnlyCursorAndKeypress";
value = 4;
};
};
};
class playerNamesViewDistance {
displayName = "$STR_ACE_NameTags_PlayerNamesViewDistance_DisplayName";
description = "$STR_ACE_NameTags_PlayerNamesViewDistance_Description";
typeName = "NUMBER";
Expand Down
8 changes: 6 additions & 2 deletions addons/nametags/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// by commy2 and esteldunedain
#include "script_component.hpp"

[] call FUNC(initIsSpeaking);
if (GVAR(showPlayerNames) > 0) then {
[] call FUNC(initIsSpeaking);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here; it's probably better to always init this regardless of it's going to be used or not

};

if (!hasInterface) exitWith {};

Expand All @@ -24,4 +26,6 @@ GVAR(ShowNamesTime) = -10;


// Draw handle
addMissionEventHandler ["Draw3D", {_this call FUNC(onDraw3d);}];
if (GVAR(showPlayerNames) > 0 || GVAR(showVehicleCrewInfo)) then {
addMissionEventHandler ["Draw3D", {_this call FUNC(onDraw3d);}];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the GVAR(showPlayerNames) is initially zero and you turn it on later, they won't draw due to draw3d eh not being installed.

You need to monitor the "SettingsChanged" EH to check for that happening and add remove the Draw3D event accordingly. Check viewdistance for a possible implementation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

};
3 changes: 2 additions & 1 deletion addons/nametags/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class CfgPatches {
};

#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
#include "ACE_Settings.hpp"
#include "CfgVehicles.hpp"

#include <RscTitles.hpp>
5 changes: 3 additions & 2 deletions addons/nametags/functions/fnc_moduleNameTags.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ if !(_activated) exitWith {};

GVAR(Module) = true;

[_logic, QGVAR(PlayerNamesViewDistance), "PlayerNamesViewDistance" ] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(showPlayerNames), "showPlayerNames" ] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(playerNamesViewDistance), "playerNamesViewDistance" ] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(ShowNamesForAI), "ShowNamesForAI" ] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(showVehicleCrewInfo), "showVehicleCrewInfo" ] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(showCursorTagForVehicles), "showCursorTagForVehicles" ] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(showCursorTagForVehicles), "showCursorTagForVehicles" ] call EFUNC(common,readSettingFromModule);

diag_log text "[ACE]: NameTags Module Initialized.";
18 changes: 9 additions & 9 deletions addons/nametags/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -161,36 +161,36 @@
<English></English>
<Polish>Moduł ten pozwala dostosować ustawienia i zasięg wyświetlania imion.</Polish>
</Key>
<Key ID="STR_ACE_Common_Disabled">
<Key ID="STR_ACE_NameTags_Disabled">
<English>Disabled</English>
<Polish>Wyłączone</Polish>
</Key>
<Key ID="STR_ACE_Common_Enabled">
<Key ID="STR_ACE_NameTags_Enabled">
<English>Enabled</English>
<Polish>Włączone</Polish>
</Key>
<Key ID="STR_ACE_Common_OnlyCursor">
<Key ID="STR_ACE_NameTags_OnlyCursor">
<English>Only Cursor</English>
<Polish>Tylko pod kursorem</Polish>
</Key>
<Key ID="STR_ACE_Common_OnlyOnKeypress">
<Key ID="STR_ACE_NameTags_OnlyOnKeypress">
<English>Only On Keypress</English>
<Polish>Tylko po wciśnięciu klawisza</Polish>
</Key>
<Key ID="STR_ACE_Common_OnlyCursorAndKeyPress">
<English>Only Cursor and KeyPress</English>
<Key ID="STR_ACE_NameTags_OnlyCursorAndKeypress">
<English>Only Cursor and Keypress</English>
<Polish>Tylko pod kursorem i po wciśnięciu klawisza</Polish>
</Key>
<Key ID="STR_ACE_Common_NameTagSettings">
<Key ID="STR_ACE_NameTags_NameTagSettings">
<English>Use Nametag settings</English>
<Polish>Użyj ustawień imion</Polish>
</Key>
<Key ID="STR_ACE_Common_AlwaysShowAll">
<Key ID="STR_ACE_NameTags_AlwaysShowAll">
<English>Always Show All</English>
<Polish>Zawsze pokazuj wszystkie</Polish>
</Key>
<Key ID="STR_ACE_NameTags_ShowPlayerNames_Desc">
<English></English>
<English>Show player names and set their activation. Default: Enabled</English>
<Polish>Opcja ta pozwala dostosować sposób wyświetlania imion nad głowami graczy. Opcja "Tylko po wciśnięciu klawisza" wyświetla imiona tylko przytrzymania klawisza "Modyfikator" dostępnego w menu ustawień addonów -> ACE3.</Polish>
</Key>
<Key ID="STR_ACE_NameTags_ShowSoundWaves_Desc">
Expand Down