Changed: Scripted calls to putInEarPlugs/joinTeam won't show hint (#7400)

* Added ability to suppress hint message

* Adjustments based on request
This commit is contained in:
Broström.A | Evul 2020-01-09 21:40:34 +01:00 committed by PabstMirror
parent 36a6c9c2b3
commit 028a0cb3f0
5 changed files with 30 additions and 22 deletions

View File

@ -7,7 +7,7 @@ class CfgVehicles {
displayName = CSTRING(EarPlugs_On);
condition = QUOTE(GVAR(EnableCombatDeafness) && {!([_player] call FUNC(hasEarPlugsIn)) && {'ACE_EarPlugs' in items _player}});
exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting"};
statement = QUOTE( [_player] call FUNC(putInEarPlugs) );
statement = QUOTE( [_player, true] call FUNC(putInEarPlugs) );
showDisabled = 0;
icon = QPATHTOF(UI\ACE_earplugs_x_ca.paa);
};
@ -15,7 +15,7 @@ class CfgVehicles {
displayName = CSTRING(EarPlugs_Off);
condition = QUOTE( GVAR(EnableCombatDeafness) && {[_player] call FUNC(hasEarPlugsIn)});
exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting"};
statement = QUOTE( [_player] call FUNC(removeEarPlugs) );
statement = QUOTE( [_player, true] call FUNC(removeEarPlugs) );
showDisabled = 0;
icon = QPATHTOF(UI\ACE_earplugs_x_ca.paa);
};

View File

@ -5,17 +5,18 @@
*
* Arguments:
* 0: Unit (player) <OBJECT>
* 1: Display hint <BOOL> (default: false)
*
* Return Value:
* None
*
* Example:
* [ace_player] call ace_hearing_fnc_putInEarplugs
* [ace_player, false] call ace_hearing_fnc_putInEarplugs
*
* Public: No
*/
params ["_player"];
params ["_player", ["_displayHint", false, [false]]];
if (!GVAR(EnableCombatDeafness)) exitWith {};
@ -24,7 +25,9 @@ _player removeItem "ACE_EarPlugs";
_player setVariable ["ACE_hasEarPlugsIn", true, true];
if (_displayHint) then {
[localize LSTRING(EarPlugs_Are_On)] call EFUNC(common,displayTextStructured);
};
//Force an immediate fast volume update:
[[true]] call FUNC(updateVolume);

View File

@ -5,17 +5,18 @@
*
* Arguments:
* 0: Unit (player) <OBJECT>
* 1: Display hint <BOOL> (default false)
*
* Return Value:
* None
*
* Example:
* [ace_player] call ace_hearing_fnc_removeEarplugs
* [ace_player, false] call ace_hearing_fnc_removeEarplugs
*
* Public: No
*/
params ["_player"];
params ["_player", ["_displayHint", false, [false]]];
if (!GVAR(EnableCombatDeafness)) exitWith {};
@ -28,7 +29,9 @@ _player addItem "ACE_EarPlugs";
_player setVariable ["ACE_hasEarPlugsIn", false, true];
if (_displayHint) then {
[localize LSTRING(EarPlugs_Are_Off)] call EFUNC(common,displayTextStructured);
};
//Force an immediate fast volume update:
[[true]] call FUNC(updateVolume);

View File

