From d1aacf3fef3cc6c5719f5d28ab962cae9b108ecd Mon Sep 17 00:00:00 2001 From: commy2 Date: Tue, 29 Sep 2015 19:51:41 +0200 Subject: [PATCH] more goggles code cleanup --- addons/goggles/XEH_postInit.sqf | 6 +- addons/goggles/XEH_preInit.sqf | 48 ++++++------ addons/goggles/functions/fnc_applyDirt.sqf | 33 -------- .../goggles/functions/fnc_applyDirtEffect.sqf | 39 ++++++++++ addons/goggles/functions/fnc_applyDust.sqf | 60 --------------- .../goggles/functions/fnc_applyDustEffect.sqf | 77 +++++++++++++++++++ ...Glasses.sqf => fnc_applyGlassesEffect.sqf} | 39 +++++----- .../goggles/functions/fnc_applyRainEffect.sqf | 68 ++++++++++++++++ addons/goggles/functions/fnc_checkGoggles.sqf | 2 +- addons/goggles/functions/fnc_dustHandler.sqf | 2 +- addons/goggles/functions/fnc_onEachFrame.sqf | 4 +- addons/goggles/functions/fnc_rainEffect.sqf | 53 ------------- 12 files changed, 238 insertions(+), 193 deletions(-) delete mode 100644 addons/goggles/functions/fnc_applyDirt.sqf create mode 100644 addons/goggles/functions/fnc_applyDirtEffect.sqf delete mode 100644 addons/goggles/functions/fnc_applyDust.sqf create mode 100644 addons/goggles/functions/fnc_applyDustEffect.sqf rename addons/goggles/functions/{fnc_applyGlasses.sqf => fnc_applyGlassesEffect.sqf} (52%) create mode 100644 addons/goggles/functions/fnc_applyRainEffect.sqf delete mode 100644 addons/goggles/functions/fnc_rainEffect.sqf diff --git a/addons/goggles/XEH_postInit.sqf b/addons/goggles/XEH_postInit.sqf index 0cff31e9d2..2d78e6f372 100644 --- a/addons/goggles/XEH_postInit.sqf +++ b/addons/goggles/XEH_postInit.sqf @@ -49,7 +49,7 @@ FUNC(CheckGlasses) = { player addEventHandler ["Explosion", { private "_effects"; if (alive ace_player) then { - call FUNC(ApplyDirt); + call FUNC(applyDirtEffect); if (GETBROKEN) exitWith {}; if (((_this select 1) call FUNC(GetExplosionIndex)) < getNumber(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_Resistance")) exitWith {}; if !([ace_player] call FUNC(isGogglesVisible)) exitWith {["GlassesCracked",[ace_player]] call EFUNC(common,localEvent);}; @@ -90,7 +90,7 @@ player AddEventHandler ["Put", {call FUNC(checkGlasses);}]; if (call FUNC(ExternalCamera)) exitWith {call FUNC(RemoveGlassesEffect)}; if ([ace_player] call FUNC(isGogglesVisible)) then { - [_this select 0] call FUNC(applyGlasses); + [_this select 0] call FUNC(applyGlassesEffect); } else { call FUNC(removeGlassesEffect); }; @@ -116,5 +116,5 @@ player AddEventHandler ["Put", {call FUNC(checkGlasses);}]; }] call EFUNC(common,addEventHandler); call FUNC(checkGlasses); [FUNC(CheckGoggles), 1, []] call CBA_fnc_addPerFrameHandler; -[FUNC(rainEffect), 0.5, []] call CBA_fnc_addPerFrameHandler; +[FUNC(applyRainEffect), 0.5, []] call CBA_fnc_addPerFrameHandler; [FUNC(onEachFrame), 0, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/goggles/XEH_preInit.sqf b/addons/goggles/XEH_preInit.sqf index 1a1222b4a1..be54cf73e6 100644 --- a/addons/goggles/XEH_preInit.sqf +++ b/addons/goggles/XEH_preInit.sqf @@ -2,31 +2,35 @@ ADDON = false; -PREP(handleExplosion); -PREP(handleFired); -PREP(handleKilled); - - -PREP(applyDirt); -PREP(applyDust); -PREP(applyGlasses); - -PREP(checkGoggles); -PREP(clearGlasses); -PREP(dustHandler); -PREP(externalCamera); -PREP(getExplosionIndex); - -PREP(isDivingGoggles); -PREP(isGogglesVisible); -PREP(isInRotorWash); - -PREP(onEachFrame); -PREP(rainEffect); - +// effects +PREP(applyDirtEffect); +PREP(applyDustEffect); +PREP(applyGlassesEffect); +PREP(applyRainEffect); PREP(removeDirtEffect); PREP(removeDustEffect); PREP(removeGlassesEffect); PREP(removeRainEffect); +// general +PREP(externalCamera); +PREP(isDivingGoggles); +PREP(isGogglesVisible); +PREP(isInRotorWash); +PREP(getExplosionIndex); + +// eventhandlers +PREP(handleExplosion); +PREP(handleFired); +PREP(handleKilled); + + + +PREP(checkGoggles); +PREP(clearGlasses); +PREP(dustHandler); + +PREP(onEachFrame); + + ADDON = true; diff --git a/addons/goggles/functions/fnc_applyDirt.sqf b/addons/goggles/functions/fnc_applyDirt.sqf deleted file mode 100644 index 87f140b91d..0000000000 --- a/addons/goggles/functions/fnc_applyDirt.sqf +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Author: Garth 'L-H' de Wet - * Adds dirt effect to the glasses. - * - * Arguments: - * None - * - * Return Value: - * Succeeded - * - * Example: - * _applied = call ace_goggles_fnc_ApplyDirt; - * - * Public: Yes - */ -#include "script_component.hpp" - -if (cameraOn != ace_player || {call FUNC(externalCamera)}) exitWith{false}; -private ["_dirtImage", "_applied", "_effects"]; -_effects = GETGLASSES(ace_player); -_effects set [DIRT, true]; -SETGLASSES(ace_player,_effects); - -if ([ace_player] call FUNC(isGogglesVisible)) then{ - _dirtImage = getText(ConfigFile >> "CfgGlasses" >> (goggles ace_player) >> "ACE_OverlayDirt"); - if (_dirtImage != "") then { - 100 cutRsc["RscACE_GogglesEffects", "PLAIN",0.1, false]; - - (GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10660) ctrlSetText _dirtImage; - }; -}; - -true diff --git a/addons/goggles/functions/fnc_applyDirtEffect.sqf b/addons/goggles/functions/fnc_applyDirtEffect.sqf new file mode 100644 index 0000000000..b8aedd5e64 --- /dev/null +++ b/addons/goggles/functions/fnc_applyDirtEffect.sqf @@ -0,0 +1,39 @@ +/* + * Author: Garth 'L-H' de Wet + * Adds dirt effect to the glasses. + * + * Arguments: + * None + * + * Return Value: + * Succeeded + * + * Example: + * _applied = call ace_goggles_fnc_applyDirtEffect + * + * Public: Yes + */ +#include "script_component.hpp" + +if (GVAR(showInThirdPerson)) exitWith {false}; +if (call FUNC(externalCamera)) exitWith {false}; + +private ["_unit", "_effects"]; + +_unit = ACE_player; + +_effects = GETGLASSES(_unit); +_effects set [DIRT, true]; + +SETGLASSES(_unit,_effects); + +if ([_unit] call FUNC(isGogglesVisible)) then { + local _dirtImage = getText (configFile >> "CfgGlasses" >> goggles _unit >> "ACE_OverlayDirt"); + + if (_dirtImage != "") then { + (QGVAR(GogglesEffectsLayer) call BIS_fnc_RSCLayer) cutRsc ["RscACE_GogglesEffects", "PLAIN", 0.1, false]; // @todo init as 100 + (GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10660) ctrlSetText _dirtImage; + }; +}; + +true diff --git a/addons/goggles/functions/fnc_applyDust.sqf b/addons/goggles/functions/fnc_applyDust.sqf deleted file mode 100644 index a1ac88c78d..0000000000 --- a/addons/goggles/functions/fnc_applyDust.sqf +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Author: Garth 'L-H' de Wet - * Applies dust to screen. - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call ace_goggles_fnc_ApplyDust; - * - * Public: Yes - */ -#include "script_component.hpp" - -if (call FUNC(ExternalCamera)) exitWith {}; -if ([ace_player] call FUNC(isGogglesVisible)) exitWith { - 100 cutRsc["RscACE_GogglesEffects", "PLAIN",2,false]; - (uiNamespace getVariable ["ACE_Goggles_DisplayEffects", displayNull] displayCtrl 10662) ctrlSetText format[getText(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_DustPath"), GETDUSTT(DAMOUNT)+1]; - SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)+1,0,1)); - SETDUST(DBULLETS,0); -}; - -if (GETVAR(ace_player,ACE_EyesDamaged,false)) exitWith {SETDUST(DACTIVE,false);SETDUST(DBULLETS,0);SETDUST(DAMOUNT,0);}; -SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)+1,0,2)); - -private "_amount"; -_amount = 1 - (GETDUSTT(DAMOUNT) * 0.125); - -GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [_amount,_amount,_amount,_amount],[1,1,1,0]]; -GVAR(PostProcessEyes) ppEffectCommit 1; -GVAR(PostProcessEyes) ppEffectEnable true; -SETDUST(DBULLETS,0); - -if (GVAR(DustHandler) != -1) then { // should be fixed in dev CBA - [GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler); - GVAR(DustHandler) = -1; -}; -GVAR(DustHandler) = [{ - if (ACE_diagTime >= GETDUSTT(DTIME) + 3) then { - SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2)); - private "_amount"; - _amount = 1 - (GETDUSTT(DAMOUNT) * 0.125); - if !(ace_player getVariable ["ACE_EyesDamaged", false]) then { - GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [_amount,_amount,_amount,_amount],[1,1,1,0]]; - GVAR(PostProcessEyes) ppEffectCommit 0.5; - }; - if (GETDUSTT(DAMOUNT) <= 0) then { - GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [1,1,1,1],[1,1,1,0]]; - GVAR(PostProcessEyes) ppEffectCommit 2; - [{GVAR(PostProcessEyes) ppEffectEnable false;}, [], 2, 0.5] call EFUNC(common,waitAndExecute); - SETDUST(DACTIVE,false); - SETDUST(DBULLETS,0); - [GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler); - GVAR(DustHandler) = -1; - }; - }; -},0,[]] call CALLSTACK(CBA_fnc_addPerFrameHandler); diff --git a/addons/goggles/functions/fnc_applyDustEffect.sqf b/addons/goggles/functions/fnc_applyDustEffect.sqf new file mode 100644 index 0000000000..6e89a8df6b --- /dev/null +++ b/addons/goggles/functions/fnc_applyDustEffect.sqf @@ -0,0 +1,77 @@ +/* + * Author: Garth 'L-H' de Wet + * Applies dust to screen. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_goggles_fnc_applyDustEffect + * + * Public: Yes + */ +#include "script_component.hpp" + +if (GVAR(showInThirdPerson)) exitWith {false}; +if (call FUNC(ExternalCamera)) exitWith {}; + +private ["_unit", "_amount"]; + +_unit = ACE_player; + +if ([_unit] call FUNC(isGogglesVisible)) exitWith { + (QGVAR(GogglesEffectsLayer) call BIS_fnc_RSCLayer) cutRsc ["RscACE_GogglesEffects", "PLAIN", 2, false]; + + ((GETUVAR(GVAR(DisplayEffects),displayNull)) displayCtrl 10662) ctrlSetText format [getText (configFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_DustPath"), GETDUSTT(DAMOUNT) + 1]; + + SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT) + 1,0,1)); + SETDUST(DBULLETS,0); +}; + +if (GETVAR(_unit,ACE_EyesDamaged,false)) exitWith { + SETDUST(DACTIVE,false); + SETDUST(DBULLETS,0); + SETDUST(DAMOUNT,0); +}; + +SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT) + 1,0,2)); + +_amount = 1 - (GETDUSTT(DAMOUNT) * 0.125); + +GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [_amount, _amount, _amount, _amount], [1, 1, 1, 0]]; +GVAR(PostProcessEyes) ppEffectCommit 1; +GVAR(PostProcessEyes) ppEffectEnable true; + +SETDUST(DBULLETS,0); + +[GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler; +GVAR(DustHandler) = -1; + +GVAR(DustHandler) = [{ + if (ACE_diagTime >= GETDUSTT(DTIME) + 3) then { + SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2)); + + local _amount = 1 - (GETDUSTT(DAMOUNT) * 0.125); + + if !(_unit getVariable ["ACE_EyesDamaged", false]) then { + GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [_amount, _amount, _amount, _amount], [1, 1, 1, 0]]; + GVAR(PostProcessEyes) ppEffectCommit 0.5; + }; + + if (GETDUSTT(DAMOUNT) <= 0) then { + GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [1, 1, 1, 1], [1, 1, 1, 0]]; + GVAR(PostProcessEyes) ppEffectCommit 2; + + [{GVAR(PostProcessEyes) ppEffectEnable false}, [], 2] call EFUNC(common,waitAndExecute); + + SETDUST(DACTIVE,false); + SETDUST(DBULLETS,0); + + [GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler; + GVAR(DustHandler) = -1; + }; + }; +}, 0, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/goggles/functions/fnc_applyGlasses.sqf b/addons/goggles/functions/fnc_applyGlassesEffect.sqf similarity index 52% rename from addons/goggles/functions/fnc_applyGlasses.sqf rename to addons/goggles/functions/fnc_applyGlassesEffect.sqf index e524a503a6..a8ccf23633 100644 --- a/addons/goggles/functions/fnc_applyGlasses.sqf +++ b/addons/goggles/functions/fnc_applyGlassesEffect.sqf @@ -11,20 +11,23 @@ * None * * Example: - * [goggles ace_player] call ace_goggles_fnc_ApplyGlasses + * [goggles ace_player] call ace_goggles_fnc_applyGlassesEffect * * Public: No */ #include "script_component.hpp" -private["_postProcessColour", "_postProcessTintAmount", "_glassesClassname", "_glassImagePath"]; - -_glassesClassname = _this select 0; -_postProcessColour = getArray(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_Color"); -_postProcessTintAmount = getNumber(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_TintAmount"); +params ["_glasses"]; +// remove old effect call FUNC(removeGlassesEffect); -GVAR(EffectsActive) = true; + +private ["_config", "_postProcessColour", "_postProcessTintAmount", "_imagePath"]; + +_config = configFile >> "CfgGlasses" >> _glasses; + +_postProcessColour = getArray (_config >> "ACE_Color"); +_postProcessTintAmount = getNumber (_config >> "ACE_TintAmount"); if (_postProcessTintAmount != 0 && {GVAR(UsePP)}) then { _postProcessColour set [3, _postProcessTintAmount/100]; @@ -36,20 +39,20 @@ if (_postProcessTintAmount != 0 && {GVAR(UsePP)}) then { GVAR(PostProcess) ppEffectCommit 30; }; -_glassImagePath = getText(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_Overlay"); -if GETBROKEN then { - _glassImagePath = getText(configFile >> "CfgGlasses" >> _glassesClassname >> "ACE_OverlayCracked"); -}; -if (_glassImagePath != "") then { - 150 cutRsc["RscACE_Goggles", "PLAIN",1, false]; - (GLASSDISPLAY displayCtrl 10650) ctrlSetText _glassImagePath; +_imagePath = getText (_config >> ["ACE_Overlay", "ACE_OverlayCracked"] select GETBROKEN); + +if (_imagePath != "") then { + (QGVAR(GogglesLayer) call BIS_fnc_RSCLayer) cutRsc ["RscACE_Goggles", "PLAIN", 1, false]; // @todo init as 150 + (GLASSDISPLAY displayCtrl 10650) ctrlSetText _imagePath; }; -if GETDIRT then { - call FUNC(applyDirt); +if (GETDIRT) then { + call FUNC(applyDirtEffect); }; -if GETDUSTT(DACTIVE) then { +if (GETDUSTT(DACTIVE)) then { SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2)); - call FUNC(applyDust); + call FUNC(applyDustEffect); }; + +GVAR(EffectsActive) = true; diff --git a/addons/goggles/functions/fnc_applyRainEffect.sqf b/addons/goggles/functions/fnc_applyRainEffect.sqf new file mode 100644 index 0000000000..7e1260a453 --- /dev/null +++ b/addons/goggles/functions/fnc_applyRainEffect.sqf @@ -0,0 +1,68 @@ +/* + * Author: Garth 'L-H' de Wet + * Handles rain effects being created on glasses. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_goggles_fnc_applyRainEffect; + * + * Public: No + */ +#include "script_component.hpp" + +private ["_unit", "_fnc_underCover"]; + +_unit = ACE_player; + +if (!alive _unit) exitWith {}; + +_fnc_underCover = { + params ["_unit"]; + + if (vehicle _unit != _unit && {!isTurnedOut _unit}) exitWith {true}; + + // looking up and no roof over head + local _position = eyePos _unit; + positionCameraToWorld [0, 0, 1] select 2 < (positionCameraToWorld [0, 0, 0] select 2) - 0.4 || {(lineIntersects [_position, _position vectorAdd [0, 0, 15], _unit])} // return +}; + +if (!isNull findDisplay 312) exitWith { + if (GVAR(RainActive)) then { + call FUNC(removeRainEffect); + }; +}; + +// Ignore if unit is under water +if !(GVAR(EffectsActive) || {underwater _unit}) exitWith { + call FUNC(RemoveRainEffect); +}; + +if (GVAR(RainLastLevel) != rain) then { + call FUNC(RemoveRainEffect); + + GVAR(RainLastLevel) = rain; + + // Rain is happening + if (GVAR(RainLastLevel) > 0.05 && {!([_unit] call _fnc_underCover)}) then { + GVAR(RainActive) = true; + GVAR(RainDrops) = "#particlesource" createVehicleLocal position _unit; + GVAR(RainDrops) setParticleClass "ACERainEffect"; + GVAR(RainDrops) setDropInterval (0.07 * (1.1 - GVAR(RainLastLevel))); + GVAR(RainDrops) attachTo [vehicle _unit, [0,0,0]]; + }; +} else { + if (GVAR(RainLastLevel) > 0.05) then { + if (GVAR(RainActive) && {[_unit] call _fnc_underCover}) exitWith { + call FUNC(RemoveRainEffect); + }; + + if !(GVAR(RainActive)) then { + GVAR(RainLastLevel) = -1; + }; + }; +}; diff --git a/addons/goggles/functions/fnc_checkGoggles.sqf b/addons/goggles/functions/fnc_checkGoggles.sqf index 0587469f02..84b86c3da4 100644 --- a/addons/goggles/functions/fnc_checkGoggles.sqf +++ b/addons/goggles/functions/fnc_checkGoggles.sqf @@ -35,7 +35,7 @@ if (true) then { }; }; if !(GVAR(EffectsActive)) then { - [goggles ace_player] call FUNC(applyGlasses); + [goggles ace_player] call FUNC(applyGlassesEffect); } else { if ([goggles ace_player] call FUNC(isDivingGoggles) && {underwater ace_player}) then { call FUNC(removeRainEffect); diff --git a/addons/goggles/functions/fnc_dustHandler.sqf b/addons/goggles/functions/fnc_dustHandler.sqf index 2f23f69afb..90260d07b3 100644 --- a/addons/goggles/functions/fnc_dustHandler.sqf +++ b/addons/goggles/functions/fnc_dustHandler.sqf @@ -81,7 +81,7 @@ if (GETDUSTT(DAMOUNT) < 2) then { if (_bullets > _bulletsRequired) then { SETDUST(DACTIVE,true); - call FUNC(applyDust); + call FUNC(applyDustEffect); }; }; diff --git a/addons/goggles/functions/fnc_onEachFrame.sqf b/addons/goggles/functions/fnc_onEachFrame.sqf index 85692a0f57..b3494d1290 100644 --- a/addons/goggles/functions/fnc_onEachFrame.sqf +++ b/addons/goggles/functions/fnc_onEachFrame.sqf @@ -46,10 +46,10 @@ if !(_safe) then { if (GETDUSTT(DAMOUNT) < 2) then { if (!GETDUSTT(DACTIVE)) then { SETDUST(DACTIVE,true); - call FUNC(ApplyDust); + call FUNC(applyDustEffect); } else { if ((_rotorWash select 1) > 0.5) then { - call FUNC(ApplyDust); + call FUNC(applyDustEffect); }; }; }; diff --git a/addons/goggles/functions/fnc_rainEffect.sqf b/addons/goggles/functions/fnc_rainEffect.sqf deleted file mode 100644 index 6f351f4002..0000000000 --- a/addons/goggles/functions/fnc_rainEffect.sqf +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Author: Garth 'L-H' de Wet - * Handles rain effects being created on glasses. - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call ace_goggles_fnc_rainEffect; - * - * Public: No - */ -#include "script_component.hpp" -private ["_fnc_underCover"]; -if (isNull(ace_player) || {!(alive ace_player)}) exitWith {}; -_fnc_underCover = { - private ["_pos", "_unit"]; - _unit = (_this select 0); - if (vehicle _unit != _unit && {!isTurnedOut _unit}) exitWith {true}; - _pos = eyePos _unit; - ((positionCameraToWorld [0,0,1] select 2) < ((positionCameraToWorld [0,0,0] select 2) - 0.4)) || {(lineIntersects [_pos, _pos vectorAdd [0,0,15], _unit])} -}; -if (!isNull(findDisplay 312)) exitWith { - if (GVAR(RainActive)) then { - call FUNC(RemoveRainEffect); - }; -}; -// Ignore if ace_player is under water -if (!GVAR(EffectsActive) || {underwater ace_player}) exitWith{call FUNC(RemoveRainEffect);}; -if (GVAR(RainLastLevel) != rain) then { - call FUNC(RemoveRainEffect); - GVAR(RainLastLevel) = rain; - // Rain is happening - if (GVAR(RainLastLevel) > 0.05 && {!([ace_player] call _fnc_underCover)}) then { - GVAR(RainActive) = true; - GVAR(RainDrops) = "#particlesource" createVehicleLocal GetPos ace_player; - GVAR(RainDrops) setParticleClass "ACERainEffect"; - GVAR(RainDrops) setDropInterval (0.07 * (1.1 - GVAR(RainLastLevel))); - GVAR(RainDrops) attachTo [vehicle ace_player,[0,0,0]]; - }; -}else{ - if (GVAR(RainLastLevel) > 0.05) then { - if (GVAR(RainActive) && {[ace_player] call _fnc_underCover}) exitWith { - call FUNC(RemoveRainEffect); - }; - if (!GVAR(RainActive)) then { - GVAR(RainLastLevel) = -1; - }; - }; -};