mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #2699 from BaerMitUmlaut/disable-nvgs-in-sight
Disable nvgs in sight
This commit is contained in:
commit
e669f3e2cb
8
addons/nightvision/ACE_Settings.hpp
Normal file
8
addons/nightvision/ACE_Settings.hpp
Normal file
@ -0,0 +1,8 @@
|
||||
class ACE_Settings {
|
||||
class GVAR(disableNVGsWithSights) {
|
||||
displayName = CSTRING(DisableNVGsWithSights_DisplayName);
|
||||
description = CSTRING(DisableNVGsWithSights_description);
|
||||
typeName = "BOOL";
|
||||
value = 1;
|
||||
};
|
||||
};
|
@ -14,4 +14,28 @@ class CfgVehicles {
|
||||
MACRO_ADDITEM(ACE_NVG_Wide,6);
|
||||
};
|
||||
};
|
||||
|
||||
class ACE_Module;
|
||||
class GVAR(ModuleSettings): ACE_Module {
|
||||
scope = 2;
|
||||
displayName = CSTRING(Module_DisplayName);
|
||||
icon = QUOTE(PATHTOF(UI\Icon_Module_ca.paa));
|
||||
category = "ACE";
|
||||
function = QUOTE(FUNC(initModule));
|
||||
functionPriority = 1;
|
||||
isGlobal = 1;
|
||||
isTriggerActivated = 0;
|
||||
author = "BaerMitUmlaut";
|
||||
class Arguments {
|
||||
class disableNVGsWithSights {
|
||||
displayName = CSTRING(DisableNVGsWithSights_DisplayName);
|
||||
description = CSTRING(DisableNVGsWithSights_Description);
|
||||
typeName = "BOOL";
|
||||
defaultValue = 1;
|
||||
};
|
||||
};
|
||||
class ModuleDescription {
|
||||
description = CSTRING(Module_Description);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
BIN
addons/nightvision/UI/Icon_Module_ca.paa
Normal file
BIN
addons/nightvision/UI/Icon_Module_ca.paa
Normal file
Binary file not shown.
@ -30,9 +30,15 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0;
|
||||
|
||||
// Setup the event handlers
|
||||
["playerInventoryChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler);
|
||||
["playerVisionModeChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler);
|
||||
["playerVisionModeChanged", {
|
||||
_this call FUNC(updatePPEffects);
|
||||
_this call FUNC(onVisionModeChanged);
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
["zeusDisplayChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler);
|
||||
["cameraViewChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler);
|
||||
["cameraViewChanged", {
|
||||
_this call FUNC(updatePPEffects);
|
||||
_this call FUNC(onCameraViewChanged);
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
["playerVehicleChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler);
|
||||
["playerTurretChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler);
|
||||
|
||||
|
@ -4,6 +4,9 @@ ADDON = false;
|
||||
|
||||
PREP(blending);
|
||||
PREP(changeNVGBrightness);
|
||||
PREP(initModule);
|
||||
PREP(onCameraViewChanged);
|
||||
PREP(onVisionModeChanged);
|
||||
PREP(updatePPEffects);
|
||||
|
||||
ADDON = true;
|
||||
|
@ -15,3 +15,4 @@ class CfgPatches {
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
#include "ACE_Settings.hpp"
|
||||
|
21
addons/nightvision/functions/fnc_initModule.sqf
Normal file
21
addons/nightvision/functions/fnc_initModule.sqf
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Initializes the settings for the disable NVGs in sight module.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Module <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [_module] call ace_nightvision_fnc_initModule
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_module"];
|
||||
|
||||
[_module, QGVAR(disableNVGsWithSights), "disableNVGsWithSights"] call EFUNC(common,readSettingFromModule);
|
38
addons/nightvision/functions/fnc_onCameraViewChanged.sqf
Normal file
38
addons/nightvision/functions/fnc_onCameraViewChanged.sqf
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Disables/re-enables NVGs when the player starts/stops aiming down his sight.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: New camera view <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [player, "GUNNER"] call ace_nightvision_fnc_onCameraViewChanged
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_cameraView"];
|
||||
|
||||
if (GVAR(disableNVGsWithSights) && {(hmd _unit) != ""}) then {
|
||||
if ((vehicle _unit == _unit)
|
||||
|| {isTurnedOut _unit}
|
||||
|| {!([_unit] call EFUNC(common,hasHatch))
|
||||
&& {[_unit] call EFUNC(common,getTurretIndex) in ([vehicle _unit] call EFUNC(common,getTurretsFFV))}
|
||||
}) then {
|
||||
if ((_cameraView == "GUNNER") && {currentVisionMode _unit == 1}) then {
|
||||
_unit action ["NVGogglesOff", _unit];
|
||||
_unit setVariable [QGVAR(reenableNVGs), true];
|
||||
} else {
|
||||
if (_unit getVariable [QGVAR(reenableNVGs), false] && {_cameraView != "GUNNER"}) then {
|
||||
_unit action ["NVGoggles", _unit];
|
||||
_unit setVariable [QGVAR(reenableNVGs), false];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
32
addons/nightvision/functions/fnc_onVisionModeChanged.sqf
Normal file
32
addons/nightvision/functions/fnc_onVisionModeChanged.sqf
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Disables turning on NVGs while the player aims down his sight.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: New vision mode <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [player, 1] call ace_nightvision_fnc_onVisionModeChanged
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_visionMode"];
|
||||
|
||||
if (GVAR(disableNVGsWithSights) && {(hmd _unit) != ""}) then {
|
||||
if ((vehicle _unit == _unit)
|
||||
|| {isTurnedOut _unit}
|
||||
|| {!([_unit] call EFUNC(common,hasHatch))
|
||||
&& {[_unit] call EFUNC(common,getTurretIndex) in ([vehicle _unit] call EFUNC(common,getTurretsFFV))}
|
||||
}) then {
|
||||
if ((cameraView == "GUNNER") && {_visionMode > 0}) then {
|
||||
_unit action ["NVGogglesOff", _unit];
|
||||
};
|
||||
};
|
||||
};
|
@ -133,5 +133,21 @@
|
||||
<Portuguese>Diminuir Luminosidade do EVN</Portuguese>
|
||||
<Italian>Riduci la luminosità dell'NVG</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_NightVision_Module_DisplayName">
|
||||
<English>Nightvision</English>
|
||||
<German>Nachtsicht</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_NightVision_Module_Description">
|
||||
<English>Settings for night vision.</English>
|
||||
<German>Einstellungen für Nachtsichtgeräte.</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_NightVision_DisableNVGsWithSights_DisplayName">
|
||||
<English>Disable NVGs in scope</English>
|
||||
<German>Deakt. NVGs mit Visier</German>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_NightVision_DisableNVGsWithSights_Description">
|
||||
<English>Blocks the usage of night vision goggles whilst aiming down the sight.</English>
|
||||
<German>Blockiert das Benutzen von Nachtsichtbrillen beim Benutzen des Visiers.</German>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
</Project>
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 552 B |
Loading…
Reference in New Issue
Block a user