fixed Instance already initialized

This commit is contained in:
[VB]AWOL
2014-02-18 10:36:23 -06:00
parent c55ac56bb6
commit 8dc7ce4250
2 changed files with 33 additions and 16 deletions

View File

@@ -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_versionNo = getText(configFile >> "CfgMods" >> "DayZ" >> "version");
dayz_hiveVersionNo = getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion"); dayz_hiveVersionNo = getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");
_hiveLoaded = false;
waitUntil{initialized}; //means all the functions are now defined waitUntil{initialized}; //means all the functions are now defined
diag_log "HIVE: Starting"; diag_log "HIVE: Starting";
@@ -42,7 +44,15 @@ if (isServer and isNil "sm_done") then {
_key = format["CHILD:302:%1:", dayZ_instance]; _key = format["CHILD:302:%1:", dayZ_instance];
_hiveResponse = _key call server_hiveReadWrite; _hiveResponse = _key call server_hiveReadWrite;
if ((((isnil "_hiveResponse") || {(typeName _hiveResponse != "ARRAY")}) || {((typeName (_hiveResponse select 1)) != "SCALAR")})) then { 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]; _hiveResponse = ["",0];
} }
else { else {
@@ -55,6 +65,13 @@ if (isServer and isNil "sm_done") then {
_objectQueue = []; _objectQueue = [];
if ((_hiveResponse select 0) == "ObjectStreamStart") then { if ((_hiveResponse select 0) == "ObjectStreamStart") then {
// save superkey
profileNamespace setVariable ["SUPERKEY",(_hiveResponse select 2)];
saveProfileNamespace;
_hiveLoaded = true;
diag_log ("HIVE: Commence Object Streaming..."); diag_log ("HIVE: Commence Object Streaming...");
_key = format["CHILD:302:%1:", dayZ_instance]; _key = format["CHILD:302:%1:", dayZ_instance];
_objectCount = _hiveResponse select 1; _objectCount = _hiveResponse select 1;
@@ -249,7 +266,6 @@ if (isServer and isNil "sm_done") then {
}; };
} forEach (_BuildingQueue + _objectQueue); } forEach (_BuildingQueue + _objectQueue);
// # END SPAWN OBJECTS # // # END SPAWN OBJECTS #
// preload server traders menu data into cache // preload server traders menu data into cache
if !(DZE_ConfigTrader) then { if !(DZE_ConfigTrader) then {
@@ -290,16 +306,19 @@ if (isServer and isNil "sm_done") then {
} forEach serverTraders; } forEach serverTraders;
}; };
// spawn_vehicles if (_hiveLoaded) then {
_vehLimit = MaxVehicleLimit - _totalvehicles; // spawn_vehicles
if(_vehLimit > 0) then { _vehLimit = MaxVehicleLimit - _totalvehicles;
diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit)); if(_vehLimit > 0) then {
for "_x" from 1 to _vehLimit do { diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit));
[] spawn spawn_vehicles; 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 // spawn_roadblocks
diag_log ("HIVE: Spawning # of Debris: " + str(MaxDynamicDebris)); diag_log ("HIVE: Spawning # of Debris: " + str(MaxDynamicDebris));
for "_x" from 1 to MaxDynamicDebris do { for "_x" from 1 to MaxDynamicDebris do {
@@ -326,13 +345,10 @@ if (isServer and isNil "sm_done") then {
OldHeliCrash = false; OldHeliCrash = false;
}; };
allowConnection = true;
// [_guaranteedLoot, _randomizedLoot, _frequency, _variance, _spawnChance, _spawnMarker, _spawnRadius, _spawnFire, _fadeFire] // [_guaranteedLoot, _randomizedLoot, _frequency, _variance, _spawnChance, _spawnMarker, _spawnRadius, _spawnFire, _fadeFire]
if(OldHeliCrash) then { if(OldHeliCrash) then {
_nul = [3, 4, (50 * 60), (15 * 60), 0.75, 'center', HeliCrashArea, true, false] spawn server_spawnCrashSite; _nul = [3, 4, (50 * 60), (15 * 60), 0.75, 'center', HeliCrashArea, true, false] spawn server_spawnCrashSite;
}; };
if (isDedicated) then { if (isDedicated) then {
// Epoch Events // Epoch Events
_id = [] spawn server_spawnEvents; _id = [] spawn server_spawnEvents;
@@ -355,9 +371,7 @@ if (isServer and isNil "sm_done") then {
if(isnil "spawnMarkerCount") then { if(isnil "spawnMarkerCount") then {
spawnMarkerCount = 10; spawnMarkerCount = 10;
}; };
actualSpawnMarkerCount = 0; actualSpawnMarkerCount = 0;
// count valid spawn marker positions // count valid spawn marker positions
for "_i" from 0 to spawnMarkerCount do { for "_i" from 0 to spawnMarkerCount do {
if (!([(getMarkerPos format["spawn%1", _i]), [0,0,0]] call BIS_fnc_areEqual)) then { 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]; diag_log format["Total Number of spawn locations %1", actualSpawnMarkerCount];
endLoadingScreen;
}; };
allowConnection = true;
sm_done = true; sm_done = true;
publicVariable "sm_done"; publicVariable "sm_done";
}; };