@ -79,7 +79,7 @@ class CfgVehicles {
class ACE_AssignTeamRed {
displayName = CSTRING(AssignTeamRed);
condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam));
statement = QUOTE([ARR_2(_target,'RED')] call DFUNC(joinTeam));
statement = QUOTE([ARR_3(_target,'RED',true)] call DFUNC(joinTeam));
exceptions[] = {"isNotSwimming"};
showDisabled = 1;
icon = QPATHTOF(UI\team\team_red_ca.paa);
@ -87,7 +87,7 @@ class CfgVehicles {
class ACE_AssignTeamGreen {
displayName = CSTRING(AssignTeamGreen);
condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam));
statement = QUOTE([ARR_2(_target,'GREEN')] call DFUNC(joinTeam));
statement = QUOTE([ARR_3(_target,'GREEN',true)] call DFUNC(joinTeam));
exceptions[] = {"isNotSwimming"};
showDisabled = 1;
icon = QPATHTOF(UI\team\team_green_ca.paa);
@ -95,7 +95,7 @@ class CfgVehicles {
class ACE_AssignTeamBlue {
displayName = CSTRING(AssignTeamBlue);
condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam));
statement = QUOTE([ARR_2(_target,'BLUE')] call DFUNC(joinTeam));
statement = QUOTE([ARR_3(_target,'BLUE',true)] call DFUNC(joinTeam));
exceptions[] = {"isNotSwimming"};
showDisabled = 1;
icon = QPATHTOF(UI\team\team_blue_ca.paa);
@ -103,7 +103,7 @@ class CfgVehicles {
class ACE_AssignTeamYellow {
displayName = CSTRING(AssignTeamYellow);
condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam));
statement = QUOTE([ARR_2(_target,'YELLOW')] call DFUNC(joinTeam));
statement = QUOTE([ARR_3(_target,'YELLOW',true)] call DFUNC(joinTeam));
exceptions[] = {"isNotSwimming"};
showDisabled = 1;
icon = QPATHTOF(UI\team\team_yellow_ca.paa);
@ -111,7 +111,7 @@ class CfgVehicles {
class ACE_UnassignTeam {
displayName = CSTRING(LeaveTeam);
condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam) && {assignedTeam _target != 'MAIN'});
statement = QUOTE([ARR_2(_target,'MAIN')] call DFUNC(joinTeam));
statement = QUOTE([ARR_3(_target,'MAIN',true)] call DFUNC(joinTeam));
exceptions[] = {"isNotSwimming"};
showDisabled = 1;
icon = QPATHTOF(UI\team\team_white_ca.paa);
@ -251,7 +251,7 @@ class CfgVehicles {
displayName = CSTRING(JoinTeamRed);
condition = QUOTE(true);
exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"};
statement = QUOTE([ARR_2(_player,'RED')] call DFUNC(joinTeam));
statement = QUOTE([ARR_3(_player,'RED',true)] call DFUNC(joinTeam));
showDisabled = 1;
icon = QPATHTOF(UI\team\team_red_ca.paa);
};
@ -259,7 +259,7 @@ class CfgVehicles {
displayName = CSTRING(JoinTeamGreen);
condition = QUOTE(true);
exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"};
statement = QUOTE([ARR_2(_player,'GREEN')] call DFUNC(joinTeam));
statement = QUOTE([ARR_3(_player,'GREEN',true)] call DFUNC(joinTeam));
showDisabled = 1;
icon = QPATHTOF(UI\team\team_green_ca.paa);
};
@ -267,7 +267,7 @@ class CfgVehicles {
displayName = CSTRING(JoinTeamBlue);
condition = QUOTE(true);
exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"};
statement = QUOTE([ARR_2(_player,'BLUE')] call DFUNC(joinTeam));
statement = QUOTE([ARR_3(_player,'BLUE',true)] call DFUNC(joinTeam));
showDisabled = 1;
icon = QPATHTOF(UI\team\team_blue_ca.paa);
};
@ -275,7 +275,7 @@ class CfgVehicles {
displayName = CSTRING(JoinTeamYellow);
condition = QUOTE(true);
exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"};
statement = QUOTE([ARR_2(_player,'YELLOW')] call DFUNC(joinTeam));
statement = QUOTE([ARR_3(_player,'YELLOW',true)] call DFUNC(joinTeam));
showDisabled = 1;
icon = QPATHTOF(UI\team\team_yellow_ca.paa);
};
@ -283,7 +283,7 @@ class CfgVehicles {
displayName = CSTRING(LeaveTeam);
condition = QUOTE(assignedTeam _player != 'MAIN');
exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting", "isNotOnLadder", "isNotRefueling"};
statement = QUOTE([ARR_2(_player,'MAIN')] call DFUNC(joinTeam));
statement = QUOTE([ARR_3(_player,'MAIN',true)] call DFUNC(joinTeam));
showDisabled = 1;
icon = QPATHTOF(UI\team\team_white_ca.paa);
};

View File

@ -6,17 +6,18 @@
* Arguments:
* 0: Unit <OBJECT>
* 1: Team <STRING>
* 2: Display hint <BOOL> (default: false)
*
* Return Value:
* None
*
* Example:
* [player, "YELLOW"] call ace_interaction_fnc_joinTeam
* [player, "YELLOW", false] call ace_interaction_fnc_joinTeam
*
* Public: No
*/
params ["_unit", "_team"];
params ["_unit", "_team", ["_displayHint", false, [false]]];
["CBA_teamColorChanged", [_unit, _team]] call CBA_fnc_globalEvent;
@ -30,6 +31,7 @@ if (_unit == ACE_player) then {
_team = localize format [LSTRING(Team%1), _team];
_message = format [localize LSTRING(JoinedTeam), _team];
};
if (_displayHint) then {
[_message] call EFUNC(common,displayTextStructured);
};
};