Skip to content

Commit

Permalink
linearSD: ability to set weather per round
Browse files Browse the repository at this point in the history
  • Loading branch information
McDiod committed Jun 23, 2019
1 parent f04130f commit 7d7bb6d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
2 changes: 2 additions & 0 deletions functions/linearSD/cfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class grad_linearSD {
class createSector {};
class dynamicText {};
class endRound {};
class getWeather {};
class isLastSector {};
class movePlayerToRespawnPos {};
class moveRespawnPositions {};
Expand All @@ -20,6 +21,7 @@ class grad_linearSD {
class setActiveSectors {};
class setLastRound {};
class setTimeAndDate {};
class setWeather {};
class spawnSectorVehicles {};
class startEliminationCheck {};
class startLinearSD {};
Expand Down
8 changes: 8 additions & 0 deletions functions/linearSD/fn_getWeather.sqf
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions functions/linearSD/fn_setWeather.sqf
Original file line number Diff line number Diff line change
@@ -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;
};
3 changes: 2 additions & 1 deletion functions/linearSD/fn_startLinearSD.sqf
Original file line number Diff line number Diff line change
@@ -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);
Expand Down Expand Up @@ -28,6 +28,7 @@ if (isServer) then {

GVAR(opforDirection) = _opforDirection;
GVAR(dateAndTimeArray) = _dateAndTimeArray;
GVAR(weatherArray) = _weatherArray;
GVAR(defendingSide) = sideUnknown;
GVAR(allAttackerVehicles) = [];
GVAR(isLastRound) = false;
Expand Down
1 change: 1 addition & 0 deletions functions/linearSD/fn_startNewRound.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7d7bb6d

Please sign in to comment.