Fix fn_waitForObject handling multiple of same object type

Forgot to handle case where there is already one or more of that object
type in the area (safes, cars, etc.).
This commit is contained in:
ebaydayz
2016-08-22 20:13:39 -04:00
parent a70501cf59
commit 38b2a551bd
12 changed files with 47 additions and 29 deletions

View File

@@ -5,22 +5,24 @@
Parameters:
_this select 0: string - object class name to reveal
_this select 1: object - sign object or ObjNull if none
_this select 2: array - result of (nearestObjects [player,[_class],50]) before call to spawn object
["objectClassName", objNull] spawn fn_waitForObject;
["objectClassName", objNull, []] spawn fn_waitForObject;
*/
private ["_object","_sign"];
private ["_class","_sign","_near"];
_object = _this select 0;
_class = _this select 0;
_sign = _this select 1;
_near = _this select 2;
waitUntil {
uiSleep 1;
!isNull (nearestObject [player,_object])
(count (nearestObjects [player,[_class],50]) != count _near)
};
if (!isNull _sign) then {
deleteVehicle _sign;
};
player reveal (nearestObject [player,_object]);
{player reveal _x;} count (nearestObjects [player,[_class],50]);