From 05f1cf9fe0a6e475cf6aace6d10d68daf2023b77 Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Mon, 30 Jan 2017 15:45:14 -0500 Subject: [PATCH] Use nearObjects instead of nearestObjects for spawn check #1816 Lowered spawn check radius for loot and zombies to the same as 1051. (200m) --- SQF/dayz_code/actions/tow_AttachStraps.sqf | 4 ++-- SQF/dayz_code/compile/fn_nearWaterHole.sqf | 2 +- SQF/dayz_code/compile/fn_waitForObject.sqf | 6 +++--- SQF/dayz_code/compile/player_spawnCheck.sqf | 11 ++++++----- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/SQF/dayz_code/actions/tow_AttachStraps.sqf b/SQF/dayz_code/actions/tow_AttachStraps.sqf index e032bbd8b..ad494e22a 100644 --- a/SQF/dayz_code/actions/tow_AttachStraps.sqf +++ b/SQF/dayz_code/actions/tow_AttachStraps.sqf @@ -17,7 +17,7 @@ _findNearestVehicles = _towTruck nearEntities [["Car","Motorcycle"],10]; _findNearestVehicle = []; { if (alive _x && _towTruck != _x) then { - if([_x,_towTruck] call fnc_isInsideBuilding2) then { + if([_x,_towTruck] call fnc_isInsideBuilding) then { _findNearestVehicle set [(count _findNearestVehicle),_x]; }; }; @@ -77,7 +77,7 @@ if(_IsNearVehicle >= 1) then { if (_finished) then { if((sizeOf typeOf _vehicle) <= _allowedSize) then { - if([_vehicle,_towTruck] call fnc_isInsideBuilding2 && ((vectorUp _vehicle) select 2) > 0.5) then { + if([_vehicle,_towTruck] call fnc_isInsideBuilding && ((vectorUp _vehicle) select 2) > 0.5) then { if(typeOf _towTruck == "TOW_DZE" ) then { _vehicle attachTo [_towTruck,[1.3,-2,2.3]]; _towTruck setVariable ["DZEinTow", true, true]; diff --git a/SQF/dayz_code/compile/fn_nearWaterHole.sqf b/SQF/dayz_code/compile/fn_nearWaterHole.sqf index 0ffbd1ece..5d1a32b5b 100644 --- a/SQF/dayz_code/compile/fn_nearWaterHole.sqf +++ b/SQF/dayz_code/compile/fn_nearWaterHole.sqf @@ -21,6 +21,6 @@ _nearWaterHole = [false,false]; } count (nearestObjects [_x, [], 1]); if (_nearWaterHole select 0) exitWith {}; -} forEach (nearestObjects [player, ["waterHoleProxy"], 50]); +} forEach (player nearObjects ["waterHoleProxy",50]); _nearWaterHole \ No newline at end of file diff --git a/SQF/dayz_code/compile/fn_waitForObject.sqf b/SQF/dayz_code/compile/fn_waitForObject.sqf index 56fdc3f8c..c53c85d60 100644 --- a/SQF/dayz_code/compile/fn_waitForObject.sqf +++ b/SQF/dayz_code/compile/fn_waitForObject.sqf @@ -13,7 +13,7 @@ private ["_class","_sign","_near"]; _class = _this select 0; _sign = _this select 1; -_near = count (nearestObjects [player,[_class],50]); +_near = count (player nearObjects [_class,50]); [_class,_sign,_near] spawn { _class = _this select 0; @@ -23,12 +23,12 @@ _near = count (nearestObjects [player,[_class],50]); waitUntil { uiSleep 1; - (count (nearestObjects [player,[_class],50]) != _near or (diag_tickTime - _time > 15)) + (count (player nearObjects [_class,50]) != _near or (diag_tickTime - _time > 15)) }; if (!isNull _sign) then { deleteVehicle _sign; }; - {player reveal _x;} count (nearestObjects [player,[_class],50]); + {player reveal _x;} count (player nearObjects [_class,50]); }; \ No newline at end of file diff --git a/SQF/dayz_code/compile/player_spawnCheck.sqf b/SQF/dayz_code/compile/player_spawnCheck.sqf index 3307e102a..2944e4c59 100644 --- a/SQF/dayz_code/compile/player_spawnCheck.sqf +++ b/SQF/dayz_code/compile/player_spawnCheck.sqf @@ -1,10 +1,9 @@ -private ["_isWreck","_maxControlledZombies","_looted","_zombied","_doNothing","_spawnZedRadius","_serverTime","_age","_nearbyBuildings","_position","_spawnableObjects","_speed","_radius","_maxlocalspawned","_maxWeaponHolders","_currentWeaponHolders","_maxtoCreate","_inVehicle","_isAir","_isLand","_isSea","_Controlledzeddivided","_totalcrew","_nearby","_type","_config","_canSpawn","_dis","_checkLoot","_islocal","_bPos","_zombiesNum"]; +private ["_isWreck","_maxControlledZombies","_looted","_zombied","_doNothing","_spawnZedRadius","_serverTime","_age","_nearbyBuildings","_position","_speed","_radius","_maxlocalspawned","_maxWeaponHolders","_currentWeaponHolders","_maxtoCreate","_inVehicle","_isAir","_isLand","_isSea","_Controlledzeddivided","_totalcrew","_nearby","_type","_config","_canSpawn","_dis","_checkLoot","_islocal","_bPos","_zombiesNum"]; _age = -1; //_nearbyBuildings = []; _position = [player] call FNC_GetPos; -_spawnableObjects = ["building", "CrashSite", "IC_Fireplace1", "IC_DomeTent", "IC_Tent"]; _speed = speed (vehicle player); -_radius = 300; //150*0.707; Pointless Processing (106.5) +_radius = 200; //150*0.707; Pointless Processing (106.5) _spawnZedRadius = 20; /* @@ -99,8 +98,10 @@ if (_doNothing) exitwith {}; _maxlocalspawned, _maxControlledZombies, _radius, round diag_fpsmin,dayz_currentGlobalZombies, dayz_maxGlobalZeds, dayz_CurrentNearByZombies, dayz_maxNearByZombies, _currentWeaponHolders,_maxWeaponHolders]); };*/ - -_nearby = nearestObjects [_position, _spawnableObjects,_radius]; + +// nearObjects is faster than nearestObjects when sorting by distance isn't needed +// "Building" includes House and all of its child classes (Crashsite, IC_Fireplace1, IC_Tent, etc.) +_nearby = _position nearObjects ["Building",_radius]; _maxlocalspawned = _maxlocalspawned max floor(_maxControlledZombies*.8); if (_maxlocalspawned > 0) then { _spawnZedRadius = _spawnZedRadius * 3; };