Remove ISpriteBody

This commit is contained in:
abcdefg30
2015-12-20 18:44:55 +01:00
parent 7c0b30888d
commit 72ac5240b8
4 changed files with 5 additions and 13 deletions

View File

@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits
// If a sprite actor has neither custom QuantizedFacings nor a trait implementing IQuantizeBodyOrientationInfo, throw // If a sprite actor has neither custom QuantizedFacings nor a trait implementing IQuantizeBodyOrientationInfo, throw
if (qboi == null) if (qboi == null)
{ {
if (self.Info.HasTraitInfo<ISpriteBodyInfo>()) if (self.Info.HasTraitInfo<WithSpriteBodyInfo>())
throw new InvalidOperationException("Actor '" + self.Info.Name + "' has a sprite body but no facing quantization." throw new InvalidOperationException("Actor '" + self.Info.Name + "' has a sprite body but no facing quantization."
+ " Either add the QuantizeFacingsFromSequence trait or set custom QuantizedFacings on BodyOrientation."); + " Either add the QuantizeFacingsFromSequence trait or set custom QuantizedFacings on BodyOrientation.");
else else

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits namespace OpenRA.Mods.Common.Traits
{ {
[Desc("Default trait for rendering sprite-based actors.")] [Desc("Default trait for rendering sprite-based actors.")]
public class WithSpriteBodyInfo : UpgradableTraitInfo, ISpriteBodyInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo> public class WithSpriteBodyInfo : UpgradableTraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>
{ {
[Desc("Animation to play when the actor is created."), SequenceReference] [Desc("Animation to play when the actor is created."), SequenceReference]
public readonly string StartSequence = null; public readonly string StartSequence = null;
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
} }
} }
public class WithSpriteBody : UpgradableTrait<WithSpriteBodyInfo>, ISpriteBody, INotifyDamageStateChanged, INotifyBuildComplete public class WithSpriteBody : UpgradableTrait<WithSpriteBodyInfo>, INotifyDamageStateChanged, INotifyBuildComplete
{ {
public readonly Animation DefaultAnimation; public readonly Animation DefaultAnimation;

View File

@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits
readonly UpgradeManager manager; readonly UpgradeManager manager;
readonly bool checkTerrainType; readonly bool checkTerrainType;
readonly bool canTurn; readonly bool canTurn;
readonly Lazy<ISpriteBody> body; readonly Lazy<WithSpriteBody> body;
DeployState deployState; DeployState deployState;
@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.Traits
manager = self.Trait<UpgradeManager>(); manager = self.Trait<UpgradeManager>();
checkTerrainType = info.AllowedTerrainTypes.Count > 0; checkTerrainType = info.AllowedTerrainTypes.Count > 0;
canTurn = self.Info.HasTraitInfo<IFacingInfo>(); canTurn = self.Info.HasTraitInfo<IFacingInfo>();
body = Exts.Lazy(self.TraitOrDefault<ISpriteBody>); body = Exts.Lazy(self.TraitOrDefault<WithSpriteBody>);
if (init.Contains<DeployStateInit>()) if (init.Contains<DeployStateInit>())
deployState = init.Get<DeployStateInit, DeployState>(); deployState = init.Get<DeployStateInit, DeployState>();
} }

View File

@@ -19,14 +19,6 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits namespace OpenRA.Mods.Common.Traits
{ {
public interface ISpriteBodyInfo : ITraitInfo { }
public interface ISpriteBody
{
void PlayCustomAnimation(Actor self, string newAnimation, Action after);
void PlayCustomAnimationRepeating(Actor self, string name);
void PlayCustomAnimationBackwards(Actor self, string name, Action after);
}
public interface IQuantizeBodyOrientationInfo : ITraitInfo public interface IQuantizeBodyOrientationInfo : ITraitInfo
{ {
int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string race); int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string race);