209 {
210 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
211
212 array<Object> objectsInVicinity = new array<Object>();
213 array<CargoBase> proxyCargos = new array<CargoBase>();
214 array<Object> filteredObjects = new array<Object>();
215 array<Object> allFoundObjects = new array<Object>();
216 vector playerPosition = player.GetPosition();
217 vector playerHeadPositionFixed = MiscGameplayFunctions.GetPlayerHeadPosition(player);
218 vector headingDirection = MiscGameplayFunctions.GetHeadingVector(player);
219
221 bool cameraActive = FreeDebugCamera.GetInstance() && FreeDebugCamera.GetInstance().IsActive();
222 if (cameraActive)
223 {
224 playerPosition = FreeDebugCamera.GetInstance().GetPosition();
225 playerHeadPositionFixed = playerPosition;
226
227 float headingAngle = FreeDebugCamera.GetInstance().GetOrientation()[0] * Math.DEG2RAD;
228
229 headingDirection[0] = Math.Cos(headingAngle);
230 headingDirection[1] = 0;
231 headingDirection[2] = Math.Sin(headingAngle);
233 }
234
237
240
241
242
244
245
246 foreach (CargoBase cargoObject : proxyCargos)
248
249
250 foreach (
Object actorInRadius : objectsInVicinity)
251 {
253 allFoundObjects.Insert(actorInRadius);
254
256 continue;
257
259 filteredObjects.Insert(actorInRadius);
260 }
261
262 if (objectsInVicinity)
263 objectsInVicinity.Clear();
264
265
267
268
269
270 foreach (
Object objectInRadius : objectsInVicinity)
271 {
273 allFoundObjects.Insert(objectInRadius);
274
276 continue;
277
279 filteredObjects.Insert(objectInRadius);
280 }
281
282 if (objectsInVicinity)
283 objectsInVicinity.Clear();
284
285
287
288
289 RaycastRVParams rayInput;
290 array<ref RaycastRVResult> raycastResults = new array<ref RaycastRVResult>();
291
292 foreach (
Object objectInCone : objectsInVicinity)
293 {
295 allFoundObjects.Insert(objectInCone);
296
298 continue;
299
301 {
302
304 if (Class.CastTo(ent,objectInCone) && ent.GetInventory())
305 {
306
307 filteredObjects.Insert(objectInCone);
308 continue;
309 }
310
311 rayInput = new RaycastRVParams(playerHeadPositionFixed, objectInCone.GetPosition());
313 rayInput.
type = ObjIntersectView;
315 DayZPhysics.RaycastRVProxy(rayInput, raycastResults, {player});
316
317
318 foreach (RaycastRVResult result : raycastResults)
319 {
321 continue;
322
323 if (result.hierLevel > 0)
324 {
325 if (result.parent.CanProxyObstruct())
326 break;
327
328 if (result.parent == objectInCone)
329 {
330 filteredObjects.Insert(objectInCone);
331 break;
332 }
333 }
334 else
335 {
336 if (result.obj == objectInCone)
337 {
338 filteredObjects.Insert(objectInCone);
339 break;
340 }
341 }
342 }
343 }
344 }
345
346
347 BoxCollidingParams params = new BoxCollidingParams();
348 vector boxEdgeLength = {
352 };
353
354 params.
SetParams(playerPosition, headingDirection.
VectorToAngles(), boxEdgeLength * 2, ObjIntersect.View, ObjIntersect.Fire,
true);
355 array<ref BoxCollidingResult> results = new array<ref BoxCollidingResult>();
356 if (
g_Game.IsBoxCollidingGeometryProxy(params, {player}, results))
357 {
358 foreach (BoxCollidingResult bResult : results)
359 {
360 if (bResult.obj && (bResult.obj.CanObstruct() || bResult.obj.CanProxyObstruct()))
361 {
363 allFoundObjects.Insert(bResult.obj);
364 }
365
366 if (bResult.parent && (bResult.parent.CanObstruct() || bResult.parent.CanProxyObstruct()))
367 {
369 allFoundObjects.Insert(bResult.parent);
370 }
371 }
372 }
373
374
375 array<Object> obstructingObjects = new array<Object>();
376 MiscGameplayFunctions.FilterObstructingObjects(allFoundObjects, obstructingObjects);
377
379 if (obstructingObjects.Count() > 0 && !cameraActive)
380 {
381
382 if (filteredObjects.Count() > 10)
383 {
384 array<Object> filteredObjectsGrouped = new array<Object>();
386
387 foreach (
Object object: filteredObjectsGrouped)
389 }
390 else
391 {
392 foreach (
Object filteredObjectClose: filteredObjects)
393 {
395 Class.CastTo(entity, filteredObjectClose);
396
397
399 {
401 {
402 continue;
403 }
404 }
405
407 {
409 }
410 }
411 }
412 }
413 else
414 {
415 foreach (
Object filteredObject: filteredObjects)
417 }
418 }
void DayZPlayerUtils()
cannot be instantiated
proto native void SetParams(vector center, vector orientation, vector edgeLength, ObjIntersect primaryType, ObjIntersect secondaryType, bool fullComponentInfo)
Set the parameters.
float radius
radius along the ray tested
bool IsObstructed(Object filtered_object)
const float VICINITY_CONE_DISTANCE
const float VICINITY_CONE_REACH_DISTANCE
void AddVicinityCargos(CargoBase object)
const float VICINITY_ACTOR_DISTANCE
const float CONE_HEIGHT_MIN
bool ExcludeFromContainer_Phase3(Object object_in_cone)
bool ExcludeFromContainer_Phase1(Object actor_in_radius)
const float CONE_HEIGHT_MAX
const float VICINITY_LARGE_ACTOR_DISTANCE
void AddVicinityItems(Object object)
const float VICINITY_CONE_ANGLE
ref array< EntityAI > m_VicinityItems
const float VICINITY_DISTANCE
bool ExcludeFromContainer_Phase2(Object object_in_radius)
bool CanIgnoreDistanceCheck(EntityAI entity_ai)
ref array< CargoBase > m_VicinityCargos
proto float Normalize()
Normalizes vector. Returns length.
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
const int INDEX_NOT_FOUND