2015-01-18 21:50:45 +00:00
|
|
|
#include "script_component.hpp"
|
2015-09-29 14:22:57 +00:00
|
|
|
|
2015-01-18 21:50:45 +00:00
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
|
2015-09-29 14:22:57 +00:00
|
|
|
["ACE3 Common", QGVAR(wipeGlasses), localize LSTRING(WipeGlasses), {
|
2016-06-26 00:16:26 +00:00
|
|
|
if (GVAR(effects) != 2) exitWith {false}; //Can only wipe if full effects setting is set
|
2017-12-30 13:38:45 +00:00
|
|
|
if (!GETVAR(ace_player,ACE_isUnconscious,false)) exitWith {
|
2015-03-05 07:32:26 +00:00
|
|
|
call FUNC(clearGlasses);
|
|
|
|
true
|
|
|
|
};
|
|
|
|
false
|
|
|
|
},
|
2015-03-05 08:51:24 +00:00
|
|
|
{false},
|
2015-09-29 14:22:57 +00:00
|
|
|
[20, [true, true, false]], false] call CBA_fnc_addKeybind;
|
|
|
|
|
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
["ace_settingsInitialized", {
|
|
|
|
TRACE_2("ace_settingsInitialized eh",GVAR(effects),GVAR(showInThirdPerson));
|
2015-01-18 21:50:45 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
if (GVAR(effects) == 0) exitWith {};
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
// ---Add the TINT Effect---
|
2017-04-11 15:06:29 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
// make sure to stack effect layers in correct order
|
|
|
|
GVAR(GogglesEffectsLayer) = QGVAR(GogglesEffectsLayer) call BIS_fnc_RSCLayer;
|
|
|
|
GVAR(GogglesLayer) = QGVAR(GogglesLayer) call BIS_fnc_RSCLayer;
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
if (isNil QGVAR(UsePP)) then {
|
|
|
|
GVAR(UsePP) = true;
|
|
|
|
};
|
|
|
|
|
2017-04-11 15:06:29 +00:00
|
|
|
// init pp effects
|
|
|
|
GVAR(PostProcess) = ppEffectCreate ["ColorCorrections", 1995];
|
|
|
|
GVAR(EffectsActive) = false;
|
|
|
|
|
|
|
|
// add glasses eventhandlers
|
|
|
|
["ace_glassesChanged", {
|
|
|
|
params ["_unit", "_glasses"];
|
|
|
|
TRACE_2("ace_glassesChanged eh",_unit,_glasses);
|
|
|
|
|
|
|
|
SETGLASSES(_unit,GLASSESDEFAULT);
|
|
|
|
|
|
|
|
if (call FUNC(ExternalCamera)) exitWith {call FUNC(RemoveGlassesEffect)};
|
|
|
|
|
|
|
|
if ([_unit] call FUNC(isGogglesVisible)) then {
|
|
|
|
[_unit, _glasses] call FUNC(applyGlassesEffect);
|
|
|
|
} else {
|
|
|
|
call FUNC(removeGlassesEffect);
|
|
|
|
};
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
// init GlassesChanged eventhandler
|
|
|
|
GVAR(OldGlasses) = "<null>";
|
|
|
|
["loadout", {
|
|
|
|
params ["_unit"];
|
|
|
|
|
|
|
|
private _currentGlasses = goggles _unit;
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
if (GVAR(OldGlasses) != _currentGlasses) then {
|
|
|
|
["ace_glassesChanged", [_unit, _currentGlasses]] call CBA_fnc_localEvent;
|
|
|
|
GVAR(OldGlasses) = _currentGlasses;
|
|
|
|
};
|
2017-04-11 15:06:29 +00:00
|
|
|
}, true] call CBA_fnc_addPlayerEventHandler;
|
2015-01-18 21:50:45 +00:00
|
|
|
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2016-05-16 13:22:37 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
// check goggles
|
|
|
|
private _fnc_checkGoggles = {
|
|
|
|
params ["_unit"];
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
if (GVAR(EffectsActive)) then {
|
|
|
|
if (call FUNC(externalCamera) || {!([_unit] call FUNC(isGogglesVisible))}) then {
|
|
|
|
call FUNC(removeGlassesEffect);
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
if (!(call FUNC(externalCamera)) && {[_unit] call FUNC(isGogglesVisible)}) then {
|
2017-04-11 15:06:29 +00:00
|
|
|
[_unit, goggles _unit] call FUNC(applyGlassesEffect);
|
2016-06-26 00:16:26 +00:00
|
|
|
};
|
|
|
|
};
|
2015-03-05 07:32:26 +00:00
|
|
|
};
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
["cameraView", _fnc_checkGoggles] call CBA_fnc_addPlayerEventHandler;
|
2018-10-12 12:59:40 +00:00
|
|
|
["featureCamera", _fnc_checkGoggles] call CBA_fnc_addPlayerEventHandler;
|
2015-01-18 21:50:45 +00:00
|
|
|
|
|
|
|
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
// // ---Add the Dust/Dirt/Rain Effects---
|
|
|
|
if (GVAR(effects) == 2) then {
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
// Register fire event handler
|
|
|
|
["ace_firedPlayer", DFUNC(handleFired)] call CBA_fnc_addEventHandler;
|
|
|
|
|
|
|
|
//Add Explosion XEH
|
|
|
|
["CAManBase", "explosion", FUNC(handleExplosion)] call CBA_fnc_addClassEventHandler;
|
|
|
|
|
|
|
|
GVAR(PostProcessEyes) = ppEffectCreate ["ColorCorrections", 1992];
|
|
|
|
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [1, 1, 1, 0]];
|
|
|
|
GVAR(PostProcessEyes) ppEffectCommit 0;
|
|
|
|
GVAR(PostProcessEyes) ppEffectEnable false;
|
|
|
|
GVAR(PostProcessEyes_Enabled) = false;
|
2017-04-11 15:06:29 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
GVAR(FrameEvent) = [false, [false, 20]];
|
|
|
|
GVAR(DustHandler) = -1;
|
|
|
|
GVAR(RainDrops) = objNull;
|
|
|
|
GVAR(RainActive) = false;
|
|
|
|
GVAR(RainLastLevel) = 0;
|
|
|
|
GVAR(surfaceCache) = "";
|
|
|
|
GVAR(surfaceCacheIsDust) = false;
|
|
|
|
|
|
|
|
["ace_glassesCracked", {
|
2015-09-29 20:01:40 +00:00
|
|
|
params ["_unit"];
|
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
_unit setVariable ["ACE_EyesDamaged", true];
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [0.5, 0.5, 0.5, 0.5], [1, 1, 1, 0]];
|
|
|
|
GVAR(PostProcessEyes) ppEffectCommit 0;
|
|
|
|
GVAR(PostProcessEyes) ppEffectEnable true;
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
[{
|
|
|
|
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [1, 1, 1, 1], [1, 1, 1, 0]];
|
|
|
|
GVAR(PostProcessEyes) ppEffectCommit 5;
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
[{
|
|
|
|
params ["_unit"];
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
GVAR(PostProcessEyes) ppEffectEnable false;
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
_unit setVariable ["ACE_EyesDamaged", false];
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
}, _this, 5] call CBA_fnc_waitAndExecute;
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
}, _unit, 25] call CBA_fnc_waitAndExecute;
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
}] call CBA_fnc_addEventHandler;
|
2015-12-27 05:31:49 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
// goggles effects main PFH
|
|
|
|
[{
|
|
|
|
BEGIN_COUNTER(goggles);
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
// rain
|
|
|
|
call FUNC(applyRainEffect);
|
2015-09-29 20:01:40 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
// auto remove effects under water
|
|
|
|
if (GVAR(EffectsActive) && {underwater ACE_player} && {[goggles ACE_player] call FUNC(isDivingGoggles)}) then {
|
|
|
|
call FUNC(removeRainEffect);
|
|
|
|
call FUNC(removeDirtEffect);
|
|
|
|
call FUNC(removeDustEffect);
|
|
|
|
};
|
2015-12-27 05:31:49 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
// rotor wash effect
|
|
|
|
call FUNC(applyRotorWashEffect);
|
2016-02-06 20:16:10 +00:00
|
|
|
|
2016-06-26 00:16:26 +00:00
|
|
|
END_COUNTER(goggles);
|
|
|
|
}, 0.5, []] call CBA_fnc_addPerFrameHandler;
|
|
|
|
};
|
|
|
|
}] call CBA_fnc_addEventHandler;
|