Add settings

This commit is contained in:
PabstMirror 2019-09-05 22:58:27 -05:00
parent e3bedbbfc3
commit 62bbfdbaf9
15 changed files with 99 additions and 64 deletions

View File

@ -6,7 +6,7 @@ class CfgVehicles {
class GVAR(backpack): Bag_Base { class GVAR(backpack): Bag_Base {
scope = 2; scope = 2;
displayName = "PRD-13 Radio Direction Finder"; displayName = "PRD-13 Radio Direction Finder";
author = "PabstMirror"; author = ECSTRING(common,aceteam);
model = "z\ace\addons\radiodirectionfinder\data\ace_antennaBackpack"; model = "z\ace\addons\radiodirectionfinder\data\ace_antennaBackpack";
maximumLoad = 50; maximumLoad = 50;
mass = 100; mass = 100;
@ -16,14 +16,14 @@ class CfgVehicles {
class Items_base_F; class Items_base_F;
class ACE_transmitter_base: Items_base_F { class ACE_transmitter_base: Items_base_F {
class EventHandlers { class EventHandlers {
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {}; class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {}; // enable XEH
}; };
author = ECSTRING(common,aceteam); author = ECSTRING(common,aceteam);
model = "\A3\Structures_F\Items\Tools\MultiMeter_F.p3d"; model = "\A3\Structures_F\Items\Tools\MultiMeter_F.p3d";
scope = 1; scope = 1;
}; };
class ACE_transmitter_406MHz: ACE_transmitter_base { class ACE_transmitter_406MHz: ACE_transmitter_base {
displayName = "Transmitter 406MHz"; displayName = "[ACE] Transmitter 406MHz";
GVAR(freq) = 406; GVAR(freq) = 406;
GVAR(power) = 5000; GVAR(power) = 5000;
}; };
@ -33,16 +33,14 @@ class CfgVehicles {
class CAManBase: Man { class CAManBase: Man {
class ACE_SelfActions { class ACE_SelfActions {
class ACE_Equipment { class ACE_Equipment {
class GVAR(open) { class GVAR(open) { // Opens the dialog
//Opens the dialog
// displayName = CSTRING(configure); // displayName = CSTRING(configure);
displayName = "open"; displayName = "RDF: Open";
condition = QUOTE(_player call FUNC(displayCondition)); condition = QUOTE(_player call FUNC(displayCondition));
statement = QUOTE([DISPLAY_MODE_DIALOG] call FUNC(toggleDisplayMode)); 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) { class GVAR(show) { // Opens the display
//Opens the mini map
// displayName = CSTRING(show); // displayName = CSTRING(show);
displayName = "Show"; displayName = "Show";
condition = QUOTE(GVAR(currentShowMode) != DISPLAY_MODE_DISPLAY); condition = QUOTE(GVAR(currentShowMode) != DISPLAY_MODE_DISPLAY);

View File

@ -3,16 +3,16 @@ class CfgWeapons {
class CBA_MiscItem_ItemInfo; class CBA_MiscItem_ItemInfo;
class ACE_TransmitterItem_406MHz: ACE_ItemCore { class ACE_TransmitterItem_406MHz: ACE_ItemCore {
ACE_attachable = "ACE_transmitter_406MHz"; 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(IrStrobe_Name);
displayName = "406MHz Locator Bacon"; displayName = "[ACE] 406MHz Locator Bacon";
// descriptionShort = CSTRING(IrStrobe_Description); // descriptionShort = CSTRING(IrStrobe_Description);
descriptionShort = "Attach to activate";
// model = QPATHTOF(data\x.p3d); // 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);
class ItemInfo: CBA_MiscItem_ItemInfo { class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 1; mass = 1;
}; };

View File

@ -50,15 +50,13 @@ class GVAR(dialog) {
fadein = 0; fadein = 0;
fadeout = 0; fadeout = 0;
onLoad = QUOTE(with uiNamespace do {GVAR(dialog) = _this select 0;};); onLoad = QUOTE(with uiNamespace do {GVAR(dialog) = _this select 0;};);
// onUnload = QUOTE(call FUNC());
class objects { class objects {
class GVAR(MapGpsDisplay): RscObject { class GVAR(MapGpsDisplay): RscObject {
// show = 0;
idc = IDC_OBJECT_SCREEN; idc = IDC_OBJECT_SCREEN;
type = 82; type = 82;
model = QPATHTOF(data\ace_handheldDeviceDisplay.p3d); model = QPATHTOF(data\ace_handheldDeviceDisplay.p3d);
// useGlobalLight = 1; // useGlobalLight = 1;
// minGlobalLightIntensity = -100; // minGlobalLightIntensity = -100; // can't find any doc on this, seems to apply sun effects, but is too much
/* /*
1.000 - normal model 1.000 - normal model
memory - has 4 points in selection "deviceScreen" and then those 4 as individual "deviceScreen tl", "deviceScreen br", "deviceScreen b'", "deviceScreen br" memory - has 4 points in selection "deviceScreen" and then those 4 as individual "deviceScreen tl", "deviceScreen br", "deviceScreen b'", "deviceScreen br"
@ -106,12 +104,9 @@ class RscTitles {
class controls {}; class controls {};
class objects { class objects {
class GVAR(MapGpsDisplay): RscObject { class GVAR(MapGpsDisplay): RscObject {
// show = 0;
idc = IDC_OBJECT_SCREEN; idc = IDC_OBJECT_SCREEN;
type = 82; type = 82;
model = QPATHTOF(data\ace_handheldDeviceDisplay.p3d); model = QPATHTOF(data\ace_handheldDeviceDisplay.p3d);
// useGlobalLight = 1;
// minGlobalLightIntensity = -100;
/* /*
1.000 - normal model 1.000 - normal model
memory - has 4 points in selection "deviceScreen" and then those 4 as individual "deviceScreen tl", "deviceScreen br", "deviceScreen b'", "deviceScreen br" memory - has 4 points in selection "deviceScreen" and then those 4 as individual "deviceScreen tl", "deviceScreen br", "deviceScreen b'", "deviceScreen br"

View File

@ -1,13 +1,14 @@
#include "script_component.hpp" #include "script_component.hpp"
// debug ["ace_settingsInitialized", {
["Q", "Q", "Q", { TRACE_2("ace_settingsInitialized",GVAR(showUAV),GVAR(showACRE));
systemChat "Q RECOMPILE"; if (GVAR(showUAV)) then {
[] call ACE_PREP_RECOMPILE; GVAR(signalSourceFuncs) pushBack LINKFUNC(getSignalsUAV);
[-1] call FUNC(toggleDisplayMode); };
false if ((isClass (configFile >> "CfgPatches" >> "acre_sys_core")) && GVAR(showACRE)) then {
}, {false}, [0x10, [false, false, false]], false] call CBA_fnc_addKeybind; // Q Key GVAR(signalSourceFuncs) pushBack LINKFUNC(getSignalsACRE);
};
}] 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(beaconInit), true, [], true] call CBA_fnc_addClassEventHandler;
@ -19,6 +20,7 @@ if (isServer) then {
_uav setVariable [QGVAR(freqMhz), _randomFreq, true]; _uav setVariable [QGVAR(freqMhz), _randomFreq, true];
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;
}; };
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
GVAR(currentShowMode) = 0; GVAR(currentShowMode) = 0;
@ -37,3 +39,16 @@ private _closeCode = {
}; };
// [(localize LSTRING(itemName)), QPATHTOF(images\x_item.paa), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew); // [(localize LSTRING(itemName)), QPATHTOF(images\x_item.paa), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew);
["RDF", "", _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew); ["RDF", "", _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew);
#ifdef DEBUG_MODE_FULL
["Q", "Q", "Q", {
systemChat "Q RECOMPILE";
[] call ACE_PREP_RECOMPILE;
[-1] call FUNC(toggleDisplayMode);
false
}, {false}, [0x10, [false, false, false]], false] call CBA_fnc_addKeybind; // Q Key
#endif

View File

@ -6,8 +6,9 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp" #include "XEH_PREP.hpp"
PREP_RECOMPILE_END; PREP_RECOMPILE_END;
#include "initSettings.sqf"
// Semi-public var: // Semi-public var:
GVAR(signalSourceFuncs) = [FUNC(getSignalsScripted), FUNC(getSignalsUAV)]; GVAR(signalSourceFuncs) = [LINKFUNC(getSignalsScripted)];
if (isClass (configFile >> "CfgPatches" >> "acre_sys_core")) then { GVAR(signalSourceFuncs) pushBack FUNC(getSignalsACRE); };
ADDON = true; ADDON = true;

View File

@ -1,18 +1,20 @@
#include "script_component.hpp" #include "script_component.hpp"
/* /*
* Author: PabstMirror * Author: PabstMirror
* * Adds a scripted signal
* *
* Arguments: * Arguments:
* 0: * 0: Source <ARRAY>or<OBJECT>
* 1: Frequency <NUMBER>
* 2: Power <NUMBER>
* *
* Return Value: * Return Value:
* None * None
* *
* Example: * Example:
* [] call ace_radiodirectionfinder_fnc_addSignal * [player, 2400, 50] call ace_radiodirectionfinder_fnc_addSignal
* *
* Public: No * Public: Yes
*/ */
if (!isServer) exitWith {}; if (!isServer) exitWith {};

View File

@ -1,7 +1,7 @@
#include "script_component.hpp" #include "script_component.hpp"
/* /*
* Author: PabstMirror * Author: PabstMirror
* * (Server Only)
* *
* Arguments: * Arguments:
* None * None
@ -20,16 +20,13 @@ TRACE_1("beaconCleanup",_this);
[{ [{
private _removed = false; private _removed = false;
private _list = missionNamespace getVariable [QGVAR(signalList), []]; private _list = missionNamespace getVariable [QGVAR(signalList), []];
_list = _list select { private _countStart = count _list;
_list = _list select { // select if array or alive or just not-null (if not a transmitter)
_x params ["_obj"]; _x params ["_obj"];
if ((_obj isEqualType []) || {alive _obj} || {!isNull _obj && {!(_obj isKindOf "ACE_transmitter_base")}}) then { (_obj isEqualType []) || {alive _obj} || {(!isNull _obj) && {!(_obj isKindOf "ACE_transmitter_base")}}
true
} else {
_removed = true;
false
};
}; };
TRACE_1("",_removed); TRACE_2("",_countStart,count _list);
if (!_removed) exitWith {}; if (_countStart != count _list) then {
missionNamespace setVariable [QGVAR(signalList), _list, true]; missionNamespace setVariable [QGVAR(signalList), _list, true];
}, []] call CBA_fnc_execNextFrame; };
}, []] call CBA_fnc_execNextFrame; // delay a frame because deletedEH is weird

View File

@ -17,13 +17,13 @@
params ["_beacon"]; params ["_beacon"];
if (!alive _beacon) exitWith { TRACE_1("dead",_this); }; if (!alive _beacon) exitWith { TRACE_1("beaconInit - dead",_this); };
private _typeOf = typeOf _beacon; private _typeOf = typeOf _beacon;
private _freqMHz = getNumber (configFile >> "CfgVehicles" >> QGVAR(freq)); private _freqMHz = getNumber (configFile >> "CfgVehicles" >> _typeOf >> QGVAR(freq));
private _powerMW = getNumber (configFile >> "CfgVehicles" >> QGVAR(power)); private _powerMW = getNumber (configFile >> "CfgVehicles" >> _typeOf >> QGVAR(power));
TRACE_4("beaconInit - new",_beacon,_typeOf,_freqMHz,_powerMW); TRACE_4("beaconInit",_beacon,_typeOf,_freqMHz,_powerMW);
[_beacon, 444, 55] call FUNC(addSignal); [_beacon, _freqMHz, _powerMW] call FUNC(addSignal);
_beacon addEventHandler ["Killed", {call FUNC(beaconCleanup)}]; _beacon addEventHandler ["Killed", {call FUNC(beaconCleanup)}];
_beacon addEventHandler ["Deleted", {call FUNC(beaconCleanup)}]; _beacon addEventHandler ["Deleted", {call FUNC(beaconCleanup)}];

View File

@ -104,7 +104,7 @@ for "_i" from 0 to 9 do {
_display setVariable [QGVAR(lines), _lines]; _display setVariable [QGVAR(lines), _lines];
private _ctrlText = _display ctrlCreate [QGVAR(structuredText), IDC_MODE1_SCAN_INFO_TEXT, _ctrlModeGroup1]; private _ctrlText = _display ctrlCreate [QGVAR(structuredText), IDC_MODE1_SCAN_INFO_TEXT, _ctrlModeGroup1];
_ctrlText ctrlSetPosition [0,_circleY+_circleH/4,1-_circleW,_circleH/2]; _ctrlText ctrlSetPosition [0, _circleY+_circleH/4, 1 - 0.95*_circleW, _circleH/2];
_ctrlText ctrlCommit 0; _ctrlText ctrlCommit 0;
// _ctrlText ctrlSetBackgroundColor [0.1,0.1,0.1,0.5]; // _ctrlText ctrlSetBackgroundColor [0.1,0.1,0.1,0.5];

View File

@ -20,7 +20,7 @@ params ["_positionASL", "_targetFreq", "_maxSignals"];
// semi-cached (Run though only a single source func each tick, then process all at end) // semi-cached (Run though only a single source func each tick, then process all at end)
if (GVAR(signalStage) < count GVAR(signalSourceFuncs)) then { if (GVAR(signalStage) < count GVAR(signalSourceFuncs)) then {
[GVAR(signalsAccumulator)] call (GVAR(signalSourceFuncs) select GVAR(signalStage)); [GVAR(signalsAccumulator)] call (GVAR(signalSourceFuncs) select GVAR(signalStage));
TRACE_2("tick",GVAR(signalsAccumulator),GVAR(signalStage)); // TRACE_2("tick",GVAR(signalsAccumulator),GVAR(signalStage));
GVAR(signalStage) = GVAR(signalStage) + 1; GVAR(signalStage) = GVAR(signalStage) + 1;
} else { } else {
GVAR(signalStage) = 0; GVAR(signalStage) = 0;
@ -34,7 +34,7 @@ if (GVAR(signalStage) < count GVAR(signalSourceFuncs)) then {
// for meters/MHz/miliwatts (ignoring antenna gain, terrain.....) // for meters/MHz/miliwatts (ignoring antenna gain, terrain.....)
private _rtx = (10 * log _powerMW) - (-27.55 + 20 * log _freqMhz + 20 * log _distance); private _rtx = (10 * log _powerMW) - (-27.55 + 20 * log _freqMhz + 20 * log _distance);
private _bearing = _positionASL getDir _xPosASL; private _bearing = (_positionASL getDir _xPosASL) + 2 * sin (time * 6) + 2 * sin (time * 20); // add some drift
GVAR(signalsLast) pushBack [_rtx, _freqMhz, _bearing]; GVAR(signalsLast) pushBack [_rtx, _freqMhz, _bearing];
#ifdef DEBUG_MODE_FULL #ifdef DEBUG_MODE_FULL

View File

@ -23,9 +23,13 @@ params ["_list"];
[QGVAR(getUavFreq), [_x]] call CBA_fnc_serverEvent; [QGVAR(getUavFreq), [_x]] call CBA_fnc_serverEvent;
} else { } else {
_list pushBack [getPosASL _x, _freqMhz, 10000]; _list pushBack [getPosASL _x, _freqMhz, 10000];
private _unit = (UAVControl _x) param [0, objNull]; private _unit1 = (UAVControl _x) param [0, objNull];
if (alive _unit) then { if (alive _unit1) then {
_list pushBack [getPosASL _unit, _freqMhz, 10000]; _list pushBack [getPosASL _unit1, _freqMhz, 10000];
};
private _unit2 = (UAVControl _x) param [2, objNull];
if (alive _unit2) then {
_list pushBack [getPosASL _unit2, _freqMhz, 10000];
}; };
}; };
} forEach allUnitsUAV; } forEach allUnitsUAV;

View File

@ -29,14 +29,14 @@ _display setVariable [QGVAR(currentShown), _currentShown];
_ctrlPhoneObject ctrlSetModelScale 0.5; _ctrlPhoneObject ctrlSetModelScale 0.5;
if (_currentShown == 0) then { if (_currentShown <= 0) then {
_ctrlPhoneObject ctrlShow false; _ctrlPhoneObject ctrlShow false;
false false
} else { } else {
_ctrlPhoneObject ctrlShow true; _ctrlPhoneObject ctrlShow true;
private _xPos = linearConversion [0.9, 1, _currentShown, 0.35, 0.5, true]; private _xPos = linearConversion [0.9, 1, _currentShown, 0.3, 0.5, true];
private _yPos = linearConversion [0.9, 1, _currentShown, 0.12, 0.08, true]; private _yPos = linearConversion [0.9, 1, _currentShown, 0.12, 0.08, true];
private _zPos = linearConversion [0, 1, _currentShown, 1.25, 0.75] + linearConversion [0, 0.5, _currentShown, 0.25, 0, true]; private _zPos = linearConversion [0, 1, _currentShown, 1.25, 0.75] + linearConversion [0, 0.1, _currentShown, 0.5, 0, true];
private _yAngle = linearConversion [0, 1, _currentShown, 30, 80] + linearConversion [0, 0.75, _currentShown, -30, 0, true]; private _yAngle = linearConversion [0, 1, _currentShown, 30, 80] + linearConversion [0, 0.75, _currentShown, -30, 0, true];
// [xScreen, dist, yScreen] x/y extents are based on UI scaling // [xScreen, dist, yScreen] x/y extents are based on UI scaling
_ctrlPhoneObject ctrlSetPosition [_xPos, _yPos, _zPos]; _ctrlPhoneObject ctrlSetPosition [_xPos, _yPos, _zPos];

View File

@ -28,14 +28,14 @@ _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, ["isNotSitting"]] call EFUNC(common,canInteractWith); private _canShow = [_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 (_canShow && {cameraView != "GUNNER"} && {EGVAR(interact_menu,openedMenuType) < 0}) then {
if (weaponLowered _unit) then { 0.9 } else { 0.7 }; if (weaponLowered _unit) then { 0.9 } else { 0.75 };
} else { } else {
0 0
}; };
@ -43,7 +43,7 @@ if (GVAR(currentShowMode) == DISPLAY_MODE_DISPLAY) then {
} 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 ((!_canShow) || {isNull _display}) exitWith { [DISPLAY_MODE_DISPLAY, 1] call FUNC(toggleDisplayMode); };
_shown = [_display, 1, _deltaTime * 2] call FUNC(updateDisplayAnim); _shown = [_display, 1, _deltaTime] call FUNC(updateDisplayAnim);
}; };
if (!_shown) exitWith {}; if (!_shown) exitWith {};

View File

@ -0,0 +1,23 @@
// CBA Settings [ADDON: ace_radiodirectionfinder]:
private _categoryArray = ["ACE Radiodirectionfinder"];
[
QGVAR(showUAV), "CHECKBOX",
["showUAV"], // [LSTRING(), LSTRING()],
_categoryArray,
true, // default value
true, // isGlobal
{[QGVAR(showUAV), _this] call EFUNC(common,cbaSettings_settingChanged)}
] call CBA_settings_fnc_init;
if (isClass (configFile >> "CfgPatches" >> "acre_sys_core")) then {
[
QGVAR(showACRE), "CHECKBOX",
["showACRE"], // [LSTRING(), LSTRING()],
_categoryArray,
false, // default value
true, // isGlobal
{[QGVAR(showACRE), _this] call EFUNC(common,cbaSettings_settingChanged)}
] call CBA_settings_fnc_init;
};

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"