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 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"};

View File

@ -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;
};

View File

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

View File

@ -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

View File

@ -1,7 +1,7 @@
#include "script_component.hpp"
/*
* Author: PabstMirror
* Adds a scripted signal
* Adds a scripted signal (Server only)
*
* Arguments:
* 0: Source <ARRAY>or<OBJECT>
@ -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);

View File

@ -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)

View File

@ -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 <OBJECT>
@ -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)}];

View File

@ -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) <OBJECT>
@ -15,7 +15,7 @@
* Public: No
*/
params ["_unit"];
params ["_player"];
(alive _unit)
&& {(backpack _unit) == QGVAR(backpack)}
((backpack _player) == QGVAR(backpack))
&& {alive _player}

View File

@ -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

View File

@ -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 ["<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;
} 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"];

View File

@ -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"

View File

@ -1,8 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="RadioDirectionFinder">
<Key ID="STR_ACE_radiodirectionfinder_x">
<English>x</English>
<Key ID="STR_ACE_RadioDirectionFinder_backpack_displayName">
<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>
</Package>
</Project>