diff --git a/SQF/dayz_server/system/server_monitor.sqf b/SQF/dayz_server/system/server_monitor.sqf index 232de972b..4357c6b78 100644 --- a/SQF/dayz_server/system/server_monitor.sqf +++ b/SQF/dayz_server/system/server_monitor.sqf @@ -1,8 +1,10 @@ -private ["_nul","_result","_pos","_wsDone","_dir","_block","_isOK","_countr","_objWpnTypes","_objWpnQty","_dam","_selection","_totalvehicles","_object","_idKey","_type","_ownerID","_worldspace","_intentory","_hitPoints","_fuel","_damage","_key","_vehLimit","_hiveResponse","_objectCount","_codeCount","_data","_status","_val","_traderid","_retrader","_traderData","_id","_lockable","_debugMarkerPosition","_vehicle_0","_bQty","_vQty","_BuildingQueue","_objectQueue"]; +private ["_nul","_result","_pos","_wsDone","_dir","_isOK","_countr","_objWpnTypes","_objWpnQty","_dam","_selection","_totalvehicles","_object","_idKey","_type","_ownerID","_worldspace","_intentory","_hitPoints","_fuel","_damage","_key","_vehLimit","_hiveResponse","_objectCount","_codeCount","_data","_status","_val","_traderid","_retrader","_traderData","_id","_lockable","_debugMarkerPosition","_vehicle_0","_bQty","_vQty","_BuildingQueue","_objectQueue","_superkey","_shutdown","_res","_hiveLoaded"]; dayz_versionNo = getText(configFile >> "CfgMods" >> "DayZ" >> "version"); dayz_hiveVersionNo = getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion"); +_hiveLoaded = false; + waitUntil{initialized}; //means all the functions are now defined diag_log "HIVE: Starting"; @@ -42,7 +44,15 @@ if (isServer and isNil "sm_done") then { _key = format["CHILD:302:%1:", dayZ_instance]; _hiveResponse = _key call server_hiveReadWrite; if ((((isnil "_hiveResponse") || {(typeName _hiveResponse != "ARRAY")}) || {((typeName (_hiveResponse select 1)) != "SCALAR")})) then { - diag_log ("HIVE: connection problem... HiveExt response:"+str(_hiveResponse)); + if ((_hiveResponse select 1) == "Instance already initialized") then { + _superkey = profileNamespace getVariable "SUPERKEY"; + _shutdown = format["CHILD:400:%1:", _superkey]; + _res = _shutdown call server_hiveReadWrite; + diag_log ("HIVE: attempt to kill.. HiveExt response:"+str(_res)); + } else { + diag_log ("HIVE: connection problem... HiveExt response:"+str(_hiveResponse)); + + }; _hiveResponse = ["",0]; } else { @@ -55,6 +65,13 @@ if (isServer and isNil "sm_done") then { _objectQueue = []; if ((_hiveResponse select 0) == "ObjectStreamStart") then { + + // save superkey + profileNamespace setVariable ["SUPERKEY",(_hiveResponse select 2)]; + saveProfileNamespace; + + _hiveLoaded = true; + diag_log ("HIVE: Commence Object Streaming..."); _key = format["CHILD:302:%1:", dayZ_instance]; _objectCount = _hiveResponse select 1; @@ -249,7 +266,6 @@ if (isServer and isNil "sm_done") then { }; } forEach (_BuildingQueue + _objectQueue); // # END SPAWN OBJECTS # - // preload server traders menu data into cache if !(DZE_ConfigTrader) then { @@ -290,16 +306,19 @@ if (isServer and isNil "sm_done") then { } forEach serverTraders; }; - // spawn_vehicles - _vehLimit = MaxVehicleLimit - _totalvehicles; - if(_vehLimit > 0) then { - diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit)); - for "_x" from 1 to _vehLimit do { - [] spawn spawn_vehicles; + if (_hiveLoaded) then { + // spawn_vehicles + _vehLimit = MaxVehicleLimit - _totalvehicles; + if(_vehLimit > 0) then { + diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit)); + for "_x" from 1 to _vehLimit do { + [] spawn spawn_vehicles; + }; + } else { + diag_log "HIVE: Vehicle Spawn limit reached!"; }; - } else { - diag_log "HIVE: Vehicle Spawn limit reached!"; }; + // spawn_roadblocks diag_log ("HIVE: Spawning # of Debris: " + str(MaxDynamicDebris)); for "_x" from 1 to MaxDynamicDebris do { @@ -326,13 +345,10 @@ if (isServer and isNil "sm_done") then { OldHeliCrash = false; }; - allowConnection = true; - // [_guaranteedLoot, _randomizedLoot, _frequency, _variance, _spawnChance, _spawnMarker, _spawnRadius, _spawnFire, _fadeFire] if(OldHeliCrash) then { _nul = [3, 4, (50 * 60), (15 * 60), 0.75, 'center', HeliCrashArea, true, false] spawn server_spawnCrashSite; }; - if (isDedicated) then { // Epoch Events _id = [] spawn server_spawnEvents; @@ -355,9 +371,7 @@ if (isServer and isNil "sm_done") then { if(isnil "spawnMarkerCount") then { spawnMarkerCount = 10; }; - actualSpawnMarkerCount = 0; - // count valid spawn marker positions for "_i" from 0 to spawnMarkerCount do { if (!([(getMarkerPos format["spawn%1", _i]), [0,0,0]] call BIS_fnc_areEqual)) then { @@ -369,8 +383,11 @@ if (isServer and isNil "sm_done") then { }; diag_log format["Total Number of spawn locations %1", actualSpawnMarkerCount]; + + endLoadingScreen; }; + allowConnection = true; sm_done = true; publicVariable "sm_done"; }; diff --git a/Server Files/@DayZ_Epoch_Server/addons/dayz_server.pbo b/Server Files/@DayZ_Epoch_Server/addons/dayz_server.pbo index 6365508f6..b6941e9e6 100644 Binary files a/Server Files/@DayZ_Epoch_Server/addons/dayz_server.pbo and b/Server Files/@DayZ_Epoch_Server/addons/dayz_server.pbo differ