Skip to content

Commit

Permalink
Radar - Fix speaking icon being stuck (#182)
Browse files Browse the repository at this point in the history
* move tfar OnSpeak eh register to post init

* up version

* adapt read me
  • Loading branch information
diwako authored Apr 17, 2021
1 parent 529ce11 commit de88517
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 185 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A strong point of this UI is its customizability and its many features are all s
## Supported mods
- ACE 3
- ACRE
- TFAR (1.0 Beta)
- TFAR (Both versions)

## Features
#### Scaling
Expand Down
132 changes: 66 additions & 66 deletions addons/buddy/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
#include "script_component.hpp"

if !(hasInterface) exitWith {};

private _labelAdd = localize "STR_dui_buddy_action";
private _labelRemove = localize "STR_dui_buddy_action_remove";
private _range = 10;
if (isNil "ace_interact_menu_fnc_createAction") then {
[[_labelAdd, {
[player, cursorObject] call FUNC(pairBuddies);
}, [], -5000, false, true, "", format ["cursorObject distance2d player <= %1 && {cursorObject in (units group player) && {(player getVariable ['%2', objNull]) isNotEqualTo cursorObject}}", _range, QGVAR(buddy)]]] call CBA_fnc_addPlayerAction;

[[_labelRemove, {
[player, cursorObject, false] call FUNC(pairBuddies);
}, [], -5000, false, true, "", format ["cursorObject distance2d player <= %1 && {cursorObject in (units group player) && {(player getVariable ['%2', objNull]) isEqualTo cursorObject}}", _range, QGVAR(buddy)]]] call CBA_fnc_addPlayerAction;
} else {
// root
private _action = [QGVAR(buddy_action), _labelAdd, "", {
params ["_target", "_player"];
[_player, _target] call FUNC(pairBuddies);
},{params ["_target", "_player"]; !(ace_interaction_EnableTeamManagement && [_player, _target] call ace_interaction_fnc_canJoinTeam) && {_target in (units group _player) && {(_player getVariable [QGVAR(buddy), objNull]) isNotEqualTo _target}}},{},[], [0,0,0], _range] call ace_interact_menu_fnc_createAction;

["CAManBase", 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToClass;

_action = [QGVAR(buddy_action_remove), _labelRemove, "", {
params ["_target", "_player"];
[_player, _target, false] call FUNC(pairBuddies);
},{params ["_target", "_player"]; !(ace_interaction_EnableTeamManagement && [_player, _target] call ace_interaction_fnc_canJoinTeam) && {_target in (units group _player) && {(_player getVariable [QGVAR(buddy), objNull]) isEqualTo _target}}},{},[], [0,0,0], _range] call ace_interact_menu_fnc_createAction;

["CAManBase", 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToClass;

_action = [QGVAR(buddy_action_team_remove), _labelRemove, "", {
params ["", "_player"];
[_player, _player getVariable [QGVAR(buddy), objNull], false] call FUNC(pairBuddies);
},{params ["", "_player"]; !ace_interaction_EnableTeamManagement && {!isNull (_player getVariable [QGVAR(buddy), objNull])}},{},[], [0,0,0]] call ace_interact_menu_fnc_createAction;

["CAManBase", 1, ["ACE_SelfActions", "ACE_TeamManagement"], _action, true] call ace_interact_menu_fnc_addActionToClass;

// team management
_action = [QGVAR(buddy_action_team), _labelAdd, "", {
params ["_target", "_player"];
[_player, _target] call FUNC(pairBuddies);
},{params ["_target", "_player"]; (ace_interaction_EnableTeamManagement && [_player, _target] call ace_interaction_fnc_canJoinTeam) && {(_player getVariable [QGVAR(buddy), objNull]) isNotEqualTo _target}},{},[], [0,0,0], _range] call ace_interact_menu_fnc_createAction;

["CAManBase", 0, ["ACE_MainActions", "ACE_TeamManagement"], _action, true] call ace_interact_menu_fnc_addActionToClass;

_action = [QGVAR(buddy_action_team_remove), _labelRemove, "", {
params ["_target", "_player"];
[_player, _target, false] call FUNC(pairBuddies);
},{params ["_target", "_player"]; (ace_interaction_EnableTeamManagement && [_player, _target] call ace_interaction_fnc_canJoinTeam) && {(_player getVariable [QGVAR(buddy), objNull]) isEqualTo _target}},{},[], [0,0,0], _range] call ace_interact_menu_fnc_createAction;

["CAManBase", 0, ["ACE_MainActions", "ACE_TeamManagement"], _action, true] call ace_interact_menu_fnc_addActionToClass;

_action = [QGVAR(buddy_action_team_remove), _labelRemove, "", {
params ["", "_player"];
[_player, _player getVariable [QGVAR(buddy), objNull], false] call FUNC(pairBuddies);
},{params ["", "_player"]; ace_interaction_EnableTeamManagement && {!isNull (_player getVariable [QGVAR(buddy), objNull])}},{},[], [0,0,0]] call ace_interact_menu_fnc_createAction;

["CAManBase", 1, ["ACE_SelfActions", "ACE_TeamManagement"], _action, true] call ace_interact_menu_fnc_addActionToClass;
};

player addEventHandler ["Respawn", {
params ["_new", "_old"];
[_old, _old getVariable [QGVAR(buddy), objNull], false] call FUNC(pairBuddies);
_new setVariable [QGVAR(buddy), nil, true];
}];
#include "script_component.hpp"

if !(hasInterface) exitWith {};

private _labelAdd = localize "STR_dui_buddy_action";
private _labelRemove = localize "STR_dui_buddy_action_remove";
private _range = 10;
if (isNil "ace_interact_menu_fnc_createAction") then {
[[_labelAdd, {
[player, cursorObject] call FUNC(pairBuddies);
}, [], -5000, false, true, "", format ["cursorObject distance2d player <= %1 && {cursorObject in (units group player) && {(player getVariable ['%2', objNull]) isNotEqualTo cursorObject}}", _range, QGVAR(buddy)]]] call CBA_fnc_addPlayerAction;

[[_labelRemove, {
[player, cursorObject, false] call FUNC(pairBuddies);
}, [], -5000, false, true, "", format ["cursorObject distance2d player <= %1 && {cursorObject in (units group player) && {(player getVariable ['%2', objNull]) isEqualTo cursorObject}}", _range, QGVAR(buddy)]]] call CBA_fnc_addPlayerAction;
} else {
// root
private _action = [QGVAR(buddy_action), _labelAdd, "", {
params ["_target", "_player"];
[_player, _target] call FUNC(pairBuddies);
},{params ["_target", "_player"]; !(ace_interaction_EnableTeamManagement && [_player, _target] call ace_interaction_fnc_canJoinTeam) && {_target in (units group _player) && {(_player getVariable [QGVAR(buddy), objNull]) isNotEqualTo _target}}},{},[], [0,0,0], _range] call ace_interact_menu_fnc_createAction;

["CAManBase", 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToClass;

_action = [QGVAR(buddy_action_remove), _labelRemove, "", {
params ["_target", "_player"];
[_player, _target, false] call FUNC(pairBuddies);
},{params ["_target", "_player"]; !(ace_interaction_EnableTeamManagement && [_player, _target] call ace_interaction_fnc_canJoinTeam) && {_target in (units group _player) && {(_player getVariable [QGVAR(buddy), objNull]) isEqualTo _target}}},{},[], [0,0,0], _range] call ace_interact_menu_fnc_createAction;

["CAManBase", 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToClass;

_action = [QGVAR(buddy_action_team_remove), _labelRemove, "", {
params ["", "_player"];
[_player, _player getVariable [QGVAR(buddy), objNull], false] call FUNC(pairBuddies);
},{params ["", "_player"]; !ace_interaction_EnableTeamManagement && {!isNull (_player getVariable [QGVAR(buddy), objNull])}},{},[], [0,0,0]] call ace_interact_menu_fnc_createAction;

["CAManBase", 1, ["ACE_SelfActions", "ACE_TeamManagement"], _action, true] call ace_interact_menu_fnc_addActionToClass;

// team management
_action = [QGVAR(buddy_action_team), _labelAdd, "", {
params ["_target", "_player"];
[_player, _target] call FUNC(pairBuddies);
},{params ["_target", "_player"]; (ace_interaction_EnableTeamManagement && [_player, _target] call ace_interaction_fnc_canJoinTeam) && {(_player getVariable [QGVAR(buddy), objNull]) isNotEqualTo _target}},{},[], [0,0,0], _range] call ace_interact_menu_fnc_createAction;

["CAManBase", 0, ["ACE_MainActions", "ACE_TeamManagement"], _action, true] call ace_interact_menu_fnc_addActionToClass;

_action = [QGVAR(buddy_action_team_remove), _labelRemove, "", {
params ["_target", "_player"];
[_player, _target, false] call FUNC(pairBuddies);
},{params ["_target", "_player"]; (ace_interaction_EnableTeamManagement && [_player, _target] call ace_interaction_fnc_canJoinTeam) && {(_player getVariable [QGVAR(buddy), objNull]) isEqualTo _target}},{},[], [0,0,0], _range] call ace_interact_menu_fnc_createAction;

["CAManBase", 0, ["ACE_MainActions", "ACE_TeamManagement"], _action, true] call ace_interact_menu_fnc_addActionToClass;

_action = [QGVAR(buddy_action_team_remove), _labelRemove, "", {
params ["", "_player"];
[_player, _player getVariable [QGVAR(buddy), objNull], false] call FUNC(pairBuddies);
},{params ["", "_player"]; ace_interaction_EnableTeamManagement && {!isNull (_player getVariable [QGVAR(buddy), objNull])}},{},[], [0,0,0]] call ace_interact_menu_fnc_createAction;

["CAManBase", 1, ["ACE_SelfActions", "ACE_TeamManagement"], _action, true] call ace_interact_menu_fnc_addActionToClass;
};

player addEventHandler ["Respawn", {
params ["_new", "_old"];
[_old, _old getVariable [QGVAR(buddy), objNull], false] call FUNC(pairBuddies);
_new setVariable [QGVAR(buddy), nil, true];
}];
2 changes: 1 addition & 1 deletion addons/main/script_version.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define MAJOR 1
#define MINOR 9
#define PATCHLVL 0
#define PATCHLVL 1
#define BUILD 1
9 changes: 9 additions & 0 deletions addons/radar/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ if (isClass(configfile >> "CfgPatches" >> "ace_finger")) then {
};

if (isClass (configFile >> "CfgPatches" >> "task_force_radio")) then {
[QGVAR(OnSpeak), "OnSpeak", {
params ["_unit", "_isSpeaking"];
if !(_isSpeaking) exitWith {
_unit setVariable [QGVAR(isSpeaking), nil];
};
if (GVAR(showSpeaking_radioOnly)) exitWith {};
_unit setVariable [QGVAR(isSpeaking), 1];
}, objNull] call TFAR_fnc_addEventHandler;

[[], {
if !(hasInterface && {isNil QGVAR(onTangent)}) exitWith {};
private _eventId = [QGVAR(onTangent), "onTangent", {
Expand Down
9 changes: 0 additions & 9 deletions addons/radar/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -620,15 +620,6 @@ if !(hasInterface) exitWith {};
}] call CBA_fnc_addKeybind;

if (_tfar) then {
[QGVAR(OnSpeak), "OnSpeak", {
params ["_unit", "_isSpeaking"];
if !(_isSpeaking) exitWith {
_unit setVariable [QGVAR(isSpeaking), nil];
};
if (GVAR(showSpeaking_radioOnly)) exitWith {};
_unit setVariable [QGVAR(isSpeaking), 1];
}, objNull] call TFAR_fnc_addEventHandler;

/* This is a custom event made by DUI not by TFAR!
* In TFAR the client's game has no idea if the one unit speaking is speaking locally or over radio.
* The OnSpeak event also appears to be delayed after the onTangent event...
Expand Down
16 changes: 8 additions & 8 deletions addons/radar/functions/fnc_getCompass.sqf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "script_component.hpp"
params ["_unit"];

private _array = (assignedItems _unit) arrayIntersect GVAR(compassWhitelist);
if (_array isNotEqualTo []) exitWith {
_array select 0
};
""
#include "script_component.hpp"
params ["_unit"];

private _array = (assignedItems _unit) arrayIntersect GVAR(compassWhitelist);
if (_array isNotEqualTo []) exitWith {
_array select 0
};
""
94 changes: 47 additions & 47 deletions addons/radar/functions/fnc_incomingFinger.sqf
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
#include "script_component.hpp"

params ["", "_fingerPosPrecise"];
private _player = call CBA_fnc_currentUnit;
if !(GVAR(ace_finger) && // ace finger enabled
{[_player] call EFUNC(main,canHudBeShown) && // hud can be shown
{diwako_dui_enable_compass && // compass is enabled
{ // hide compass when alone enabled and alone in group
(!diwako_dui_compass_hide_alone_group) || {(units group _player) isNotEqualTo [_player] && {diwako_dui_compass_hide_alone_group}}
}}}) exitWith {};
private _texture = GVAR(pointerPaths) getVariable GVAR(pointer_style);
if (isNil "_texture") exitWith {
[["DUI ACE Pointing", 2], ["No texture return for pointer style"], [GVAR(pointer_style)]] call CBA_fnc_notify;
};

private _display = uiNamespace getVariable ["diwako_dui_RscCompass", displayNull];
if (isNull _display) exitWith {};

private _ctrlHeight = pixelH * GVAR(uiPixels);
private _ctrlWidth = pixelW * GVAR(uiPixels);
private _ctrlMiddleX = 0.5 - (pixelW * (GVAR(uiPixels) / 2));
private _compassY = safeZoneY + safeZoneH - (pixelH * (GVAR(uiPixels) + 10));

if (diwako_dui_use_layout_editor) then {
_ctrlMiddleX = profileNamespace getVariable ["igui_diwako_dui_compass_x", _ctrlMiddleX];
_compassY = profileNamespace getVariable ["igui_diwako_dui_compass_y", _compassY];
_ctrlWidth = profileNamespace getVariable ["igui_diwako_dui_compass_w", _ctrlWidth];
_ctrlHeight = profileNamespace getVariable ["igui_diwako_dui_compass_h", _ctrlHeight];
};

private _pointer = _display ctrlCreate ["RscPicture", -1];
_pointer ctrlSetPosition [
_ctrlMiddleX,
_compassY,
_ctrlWidth,
_ctrlHeight
];
_pointer ctrlSetTextColor GVAR(pointer_color);
_pointer ctrlSetText _texture;
_pointer ctrlCommit 0;

private _setting = [_pointer, _fingerPosPrecise];
GVAR(pointers) pushBack _setting;

[{
ctrlDelete _this;
}, _pointer, 2] call CBA_fnc_waitAndExecute;
#include "script_component.hpp"

params ["", "_fingerPosPrecise"];
private _player = call CBA_fnc_currentUnit;
if !(GVAR(ace_finger) && // ace finger enabled
{[_player] call EFUNC(main,canHudBeShown) && // hud can be shown
{diwako_dui_enable_compass && // compass is enabled
{ // hide compass when alone enabled and alone in group
(!diwako_dui_compass_hide_alone_group) || {(units group _player) isNotEqualTo [_player] && {diwako_dui_compass_hide_alone_group}}
}}}) exitWith {};
private _texture = GVAR(pointerPaths) getVariable GVAR(pointer_style);
if (isNil "_texture") exitWith {
[["DUI ACE Pointing", 2], ["No texture return for pointer style"], [GVAR(pointer_style)]] call CBA_fnc_notify;
};

private _display = uiNamespace getVariable ["diwako_dui_RscCompass", displayNull];
if (isNull _display) exitWith {};

private _ctrlHeight = pixelH * GVAR(uiPixels);
private _ctrlWidth = pixelW * GVAR(uiPixels);
private _ctrlMiddleX = 0.5 - (pixelW * (GVAR(uiPixels) / 2));
private _compassY = safeZoneY + safeZoneH - (pixelH * (GVAR(uiPixels) + 10));

if (diwako_dui_use_layout_editor) then {
_ctrlMiddleX = profileNamespace getVariable ["igui_diwako_dui_compass_x", _ctrlMiddleX];
_compassY = profileNamespace getVariable ["igui_diwako_dui_compass_y", _compassY];
_ctrlWidth = profileNamespace getVariable ["igui_diwako_dui_compass_w", _ctrlWidth];
_ctrlHeight = profileNamespace getVariable ["igui_diwako_dui_compass_h", _ctrlHeight];
};

private _pointer = _display ctrlCreate ["RscPicture", -1];
_pointer ctrlSetPosition [
_ctrlMiddleX,
_compassY,
_ctrlWidth,
_ctrlHeight
];
_pointer ctrlSetTextColor GVAR(pointer_color);
_pointer ctrlSetText _texture;
_pointer ctrlCommit 0;

private _setting = [_pointer, _fingerPosPrecise];
GVAR(pointers) pushBack _setting;

[{
ctrlDelete _this;
}, _pointer, 2] call CBA_fnc_waitAndExecute;
106 changes: 53 additions & 53 deletions addons/radar/functions/fnc_sortNameList.sqf
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
#include "script_component.hpp"

params ["_grp", "_player"];

private _newGrp = + _grp;
private _sqlFirst = GVAR(sqlFirst);
private _sql = objNull;
if (_sqlFirst) then {
_sql = leader _player;
_newGrp = _newGrp - [_sql];
};

private _nameSpace = GVAR(sortNamespace);

switch (GVAR(sortType)) do {
case "name": {
_newGrp = _newGrp apply { [_x getVariable [QEGVAR(main,customName), name _x], _x] };
_newGrp sort true;
_newGrp = _newGrp apply { _x select 1 };
};
case "fireteam": {
_newGrp = _newGrp apply { [_nameSpace getVariable [[assignedTeam _x] param [0, "MAIN"], 9999], _x getVariable [QEGVAR(main,customName), name _x], _x] };
_newGrp sort true;
_newGrp = _newGrp apply { _x select 2 };
};
case "fireteam2": {
_newGrp = _newGrp apply { [_nameSpace getVariable [[assignedTeam _x] param [0, "MAIN"], 9999], _nameSpace getVariable [rank _x, 9999], _x getVariable [QEGVAR(main,customName), name _x], _x] };
_newGrp sort true;
_newGrp = _newGrp apply { _x select 3 };
};
case "rank": {
_newGrp = _newGrp apply { [_nameSpace getVariable [rank _x, 9999], _x getVariable [QEGVAR(main,customName), name _x], _x] };
_newGrp sort true;
_newGrp = _newGrp apply { _x select 2 };
};
case "custom": {
if (!isNil QGVAR(customSort) && {GVAR(customSort) isEqualType {}}) then {
private _customGrp = [_newGrp, _player] call GVAR(customSort);
if (!isNil "_customGrp" && {_customGrp isEqualType [] && { !((_customGrp select 0) isEqualType []) && {(_customGrp select 0) isKindOf "CAManBase"}}}) then {
_newGrp = _customGrp;
} else {
[["DUI Custom Sorting Code", 2], ["Return type is incorrect!"], ["CAManBase object expected as first entry of array!"]] call CBA_fnc_notify;
};
};
};
default { };
};

if (_sqlFirst) then {
_newGrp = [_sql] + _newGrp;
};

_newGrp
#include "script_component.hpp"

params ["_grp", "_player"];

private _newGrp = + _grp;
private _sqlFirst = GVAR(sqlFirst);
private _sql = objNull;
if (_sqlFirst) then {
_sql = leader _player;
_newGrp = _newGrp - [_sql];
};

private _nameSpace = GVAR(sortNamespace);

switch (GVAR(sortType)) do {
case "name": {
_newGrp = _newGrp apply { [_x getVariable [QEGVAR(main,customName), name _x], _x] };
_newGrp sort true;
_newGrp = _newGrp apply { _x select 1 };
};
case "fireteam": {
_newGrp = _newGrp apply { [_nameSpace getVariable [[assignedTeam _x] param [0, "MAIN"], 9999], _x getVariable [QEGVAR(main,customName), name _x], _x] };
_newGrp sort true;
_newGrp = _newGrp apply { _x select 2 };
};
case "fireteam2": {
_newGrp = _newGrp apply { [_nameSpace getVariable [[assignedTeam _x] param [0, "MAIN"], 9999], _nameSpace getVariable [rank _x, 9999], _x getVariable [QEGVAR(main,customName), name _x], _x] };
_newGrp sort true;
_newGrp = _newGrp apply { _x select 3 };
};
case "rank": {
_newGrp = _newGrp apply { [_nameSpace getVariable [rank _x, 9999], _x getVariable [QEGVAR(main,customName), name _x], _x] };
_newGrp sort true;
_newGrp = _newGrp apply { _x select 2 };
};
case "custom": {
if (!isNil QGVAR(customSort) && {GVAR(customSort) isEqualType {}}) then {
private _customGrp = [_newGrp, _player] call GVAR(customSort);
if (!isNil "_customGrp" && {_customGrp isEqualType [] && { !((_customGrp select 0) isEqualType []) && {(_customGrp select 0) isKindOf "CAManBase"}}}) then {
_newGrp = _customGrp;
} else {
[["DUI Custom Sorting Code", 2], ["Return type is incorrect!"], ["CAManBase object expected as first entry of array!"]] call CBA_fnc_notify;
};
};
};
default { };
};

if (_sqlFirst) then {
_newGrp = [_sql] + _newGrp;
};

_newGrp

0 comments on commit de88517

Please sign in to comment.