mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Split event handlers
This commit is contained in:
parent
e50a28874f
commit
2fe53431c7
@ -32,12 +32,12 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0;
|
||||
["playerInventoryChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler);
|
||||
["playerVisionModeChanged", {
|
||||
_this call FUNC(updatePPEffects);
|
||||
_this call FUNC(handleNVGs);
|
||||
_this call FUNC(onVisionModeChanged);
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
["zeusDisplayChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler);
|
||||
["cameraViewChanged", {
|
||||
_this call FUNC(updatePPEffects);
|
||||
_this call FUNC(handleNVGs);
|
||||
_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,8 +4,9 @@ ADDON = false;
|
||||
|
||||
PREP(blending);
|
||||
PREP(changeNVGBrightness);
|
||||
PREP(handleNVGs);
|
||||
PREP(initModule);
|
||||
PREP(onCameraViewChanged);
|
||||
PREP(onVisionModeChanged);
|
||||
PREP(updatePPEffects);
|
||||
|
||||
ADDON = true;
|
||||
|
@ -1,31 +1,32 @@
|
||||
/*
|
||||
* Author: BaerMitUmlaut
|
||||
* Disables NVGs when the player aims down his sight.
|
||||
* 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] call ace_nightvision_fnc_disableNVGs
|
||||
* [player, "GUNNER"] call ace_nightvision_fnc_onCameraViewChanged
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit"];
|
||||
params ["_unit", "_cameraView"];
|
||||
|
||||
if (GVAR(disableNVGsWithSights) && {(hmd _unit) != ""}) then {
|
||||
(assignedVehicleRole _unit) params ["_role", "_turretPath"];
|
||||
if ((vehicle _unit == _unit) || {isTurnedOut _unit} || {_role == "cargo" && {!(isNil "_turretPath")}}) then {
|
||||
if ((cameraView == "GUNNER") && {currentVisionMode _unit > 0}) then {
|
||||
if ((_cameraView == "GUNNER") && {currentVisionMode _unit > 0}) then {
|
||||
_unit action ["NVGogglesOff", _unit];
|
||||
GVAR(reenableNVGs) = true;
|
||||
} else {
|
||||
if (GVAR(reenableNVGs) && {cameraView != "GUNNER"}) then {
|
||||
if (GVAR(reenableNVGs) && {_cameraView != "GUNNER"}) then {
|
||||
_unit action ["NVGoggles", _unit];
|
||||
GVAR(reenableNVGs) = false;
|
||||
};
|
29
addons/nightvision/functions/fnc_onVisionModeChanged.sqf
Normal file
29
addons/nightvision/functions/fnc_onVisionModeChanged.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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 {
|
||||
(assignedVehicleRole _unit) params ["_role", "_turretPath"];
|
||||
if ((vehicle _unit == _unit) || {isTurnedOut _unit} || {_role == "cargo" && {!(isNil "_turretPath")}}) then {
|
||||
if ((cameraView == "GUNNER") && {_visionMode > 0}) then {
|
||||
_unit action ["NVGogglesOff", _unit];
|
||||
};
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue
Block a user