mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
more goggles code cleanup
This commit is contained in:
parent
53bfcdb61e
commit
d1aacf3fef
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Author: Garth 'L-H' de Wet
|
||||
* Adds dirt effect to the glasses.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* Succeeded <BOOL>
|
||||
*
|
||||
* 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
|
39
addons/goggles/functions/fnc_applyDirtEffect.sqf
Normal file
39
addons/goggles/functions/fnc_applyDirtEffect.sqf
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Author: Garth 'L-H' de Wet
|
||||
* Adds dirt effect to the glasses.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* Succeeded <BOOL>
|
||||
*
|
||||
* 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
|
@ -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);
|
77
addons/goggles/functions/fnc_applyDustEffect.sqf
Normal file
77
addons/goggles/functions/fnc_applyDustEffect.sqf
Normal file
@ -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;
|
@ -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;
|
68
addons/goggles/functions/fnc_applyRainEffect.sqf
Normal file
68
addons/goggles/functions/fnc_applyRainEffect.sqf
Normal file
@ -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;
|
||||
};
|
||||
};
|
||||
};
|
@ -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);
|
||||
|
@ -81,7 +81,7 @@ if (GETDUSTT(DAMOUNT) < 2) then {
|
||||
|
||||
if (_bullets > _bulletsRequired) then {
|
||||
SETDUST(DACTIVE,true);
|
||||
call FUNC(applyDust);
|
||||
call FUNC(applyDustEffect);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -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);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -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;
|
||||
};
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue
Block a user