From 7d7bb6d0d4b68dbc67b5936897d93600914ae2f6 Mon Sep 17 00:00:00 2001 From: McDiod Date: Sun, 23 Jun 2019 21:00:16 +0200 Subject: [PATCH] linearSD: ability to set weather per round --- functions/linearSD/cfgFunctions.hpp | 2 ++ functions/linearSD/fn_getWeather.sqf | 8 ++++++++ functions/linearSD/fn_setWeather.sqf | 15 +++++++++++++++ functions/linearSD/fn_startLinearSD.sqf | 3 ++- functions/linearSD/fn_startNewRound.sqf | 1 + 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 functions/linearSD/fn_getWeather.sqf create mode 100644 functions/linearSD/fn_setWeather.sqf diff --git a/functions/linearSD/cfgFunctions.hpp b/functions/linearSD/cfgFunctions.hpp index 2327967..a2267ab 100644 --- a/functions/linearSD/cfgFunctions.hpp +++ b/functions/linearSD/cfgFunctions.hpp @@ -10,6 +10,7 @@ class grad_linearSD { class createSector {}; class dynamicText {}; class endRound {}; + class getWeather {}; class isLastSector {}; class movePlayerToRespawnPos {}; class moveRespawnPositions {}; @@ -20,6 +21,7 @@ class grad_linearSD { class setActiveSectors {}; class setLastRound {}; class setTimeAndDate {}; + class setWeather {}; class spawnSectorVehicles {}; class startEliminationCheck {}; class startLinearSD {}; diff --git a/functions/linearSD/fn_getWeather.sqf b/functions/linearSD/fn_getWeather.sqf new file mode 100644 index 0000000..9289ed9 --- /dev/null +++ b/functions/linearSD/fn_getWeather.sqf @@ -0,0 +1,8 @@ +#include "component.hpp" + +// returns array in format for weatherArray entry (fn_startLinearSD) + +private _return = [overcast,fogParams,wind]; +(_return select 2) set [2,false]; + +_return diff --git a/functions/linearSD/fn_setWeather.sqf b/functions/linearSD/fn_setWeather.sqf new file mode 100644 index 0000000..a3a1106 --- /dev/null +++ b/functions/linearSD/fn_setWeather.sqf @@ -0,0 +1,15 @@ +#include "component.hpp" + +if (!isServer) exitWith {}; + +private _targetWeather = GVAR(weatherArray) deleteAt 0; +if (isNil "_targetWeather") exitWith {}; + +[_targetWeather] spawn { + (_this select 0) params [["_overcast",random 0.4],["_fogParams",[0,0,0]]]; + + [_overcast] call BIS_fnc_setOvercast; + + sleep 1; + 0.5 setFog _fogParams; +}; diff --git a/functions/linearSD/fn_startLinearSD.sqf b/functions/linearSD/fn_startLinearSD.sqf index 495c5a5..e06e626 100644 --- a/functions/linearSD/fn_startLinearSD.sqf +++ b/functions/linearSD/fn_startLinearSD.sqf @@ -1,6 +1,6 @@ #include "component.hpp" -params [["_startingSectorID",-1],["_roundLength",60],["_opforDirection",1],["_dateAndTimeArray",[]]]; +params [["_startingSectorID",-1],["_roundLength",60],["_opforDirection",1],["_dateAndTimeArray",[]],["_weatherArray",[]]]; if (hasInterface) then { [] call FUNC(addTeleportAction); @@ -28,6 +28,7 @@ if (isServer) then { GVAR(opforDirection) = _opforDirection; GVAR(dateAndTimeArray) = _dateAndTimeArray; + GVAR(weatherArray) = _weatherArray; GVAR(defendingSide) = sideUnknown; GVAR(allAttackerVehicles) = []; GVAR(isLastRound) = false; diff --git a/functions/linearSD/fn_startNewRound.sqf b/functions/linearSD/fn_startNewRound.sqf index 02b29ca..9ca2fea 100644 --- a/functions/linearSD/fn_startNewRound.sqf +++ b/functions/linearSD/fn_startNewRound.sqf @@ -24,6 +24,7 @@ publicVariable QGVAR(roundNumber); [] remoteExec [QFUNC(respawnPlayer),0,false]; [] call FUNC(playzoneCleanup); [] call FUNC(setTimeAndDate); + [] call FUNC(setWeather); // move players to respawn position manually in first round } else {