Add ActorInfo.TraitInfo[OrDefault]<T>() requiring ITraitIfo types
This commit is contained in:
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
var initialFacing = self.World.Map.FacingBetween(location, self.Location, 0);
|
||||
|
||||
// If aircraft, spawn at cruise altitude
|
||||
var aircraftInfo = self.World.Map.Rules.Actors[deliveringActorName.ToLower()].Traits.GetOrDefault<AircraftInfo>();
|
||||
var aircraftInfo = self.World.Map.Rules.Actors[deliveringActorName.ToLower()].TraitInfoOrDefault<AircraftInfo>();
|
||||
if (aircraftInfo != null)
|
||||
spawn += new WVec(0, 0, aircraftInfo.CruiseAltitude.Length);
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
var pos = self.World.Map.CenterOfCell(location);
|
||||
|
||||
// If aircraft, spawn at cruise altitude
|
||||
var aircraftInfo = producee.Traits.GetOrDefault<AircraftInfo>();
|
||||
var aircraftInfo = producee.TraitInfoOrDefault<AircraftInfo>();
|
||||
if (aircraftInfo != null)
|
||||
pos += new WVec(0, 0, aircraftInfo.CruiseAltitude.Length);
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.D2k.Traits
|
||||
|
||||
IsBusy = false;
|
||||
IsCarrying = false;
|
||||
var helicopter = self.Info.Traits.GetOrDefault<HelicopterInfo>();
|
||||
var helicopter = self.Info.TraitInfoOrDefault<HelicopterInfo>();
|
||||
carryHeight = helicopter != null ? helicopter.LandAltitude : WDist.Zero;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user