This commit is contained in:
PabstMirror
2019-12-31 20:34:32 -06:00
parent b24e210af2
commit d56eb2c9ca
12 changed files with 60 additions and 55 deletions

View File

@ -5,9 +5,9 @@ class CfgVehicles {
class Bag_Base; class Bag_Base;
class GVAR(backpack): Bag_Base { class GVAR(backpack): Bag_Base {
scope = 2; scope = 2;
displayName = "PRD-13 Radio Direction Finder"; displayName = CSTRING(backpack_displayName);
author = ECSTRING(common,aceteam); author = ECSTRING(common,aceteam);
model = "z\ace\addons\radiodirectionfinder\data\ace_antennaBackpack"; model = QPATHTOF(data\ace_antennaBackpack);
maximumLoad = 50; maximumLoad = 50;
mass = 100; mass = 100;
}; };
@ -23,7 +23,7 @@ class CfgVehicles {
scope = 1; scope = 1;
}; };
class ACE_transmitter_406MHz: ACE_transmitter_base { class ACE_transmitter_406MHz: ACE_transmitter_base {
displayName = "[ACE] Transmitter 406MHz"; displayName = CSTRING(locatorBeacon406);
GVAR(freq) = 406; GVAR(freq) = 406;
GVAR(power) = 5000; GVAR(power) = 5000;
}; };
@ -33,23 +33,21 @@ class CfgVehicles {
class CAManBase: Man { class CAManBase: Man {
class ACE_SelfActions { class ACE_SelfActions {
class ACE_Equipment { class ACE_Equipment {
class GVAR(open) { // Opens the dialog class GVAR(open) { // Opens the interactive dialog
// displayName = CSTRING(configure); displayName = CSTRING(openRDF);
displayName = "RDF: Open";
condition = QUOTE(_player call FUNC(displayCondition)); 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); statement = QUOTE([ARR_2(FUNC(toggleDisplayMode),[DISPLAY_MODE_DIALOG])] call CBA_fnc_execNextFrame);
// icon = QPATHTOF(UI\icon_android.paa); // icon = QPATHTOF(UI\icon_android.paa);
exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"}; exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"};
class GVAR(show) { // Opens the display class GVAR(show) { // Opens the display
// displayName = CSTRING(show); displayName = "$STR_DISP_SHOW";
displayName = "Show";
condition = QUOTE(GVAR(currentShowMode) != DISPLAY_MODE_DISPLAY); condition = QUOTE(GVAR(currentShowMode) != DISPLAY_MODE_DISPLAY);
statement = QUOTE([DISPLAY_MODE_DISPLAY] call FUNC(toggleDisplayMode)); statement = QUOTE([DISPLAY_MODE_DISPLAY] call FUNC(toggleDisplayMode));
exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"}; exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"};
}; };
class GVAR(close) { class GVAR(hide) {
// displayName = CSTRING(closeUnit); displayName = "$STR_DISP_HIDE";
displayName = "Close";
condition = QUOTE(GVAR(currentShowMode) != DISPLAY_MODE_CLOSED); condition = QUOTE(GVAR(currentShowMode) != DISPLAY_MODE_CLOSED);
statement = QUOTE([DISPLAY_MODE_CLOSED] call FUNC(toggleDisplayMode)); statement = QUOTE([DISPLAY_MODE_CLOSED] call FUNC(toggleDisplayMode));
exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"}; exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"};

View File

@ -6,13 +6,11 @@ class CfgWeapons {
ACE_attachable = "ACE_transmitter_406MHz"; // the CfgVehicle ACE_attachable = "ACE_transmitter_406MHz"; // the CfgVehicle
author = ECSTRING(common,ACETeam); author = ECSTRING(common,ACETeam);
scope = 2; scope = 2;
// displayName = CSTRING(IrStrobe_Name); displayName = CSTRING(locatorBeacon406);
displayName = "[ACE] 406MHz Locator Bacon"; descriptionShort = CSTRING(locatorAttachToActivate);
// descriptionShort = CSTRING(IrStrobe_Description); // model = QPATHTOF(data\x.p3d); // todo?
descriptionShort = "Attach to activate";
// model = QPATHTOF(data\x.p3d);
model = "\A3\Structures_F\Items\Tools\MultiMeter_F.p3d"; 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 { class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 1; mass = 1;
}; };

View File

@ -1,8 +1,8 @@
LOG("prep"); LOG("prep");
PREP(addSignal); PREP(addSignal);
PREP(beaconCleanup); PREP(beaconCleanupServer);
PREP(beaconInit); PREP(beaconInitServer);
PREP(createGUI); PREP(createGUI);
PREP(displayCondition); PREP(displayCondition);
PREP(getSignals); PREP(getSignals);

View File

@ -5,13 +5,13 @@
if (GVAR(showUAV)) then { if (GVAR(showUAV)) then {
GVAR(signalSourceFuncs) pushBack LINKFUNC(getSignalsUAV); 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); GVAR(signalSourceFuncs) pushBack LINKFUNC(getSignalsACRE);
}; };
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;
if (isServer) then { 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), { [QGVAR(getUavFreq), {
params ["_uav"]; params ["_uav"];
if (!isNil {_uav getVariable QGVAR(freqMhz)}) exitWith {TRACE_1("getUavFreq - already set",_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 {}; if (GVAR(currentShowMode) == DISPLAY_MODE_CLOSED) exitWith {};
[DISPLAY_MODE_CLOSED] call FUNC(toggleDisplayMode); [DISPLAY_MODE_CLOSED] call FUNC(toggleDisplayMode);
}; };
// [(localize LSTRING(itemName)), QPATHTOF(images\x_item.paa), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew); // ToDo: IconImage
["RDF", "", _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew); [LLSTRING(backpack_displayName), "", _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew);
#ifdef DEBUG_MODE_FULL #ifdef DEBUG_MODE_FULL

View File

@ -1,7 +1,7 @@
#include "script_component.hpp" #include "script_component.hpp"
/* /*
* Author: PabstMirror * Author: PabstMirror
* Adds a scripted signal * Adds a scripted signal (Server only)
* *
* Arguments: * Arguments:
* 0: Source <ARRAY>or<OBJECT> * 0: Source <ARRAY>or<OBJECT>
@ -17,7 +17,7 @@
* Public: Yes * 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]]]; params [["_object", objNull, [objNull, []]], ["_freqMHz", 0, [0]], ["_powerMW", 0, [0]]];
TRACE_3("addSignal",_object,_freqMHz,_powerMW); TRACE_3("addSignal",_object,_freqMHz,_powerMW);

View File

@ -1,7 +1,7 @@
#include "script_component.hpp" #include "script_component.hpp"
/* /*
* Author: PabstMirror * Author: PabstMirror
* (Server Only) * Cleans up beacon on delete or killed (Server Only)
* *
* Arguments: * Arguments:
* None * None
@ -10,7 +10,7 @@
* None * None
* *
* Example: * Example:
* [] call ace_radiodirectionfinder_fnc_beaconCleanup * [] call ace_radiodirectionfinder_fnc_beaconCleanupServer
* *
* Public: No * Public: No
*/ */
@ -18,7 +18,6 @@
TRACE_1("beaconCleanup",_this); TRACE_1("beaconCleanup",_this);
[{ [{
private _removed = false;
private _list = missionNamespace getVariable [QGVAR(signalList), []]; private _list = missionNamespace getVariable [QGVAR(signalList), []];
private _countStart = count _list; private _countStart = count _list;
_list = _list select { // select if array or alive or just not-null (if not a transmitter) _list = _list select { // select if array or alive or just not-null (if not a transmitter)

View File

@ -1,7 +1,7 @@
#include "script_component.hpp" #include "script_component.hpp"
/* /*
* Author: PabstMirror * Author: PabstMirror
* (Server Only) * Handles beacon init and adds to signal list globally (Server Only)
* *
* Arguments: * Arguments:
* 0: Beacon <OBJECT> * 0: Beacon <OBJECT>
@ -10,20 +10,20 @@
* None * None
* *
* Example: * Example:
* [] call ace_radiodirectionfinder_fnc_beaconInit * [x] call ace_radiodirectionfinder_fnc_beaconInitServer
* *
* Public: No * Public: No
*/ */
params ["_beacon"]; 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 _typeOf = typeOf _beacon;
private _freqMHz = getNumber (configFile >> "CfgVehicles" >> _typeOf >> QGVAR(freq)); private _freqMHz = getNumber (configFile >> "CfgVehicles" >> _typeOf >> QGVAR(freq));
private _powerMW = getNumber (configFile >> "CfgVehicles" >> _typeOf >> QGVAR(power)); 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, _freqMHz, _powerMW] call FUNC(addSignal);
_beacon addEventHandler ["Killed", {call FUNC(beaconCleanup)}]; _beacon addEventHandler ["Killed", {call FUNC(beaconCleanupServer)}];
_beacon addEventHandler ["Deleted", {call FUNC(beaconCleanup)}]; _beacon addEventHandler ["Deleted", {call FUNC(beaconCleanupServer)}];

View File

@ -1,7 +1,7 @@
#include "script_component.hpp" #include "script_component.hpp"
/* /*
* Author: PabstMirror * Author: PabstMirror
* * Condition for showing the RDF interface
* *
* Arguments: * Arguments:
* 0: vehicle that it will be attached to (player or vehicle) <OBJECT> * 0: vehicle that it will be attached to (player or vehicle) <OBJECT>
@ -15,7 +15,7 @@
* Public: No * Public: No
*/ */
params ["_unit"]; params ["_player"];
(alive _unit) ((backpack _player) == QGVAR(backpack))
&& {(backpack _unit) == QGVAR(backpack)} && {alive _player}

View File

@ -1,7 +1,7 @@
#include "script_component.hpp" #include "script_component.hpp"
/* /*
* Author: PabstMirror * 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: * Arguments:
* None * None

View File

@ -1,7 +1,7 @@
#include "script_component.hpp" #include "script_component.hpp"
/* /*
* Author: PabstMirror * Author: PabstMirror
* Updates the display (several times a second) called from the pfeh * Main PFEH, runs while display or dialog is open
* *
* Arguments: * Arguments:
* None * None
@ -19,7 +19,7 @@ private _unit = ace_player;
private _backpackObject = backpackContainer _unit; private _backpackObject = backpackContainer _unit;
if (!([_unit] call FUNC(displayCondition))) exitWith { 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); [DISPLAY_MODE_CLOSED] call FUNC(toggleDisplayMode);
}; };
@ -28,27 +28,28 @@ _args params ["_deltaTime"];
_deltaTime = CBA_missionTime - _deltaTime; _deltaTime = CBA_missionTime - _deltaTime;
_args set [0, CBA_missionTime]; _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 _display = displayNull;
private _shown = false; private _shown = false;
if (GVAR(currentShowMode) == DISPLAY_MODE_DISPLAY) then { if (GVAR(currentShowMode) == DISPLAY_MODE_DISPLAY) then {
_display = uiNamespace getVariable [QGVAR(display), displayNull]; _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 }; if (weaponLowered _unit) then { 0.9 } else { 0.75 };
} else { } else {
0 0 // hide it
}; };
_shown = [_display, _desiredPhase, _deltaTime] call FUNC(updateDisplayAnim); _shown = [_display, _desiredPhase, _deltaTime] call FUNC(updateDisplayAnim);
} else { } else {
_display = uiNamespace getVariable [QGVAR(dialog), displayNull]; _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); _shown = [_display, 1, _deltaTime] call FUNC(updateDisplayAnim);
}; };
if (!_shown) exitWith {}; if (!_shown) exitWith {};
if (GVAR(nextGuiUpate) > CBA_missionTime) exitWith {}; if (GVAR(nextGuiUpate) > CBA_missionTime) exitWith {};
GVAR(nextGuiUpate) = CBA_missionTime + 0.1; GVAR(nextGuiUpate) = CBA_missionTime + 0.25;
BEGIN_COUNTER(hudUpdate); 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)); (_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 { switch (_menuTab) do {
case (IDC_MENU_BUTTON1): { case (IDC_MENU_BUTTON1): { // Compas view
private _signals = [getPosASL _unit, _currentTargetFreq, 10] call FUNC(getSignals); private _signals = [getPosASL _unit, _currentTargetFreq, 10] call FUNC(getSignals);
private _baseDir = getDir _unit; private _baseDir = getDir _unit;
// re-sort by relative dir // re-sort by relative dir
@ -86,7 +87,7 @@ case (IDC_MENU_BUTTON1): {
private _ctrlCircleDot = _display displayCtrl IDC_MODE1_CIRCLE_DOT; private _ctrlCircleDot = _display displayCtrl IDC_MODE1_CIRCLE_DOT;
private _primarySignalInfo = []; private _primarySignalInfo = [];
if (_signals isEqualTo []) then { if (_signals isEqualTo []) then {
_primarySignalInfo pushBack format ["<t size='2'><t align='center'>Nothing</t></t>", _freqMhz]; _primarySignalInfo pushBack format ["<t size='2'><t align='center'>Nothing</t></t>"];
_ctrlCircleDot ctrlShow false; _ctrlCircleDot ctrlShow false;
} else { } else {
_ctrlCircleDot ctrlShow true; _ctrlCircleDot ctrlShow true;
@ -111,7 +112,7 @@ case (IDC_MENU_BUTTON1): {
}; };
} forEach _lines; } forEach _lines;
}; };
case (IDC_MENU_BUTTON2): { case (IDC_MENU_BUTTON2): { // Frequency Selections
private _signals = [getPosASL _unit, _currentTargetFreq, 10] call FUNC(getSignals); private _signals = [getPosASL _unit, _currentTargetFreq, 10] call FUNC(getSignals);
private _ctrlFreqSelectionText = _display displayCtrl IDC_MODE2_FREQ_TEXT; private _ctrlFreqSelectionText = _display displayCtrl IDC_MODE2_FREQ_TEXT;
private _currentTargetFreqText = if (_currentTargetFreq > 0) then { format ["%1 MHz",_currentTargetFreq] } else { "Any" }; 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; 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)); _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 private _signals = [getPosASL _unit, 0, 20] call FUNC(getSignals); // no freq filter
_signals = _signals apply { _signals = _signals apply {
_x params ["_rtx", "_freqMhz", "_bearing"]; _x params ["_rtx", "_freqMhz", "_bearing"];

View File

@ -2,9 +2,9 @@
#define COMPONENT_BEAUTIFIED RadioDirectionFinder #define COMPONENT_BEAUTIFIED RadioDirectionFinder
#include "\z\ace\addons\main\script_mod.hpp" #include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE #define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS #define ENABLE_PERFORMANCE_COUNTERS
#include "\z\ace\addons\main\script_macros.hpp" #include "\z\ace\addons\main\script_macros.hpp"

View File

@ -1,8 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project name="ACE"> <Project name="ACE">
<Package name="RadioDirectionFinder"> <Package name="RadioDirectionFinder">
<Key ID="STR_ACE_radiodirectionfinder_x"> <Key ID="STR_ACE_RadioDirectionFinder_backpack_displayName">
<English>x</English> <English>PRD-13(V)3 Radio Direction Finder</English>
</Key>
<Key ID="STR_ACE_RadioDirectionFinder_openRDF">
<English>Open Radio Direction Finder</English>
</Key>
<Key ID="STR_ACE_RadioDirectionFinder_locatorBeacon406">
<English>[ACE] 406MHz Locator Bacon</English>
</Key>
<Key ID="STR_ACE_RadioDirectionFinder_locatorAttachToActivate">
<English>Attach to activate</English>
</Key> </Key>
</Package> </Package>
</Project> </Project>