Use nearObjects instead of nearestObjects for spawn check #1816

Lowered spawn check radius for loot and zombies to the same as 1051.
(200m)
This commit is contained in:
ebaydayz
2017-01-30 15:45:14 -05:00
parent 752ed00566
commit 05f1cf9fe0
4 changed files with 12 additions and 11 deletions

View File

@@ -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];

View File

@@ -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

View File

@@ -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]);
};

View File

@@ -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;
/*
@@ -100,7 +99,9 @@ if (_doNothing) exitwith {};
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; };