Remove Actor.HasTrait<T>()
This commit is contained in:
@@ -19,7 +19,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
public class AircraftInfo : ITraitInfo, IFacingInfo, IOccupySpaceInfo, ICruiseAltitudeInfo, UsesInit<LocationInit>, UsesInit<FacingInit>
|
||||
public class AircraftInfo : IPositionableInfo, IFacingInfo, IOccupySpaceInfo, ICruiseAltitudeInfo, UsesInit<LocationInit>, UsesInit<FacingInit>
|
||||
{
|
||||
public readonly WDist CruiseAltitude = new WDist(1280);
|
||||
public readonly WDist IdealSeparation = new WDist(1706);
|
||||
@@ -120,7 +120,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
firstTick = false;
|
||||
|
||||
// TODO: Aircraft husks don't properly unreserve.
|
||||
if (self.HasTrait<FallsToEarth>())
|
||||
if (self.Info.Traits.Contains<FallsToEarthInfo>())
|
||||
return;
|
||||
|
||||
ReserveSpawnBuilding();
|
||||
@@ -158,7 +158,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return WVec.Zero;
|
||||
|
||||
return self.World.FindActorsInCircle(self.CenterPosition, info.IdealSeparation)
|
||||
.Where(a => !a.IsDead && a.HasTrait<Aircraft>() && a.Info.Traits.Get<AircraftInfo>().CruiseAltitude == info.CruiseAltitude)
|
||||
.Where(a => !a.IsDead && a.Info.Traits.Contains<AircraftInfo>() && a.Info.Traits.Get<AircraftInfo>().CruiseAltitude == info.CruiseAltitude)
|
||||
.Select(GetRepulsionForce)
|
||||
.Aggregate(WVec.Zero, (a, b) => a + b);
|
||||
}
|
||||
@@ -191,7 +191,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return null; // not on the ground.
|
||||
|
||||
return self.World.ActorMap.GetUnitsAt(self.Location)
|
||||
.FirstOrDefault(a => a.HasTrait<Reservable>());
|
||||
.FirstOrDefault(a => a.Info.Traits.Contains<ReservableInfo>());
|
||||
}
|
||||
|
||||
protected void ReserveSpawnBuilding()
|
||||
@@ -341,7 +341,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return new EnterAlliedActorTargeter<Building>("Enter", 5,
|
||||
yield return new EnterAlliedActorTargeter<BuildingInfo>("Enter", 5,
|
||||
target => AircraftCanEnter(target), target => !Reservable.IsReserved(target));
|
||||
|
||||
yield return new AircraftMoveOrderTargeter(info);
|
||||
|
||||
Reference in New Issue
Block a user