mirror of
https://github.com/thegeneralist01/Scene-Manager-DevRepo
synced 2026-01-11 15:40:29 +01:00
Refactored GetNearbyVehiclesForCollection LINQ conditions
This commit is contained in:
parent
1a52badd04
commit
354fb88b52
1 changed files with 5 additions and 4 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using Rage;
|
||||
|
|
@ -60,12 +61,12 @@ namespace SceneManager
|
|||
|
||||
private static Vehicle[] GetNearbyVehiclesForCollection(Vector3 collectorWaypointPosition, float collectorRadius)
|
||||
{
|
||||
return (from v in World.GetAllVehicles() where v.DistanceTo2D(collectorWaypointPosition) < collectorRadius && v.IsValidForCollection() select v).ToArray();
|
||||
return (from v in World.GetAllVehicles() where v.DistanceTo2D(collectorWaypointPosition) < collectorRadius && Math.Abs(collectorWaypointPosition.Z - v.Position.Z) < 3 && v.IsValidForCollection() select v).ToArray();
|
||||
}
|
||||
|
||||
private static CollectedVehicle AddVehicleToCollection(Path path, Waypoint waypoint, Vehicle v)
|
||||
{
|
||||
var collectedVehicle = new CollectedVehicle(v, path, path.Waypoints.Count, waypoint.Number, false);
|
||||
var collectedVehicle = new CollectedVehicle(v, path, waypoint, false);
|
||||
collectedVehicles.Add(collectedVehicle);
|
||||
Game.LogTrivial($"[WaypointVehicleCollector] Added {v.Model.Name} to collection from path {path.Number}, waypoint {waypoint.Number}.");
|
||||
return collectedVehicle;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue