mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Arsenal - Add Night Vision support stat for scopes (#6671)
* Add Night Vision support Arsenal stat for scopes * contrive correct configClasses camel case compliance * Change priority
This commit is contained in:
parent
8201a6bd08
commit
efb53ed181
@ -74,6 +74,14 @@ class GVAR(stats) {
|
||||
textStatement = QUOTE(call FUNC(statTextStatement_scopeMag));
|
||||
tabs[] = {{}, {0}};
|
||||
};
|
||||
class ACE_scopeVisionMode: statBase {
|
||||
scope = 2;
|
||||
priority = 1;
|
||||
displayName = CSTRING(statVisionMode);
|
||||
showText = 1;
|
||||
textStatement = QUOTE(call FUNC(statTextStatement_scopeVisionMode));
|
||||
tabs[] = {{}, {0}};
|
||||
};
|
||||
class ACE_ballisticProtection: statBase {
|
||||
scope = 2;
|
||||
priority = 5;
|
||||
|
@ -64,6 +64,7 @@ PREP(statTextStatement_accuracy);
|
||||
PREP(statTextStatement_mass);
|
||||
PREP(statTextStatement_rateOfFire);
|
||||
PREP(statTextStatement_scopeMag);
|
||||
PREP(statTextStatement_scopeVisionMode);
|
||||
PREP(statTextStatement_smokeChemTTL);
|
||||
PREP(updateCamPos);
|
||||
PREP(updateRightPanel);
|
||||
|
@ -0,0 +1,68 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: Dedmen
|
||||
* Text statement for the scope Night vision support stat.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: not used
|
||||
* 1: item config path (CONFIG)
|
||||
*
|
||||
* Return Value:
|
||||
* String to display
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["", "_config"];
|
||||
TRACE_1("statTextStatement_scopeVisionMode",_config);
|
||||
|
||||
private _opticsModes = ("true" configClasses (_config >> "ItemInfo" >> "OpticsModes")) apply {
|
||||
private _visionMode = getArray (_x >> "visionMode");
|
||||
[
|
||||
getNumber (_x >> "useModelOptics") == 1, //is in optics
|
||||
_visionMode isEqualTo [], //optional NVG
|
||||
"NVG" in _visionMode, //Integrated NVG
|
||||
"Ti" in _visionMode //Integrated Thermal
|
||||
]
|
||||
};
|
||||
|
||||
private _primaryNVGIntegrated = false;
|
||||
private _primaryNVGSupported = false;
|
||||
private _primaryTiIntegrated = false;
|
||||
private _secondaryNVGSupported = false;
|
||||
|
||||
{
|
||||
_x params ["_isPrimary", "_optionalNvg", "_integratedNVG", "_integratedTi"];
|
||||
if (_isPrimary) then {
|
||||
if (_integratedNVG) then {
|
||||
_primaryNVGIntegrated = true;
|
||||
};
|
||||
if (_optionalNvg) then {
|
||||
_primaryNVGSupported = true;
|
||||
};
|
||||
if (_integratedTi) then {
|
||||
_primaryTiIntegrated = true;
|
||||
};
|
||||
} else {
|
||||
if (_optionalNvg) then {
|
||||
_secondaryNVGSupported = true;
|
||||
}
|
||||
}
|
||||
} forEach _opticsModes;
|
||||
|
||||
//Detecting Primary by useModelOptics works in 99.9% of cases.
|
||||
//But on some scopes (from one specific mod) even the primary mode has useModelOptics=false
|
||||
//So we have this workaround
|
||||
|
||||
if (
|
||||
count _opticsModes == 1 || //If we only have a single mode. And it's a secondary, then consider it primary.
|
||||
{{_x select 1} count _opticsModes == count _opticsModes} //If every mode supports it. Then then the primary also supports it
|
||||
) then {
|
||||
_primaryNVGSupported = _secondaryNVGSupported;
|
||||
};
|
||||
|
||||
if (_primaryNVGIntegrated) exitWith {LLSTRING(statVisionMode_IntPrim)};
|
||||
if (_primaryNVGSupported) exitWith {LLSTRING(statVisionMode_supPrim)};
|
||||
if (_secondaryNVGSupported) exitWith {LLSTRING(statVisionMode_supSec)};
|
||||
|
||||
LLSTRING(statVisionMode_NoSup)
|
@ -719,6 +719,26 @@
|
||||
<Japanese>拡大倍率</Japanese>
|
||||
<Turkish>Büyütme</Turkish>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Arsenal_statVisionMode">
|
||||
<English>Nightvision Support</English>
|
||||
<German>Nachtsicht Unterstützung</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Arsenal_statVisionMode_supPrim">
|
||||
<English>Primary supported</English>
|
||||
<German>Primär unterstützt</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Arsenal_statVisionMode_supSec">
|
||||
<English>Secondary supported</English>
|
||||
<German>Sekundär unterstützt</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Arsenal_statVisionMode_IntPrim">
|
||||
<English>Primary integrated</English>
|
||||
<German>Primär Integriert</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Arsenal_statVisionMode_NoSup">
|
||||
<English>Not Supported</English>
|
||||
<German>Nicht unterstützt</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Arsenal_page">
|
||||
<English>Page</English>
|
||||
<French>Page</French>
|
||||
|
Loading…
Reference in New Issue
Block a user