Replace ITraitInfo interface with TraitInfo class.

This commit is contained in:
Paul Chote
2020-05-11 18:12:19 +01:00
committed by reaperrr
parent 3cd7ec3878
commit 86f61298e6
243 changed files with 510 additions and 505 deletions

View File

@@ -15,7 +15,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.D2k.Traits
{
public class LaysTerrainInfo : ITraitInfo, Requires<BuildingInfo>
public class LaysTerrainInfo : TraitInfo, Requires<BuildingInfo>
{
[Desc("The terrain template to place. If the template is PickAny, then " +
"the actor footprint will be filled with this tile.")]
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.D2k.Traits
"Tiles being offset out of the actor's footprint will not be placed.")]
public readonly CVec Offset = CVec.Zero;
public object Create(ActorInitializer init) { return new LaysTerrain(init.Self, this); }
public override object Create(ActorInitializer init) { return new LaysTerrain(init.Self, this); }
}
public class LaysTerrain : INotifyAddedToWorld

View File

@@ -16,9 +16,9 @@ using OpenRA.Traits;
namespace OpenRA.Mods.D2k.Traits
{
[Desc("A player with this trait will receive a free harvester when his last one gets eaten by a sandworm, provided he has at least one refinery.")]
public class HarvesterInsuranceInfo : ITraitInfo
public class HarvesterInsuranceInfo : TraitInfo
{
public object Create(ActorInitializer init) { return new HarvesterInsurance(init.Self); }
public override object Create(ActorInitializer init) { return new HarvesterInsurance(init.Self); }
}
public class HarvesterInsurance

View File

@@ -21,7 +21,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.D2k.Traits
{
[Desc("Seeds resources by explosive eruptions after accumulation times.")]
public class SpiceBloomInfo : ITraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>
public class SpiceBloomInfo : TraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>
{
[SequenceReference]
public readonly string[] GrowthSequences = { "grow1", "grow2", "grow3" };
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.D2k.Traits
[Desc("The maximum distance in cells that spice may be expelled.")]
public readonly int Range = 5;
public object Create(ActorInitializer init) { return new SpiceBloom(init.Self, this); }
public override object Create(ActorInitializer init) { return new SpiceBloom(init.Self, this); }
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
{

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.D2k.Traits
{
[Desc("Attach this to the world actor. Required for LaysTerrain to work.")]
public class BuildableTerrainLayerInfo : ITraitInfo
public class BuildableTerrainLayerInfo : TraitInfo
{
[Desc("Palette to render the layer sprites in.")]
public readonly string Palette = TileSet.TerrainPaletteInternalName;
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.D2k.Traits
[Desc("The hitpoints, which can be reduced by the DamagesConcreteWarhead.")]
public readonly int MaxStrength = 9000;
public object Create(ActorInitializer init) { return new BuildableTerrainLayer(init.Self, this); }
public override object Create(ActorInitializer init) { return new BuildableTerrainLayer(init.Self, this); }
}
public class BuildableTerrainLayer : IRenderOverlay, IWorldLoaded, ITickRender, INotifyActorDisposing

View File

@@ -16,7 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.D2k.Traits
{
class D2kFogPaletteInfo : ITraitInfo
class D2kFogPaletteInfo : TraitInfo
{
[PaletteDefinition]
[FieldLoader.Require]
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.D2k.Traits
[Desc("Allow palette modifiers to change the palette.")]
public readonly bool AllowModifiers = true;
public object Create(ActorInitializer init) { return new D2kFogPalette(this); }
public override object Create(ActorInitializer init) { return new D2kFogPalette(this); }
}
class D2kFogPalette : ILoadsPalettes, IProvidesAssetBrowserPalettes

View File

@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.D2k.Traits
{
[Desc("Create a palette by applying a scale and offset to the colors in another palette.")]
class PaletteFromScaledPaletteInfo : ITraitInfo
class PaletteFromScaledPaletteInfo : TraitInfo
{
[PaletteDefinition]
[FieldLoader.Require]
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.D2k.Traits
[Desc("Amount to offset the base palette colors by.")]
public readonly int Offset = 0;
public object Create(ActorInitializer init) { return new PaletteFromScaledPalette(this); }
public override object Create(ActorInitializer init) { return new PaletteFromScaledPalette(this); }
}
class PaletteFromScaledPalette : ILoadsPalettes, IProvidesAssetBrowserPalettes