Rain effect is working as expected.

This commit is contained in:
Garth L-H de Wet 2015-01-19 01:12:45 +02:00
parent 10cdbeb4dd
commit b499cc9a1d

View File

@ -13,7 +13,7 @@
Nothing
Example:
[] spawn FUNC(RainEffect);
[] call FUNC(RainEffect);
*/
#include "script_component.hpp"
private ["_fnc_underCover"];
@ -25,31 +25,31 @@ _fnc_underCover = {
_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 (!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(RainLastRain) != rain) then {
if (GVAR(RainLastLevel) != rain) then {
call FUNC(RemoveRainEffect);
GVAR(RainLastRain) = rain;
GVAR(RainLastLevel) = rain;
// Rain is happening
if (GVAR(RainLastRain) > 0.05 && {!([ace_player] call _fnc_underCover)}) then {
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(RainLastRain)));
GVAR(RainDrops) setDropInterval (0.07 * (1.1 - GVAR(RainLastLevel)));
GVAR(RainDrops) attachTo [vehicle ace_player,[0,0,0]];
};
}else{
if (GVAR(RainLastRain) > 0.05) then {
if (GVAR(RainLastLevel) > 0.05) then {
if (GVAR(RainActive) && {[ace_player] call _fnc_underCover}) exitWith {
call FUNC(RemoveRainEffect);
};
if (!GVAR(RainActive)) then {
GVAR(RainLastRain) = -1;
GVAR(RainLastLevel) = -1;
};
};
};