Revert "Fixed if _hiveResponse is null"

This reverts commit 76314d5636.
This commit is contained in:
[VB]AWOL
2014-02-12 12:58:22 -06:00
parent 9b8b998deb
commit f482bf2677

View File

@@ -8,7 +8,7 @@ waitUntil{initialized}; //means all the functions are now defined
diag_log "HIVE: Starting";
waituntil{isNil "sm_done"}; // prevent server_monitor be called twice (bug during login of the first player)
// Custom Configs
if(isnil "MaxVehicleLimit") then {
MaxVehicleLimit = 50;
@@ -33,26 +33,20 @@ if (isServer and isNil "sm_done") then {
for "_i" from 1 to 5 do {
diag_log "HIVE: trying to get objects";
_key = format["CHILD:302:%1:", dayZ_instance];
_hiveResponse = _key call server_hiveReadWrite;
if (isnil "_hiveResponse") then {
diag_log ("HIVE: connection problem... unable to call HiveExt");
_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));
_hiveResponse = ["",0];
}
}
else {
if ({(typeName _hiveResponse != "ARRAY")} || {((typeName (_hiveResponse select 1)) != "SCALAR")}) then {
diag_log ("HIVE: connection problem... HiveExt response:"+str(_hiveResponse));
_hiveResponse = ["",0];
}
else {
diag_log ("HIVE: found "+str(_hiveResponse select 1)+" objects" );
_i = 99; // break
};
diag_log ("HIVE: found "+str(_hiveResponse select 1)+" objects" );
_i = 99; // break
};
};
_BuildingQueue = [];
_objectQueue = [];
if ((_hiveResponse select 0) == "ObjectStreamStart") then {
diag_log ("HIVE: Commence Object Streaming...");
_key = format["CHILD:302:%1:", dayZ_instance];
@@ -72,7 +66,7 @@ if (isServer and isNil "sm_done") then {
};
diag_log ("HIVE: got " + str(_bQty) + " Epoch Objects and " + str(_vQty) + " Vehicles");
};
// # NOW SPAWN OBJECTS #
_totalvehicles = 0;
{
@@ -85,7 +79,7 @@ if (isServer and isNil "sm_done") then {
_hitPoints = _x select 6;
_fuel = _x select 7;
_damage = _x select 8;
_dir = 0;
_pos = [0,0,0];
_wsDone = false;
@@ -96,19 +90,19 @@ if (isServer and isNil "sm_done") then {
_pos = _worldspace select 1;
_wsDone = true;
}
};
};
if (!_wsDone) then {
if (count _worldspace >= 1) then { _dir = _worldspace select 0; };
_pos = [getMarkerPos "center",0,4000,10,0,2000,0] call BIS_fnc_findSafePos;
if (count _pos < 3) then { _pos = [_pos select 0,_pos select 1,0]; };
diag_log ("MOVED OBJ: " + str(_idKey) + " of class " + _type + " to pos: " + str(_pos));
};
if (_damage < 1) then {
//diag_log format["OBJ: %1 - %2", _idKey,_type];
//Create it
_object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
_object setVariable ["lastUpdate",time];
@@ -144,15 +138,15 @@ if (isServer and isNil "sm_done") then {
};
_object setVariable ["CharacterID", _ownerID, true];
clearWeaponCargoGlobal _object;
clearMagazineCargoGlobal _object;
// _object setVehicleAmmo DZE_vehicleAmmo;
_object setdir _dir;
_object setposATL _pos;
_object setDamage _damage;
if ((typeOf _object) in dayz_allowedObjects) then {
if (DZE_GodModeBase) then {
_object addEventHandler ["HandleDamage", {false}];
@@ -163,7 +157,7 @@ if (isServer and isNil "sm_done") then {
_object enableSimulation false;
// used for inplace upgrades and lock/unlock of safe
_object setVariable ["OEMPos", _pos, true];
};
if (count _intentory > 0) then {
@@ -177,7 +171,7 @@ if (isServer and isNil "sm_done") then {
//Add weapons
_objWpnTypes = (_intentory select 0) select 0;
_objWpnQty = (_intentory select 0) select 1;
_countr = 0;
_countr = 0;
{
if(_x in (DZE_REPLACE_WEAPONS select 0)) then {
_x = (DZE_REPLACE_WEAPONS select 1) select ((DZE_REPLACE_WEAPONS select 0) find _x);
@@ -187,8 +181,8 @@ if (isServer and isNil "sm_done") then {
_object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
};
_countr = _countr + 1;
} forEach _objWpnTypes;
} forEach _objWpnTypes;
//Add Magazines
_objWpnTypes = (_intentory select 1) select 0;
_objWpnQty = (_intentory select 1) select 1;
@@ -215,8 +209,8 @@ if (isServer and isNil "sm_done") then {
_countr = _countr + 1;
} forEach _objWpnTypes;
};
};
};
if (_object isKindOf "AllVehicles") then {
{
_selection = _x select 0;
@@ -228,14 +222,14 @@ if (isServer and isNil "sm_done") then {
_object setFuel _fuel;
if (!((typeOf _object) in dayz_allowedObjects)) then {
//_object setvelocity [0,0,1];
_object call fnc_veh_ResetEH;
_object call fnc_veh_ResetEH;
if(_ownerID != "0" and !(_object isKindOf "Bicycle")) then {
_object setvehiclelock "locked";
};
_totalvehicles = _totalvehicles + 1;
// total each vehicle
@@ -248,7 +242,7 @@ if (isServer and isNil "sm_done") then {
};
} forEach (_BuildingQueue + _objectQueue);
// # END SPAWN OBJECTS #
// preload server traders menu data into cache
if !(DZE_ConfigTrader) then {
@@ -265,11 +259,11 @@ if (isServer and isNil "sm_done") then {
_data = "HiveEXT" callExtension _key;
//diag_log "HIVE: Request sent";
//Process result
_result = call compile format ["%1",_data];
_status = _result select 0;
if (_status == "ObjectStreamStart") then {
_val = _result select 1;
//Stream Objects
@@ -354,7 +348,7 @@ if (isServer and isNil "sm_done") then {
if(isnil "spawnMarkerCount") then {
spawnMarkerCount = 10;
};
actualSpawnMarkerCount = 0;
// count valid spawn marker positions
@@ -365,7 +359,7 @@ if (isServer and isNil "sm_done") then {
// exit since we did not find any further markers
_i = spawnMarkerCount + 99;
};
};
diag_log format["Total Number of spawn locations %1", actualSpawnMarkerCount];
};