Spawn infectious waterholes locally on each machine

Vanilla commits:

2d47c7250c

94a0bac524

44b7114129
This commit is contained in:
ebaydayz
2016-10-17 16:49:24 -04:00
parent 228ac99eb1
commit fffcf43bbb
46 changed files with 1576 additions and 1536 deletions

View File

@@ -1,59 +1,57 @@
//Start server selection for infectedWaterHoles.
if (isServer) then {
private ["_WaterHoleArray","_ShuffleArray"];
private ["_WaterHoleArray","_ShuffleArray"];
_WaterHoleArray = [
"BlackLake",
"Gvozdno",
"Gvozdno",
"Kabanino",
"Kopyto",
"Mogilevka",
"Nadezdinho",
"NorthNadezdinho",
"NorthPusta",
"NorthTopolka",
"Novy",
"PobedaDam",
"Pogorevka",
"Polana",
"Prud",
"Sosnovy",
"Stary",
"Topolka",
"Vysota",
"WillowLake"
];
_WaterHoleArray = [
"BlackLake",
"Gvozdno",
"Gvozdno",
"Kabanino",
"Kopyto",
"Mogilevka",
"Nadezdinho",
"NorthNadezdinho",
"NorthPusta",
"NorthTopolka",
"Novy",
"PobedaDam",
"Pogorevka",
"Polana",
"Prud",
"Sosnovy",
"Stary",
"Topolka",
"Vysota",
"WillowLake"
];
_infectedWaterHoles = _WaterHoleArray call fn_shuffleArray;
_ShuffleArray = {
private ["_ar","_rand_array","_rand"];
_ar = _this;
_rand_array = [];
while {count _ar > 0} do {
_rand = (count _ar);
_rand = floor (random _rand);
_rand_array set [count _rand_array, _ar select _rand];
_ar set [_rand, "randarray_del"];
_ar = _ar - ["randarray_del"];
uiSleep 0.001;
};
_rand_array;
infectedWaterHoles = [];
diag_log format["INFO: Choosing waterholes to be infectious",true];
{
if ((random 1) < 0.5) then {
infectedWaterHoles set [count infectedWaterHoles, _x]; // set
};
uiSleep 0.01;
} count _infectedWaterHoles;
//Send the random array to everyone.
publicVariable "infectedWaterHoles";
diag_log format["INFO: Chosen waterholes to be infectious - %1",infectedWaterHoles];
};
_infectedWaterHoles = _WaterHoleArray call _ShuffleArray;
//Setup on each client witch water holes have been chosen by the server to be infected
if (!isDedicated) then {
_i = 0;
_t = 0;
_activeArray = [];
//diag_log [ diag_tickTime, __FILE__, "Sp4wing infectious waterholes..."];
{
if ((random 1) < 0.5) then {
call compile preprocessFileLineNumbers ("\z\addons\dayz_code\system\mission\chernarus\infectiousWaterholes\"+_x+".sqf");
_activeArray set [count _activeArray, _x]; // set
_i = _i + 1;
};
_t = _t + 1;
uiSleep 0.01;
}count _infectedWaterHoles;
//diag_log [ diag_tickTime, __FILE__, "Infectious waterholes Max,Spawned,Active:",_t,_i,_activeArray];
waitUntil { uiSleep 0.1; !isNil "infectedWaterHoles" };
{
call compile preprocessFileLineNumbers ("\z\addons\dayz_code\system\mission\chernarus\infectiousWaterholes\"+_x+".sqf");
} count infectedWaterHoles;
};