2015-01-18 21:50:45 +00:00
|
|
|
/*
|
2015-02-02 09:04:53 +00:00
|
|
|
* Author: Garth 'L-H' de Wet
|
|
|
|
* Checks whether the player is in the downwash of a helicopter and handles applying effects of that.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* ["ACE_Goggles_RotorWash", "OnEachFrame", "call ace_goggles_fnc_OnEachFrame;"] call BIS_fnc_addStackedEventHandler;
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-01-18 21:50:45 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-18 22:57:39 +00:00
|
|
|
if (isNull(ace_player)) exitWith {};
|
2015-01-18 21:50:45 +00:00
|
|
|
GVAR(FrameEvent) set [0, !(GVAR(FrameEvent) select 0)];
|
|
|
|
if (GVAR(FrameEvent) select 0) exitWith {
|
2015-04-06 16:22:43 +00:00
|
|
|
if (vehicle ace_player != ace_player && {!([ace_player] call EFUNC(common,isTurnedOut))}) exitWith {(GVAR(FrameEvent) select 1) set [0, false]; };
|
|
|
|
GVAR(FrameEvent) set [1, ([ace_player] call FUNC(isInRotorWash))];
|
2015-01-18 21:50:45 +00:00
|
|
|
};
|
|
|
|
private ["_rotorWash","_safe"];
|
|
|
|
_rotorWash = GVAR(FrameEvent) select 1;
|
|
|
|
_safe = false;
|
|
|
|
if !(_rotorWash select 0) exitWith {
|
2015-04-06 16:22:43 +00:00
|
|
|
if (GVAR(PostProcessEyes_Enabled)) then {
|
|
|
|
GVAR(PostProcessEyes_Enabled) = false;
|
|
|
|
if (GVAR(DustHandler) != -1) then { // should be fixed in dev CBA
|
|
|
|
[GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler);
|
|
|
|
GVAR(DustHandler) = -1;
|
|
|
|
};
|
|
|
|
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0,0,0,0], [0,0,0,1],[1,1,1,0]];
|
|
|
|
GVAR(PostProcessEyes) ppEffectCommit 2;
|
|
|
|
GVAR(DustHandler) = [{
|
|
|
|
GVAR(PostProcessEyes) ppEffectEnable false;
|
|
|
|
GVAR(DustHandler) = -1;
|
|
|
|
}, [], 2, 0.5] call EFUNC(common,waitAndExecute);
|
|
|
|
};
|
2015-01-18 21:50:45 +00:00
|
|
|
};
|
|
|
|
if ((headgear ace_player) != "") then {
|
2015-04-06 16:22:43 +00:00
|
|
|
_safe = (getNumber (ConfigFile >> "CfgWeapons" >> (headgear ace_player) >> "ACE_Protection") == 1);
|
2015-01-18 21:50:45 +00:00
|
|
|
};
|
|
|
|
if !(_safe) then {
|
2015-04-06 16:22:43 +00:00
|
|
|
if !([ace_player] call FUNC(isGogglesVisible)) exitWith{};
|
|
|
|
if (GETDUSTT(DAMOUNT) < 2) then {
|
|
|
|
if (!GETDUSTT(DACTIVE)) then {
|
|
|
|
SETDUST(DACTIVE,true);
|
|
|
|
call FUNC(ApplyDust);
|
|
|
|
} else {
|
|
|
|
if ((_rotorWash select 1) > 0.5) then {
|
|
|
|
call FUNC(ApplyDust);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
_safe = (getNumber (ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_Protection") == 1);
|
2015-01-18 21:50:45 +00:00
|
|
|
};
|
|
|
|
if (_safe) exitWith {};
|
|
|
|
if ((_rotorWash select 1) <= 15) then {
|
2015-04-06 16:22:43 +00:00
|
|
|
private "_scale";
|
|
|
|
_scale = 0.7;
|
|
|
|
if ((_rotorWash select 1) != 0) then {
|
|
|
|
_scale = CLAMP(0.3*(_rotorWash select 1),0.1,0.3);
|
|
|
|
} else {
|
|
|
|
_scale = 0.1;
|
|
|
|
};
|
|
|
|
_scale = 1 - _scale;
|
|
|
|
if (GVAR(DustHandler) != -1) then { // should be fixed in dev CBA
|
|
|
|
[GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler);
|
|
|
|
GVAR(DustHandler) = -1;
|
|
|
|
};
|
|
|
|
if !(ace_player getVariable ["ACE_EyesDamaged", false]) then {
|
|
|
|
GVAR(PostProcessEyes_Enabled) = true;
|
|
|
|
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0,0,0,0], [_scale,_scale,_scale,_scale],[1,1,1,0]];
|
|
|
|
GVAR(PostProcessEyes) ppEffectCommit 0.5;
|
|
|
|
GVAR(PostProcessEyes) ppEffectEnable true;
|
|
|
|
};
|
2015-01-18 21:50:45 +00:00
|
|
|
};
|