Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ACE Arsenal Stats #1053

Merged
merged 1 commit into from Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions addons/ace_interact/XEH_PREP.hpp
@@ -1,4 +1,7 @@
PREP(actionSetMTT);
PREP(arsenalStats_externalSpeaker);
PREP(arsenalStats_frequencyRange);
PREP(arsenalStats_transmitPower);
PREP(generateConnectors);
PREP(generateConnectorActions);
PREP(generateConnectorList);
Expand Down
39 changes: 39 additions & 0 deletions addons/ace_interact/ace_arsenal_stats.hpp
@@ -0,0 +1,39 @@
class ace_arsenal_stats {
class statBase;
class GVAR(frequencyRange): statBase {
scope = 2;
stats[] = {QEGVAR(arsenalStats,frequencyMin), QEGVAR(arsenalStats,frequencyMax)};
displayName= CSTRING(arsenalStats_frequencyRange);
showText = 1;
textStatement = QUOTE(call FUNC(arsenalStats_frequencyRange));
condition = QUOTE((getNumber(_this select 1 >> 'acre_isRadio')) == 1);
tabs[] = {{}, {7}}; // Misc-Items on right tab
};
class GVAR(transmitPower): statBase {
scope = 2;
stats[] = {QEGVAR(arsenalStats,transmitPower)};
displayName= CSTRING(arsenalStats_transmitPower);
showText = 1;
textStatement = QUOTE(call FUNC(arsenalStats_transmitPower));
condition = QUOTE((getNumber(_this select 1 >> 'acre_isRadio')) == 1);
tabs[] = {{}, {7}};
};
class GVAR(effectiveRange): statBase {
scope = 2;
stats[] = {QEGVAR(arsenalStats,effectiveRange)};
displayName= CSTRING(arsenalStats_effectiveRange);
showText = 1;
textStatement = QUOTE(getText ((_this select 1) >> (_this select 0 select 0)));
condition = QUOTE((getNumber(_this select 1 >> 'acre_isRadio')) == 1);
tabs[] = {{}, {7}};
};
class GVAR(externalSpeaker): statBase {
scope = 2;
stats[] = {QEGVAR(arsenalStats,externalSpeaker)};
displayName= CSTRING(arsenalStats_externalSpeaker);
showText = 1;
textStatement = QUOTE(call FUNC(arsenalStats_externalSpeaker));
condition = QUOTE((getNumber(_this select 1 >> 'acre_isRadio')) == 1);
tabs[] = {{}, {7}};
};
};
1 change: 1 addition & 0 deletions addons/ace_interact/config.cpp
Expand Up @@ -16,3 +16,4 @@ class CfgPatches {

#include "CfgVehicles.hpp"
#include "CfgEventHandlers.hpp"
#include "ace_arsenal_stats.hpp"
22 changes: 22 additions & 0 deletions addons/ace_interact/fnc_arsenalStats_externalSpeaker.sqf
@@ -0,0 +1,22 @@
#include "script_component.hpp"
/*
* Author: PabstMirror
* Shows arsenal stats
*
* Arguments:
* 0: Stats Array of config strings <ARRAY>
* 1: Radio Cfg <CONFIG>
*
* Return Value:
* <STRING>
*
* Example:
* [["acre_arsenalStats_externalSpeaker"], configFile >> "CfgWeapons" >> "ACRE_PRC117F"] call acre_ace_interact_fnc_arsenalStats_externalSpeaker
*
* Public: No
*/

params ["_statsArray", "_itemCfg"];

private _val = getNumber (_itemCfg >> (_statsArray select 0));
if (_val > 0) then { localize "str_lib_info_yes" } else { localize "str_lib_info_no" }
34 changes: 34 additions & 0 deletions addons/ace_interact/fnc_arsenalStats_frequencyRange.sqf
@@ -0,0 +1,34 @@
#include "script_component.hpp"
/*
* Author: PabstMirror
* Shows arsenal stats for frequency range
*
* Arguments:
* 0: Stats Array of config strings <ARRAY>
* 1: Radio Cfg <CONFIG>
*
* Return Value:
* <STRING>
*
* Example:
* [["..min", "...max"], configFile >> "CfgWeapons" >> "ACRE_PRC117F"] call acre_ace_interact_fnc_arsenalStats_frequencyRange
*
* Public: No
*/

params ["_statsArray", "_itemCfg"];

_statsArray = _statsArray apply {
private _value = getNumber (_itemCfg >> _x);
switch (true) do {
case (_value == 0): {"?"};
case (_value < 1e6): {format ["%1kHz", _value / 1e3]};
case (_value < 1e9): {format ["%1MHz", _value / 1e6]};
default {format ["%1GHz", _value / 1e9]};
};
};

// note: doesn't handle non-contiguous ranges,
// and just because 2 radios are on same freq doesn't mean their bandwidth/modulation will be compatible..

format ["%1 - %2", _statsArray#0, _statsArray#1]
24 changes: 24 additions & 0 deletions addons/ace_interact/fnc_arsenalStats_transmitPower.sqf
@@ -0,0 +1,24 @@
#include "script_component.hpp"
/*
* Author: PabstMirror
* Shows arsenal stats
*
* Arguments:
* 0: Stats Array of config strings <ARRAY>
* 1: Radio Cfg <CONFIG>
*
* Return Value:
* <STRING>
*
* Example:
* [["...power"], configFile >> "CfgWeapons" >> "ACRE_PRC117F"] call acre_ace_interact_fnc_arsenalStats_transmitPower
*
* Public: No
*/

params ["_statsArray", "_itemCfg"];

private _power = getNumber (_itemCfg >> _statsArray select 0); //in milliwatts

if (_power == 0) exitWith {"?"};
if (_power >= 1e3) then { format ["%1W", _power/1000] } else { format ["%1mW",_power] }
12 changes: 12 additions & 0 deletions addons/ace_interact/stringtable.xml
Expand Up @@ -186,5 +186,17 @@
<Chinesesimp>把天线往上弯曲</Chinesesimp>
<Portuguese>Dobrar antena para cima</Portuguese>
</Key>
<Key ID="STR_ACRE_ace_interact_arsenalStats_frequencyRange">
<English>Frequency Range</English>
</Key>
<Key ID="STR_ACRE_ace_interact_arsenalStats_transmitPower">
<English>Transmit Power</English>
</Key>
<Key ID="STR_ACRE_ace_interact_arsenalStats_effectiveRange">
<English>Effective Range (Urban)</English>
</Key>
<Key ID="STR_ACRE_ace_interact_arsenalStats_externalSpeaker">
<English>External Speaker</English>
</Key>
</Package>
</Project>
5 changes: 5 additions & 0 deletions addons/sys_prc117f/CfgWeapons.hpp
Expand Up @@ -20,6 +20,11 @@ class CfgWeapons {
class Library {
libTextDesc = QUOTE(NAME_PRC117F);
};

EGVAR(arsenalStats,frequencyMin) = 30e6;
EGVAR(arsenalStats,frequencyMax) = 512e6;
EGVAR(arsenalStats,transmitPower) = 20000;
EGVAR(arsenalStats,effectiveRange) = "20+km (10-20km)";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure I like placing those arbitrary numbers here. It's clear it's for the Arsenal, so that's good, but can we get those from actual radio data that's already defined somehow? @Sniperhid @Soldia1138

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

148 seems to validate data with if (_newVal > 512 || {_newVal < 30}) then {
but 152 allows you to enter anything
image
117 same
image

could add new (non-arsenal) configs for min/max frequency for user input
but I don't know how the real radios handle this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IDI-Systems/acre-managers ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the way to go about this is make those not Arsenal-specific, but actually use those config entries to limit radio operation (like 148 does).

};

RADIO_ID_LIST(ACRE_PRC117F)
Expand Down
6 changes: 6 additions & 0 deletions addons/sys_prc148/CfgWeapons.hpp
Expand Up @@ -19,6 +19,12 @@ class CfgWeapons {
class Library {
libTextDesc = QUOTE(NAME_PRC148);
};

EGVAR(arsenalStats,frequencyMin) = 30e6;
EGVAR(arsenalStats,frequencyMax) = 512e6;
EGVAR(arsenalStats,transmitPower) = 5000;
EGVAR(arsenalStats,effectiveRange) = "5-7km (3-5km)";
EGVAR(arsenalStats,externalSpeaker) = 1;
};
/*
class ACRE_PRC148_UHF: ACRE_BaseRadio {
Expand Down
6 changes: 6 additions & 0 deletions addons/sys_prc152/CfgWeapons.hpp
Expand Up @@ -19,6 +19,12 @@ class CfgWeapons {
class Library {
libTextDesc = QUOTE(NAME_PRC152);
};

EGVAR(arsenalStats,frequencyMin) = 30e6;
EGVAR(arsenalStats,frequencyMax) = 512e6;
EGVAR(arsenalStats,transmitPower) = 5000;
EGVAR(arsenalStats,effectiveRange) = "5-7km (3-5km)";
EGVAR(arsenalStats,externalSpeaker) = 1;
};

RADIO_ID_LIST(ACRE_PRC152)
Expand Down
5 changes: 5 additions & 0 deletions addons/sys_prc343/CfgWeapons.hpp
Expand Up @@ -22,6 +22,11 @@ class CfgWeapons {
class Library {
libTextDesc = QUOTE(NAME_PRC343);
};

EGVAR(arsenalStats,frequencyMin) = 2.4e9;
EGVAR(arsenalStats,frequencyMax) = 2.483e9;
EGVAR(arsenalStats,transmitPower) = 100;
EGVAR(arsenalStats,effectiveRange) = "850m (400m)";
};

RADIO_ID_LIST(ACRE_PRC343)
Expand Down
5 changes: 5 additions & 0 deletions addons/sys_prc77/CfgWeapons.hpp
Expand Up @@ -20,6 +20,11 @@ class CfgWeapons {
class Library {
libTextDesc = QUOTE(NAME_PRC77);
};

EGVAR(arsenalStats,frequencyMin) = 30e6;
EGVAR(arsenalStats,frequencyMax) = 80e6;
EGVAR(arsenalStats,transmitPower) = 4000; // depends on frequency, but this is max
EGVAR(arsenalStats,effectiveRange) = "3-5km (1-3km)";
};

RADIO_ID_LIST(ACRE_PRC77)
Expand Down
6 changes: 6 additions & 0 deletions addons/sys_sem52sl/CfgWeapons.hpp
Expand Up @@ -20,6 +20,12 @@ class CfgWeapons {
class Library {
libTextDesc = QUOTE(NAME_SEM52SL);
};

EGVAR(arsenalStats,frequencyMin) = 46e3;
EGVAR(arsenalStats,frequencyMax) = 65.975e6;
EGVAR(arsenalStats,transmitPower) = 1000;
EGVAR(arsenalStats,effectiveRange) = "2-4km (1-2km)"; // not sure?
EGVAR(arsenalStats,externalSpeaker) = 1;
};

RADIO_ID_LIST(ACRE_SEM52SL)
Expand Down
6 changes: 6 additions & 0 deletions addons/sys_sem70/CfgWeapons.hpp
Expand Up @@ -21,6 +21,12 @@ class CfgWeapons {
class Library {
libTextDesc = QUOTE(NAME_SEM70);
};

EGVAR(arsenalStats,frequencyMin) = 46e3;
EGVAR(arsenalStats,frequencyMax) = 65.975e6;
EGVAR(arsenalStats,transmitPower) = 4000;
EGVAR(arsenalStats,effectiveRange) = "3-5km (1-3km)"; // not sure?
EGVAR(arsenalStats,externalSpeaker) = 1;
};

RADIO_ID_LIST(ACRE_SEM70)
Expand Down