Merge pull request #953 from vbawol/zabn-buildings-before-cars

Zabn buildings before cars
This commit is contained in:
vbawol
2013-12-22 19:07:21 -08:00

View File

@@ -1,4 +1,4 @@
private ["_nul","_result","_pos","_wsDone","_dir","_block","_isOK","_countr","_objWpnTypes","_objWpnQty","_dam","_selection","_totalvehicles","_object","_idKey","_type","_ownerID","_worldspace","_intentory","_hitPoints","_fuel","_damage","_date","_key","_outcome","_vehLimit","_hiveResponse","_objectCount","_codeCount","_objectArray","_hour","_minute","_data","_status","_val","_traderid","_retrader","_traderData","_id","_lockable","_debugMarkerPosition","_vehicle_0"];
private ["_nul","_result","_pos","_wsDone","_dir","_block","_isOK","_countr","_objWpnTypes","_objWpnQty","_dam","_selection","_totalvehicles","_object","_idKey","_type","_ownerID","_worldspace","_intentory","_hitPoints","_fuel","_damage","_date","_key","_outcome","_vehLimit","_hiveResponse","_objectCount","_codeCount","_hour","_minute","_data","_status","_val","_traderid","_retrader","_traderData","_id","_lockable","_debugMarkerPosition","_vehicle_0"];
dayz_versionNo = getText(configFile >> "CfgMods" >> "DayZ" >> "version");
dayz_hiveVersionNo = getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");
@@ -50,25 +50,37 @@ if (isServer and isNil "sm_done") then {
};
};
_objectArray = [];
_BuildingQueue = [];
_objectQueue = [];
if ((_hiveResponse select 0) == "ObjectStreamStart") then {
_objectCount = _hiveResponse select 1;
diag_log ("HIVE: Commence Object Streaming...");
for "_i" from 1 to _objectCount do {
_hiveResponse = _key call server_hiveReadWriteLarge;
_objectArray set [_i - 1, _hiveResponse];
//diag_log (format["HIVE dbg %1 %2", typeName _hiveResponse, _hiveResponse]);
_type = _hiveResponse select 2;
switch true do {
case (_type isKindOf "ModularItems"): {
_BuildingQueue set [(count _BuildingQueue),_hiveResponse];
};
diag_log ("HIVE: got " + str(count _objectArray) + " objects");
default {
_objectQueue set [(count _objectQueue),_hiveResponse];
};
};
};
_count = (count _objectQueue) + (count _BuildingQueue);
diag_log ("HIVE: got " + str(_count) + " objects");
};
// # START OF STREAMING #
_countr = 0;
_spawnSort = [_BuildingQueue,_objectQueue]; // Put arrays in order that you wish them to spawn
// # NOW SPAWN OBJECTS #
_totalvehicles = 0;
{
//Parse Array
_countr = _countr + 1;
{
_idKey = _x select 1;
_type = _x select 2;
_ownerID = _x select 3;
@@ -90,6 +102,7 @@ if (isServer and isNil "sm_done") then {
_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;
@@ -97,6 +110,7 @@ if (isServer and isNil "sm_done") then {
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];
@@ -241,8 +255,10 @@ if (isServer and isNil "sm_done") then {
//Monitor the object
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
};
} forEach _objectArray;
// # END OF STREAMING #
} forEach _x;
} forEach _spawnSort;
// # END SPAWN OBJECTS #
// preload server traders menu data into cache