2015-01-18 21:50:45 +00:00
|
|
|
/*
|
|
|
|
fnc_rainEffect.sqf
|
|
|
|
|
|
|
|
Author: Garth de Wet (LH)
|
|
|
|
|
|
|
|
Description:
|
|
|
|
|
|
|
|
|
|
|
|
Parameters:
|
|
|
|
Nothing
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
Nothing
|
|
|
|
|
|
|
|
Example:
|
2015-01-18 23:12:45 +00:00
|
|
|
[] call FUNC(RainEffect);
|
2015-01-18 21:50:45 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
2015-01-18 22:57:39 +00:00
|
|
|
private ["_fnc_underCover"];
|
|
|
|
if (isNull(ace_player) || {!(alive ace_player)}) exitWith {};
|
2015-01-18 21:50:45 +00:00
|
|
|
_fnc_underCover = {
|
|
|
|
private ["_pos", "_unit"];
|
|
|
|
_unit = (_this select 0);
|
|
|
|
if (vehicle _unit != _unit && {!([_unit] call EFUNC(common,isTurnedOut))}) 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])}
|
|
|
|
};
|
2015-01-18 23:12:45 +00:00
|
|
|
if (!isNull(findDisplay 312)) exitWith {
|
2015-01-18 22:57:39 +00:00
|
|
|
if (GVAR(RainActive)) then {
|
|
|
|
call FUNC(RemoveRainEffect);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
// Ignore if ace_player is under water
|
|
|
|
if (!GVAR(EffectsActive) || {underwater ace_player}) exitWith{call FUNC(RemoveRainEffect);};
|
2015-01-18 23:12:45 +00:00
|
|
|
if (GVAR(RainLastLevel) != rain) then {
|
2015-01-18 22:57:39 +00:00
|
|
|
call FUNC(RemoveRainEffect);
|
2015-01-18 23:12:45 +00:00
|
|
|
GVAR(RainLastLevel) = rain;
|
2015-01-18 22:57:39 +00:00
|
|
|
// Rain is happening
|
2015-01-18 23:12:45 +00:00
|
|
|
if (GVAR(RainLastLevel) > 0.05 && {!([ace_player] call _fnc_underCover)}) then {
|
2015-01-18 22:57:39 +00:00
|
|
|
GVAR(RainActive) = true;
|
|
|
|
GVAR(RainDrops) = "#particlesource" createVehicleLocal GetPos ace_player;
|
|
|
|
GVAR(RainDrops) setParticleClass "ACERainEffect";
|
2015-01-18 23:12:45 +00:00
|
|
|
GVAR(RainDrops) setDropInterval (0.07 * (1.1 - GVAR(RainLastLevel)));
|
2015-01-18 22:57:39 +00:00
|
|
|
GVAR(RainDrops) attachTo [vehicle ace_player,[0,0,0]];
|
|
|
|
};
|
|
|
|
}else{
|
2015-01-18 23:12:45 +00:00
|
|
|
if (GVAR(RainLastLevel) > 0.05) then {
|
2015-01-18 22:57:39 +00:00
|
|
|
if (GVAR(RainActive) && {[ace_player] call _fnc_underCover}) exitWith {
|
2015-01-18 21:50:45 +00:00
|
|
|
call FUNC(RemoveRainEffect);
|
|
|
|
};
|
2015-01-18 22:57:39 +00:00
|
|
|
if (!GVAR(RainActive)) then {
|
2015-01-18 23:12:45 +00:00
|
|
|
GVAR(RainLastLevel) = -1;
|
2015-01-18 21:50:45 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|