Remove hardcoded references to FacingInit and TurretFacingInit.
This commit is contained in:
committed by
RoosterDragon
parent
2a2bd676a3
commit
fdafbd9f15
@@ -22,7 +22,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
public class AircraftInfo : ITraitInfo, IPositionableInfo, IFacingInfo, IMoveInfo, ICruiseAltitudeInfo,
|
public class AircraftInfo : ITraitInfo, IPositionableInfo, IFacingInfo, IMoveInfo, ICruiseAltitudeInfo,
|
||||||
UsesInit<LocationInit>, UsesInit<FacingInit>
|
UsesInit<LocationInit>, UsesInit<FacingInit>, IActorPreviewInitInfo
|
||||||
{
|
{
|
||||||
public readonly WDist CruiseAltitude = new WDist(1280);
|
public readonly WDist CruiseAltitude = new WDist(1280);
|
||||||
public readonly WDist IdealSeparation = new WDist(1706);
|
public readonly WDist IdealSeparation = new WDist(1706);
|
||||||
@@ -92,6 +92,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("The number of ticks that a airplane will wait to make a new search for an available airport.")]
|
[Desc("The number of ticks that a airplane will wait to make a new search for an available airport.")]
|
||||||
public readonly int NumberOfTicksToVerifyAvailableAirport = 150;
|
public readonly int NumberOfTicksToVerifyAvailableAirport = 150;
|
||||||
|
|
||||||
|
[Desc("Facing to use for actor previews (map editor, color picker, etc)")]
|
||||||
|
public readonly int PreviewFacing = 92;
|
||||||
|
|
||||||
|
IEnumerable<object> IActorPreviewInitInfo.ActorPreviewInits(ActorInfo ai, ActorPreviewType type)
|
||||||
|
{
|
||||||
|
yield return new FacingInit(PreviewFacing);
|
||||||
|
}
|
||||||
|
|
||||||
public IReadOnlyDictionary<CPos, SubCell> OccupiedCells(ActorInfo info, CPos location, SubCell subCell = SubCell.Any) { return new ReadOnlyDictionary<CPos, SubCell>(); }
|
public IReadOnlyDictionary<CPos, SubCell> OccupiedCells(ActorInfo info, CPos location, SubCell subCell = SubCell.Any) { return new ReadOnlyDictionary<CPos, SubCell>(); }
|
||||||
bool IOccupySpaceInfo.SharesCell { get { return false; } }
|
bool IOccupySpaceInfo.SharesCell { get { return false; } }
|
||||||
|
|
||||||
|
|||||||
@@ -18,10 +18,18 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Spawns remains of a husk actor with the correct facing.")]
|
[Desc("Spawns remains of a husk actor with the correct facing.")]
|
||||||
public class HuskInfo : ITraitInfo, IOccupySpaceInfo, IFacingInfo
|
public class HuskInfo : ITraitInfo, IOccupySpaceInfo, IFacingInfo, IActorPreviewInitInfo
|
||||||
{
|
{
|
||||||
public readonly HashSet<string> AllowedTerrain = new HashSet<string>();
|
public readonly HashSet<string> AllowedTerrain = new HashSet<string>();
|
||||||
|
|
||||||
|
[Desc("Facing to use for actor previews (map editor, color picker, etc)")]
|
||||||
|
public readonly int PreviewFacing = 92;
|
||||||
|
|
||||||
|
IEnumerable<object> IActorPreviewInitInfo.ActorPreviewInits(ActorInfo ai, ActorPreviewType type)
|
||||||
|
{
|
||||||
|
yield return new FacingInit(PreviewFacing);
|
||||||
|
}
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new Husk(init, this); }
|
public object Create(ActorInitializer init) { return new Husk(init, this); }
|
||||||
|
|
||||||
public int GetInitialFacing() { return 128; }
|
public int GetInitialFacing() { return 128; }
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
[Desc("Unit is able to move.")]
|
[Desc("Unit is able to move.")]
|
||||||
public class MobileInfo : ConditionalTraitInfo, IMoveInfo, IPositionableInfo, IFacingInfo,
|
public class MobileInfo : ConditionalTraitInfo, IMoveInfo, IPositionableInfo, IFacingInfo,
|
||||||
UsesInit<FacingInit>, UsesInit<LocationInit>, UsesInit<SubCellInit>
|
UsesInit<FacingInit>, UsesInit<LocationInit>, UsesInit<SubCellInit>, IActorPreviewInitInfo
|
||||||
{
|
{
|
||||||
[FieldLoader.LoadUsing("LoadSpeeds", true)]
|
[FieldLoader.LoadUsing("LoadSpeeds", true)]
|
||||||
[Desc("Set Water: 0 for ground units and lower the value on rough terrain.")]
|
[Desc("Set Water: 0 for ground units and lower the value on rough terrain.")]
|
||||||
@@ -134,6 +134,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Can this actor transition on slopes?")]
|
[Desc("Can this actor transition on slopes?")]
|
||||||
public readonly bool JumpjetTransitionOnRamps = true;
|
public readonly bool JumpjetTransitionOnRamps = true;
|
||||||
|
|
||||||
|
[Desc("Facing to use for actor previews (map editor, color picker, etc)")]
|
||||||
|
public readonly int PreviewFacing = 92;
|
||||||
|
|
||||||
|
IEnumerable<object> IActorPreviewInitInfo.ActorPreviewInits(ActorInfo ai, ActorPreviewType type)
|
||||||
|
{
|
||||||
|
yield return new FacingInit(PreviewFacing);
|
||||||
|
}
|
||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new Mobile(init, this); }
|
public override object Create(ActorInitializer init) { return new Mobile(init, this); }
|
||||||
|
|
||||||
static object LoadSpeeds(MiniYaml y)
|
static object LoadSpeeds(MiniYaml y)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
public class TurretedInfo : ITraitInfo, UsesInit<TurretFacingInit>, Requires<BodyOrientationInfo>
|
public class TurretedInfo : ITraitInfo, UsesInit<TurretFacingInit>, Requires<BodyOrientationInfo>, IActorPreviewInitInfo
|
||||||
{
|
{
|
||||||
public readonly string Turret = "primary";
|
public readonly string Turret = "primary";
|
||||||
[Desc("Speed at which the turret turns.")]
|
[Desc("Speed at which the turret turns.")]
|
||||||
@@ -29,6 +29,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Muzzle position relative to turret or body. (forward, right, up) triples")]
|
[Desc("Muzzle position relative to turret or body. (forward, right, up) triples")]
|
||||||
public readonly WVec Offset = WVec.Zero;
|
public readonly WVec Offset = WVec.Zero;
|
||||||
|
|
||||||
|
[Desc("Facing to use for actor previews (map editor, color picker, etc)")]
|
||||||
|
public readonly int PreviewFacing = 92;
|
||||||
|
|
||||||
|
IEnumerable<object> IActorPreviewInitInfo.ActorPreviewInits(ActorInfo ai, ActorPreviewType type)
|
||||||
|
{
|
||||||
|
yield return new TurretFacingInit(PreviewFacing);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual object Create(ActorInitializer init) { return new Turreted(init, this); }
|
public virtual object Create(ActorInitializer init) { return new Turreted(init, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,8 +104,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
|
|
||||||
var td = new TypeDictionary();
|
var td = new TypeDictionary();
|
||||||
td.Add(new FacingInit(92));
|
|
||||||
td.Add(new TurretFacingInit(92));
|
|
||||||
td.Add(new OwnerInit(selectedOwner.Name));
|
td.Add(new OwnerInit(selectedOwner.Name));
|
||||||
td.Add(new FactionInit(selectedOwner.Faction));
|
td.Add(new FactionInit(selectedOwner.Faction));
|
||||||
foreach (var api in actor.TraitInfos<IActorPreviewInitInfo>())
|
foreach (var api in actor.TraitInfos<IActorPreviewInitInfo>())
|
||||||
|
|||||||
Reference in New Issue
Block a user