diff --git a/CHANGE LOG 1.0.6.txt b/CHANGE LOG 1.0.6.txt index 6d41433e2..13e2dd5b9 100644 --- a/CHANGE LOG 1.0.6.txt +++ b/CHANGE LOG 1.0.6.txt @@ -24,6 +24,8 @@ - vehicle_handleKilled --> fnc_veh_handleKilled - Duplicate global variables have been renamed: - dayz_allowedObjects --> DayZ_SafeObjects + - dayz_CLBase --> dz_loot_groups (similar not identical) + - dayz_CLChances --> dz_loot_weighted (similar not identical) - dayz_fullMoonNights --> dayz_ForcefullmoonNights - dayz_updateObjects --> DayZ_GearedObjects - DZE_CanPickup --> canPickup diff --git a/SQF/dayz_code/compile/player_spawnCheck.sqf b/SQF/dayz_code/compile/player_spawnCheck.sqf index 8e0b3df73..d71b319b4 100644 --- a/SQF/dayz_code/compile/player_spawnCheck.sqf +++ b/SQF/dayz_code/compile/player_spawnCheck.sqf @@ -55,15 +55,6 @@ if (_inVehicle) then { if (_doNothing) exitwith {}; -//Logging -diag_log (format["%1 Local.Agents: %2/%3, NearBy.Agents: %8/%9, Global.Agents: %6/%7, W.holders: %10/%11, (radius:%4m %5fps).","SpawnCheck", - _maxlocalspawned, _maxControlledZombies, _radius, round diag_fpsmin,dayz_currentGlobalZombies, - dayz_maxGlobalZeds, dayz_CurrentNearByZombies, dayz_maxNearByZombies, _currentWeaponHolders,_maxWeaponHolders]); - -_nearby = nearestObjects [_position, _spawnableObjects,_radius]; -_maxlocalspawned = _maxlocalspawned max floor(_maxControlledZombies*.8); -if (_maxlocalspawned > 0) then { _spawnZedRadius = _spawnZedRadius * 3; }; - if ("ItemMap_Debug" in items player) then { deleteMarkerLocal "MaxZeds"; deleteMarkerLocal "Counter"; @@ -101,9 +92,18 @@ if ("ItemMap_Debug" in items player) then { _markerstr3 setMarkerBrushLocal "Border"; _markerstr3 setMarkerSizeLocal [120, 120]; -diag_log ("LocalZombies: " +str(dayz_spawnZombies) + "/" +str(dayz_maxLocalZombies)); + diag_log ("LocalZombies: " +str(dayz_spawnZombies) + "/" +str(dayz_maxLocalZombies)); + //Logging + diag_log (format["%1 Local.Agents: %2/%3, NearBy.Agents: %8/%9, Global.Agents: %6/%7, W.holders: %10/%11, (radius:%4m %5fps).","SpawnCheck", + _maxlocalspawned, _maxControlledZombies, _radius, round diag_fpsmin,dayz_currentGlobalZombies, + dayz_maxGlobalZeds, dayz_CurrentNearByZombies, dayz_maxNearByZombies, _currentWeaponHolders,_maxWeaponHolders]); }; + +_nearby = nearestObjects [_position, _spawnableObjects,_radius]; +_maxlocalspawned = _maxlocalspawned max floor(_maxControlledZombies*.8); +if (_maxlocalspawned > 0) then { _spawnZedRadius = _spawnZedRadius * 3; }; + //Spawn Zeds & loot in buildings { _type = typeOf _x; diff --git a/SQF/dayz_code/system/player_spawn_2.sqf b/SQF/dayz_code/system/player_spawn_2.sqf index 86120f338..1045f97dc 100644 --- a/SQF/dayz_code/system/player_spawn_2.sqf +++ b/SQF/dayz_code/system/player_spawn_2.sqf @@ -446,17 +446,13 @@ while {1 == 1} do { { //get contents _weapons = getWeaponCargo _x; - diag_log (str(_weapons)); _magazines = getMagazineCargo _x; - diag_log (str(_magazines)); _backpacks = getBackpackCargo _x; - diag_log (str(_backpacks)); - if ((count (_weapons select 0) < 1) and (count (_magazines select 0) < 1) and (count (_backpacks select 0) < 1)) then { - + if ((count (_weapons select 0) < 1) and (count (_magazines select 0) < 1) and (count (_backpacks select 0) < 1)) then { //remove vehicle, Need to ask server to remove. + diag_log format["Deleting empty nearby box: %1",_x]; PVDZ_obj_Delete = [_x,player]; - diag_log (str(PVDZ_obj_Delete)); publicVariableServer "PVDZ_obj_Delete"; }; diff --git a/SQF/dayz_server/compile/server_deleteObj.sqf b/SQF/dayz_server/compile/server_deleteObj.sqf index b528bad4a..a512c4dbb 100644 --- a/SQF/dayz_server/compile/server_deleteObj.sqf +++ b/SQF/dayz_server/compile/server_deleteObj.sqf @@ -12,11 +12,11 @@ if (isServer) then { //Send request _key = format["CHILD:304:%1:",_id]; _key call server_hiveWrite; - diag_log format["DELETE: %1 Deleted by ID: %2",_activatingPlayer,_id]; + diag_log format["DELETE: Player %1 deleted object with ID: %2",_activatingPlayer,_id]; } else { //Send request _key = format["CHILD:310:%1:",_uid]; _key call server_hiveWrite; - diag_log format["DELETE: %1 Deleted by UID: %2",_activatingPlayer,_uid]; + diag_log format["DELETE: Player %1 deleted object with UID: %2",_activatingPlayer,_uid]; }; }; \ No newline at end of file diff --git a/SQF/dayz_server/compile/spawn_ammosupply.sqf b/SQF/dayz_server/compile/spawn_ammosupply.sqf index 6fe6757cb..661759bfd 100644 --- a/SQF/dayz_server/compile/spawn_ammosupply.sqf +++ b/SQF/dayz_server/compile/spawn_ammosupply.sqf @@ -1,10 +1,8 @@ private ["_position","_veh","_istoomany"]; +// do not make _roadList or _buildingList private in this function -waitUntil {!isNil "BIS_fnc_selectRandom"}; -_position = roadList call BIS_fnc_selectRandom; +_position = _roadList call BIS_fnc_selectRandom; _position = _position modelToWorld [0,0,0]; - -waitUntil {!isNil "BIS_fnc_findSafePos"}; _position = [_position,5,20,5,0,2000,0] call BIS_fnc_findSafePos; if ((count _position) == 2) then { diff --git a/SQF/dayz_server/compile/spawn_roadblocks.sqf b/SQF/dayz_server/compile/spawn_roadblocks.sqf index 4cb41e772..d14894057 100644 --- a/SQF/dayz_server/compile/spawn_roadblocks.sqf +++ b/SQF/dayz_server/compile/spawn_roadblocks.sqf @@ -1,19 +1,15 @@ private ["_position","_veh","_istoomany","_spawnveh"]; +// do not make _roadList or _buildingList private in this function -waitUntil {!isNil "BIS_fnc_selectRandom"}; -_position = roadList call BIS_fnc_selectRandom; +_position = _roadList call BIS_fnc_selectRandom; _position = _position modelToWorld [0,0,0]; - -waitUntil {!isNil "BIS_fnc_findSafePos"}; _position = [_position,0,10,5,0,2000,0] call BIS_fnc_findSafePos; if ((count _position) == 2) then { _istoomany = _position nearObjects ["All",5]; if ((count _istoomany) > 0) exitWith {}; - waitUntil {!isNil "BIS_fnc_selectRandom"}; _spawnveh = DZE_isWreck call BIS_fnc_selectRandom; - _veh = createVehicle [_spawnveh,_position, [], 0, "CAN_COLLIDE"]; _veh enableSimulation false; _veh setDir round(random 360); diff --git a/SQF/dayz_server/compile/spawn_vehicles.sqf b/SQF/dayz_server/compile/spawn_vehicles.sqf index a6c36514e..5c88084b7 100644 --- a/SQF/dayz_server/compile/spawn_vehicles.sqf +++ b/SQF/dayz_server/compile/spawn_vehicles.sqf @@ -1,4 +1,8 @@ private ["_random","_lastIndex","_weights","_index","_vehicle","_velimit","_qty","_isAir","_isShip","_position","_dir","_istoomany","_veh","_objPosition","_iClass","_itemTypes","_cntWeights","_itemType","_num","_allCfgLoots"]; +// do not make _roadList or _buildingList private in this function +#include "\z\addons\dayz_code\util\Math.hpp" +#include "\z\addons\dayz_code\util\Vector.hpp" +#include "\z\addons\dayz_code\loot\Loot.hpp" while {count AllowedVehiclesList > 0} do { // BIS_fnc_selectRandom replaced because the index may be needed to remove the element @@ -30,31 +34,25 @@ if (count AllowedVehiclesList == 0) then { if (_isShip or _isAir) then { if (_isShip) then { // Spawn anywhere on coast on water - waitUntil {!isNil "BIS_fnc_findSafePos"}; _position = [dayz_centerMarker,0,DynamicVehicleArea,10,1,2000,1] call BIS_fnc_findSafePos; //diag_log("DEBUG: spawning boat near coast " + str(_position)); } else { // Spawn air anywhere that is flat - waitUntil {!isNil "BIS_fnc_findSafePos"}; _position = [dayz_centerMarker,0,DynamicVehicleArea,10,0,2000,0] call BIS_fnc_findSafePos; //diag_log("DEBUG: spawning air anywhere flat " + str(_position)); }; } else { // Spawn around buildings and 50% near roads if ((random 1) > 0.5) then { - waitUntil {!isNil "BIS_fnc_selectRandom"}; - _position = roadList call BIS_fnc_selectRandom; + _position = _roadList call BIS_fnc_selectRandom; _position = _position modelToWorld [0,0,0]; - waitUntil {!isNil "BIS_fnc_findSafePos"}; _position = [_position,0,10,10,0,2000,0] call BIS_fnc_findSafePos; //diag_log("DEBUG: spawning near road " + str(_position)); } else { - waitUntil {!isNil "BIS_fnc_selectRandom"}; - _position = buildingList call BIS_fnc_selectRandom; + _position = _buildingList call BIS_fnc_selectRandom; _position = _position modelToWorld [0,0,0]; - waitUntil {!isNil "BIS_fnc_findSafePos"}; _position = [_position,0,40,5,0,2000,0] call BIS_fnc_findSafePos; //diag_log("DEBUG: spawning around buildings " + str(_position)); }; @@ -74,36 +72,14 @@ if (count AllowedVehiclesList == 0) then { clearMagazineCargoGlobal _veh; // _veh setVehicleAmmo DZE_vehicleAmmo; - // Add 0-3 loots to vehicle using random cfgloots + // Add 0-3 loots to vehicle using random loot groups _num = floor(random 4); - _allCfgLoots = ["Trash","ZombieCivilian","Consumable","Generic","MedicalLow","Military","ZombiePolice","ZombieHunter","ZombieWorker","clothes","militaryclothes","specialclothes","Trash"]; + _allCfgLoots = ["Trash","Trash","Consumable","Consumable","Generic","Generic","MedicalLow","MedicalLow","clothes","clothes","militaryclothes","specialclothes","tents","backpacks","Parts","pistols","AmmoCivilian"]; for "_x" from 1 to _num do { _iClass = _allCfgLoots call BIS_fnc_selectRandom; - - _itemTypes = []; - if (DZE_MissionLootTable) then{ - { - _itemTypes set [count _itemTypes, _x select 2] - } count getArray(missionConfigFile >> "CfgLoot" >> "Groups" >> _iClass); - } - else { - { - _itemTypes set [count _itemTypes, _x select 2] - } count getArray(configFile >> "CfgLoot" >> "Groups" >> _iClass); - }; - // Need to use new loot chances format - /* - _index = dayz_CLBase find _iClass; - _weights = dayz_CLChances select _index; - _cntWeights = count _weights; - - _index = floor(random _cntWeights); - _index = _weights select _index; - _itemType = _itemTypes select _index; - _veh addMagazineCargoGlobal [_itemType,1]; - //diag_log("DEBUG: spawed loot inside vehicle " + str(_itemType)); - */ + _lootGroupIndex = dz_loot_groups find _iClass; + Loot_InsertCargo(_veh, _lootGroupIndex, 1); }; [_veh,[_dir,_objPosition],_vehicle,true,"0"] call server_publishVeh; diff --git a/SQF/dayz_server/system/server_monitor.sqf b/SQF/dayz_server/system/server_monitor.sqf index 53eab5974..10c708176 100644 --- a/SQF/dayz_server/system/server_monitor.sqf +++ b/SQF/dayz_server/system/server_monitor.sqf @@ -339,46 +339,44 @@ if !(DZE_ConfigTrader) then { }; if (_hiveLoaded) then { - // spawn_vehicles - // Get all buildings and roads only once. Very taxing, but only on first startup - buildingList = []; - { - if (DZE_MissionLootTable) then { - if (isClass (missionConfigFile >> "CfgLoot" >> "Buildings" >> (typeOf _x))) then {buildingList set [count buildingList,_x];}; + [] spawn { + // spawn_vehicles + // Get all buildings and roads only once. Very taxing, but only on first startup + _startTime = diag_tickTime; + _buildingList = []; + _cfgLootFile = if (DZE_MissionLootTable) then {missionConfigFile >> "CfgLoot" >> "Buildings"} else {configFile >> "CfgLoot" >> "Buildings"}; + { + if (isClass (_cfgLootFile >> typeOf _x)) then { + _buildingList set [count _buildingList,_x]; + }; + } count (dayz_centerMarker nearObjects ["building",DynamicVehicleArea]); + _roadList = dayz_centerMarker nearRoads DynamicVehicleArea; + + _vehLimit = MaxVehicleLimit - (count serverVehicleCounter); + if (_vehLimit > 0) then { + diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit)); + for "_x" from 1 to _vehLimit do {call spawn_vehicles;}; } else { - if (isClass (configFile >> "CfgLoot" >> "Buildings" >> (typeOf _x))) then {buildingList set [count buildingList,_x];}; + diag_log "HIVE: Vehicle Spawn limit reached!"; }; - } count (dayz_centerMarker nearObjects ["building",DynamicVehicleArea]); - roadList = dayz_centerMarker nearRoads DynamicVehicleArea; - - _vehLimit = MaxVehicleLimit - (count serverVehicleCounter); - if (_vehLimit > 0) then { - diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit)); - for "_x" from 1 to _vehLimit do {spawn_vehicles_thread = [] spawn spawn_vehicles;}; - } else { - diag_log "HIVE: Vehicle Spawn limit reached!"; + + diag_log ("HIVE: Spawning # of Debris: " + str(MaxDynamicDebris)); + for "_x" from 1 to MaxDynamicDebris do {call spawn_roadblocks;}; + + diag_log ("HIVE: Spawning # of Ammo Boxes: " + str(MaxAmmoBoxes)); + for "_x" from 1 to MaxAmmoBoxes do {call spawn_ammosupply;}; + + diag_log ("HIVE: Spawning # of Veins: " + str(MaxMineVeins)); + for "_x" from 1 to MaxMineVeins do {call spawn_mineveins;}; + + _totalTime = diag_tickTime - _startTime; + diag_log format["HIVE: Server finished spawning all random vehicles in %1 seconds",_totalTime]; }; }; -diag_log ("HIVE: Spawning # of Debris: " + str(MaxDynamicDebris)); -for "_x" from 1 to MaxDynamicDebris do {[] spawn spawn_roadblocks;}; - -diag_log ("HIVE: Spawning # of Ammo Boxes: " + str(MaxAmmoBoxes)); -for "_x" from 1 to MaxAmmoBoxes do {[] spawn spawn_ammosupply;}; - -diag_log ("HIVE: Spawning # of Veins: " + str(MaxMineVeins)); -for "_x" from 1 to MaxMineVeins do {[] spawn spawn_mineveins;}; - [] spawn server_spawnEvents; _debugMarkerPosition = getMarkerPos "respawn_west"; _debugMarkerPosition = [(_debugMarkerPosition select 0),(_debugMarkerPosition select 1),1]; _vehicle_0 = createVehicle ["DebugBox_DZ", _debugMarkerPosition, [], 0, "CAN_COLLIDE"]; _vehicle_0 setPos _debugMarkerPosition; -_vehicle_0 setVariable ["ObjectID","1",true]; - -[] spawn { - waitUntil {uiSleep 5;(scriptDone spawn_vehicles_thread)}; - // All done spawning stuff, can clear these now - buildingList = nil; roadList = nil; - diag_log "All vehicle spawning threads completed"; -}; \ No newline at end of file +_vehicle_0 setVariable ["ObjectID","1",true]; \ No newline at end of file