diff --git a/addons/radiodirectionfinder/CfgVehicles.hpp b/addons/radiodirectionfinder/CfgVehicles.hpp index 019802c252..d67cfeb37b 100644 --- a/addons/radiodirectionfinder/CfgVehicles.hpp +++ b/addons/radiodirectionfinder/CfgVehicles.hpp @@ -5,9 +5,9 @@ class CfgVehicles { class Bag_Base; class GVAR(backpack): Bag_Base { scope = 2; - displayName = "PRD-13 Radio Direction Finder"; + displayName = CSTRING(backpack_displayName); author = ECSTRING(common,aceteam); - model = "z\ace\addons\radiodirectionfinder\data\ace_antennaBackpack"; + model = QPATHTOF(data\ace_antennaBackpack); maximumLoad = 50; mass = 100; }; @@ -23,7 +23,7 @@ class CfgVehicles { scope = 1; }; class ACE_transmitter_406MHz: ACE_transmitter_base { - displayName = "[ACE] Transmitter 406MHz"; + displayName = CSTRING(locatorBeacon406); GVAR(freq) = 406; GVAR(power) = 5000; }; @@ -33,23 +33,21 @@ class CfgVehicles { class CAManBase: Man { class ACE_SelfActions { class ACE_Equipment { - class GVAR(open) { // Opens the dialog - // displayName = CSTRING(configure); - displayName = "RDF: Open"; + class GVAR(open) { // Opens the interactive dialog + displayName = CSTRING(openRDF); condition = QUOTE(_player call FUNC(displayCondition)); + // open with execNextFrame to prevent problems with interaction menu closing dialog statement = QUOTE([ARR_2(FUNC(toggleDisplayMode),[DISPLAY_MODE_DIALOG])] call CBA_fnc_execNextFrame); // icon = QPATHTOF(UI\icon_android.paa); exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"}; class GVAR(show) { // Opens the display - // displayName = CSTRING(show); - displayName = "Show"; + displayName = "$STR_DISP_SHOW"; condition = QUOTE(GVAR(currentShowMode) != DISPLAY_MODE_DISPLAY); statement = QUOTE([DISPLAY_MODE_DISPLAY] call FUNC(toggleDisplayMode)); exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"}; }; - class GVAR(close) { - // displayName = CSTRING(closeUnit); - displayName = "Close"; + class GVAR(hide) { + displayName = "$STR_DISP_HIDE"; condition = QUOTE(GVAR(currentShowMode) != DISPLAY_MODE_CLOSED); statement = QUOTE([DISPLAY_MODE_CLOSED] call FUNC(toggleDisplayMode)); exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"}; diff --git a/addons/radiodirectionfinder/CfgWeapons.hpp b/addons/radiodirectionfinder/CfgWeapons.hpp index d0da623c02..8220f90143 100644 --- a/addons/radiodirectionfinder/CfgWeapons.hpp +++ b/addons/radiodirectionfinder/CfgWeapons.hpp @@ -6,13 +6,11 @@ class CfgWeapons { ACE_attachable = "ACE_transmitter_406MHz"; // the CfgVehicle author = ECSTRING(common,ACETeam); scope = 2; - // displayName = CSTRING(IrStrobe_Name); - displayName = "[ACE] 406MHz Locator Bacon"; - // descriptionShort = CSTRING(IrStrobe_Description); - descriptionShort = "Attach to activate"; - // model = QPATHTOF(data\x.p3d); + displayName = CSTRING(locatorBeacon406); + descriptionShort = CSTRING(locatorAttachToActivate); + // model = QPATHTOF(data\x.p3d); // todo? model = "\A3\Structures_F\Items\Tools\MultiMeter_F.p3d"; - // picture = QPATHTOF(UI\irstrobe_item.paa); + // picture = QPATHTOF(UI\irstrobe_item.paa); // todo class ItemInfo: CBA_MiscItem_ItemInfo { mass = 1; }; diff --git a/addons/radiodirectionfinder/XEH_PREP.hpp b/addons/radiodirectionfinder/XEH_PREP.hpp index d5f4df2905..ba3e818ea7 100644 --- a/addons/radiodirectionfinder/XEH_PREP.hpp +++ b/addons/radiodirectionfinder/XEH_PREP.hpp @@ -1,8 +1,8 @@ LOG("prep"); PREP(addSignal); -PREP(beaconCleanup); -PREP(beaconInit); +PREP(beaconCleanupServer); +PREP(beaconInitServer); PREP(createGUI); PREP(displayCondition); PREP(getSignals); diff --git a/addons/radiodirectionfinder/XEH_postInit.sqf b/addons/radiodirectionfinder/XEH_postInit.sqf index fe855a1d34..eaf300e779 100644 --- a/addons/radiodirectionfinder/XEH_postInit.sqf +++ b/addons/radiodirectionfinder/XEH_postInit.sqf @@ -5,13 +5,13 @@ if (GVAR(showUAV)) then { GVAR(signalSourceFuncs) pushBack LINKFUNC(getSignalsUAV); }; - if ((isClass (configFile >> "CfgPatches" >> "acre_sys_core")) && GVAR(showACRE)) then { + if ((isClass (configFile >> "CfgPatches" >> "acre_sys_core")) && {missionNamespace getVariable [QGVAR(showACRE), false]}) then { GVAR(signalSourceFuncs) pushBack LINKFUNC(getSignalsACRE); }; }] call CBA_fnc_addEventHandler; if (isServer) then { - ["ACE_transmitter_base", "init", FUNC(beaconInit), true, [], true] call CBA_fnc_addClassEventHandler; + ["ACE_transmitter_base", "init", FUNC(beaconInitServer), true, [], true] call CBA_fnc_addClassEventHandler; [QGVAR(getUavFreq), { params ["_uav"]; if (!isNil {_uav getVariable QGVAR(freqMhz)}) exitWith {TRACE_1("getUavFreq - already set",_uav);}; @@ -37,8 +37,8 @@ private _closeCode = { if (GVAR(currentShowMode) == DISPLAY_MODE_CLOSED) exitWith {}; [DISPLAY_MODE_CLOSED] call FUNC(toggleDisplayMode); }; -// [(localize LSTRING(itemName)), QPATHTOF(images\x_item.paa), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew); -["RDF", "", _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew); +// ToDo: IconImage +[LLSTRING(backpack_displayName), "", _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew); #ifdef DEBUG_MODE_FULL diff --git a/addons/radiodirectionfinder/functions/fnc_addSignal.sqf b/addons/radiodirectionfinder/functions/fnc_addSignal.sqf index 8b83d49b48..999d68d8cb 100644 --- a/addons/radiodirectionfinder/functions/fnc_addSignal.sqf +++ b/addons/radiodirectionfinder/functions/fnc_addSignal.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* * Author: PabstMirror - * Adds a scripted signal + * Adds a scripted signal (Server only) * * Arguments: * 0: Source or @@ -17,7 +17,7 @@ * Public: Yes */ -if (!isServer) exitWith {}; +if (!isServer) exitWith { WARNING_1("addSignal only has effect when called on server - %1",_this); }; params [["_object", objNull, [objNull, []]], ["_freqMHz", 0, [0]], ["_powerMW", 0, [0]]]; TRACE_3("addSignal",_object,_freqMHz,_powerMW); diff --git a/addons/radiodirectionfinder/functions/fnc_beaconCleanup.sqf b/addons/radiodirectionfinder/functions/fnc_beaconCleanupServer.sqf similarity index 87% rename from addons/radiodirectionfinder/functions/fnc_beaconCleanup.sqf rename to addons/radiodirectionfinder/functions/fnc_beaconCleanupServer.sqf index d5f9d62eab..0c465772c8 100644 --- a/addons/radiodirectionfinder/functions/fnc_beaconCleanup.sqf +++ b/addons/radiodirectionfinder/functions/fnc_beaconCleanupServer.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* * Author: PabstMirror - * (Server Only) + * Cleans up beacon on delete or killed (Server Only) * * Arguments: * None @@ -10,7 +10,7 @@ * None * * Example: - * [] call ace_radiodirectionfinder_fnc_beaconCleanup + * [] call ace_radiodirectionfinder_fnc_beaconCleanupServer * * Public: No */ @@ -18,7 +18,6 @@ TRACE_1("beaconCleanup",_this); [{ - private _removed = false; private _list = missionNamespace getVariable [QGVAR(signalList), []]; private _countStart = count _list; _list = _list select { // select if array or alive or just not-null (if not a transmitter) diff --git a/addons/radiodirectionfinder/functions/fnc_beaconInit.sqf b/addons/radiodirectionfinder/functions/fnc_beaconInitServer.sqf similarity index 52% rename from addons/radiodirectionfinder/functions/fnc_beaconInit.sqf rename to addons/radiodirectionfinder/functions/fnc_beaconInitServer.sqf index fd60ca4288..62f38a3789 100644 --- a/addons/radiodirectionfinder/functions/fnc_beaconInit.sqf +++ b/addons/radiodirectionfinder/functions/fnc_beaconInitServer.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* * Author: PabstMirror - * (Server Only) + * Handles beacon init and adds to signal list globally (Server Only) * * Arguments: * 0: Beacon @@ -10,20 +10,20 @@ * None * * Example: - * [] call ace_radiodirectionfinder_fnc_beaconInit + * [x] call ace_radiodirectionfinder_fnc_beaconInitServer * * Public: No */ params ["_beacon"]; -if (!alive _beacon) exitWith { TRACE_1("beaconInit - dead",_this); }; +if (!alive _beacon) exitWith { TRACE_1("beaconInit - not dead",_this); }; private _typeOf = typeOf _beacon; private _freqMHz = getNumber (configFile >> "CfgVehicles" >> _typeOf >> QGVAR(freq)); private _powerMW = getNumber (configFile >> "CfgVehicles" >> _typeOf >> QGVAR(power)); -TRACE_4("beaconInit",_beacon,_typeOf,_freqMHz,_powerMW); +TRACE_4("beaconInitServer",_beacon,_typeOf,_freqMHz,_powerMW); [_beacon, _freqMHz, _powerMW] call FUNC(addSignal); -_beacon addEventHandler ["Killed", {call FUNC(beaconCleanup)}]; -_beacon addEventHandler ["Deleted", {call FUNC(beaconCleanup)}]; +_beacon addEventHandler ["Killed", {call FUNC(beaconCleanupServer)}]; +_beacon addEventHandler ["Deleted", {call FUNC(beaconCleanupServer)}]; diff --git a/addons/radiodirectionfinder/functions/fnc_displayCondition.sqf b/addons/radiodirectionfinder/functions/fnc_displayCondition.sqf index 7e72d15410..96d4ac88e7 100644 --- a/addons/radiodirectionfinder/functions/fnc_displayCondition.sqf +++ b/addons/radiodirectionfinder/functions/fnc_displayCondition.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* * Author: PabstMirror -* +* Condition for showing the RDF interface * * Arguments: * 0: vehicle that it will be attached to (player or vehicle) @@ -15,7 +15,7 @@ * Public: No */ -params ["_unit"]; +params ["_player"]; -(alive _unit) -&& {(backpack _unit) == QGVAR(backpack)} +((backpack _player) == QGVAR(backpack)) +&& {alive _player} diff --git a/addons/radiodirectionfinder/functions/fnc_updateDisplayAnim.sqf b/addons/radiodirectionfinder/functions/fnc_updateDisplayAnim.sqf index 31ed958dfa..81eddd41b2 100644 --- a/addons/radiodirectionfinder/functions/fnc_updateDisplayAnim.sqf +++ b/addons/radiodirectionfinder/functions/fnc_updateDisplayAnim.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* * Author: PabstMirror - * Updates the display (several times a second) called from the pfeh + * Updates the display's position (several times a second) called from the pfeh * * Arguments: * None diff --git a/addons/radiodirectionfinder/functions/fnc_updatePFEH.sqf b/addons/radiodirectionfinder/functions/fnc_updatePFEH.sqf index 7d99d491f2..964be62d65 100644 --- a/addons/radiodirectionfinder/functions/fnc_updatePFEH.sqf +++ b/addons/radiodirectionfinder/functions/fnc_updatePFEH.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* * Author: PabstMirror - * Updates the display (several times a second) called from the pfeh + * Main PFEH, runs while display or dialog is open * * Arguments: * None @@ -19,7 +19,7 @@ private _unit = ace_player; private _backpackObject = backpackContainer _unit; if (!([_unit] call FUNC(displayCondition))) exitWith { - TRACE_2("displayCondition failed",_unit,_backpackObject); + TRACE_2("displayCondition failed",_unit,typeOf _backpackObject); [DISPLAY_MODE_CLOSED] call FUNC(toggleDisplayMode); }; @@ -28,27 +28,28 @@ _args params ["_deltaTime"]; _deltaTime = CBA_missionTime - _deltaTime; _args set [0, CBA_missionTime]; -private _canShow = [_unit, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith); +private _canInteract = [_unit, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith); private _display = displayNull; private _shown = false; if (GVAR(currentShowMode) == DISPLAY_MODE_DISPLAY) then { _display = uiNamespace getVariable [QGVAR(display), displayNull]; - private _desiredPhase = if (_canShow && {cameraView != "GUNNER"} && {EGVAR(interact_menu,openedMenuType) < 0}) then { + private _desiredPhase = if (_canInteract && {cameraView != "GUNNER"} && {EGVAR(interact_menu,openedMenuType) < 0}) then { + // Can interact, not in gunner view and don't have interaction menu open - show more if weapon lowered if (weaponLowered _unit) then { 0.9 } else { 0.75 }; } else { - 0 + 0 // hide it }; _shown = [_display, _desiredPhase, _deltaTime] call FUNC(updateDisplayAnim); } else { _display = uiNamespace getVariable [QGVAR(dialog), displayNull]; - if ((!_canShow) || {isNull _display}) exitWith { [DISPLAY_MODE_DISPLAY, 1] call FUNC(toggleDisplayMode); }; + if ((!_canInteract) || {isNull _display}) exitWith { [DISPLAY_MODE_DISPLAY, 1] call FUNC(toggleDisplayMode); }; _shown = [_display, 1, _deltaTime] call FUNC(updateDisplayAnim); }; if (!_shown) exitWith {}; if (GVAR(nextGuiUpate) > CBA_missionTime) exitWith {}; -GVAR(nextGuiUpate) = CBA_missionTime + 0.1; +GVAR(nextGuiUpate) = CBA_missionTime + 0.25; BEGIN_COUNTER(hudUpdate); @@ -68,7 +69,7 @@ _ctrlTime ctrlSetText ([daytime, "HH:MM"] call bis_fnc_timeToString); (_display displayCtrl IDC_MENU_BG3) ctrlSetText (["#(argb,8,8,3)color(0.15,0.15,0.15,1)", "#(argb,8,8,3)color(0.5,0.5,0.5,1)"] select (_menuTab == IDC_MENU_BUTTON3)); switch (_menuTab) do { -case (IDC_MENU_BUTTON1): { +case (IDC_MENU_BUTTON1): { // Compas view private _signals = [getPosASL _unit, _currentTargetFreq, 10] call FUNC(getSignals); private _baseDir = getDir _unit; // re-sort by relative dir @@ -86,7 +87,7 @@ case (IDC_MENU_BUTTON1): { private _ctrlCircleDot = _display displayCtrl IDC_MODE1_CIRCLE_DOT; private _primarySignalInfo = []; if (_signals isEqualTo []) then { - _primarySignalInfo pushBack format ["Nothing", _freqMhz]; + _primarySignalInfo pushBack format ["Nothing"]; _ctrlCircleDot ctrlShow false; } else { _ctrlCircleDot ctrlShow true; @@ -111,7 +112,7 @@ case (IDC_MENU_BUTTON1): { }; } forEach _lines; }; -case (IDC_MENU_BUTTON2): { +case (IDC_MENU_BUTTON2): { // Frequency Selections private _signals = [getPosASL _unit, _currentTargetFreq, 10] call FUNC(getSignals); private _ctrlFreqSelectionText = _display displayCtrl IDC_MODE2_FREQ_TEXT; private _currentTargetFreqText = if (_currentTargetFreq > 0) then { format ["%1 MHz",_currentTargetFreq] } else { "Any" }; @@ -123,7 +124,7 @@ case (IDC_MENU_BUTTON2): { private _ctrlResetBackground = _display displayCtrl IDC_MODE2_RESET_BACKGROUND; _ctrlResetBackground ctrlSetText (["#(argb,8,8,3)color(0.2,0.2,0.2,1)", "#(argb,8,8,3)color(0.9,0.1,0.1,1)"] select (_currentTargetFreq > 0)); }; -case (IDC_MENU_BUTTON3): { +case (IDC_MENU_BUTTON3): { // List View private _signals = [getPosASL _unit, 0, 20] call FUNC(getSignals); // no freq filter _signals = _signals apply { _x params ["_rtx", "_freqMhz", "_bearing"]; diff --git a/addons/radiodirectionfinder/script_component.hpp b/addons/radiodirectionfinder/script_component.hpp index 4c12694238..f0a46b4614 100644 --- a/addons/radiodirectionfinder/script_component.hpp +++ b/addons/radiodirectionfinder/script_component.hpp @@ -2,9 +2,9 @@ #define COMPONENT_BEAUTIFIED RadioDirectionFinder #include "\z\ace\addons\main\script_mod.hpp" -// #define DEBUG_MODE_FULL -// #define DISABLE_COMPILE_CACHE -// #define ENABLE_PERFORMANCE_COUNTERS +#define DEBUG_MODE_FULL +#define DISABLE_COMPILE_CACHE +#define ENABLE_PERFORMANCE_COUNTERS #include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/radiodirectionfinder/stringtable.xml b/addons/radiodirectionfinder/stringtable.xml index 80de59a4c1..b0bd025d21 100644 --- a/addons/radiodirectionfinder/stringtable.xml +++ b/addons/radiodirectionfinder/stringtable.xml @@ -1,8 +1,17 @@ - - x + + PRD-13(V)3 Radio Direction Finder + + + Open Radio Direction Finder + + + [ACE] 406MHz Locator Bacon + + + Attach to activate