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

@@ -32,7 +32,7 @@ namespace OpenRA
/// </summary>
public readonly string Name;
readonly TypeDictionary traits = new TypeDictionary();
List<ITraitInfo> constructOrderCache = null;
List<TraitInfo> constructOrderCache = null;
public ActorInfo(ObjectCreator creator, string name, MiniYaml node)
{
@@ -64,7 +64,7 @@ namespace OpenRA
}
}
public ActorInfo(string name, params ITraitInfo[] traitInfos)
public ActorInfo(string name, params TraitInfo[] traitInfos)
{
Name = name;
foreach (var t in traitInfos)
@@ -72,7 +72,7 @@ namespace OpenRA
traits.TrimExcess();
}
static ITraitInfo LoadTraitInfo(ObjectCreator creator, string traitName, MiniYaml my)
static TraitInfo LoadTraitInfo(ObjectCreator creator, string traitName, MiniYaml my)
{
if (!string.IsNullOrEmpty(my.Value))
throw new YamlException("Junk value `{0}` on trait node {1}"
@@ -80,7 +80,7 @@ namespace OpenRA
// HACK: The linter does not want to crash when a trait doesn't exist but only print an error instead
// ObjectCreator will only return null to signal us to abort here if the linter is running
var info = creator.CreateObject<ITraitInfo>(traitName + "Info");
var info = creator.CreateObject<TraitInfo>(traitName + "Info");
if (info == null)
return null;
@@ -97,12 +97,12 @@ namespace OpenRA
return info;
}
public IEnumerable<ITraitInfo> TraitsInConstructOrder()
public IEnumerable<TraitInfo> TraitsInConstructOrder()
{
if (constructOrderCache != null)
return constructOrderCache;
var source = traits.WithInterface<ITraitInfo>().Select(i => new
var source = traits.WithInterface<TraitInfo>().Select(i => new
{
Trait = i,
Type = i.GetType(),
@@ -148,7 +148,7 @@ namespace OpenRA
return constructOrderCache;
}
public static IEnumerable<Type> PrerequisitesOf(ITraitInfo info)
public static IEnumerable<Type> PrerequisitesOf(TraitInfo info)
{
return info
.GetType()

View File

@@ -12,9 +12,9 @@
namespace OpenRA.Traits
{
[Desc("Checks for pause related desyncs. Attach this to the world actor.")]
public class DebugPauseStateInfo : ITraitInfo
public class DebugPauseStateInfo : TraitInfo
{
public object Create(ActorInitializer init) { return new DebugPauseState(init.World); }
public override object Create(ActorInitializer init) { return new DebugPauseState(init.World); }
}
public class DebugPauseState : ISync

View File

@@ -15,7 +15,7 @@ using OpenRA.Primitives;
namespace OpenRA.Traits
{
[Desc("Add this to the World actor definition.")]
public class FixedColorPaletteInfo : ITraitInfo
public class FixedColorPaletteInfo : TraitInfo
{
[PaletteReference]
[Desc("The name of the palette to base off.")]
@@ -37,7 +37,7 @@ namespace OpenRA.Traits
[Desc("Allow palette modifiers to change the palette.")]
public readonly bool AllowModifiers = true;
public object Create(ActorInitializer init) { return new FixedColorPalette(this); }
public override object Create(ActorInitializer init) { return new FixedColorPalette(this); }
}
public class FixedColorPalette : ILoadsPalettes

View File

@@ -23,12 +23,12 @@ namespace OpenRA.Traits
}
[Desc("Required for FrozenUnderFog to work. Attach this to the player actor.")]
public class FrozenActorLayerInfo : Requires<ShroudInfo>, ITraitInfo
public class FrozenActorLayerInfo : TraitInfo, Requires<ShroudInfo>
{
[Desc("Size of partition bins (cells)")]
public readonly int BinSize = 10;
public object Create(ActorInitializer init) { return new FrozenActorLayer(init.Self, this); }
public override object Create(ActorInitializer init) { return new FrozenActorLayer(init.Self, this); }
}
public class FrozenActor

View File

@@ -17,7 +17,7 @@ using OpenRA.Primitives;
namespace OpenRA.Traits
{
[Desc("Define a player palette by swapping palette indices.")]
public class IndexedPlayerPaletteInfo : ITraitInfo, IRulesetLoaded
public class IndexedPlayerPaletteInfo : TraitInfo, IRulesetLoaded
{
[PaletteReference]
[Desc("The name of the palette to base off.")]
@@ -35,7 +35,7 @@ namespace OpenRA.Traits
public readonly Dictionary<string, int[]> PlayerIndex;
public object Create(ActorInitializer init) { return new IndexedPlayerPalette(this); }
public override object Create(ActorInitializer init) { return new IndexedPlayerPalette(this); }
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
{

View File

@@ -15,7 +15,7 @@ using OpenRA.Primitives;
namespace OpenRA.Traits
{
[Desc("Add this to the Player actor definition.")]
public class PlayerColorPaletteInfo : ITraitInfo
public class PlayerColorPaletteInfo : TraitInfo
{
[PaletteReference]
[Desc("The name of the palette to base off.")]
@@ -34,7 +34,7 @@ namespace OpenRA.Traits
[Desc("Allow palette modifiers to change the palette.")]
public readonly bool AllowModifiers = true;
public object Create(ActorInitializer init) { return new PlayerColorPalette(this); }
public override object Create(ActorInitializer init) { return new PlayerColorPalette(this); }
}
public class PlayerColorPalette : ILoadsPlayerPalettes

View File

@@ -16,7 +16,7 @@ using OpenRA.Primitives;
namespace OpenRA.Traits
{
[Desc("Add this to the Player actor definition.")]
public class PlayerHighlightPaletteInfo : ITraitInfo
public class PlayerHighlightPaletteInfo : TraitInfo
{
[PaletteDefinition(true)]
[Desc("The prefix for the resulting player palettes")]
@@ -25,7 +25,7 @@ namespace OpenRA.Traits
[Desc("Index set to be fully transparent/invisible.")]
public readonly int TransparentIndex = 0;
public object Create(ActorInitializer init) { return new PlayerHighlightPalette(this); }
public override object Create(ActorInitializer init) { return new PlayerHighlightPalette(this); }
}
public class PlayerHighlightPalette : ILoadsPlayerPalettes

View File

@@ -15,7 +15,7 @@ using System.Collections.Generic;
namespace OpenRA.Traits
{
[Desc("Required for shroud and fog visibility checks. Add this to the player actor.")]
public class ShroudInfo : ITraitInfo, ILobbyOptions
public class ShroudInfo : TraitInfo, ILobbyOptions
{
[Translate]
[Desc("Descriptive label for the fog checkbox in the lobby.")]
@@ -65,7 +65,7 @@ namespace OpenRA.Traits
FogCheckboxVisible, FogCheckboxDisplayOrder, FogCheckboxEnabled, FogCheckboxLocked);
}
public object Create(ActorInitializer init) { return new Shroud(init.Self, this); }
public override object Create(ActorInitializer init) { return new Shroud(init.Self, this); }
}
public class Shroud : ISync, INotifyCreated, ITick

View File

@@ -49,7 +49,7 @@ namespace OpenRA.Traits
/// </summary>
public sealed class DamageType { DamageType() { } }
public interface IHealthInfo : ITraitInfo
public interface IHealthInfo : ITraitInfoInterface
{
int MaxHP { get; }
}
@@ -324,9 +324,17 @@ namespace OpenRA.Traits
public interface IFacingInfo : ITraitInfoInterface { int GetInitialFacing(); }
public interface ITraitInfoInterface { }
public interface ITraitInfo : ITraitInfoInterface { object Create(ActorInitializer init); }
public class TraitInfo<T> : ITraitInfo where T : new() { public virtual object Create(ActorInitializer init) { return new T(); } }
public abstract class TraitInfo : ITraitInfoInterface
{
public abstract object Create(ActorInitializer init);
}
public class TraitInfo<T> : TraitInfo where T : new()
{
public override object Create(ActorInitializer init) { return new T(); }
}
public interface ILobbyCustomRulesIgnore { }
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:InterfaceNamesMustBeginWithI", Justification = "Not a real interface, but more like a tag.")]
@@ -541,7 +549,7 @@ namespace OpenRA.Traits
public interface ICreationActivity { Activity GetCreationActivity(); }
[RequireExplicitImplementation]
public interface IObservesVariablesInfo : ITraitInfo { }
public interface IObservesVariablesInfo : ITraitInfoInterface { }
public delegate void VariableObserverNotifier(Actor self, IReadOnlyDictionary<string, int> variables);
public struct VariableObserver

View File

@@ -30,12 +30,12 @@ namespace OpenRA.Traits
public override string ToString() { return "{0}->{1}".F(Actor.Info.Name, Bounds.GetType().Name); }
}
public class ScreenMapInfo : ITraitInfo
public class ScreenMapInfo : TraitInfo
{
[Desc("Size of partition bins (world pixels)")]
public readonly int BinSize = 250;
public object Create(ActorInitializer init) { return new ScreenMap(init.World, this); }
public override object Create(ActorInitializer init) { return new ScreenMap(init.World, this); }
}
public class ScreenMap : IWorldLoaded

View File

@@ -16,12 +16,12 @@ using OpenRA.Graphics;
namespace OpenRA.Traits
{
public class ScreenShakerInfo : ITraitInfo
public class ScreenShakerInfo : TraitInfo
{
public readonly float2 MinMultiplier = new float2(-3, -3);
public readonly float2 MaxMultiplier = new float2(3, 3);
public object Create(ActorInitializer init) { return new ScreenShaker(this); }
public override object Create(ActorInitializer init) { return new ScreenShaker(this); }
}
public class ScreenShaker : ITick, IWorldLoaded

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("Implements the special case handling for the Chronoshiftable return on a construction yard.",
"If ReturnOriginalActorOnCondition evaluates true and the actor is not being sold then OriginalActor will be returned to the origin.",
"Otherwise, a vortex animation is played and damage is dealt each tick, ignoring modifiers.")]
public class ConyardChronoReturnInfo : IObservesVariablesInfo, Requires<HealthInfo>, Requires<WithSpriteBodyInfo>
public class ConyardChronoReturnInfo : TraitInfo, Requires<HealthInfo>, Requires<WithSpriteBodyInfo>, IObservesVariablesInfo
{
[SequenceReference]
[Desc("Sequence name with the baked-in vortex animation")]
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("The color the bar of the 'return-to-origin' logic has.")]
public readonly Color TimeBarColor = Color.White;
public object Create(ActorInitializer init) { return new ConyardChronoReturn(init, this); }
public override object Create(ActorInitializer init) { return new ConyardChronoReturn(init, this); }
}
public class ConyardChronoReturn : ITick, ISync, IObservesVariables, ISelectionBar, INotifySold,

View File

@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Cnc.Traits
}
[Desc("Provides access to the disguise command, which makes the actor appear to be another player's actor.")]
class DisguiseInfo : ITraitInfo
class DisguiseInfo : TraitInfo
{
[VoiceReference]
public readonly string Voice = "Action";
@@ -96,7 +96,7 @@ namespace OpenRA.Mods.Cnc.Traits
[GrantedConditionReference]
public IEnumerable<string> LinterConditions { get { return DisguisedAsConditions.Values; } }
public object Create(ActorInitializer init) { return new Disguise(init.Self, this); }
public override object Create(ActorInitializer init) { return new Disguise(init.Self, this); }
}
class Disguise : IEffectiveOwner, IIssueOrder, IResolveOrder, IOrderVoice, IRadarColorModifier, INotifyAttack,

View File

@@ -19,9 +19,9 @@ namespace OpenRA.Mods.Cnc.Traits
using FrozenActorAction = Action<FrozenUnderFogUpdatedByGps, FrozenActorLayer, GpsWatcher, FrozenActor>;
[Desc("Updates frozen actors of actors that change owners, are sold or die whilst having an active GPS power.")]
public class FrozenUnderFogUpdatedByGpsInfo : ITraitInfo, Requires<FrozenUnderFogInfo>
public class FrozenUnderFogUpdatedByGpsInfo : TraitInfo, Requires<FrozenUnderFogInfo>
{
public object Create(ActorInitializer init) { return new FrozenUnderFogUpdatedByGps(init); }
public override object Create(ActorInitializer init) { return new FrozenUnderFogUpdatedByGps(init); }
}
public class FrozenUnderFogUpdatedByGps : INotifyOwnerChanged, INotifyActorDisposing, IOnGpsRefreshed

View File

@@ -15,7 +15,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
[Desc("Show an indicator revealing the actor underneath the fog when a GPSWatcher is activated.")]
class GpsDotInfo : ITraitInfo
class GpsDotInfo : TraitInfo
{
[Desc("Sprite collection for symbols.")]
public readonly string Image = "gpsdot";
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Cnc.Traits
[PaletteReference(true)]
public readonly string IndicatorPalettePrefix = "player";
public object Create(ActorInitializer init) { return new GpsDot(this); }
public override object Create(ActorInitializer init) { return new GpsDot(this); }
}
class GpsDot : INotifyCreated, INotifyAddedToWorld, INotifyRemovedFromWorld

View File

@@ -17,9 +17,9 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
[Desc("Required for `GpsPower`. Attach this to the player actor.")]
class GpsWatcherInfo : ITraitInfo
class GpsWatcherInfo : TraitInfo
{
public object Create(ActorInitializer init) { return new GpsWatcher(init.Self.Owner); }
public override object Create(ActorInitializer init) { return new GpsWatcher(init.Self.Owner); }
}
interface IOnGpsRefreshed { void OnGpsRefresh(Actor self, Player player); }

View File

@@ -14,13 +14,13 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
public class HarvesterHuskModifierInfo : ITraitInfo, Requires<HarvesterInfo>
public class HarvesterHuskModifierInfo : TraitInfo, Requires<HarvesterInfo>
{
[ActorReference]
public readonly string FullHuskActor = null;
public readonly int FullnessThreshold = 50;
public object Create(ActorInitializer init) { return new HarvesterHuskModifier(this); }
public override object Create(ActorInitializer init) { return new HarvesterHuskModifier(this); }
}
public class HarvesterHuskModifier : IHuskModifier

View File

@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
[Desc("Funds are transferred from the owner to the infiltrator.")]
class InfiltrateForCashInfo : ITraitInfo
class InfiltrateForCashInfo : TraitInfo
{
[Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")]
public readonly BitSet<TargetableType> Types = default(BitSet<TargetableType>);
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("Whether to show the cash tick indicators rising from the actor.")]
public readonly bool ShowTicks = true;
public object Create(ActorInitializer init) { return new InfiltrateForCash(this); }
public override object Create(ActorInitializer init) { return new InfiltrateForCash(this); }
}
class InfiltrateForCash : INotifyInfiltrated

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
[Desc("Steal and reset the owner's exploration.")]
class InfiltrateForExplorationInfo : ITraitInfo
class InfiltrateForExplorationInfo : TraitInfo
{
[Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")]
public readonly BitSet<TargetableType> Types = default(BitSet<TargetableType>);
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("Sound the perpetrator will hear after successful infiltration.")]
public readonly string InfiltrationNotification = null;
public object Create(ActorInitializer init) { return new InfiltrateForExploration(init.Self, this); }
public override object Create(ActorInitializer init) { return new InfiltrateForExploration(init.Self, this); }
}
class InfiltrateForExploration : INotifyInfiltrated

View File

@@ -15,7 +15,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
class InfiltrateForPowerOutageInfo : ITraitInfo
class InfiltrateForPowerOutageInfo : TraitInfo
{
[Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")]
public readonly BitSet<TargetableType> Types = default(BitSet<TargetableType>);
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("Sound the perpetrator will hear after successful infiltration.")]
public readonly string InfiltrationNotification = null;
public object Create(ActorInitializer init) { return new InfiltrateForPowerOutage(init.Self, this); }
public override object Create(ActorInitializer init) { return new InfiltrateForPowerOutage(init.Self, this); }
}
class InfiltrateForPowerOutage : INotifyOwnerChanged, INotifyInfiltrated

View File

@@ -15,7 +15,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
class InfiltrateForSupportPowerInfo : ITraitInfo
class InfiltrateForSupportPowerInfo : TraitInfo
{
[ActorReference]
[FieldLoader.Require]
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("Sound the perpetrator will hear after successful infiltration.")]
public readonly string InfiltrationNotification = null;
public object Create(ActorInitializer init) { return new InfiltrateForSupportPower(this); }
public override object Create(ActorInitializer init) { return new InfiltrateForSupportPower(this); }
}
class InfiltrateForSupportPower : INotifyInfiltrated

View File

@@ -16,7 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
class InfiltrateForSupportPowerResetInfo : ITraitInfo
class InfiltrateForSupportPowerResetInfo : TraitInfo
{
[Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")]
public readonly BitSet<TargetableType> Types = default(BitSet<TargetableType>);
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("Sound the perpetrator will hear after successful infiltration.")]
public readonly string InfiltrationNotification = null;
public object Create(ActorInitializer init) { return new InfiltrateForSupportPowerReset(this); }
public override object Create(ActorInitializer init) { return new InfiltrateForSupportPowerReset(this); }
}
class InfiltrateForSupportPowerReset : INotifyInfiltrated

View File

@@ -19,7 +19,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
[Desc("Transform into a different actor type.")]
class InfiltrateForTransformInfo : ITraitInfo
class InfiltrateForTransformInfo : TraitInfo
{
[ActorReference]
[FieldLoader.Require]
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")]
public readonly BitSet<TargetableType> Types = default(BitSet<TargetableType>);
public object Create(ActorInitializer init) { return new InfiltrateForTransform(init, this); }
public override object Create(ActorInitializer init) { return new InfiltrateForTransform(init, this); }
}
class InfiltrateForTransform : INotifyInfiltrated

View File

@@ -23,7 +23,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
class MadTankInfo : ITraitInfo, IRulesetLoaded, Requires<ExplodesInfo>, Requires<WithFacingSpriteBodyInfo>
class MadTankInfo : TraitInfo, IRulesetLoaded, Requires<ExplodesInfo>, Requires<WithFacingSpriteBodyInfo>
{
[SequenceReference]
public readonly string ThumpSequence = "piston";
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("Types of damage that this trait causes to self while self-destructing. Leave empty for no damage types.")]
public readonly BitSet<DamageType> DamageTypes = default(BitSet<DamageType>);
public object Create(ActorInitializer init) { return new MadTank(init.Self, this); }
public override object Create(ActorInitializer init) { return new MadTank(init.Self, this); }
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
{

View File

@@ -15,14 +15,14 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
class MineInfo : ITraitInfo
class MineInfo : TraitInfo
{
public readonly BitSet<CrushClass> CrushClasses = default(BitSet<CrushClass>);
public readonly bool AvoidFriendly = true;
public readonly bool BlockFriendly = true;
public readonly BitSet<CrushClass> DetonateClasses = default(BitSet<CrushClass>);
public object Create(ActorInitializer init) { return new Mine(this); }
public override object Create(ActorInitializer init) { return new Mine(this); }
}
class Mine : ICrushable, INotifyCrushed

View File

@@ -21,7 +21,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
public class MinelayerInfo : ITraitInfo, Requires<RearmableInfo>
public class MinelayerInfo : TraitInfo, Requires<RearmableInfo>
{
[ActorReference]
public readonly string Mine = "minv";
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("Sprite overlay to use for minefield cells hidden behind fog or shroud.")]
public readonly string TileUnknownName = "build-unknown";
public object Create(ActorInitializer init) { return new Minelayer(init.Self, this); }
public override object Create(ActorInitializer init) { return new Minelayer(init.Self, this); }
}
public class Minelayer : IIssueOrder, IResolveOrder, ISync, IIssueDeployOrder, IOrderVoice, ITick

View File

@@ -16,12 +16,12 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
[Desc("Apply palette full screen rotations during chronoshifts. Add this to the world actor.")]
public class ChronoshiftPaletteEffectInfo : ITraitInfo
public class ChronoshiftPaletteEffectInfo : TraitInfo
{
[Desc("Measured in ticks.")]
public readonly int ChronoEffectLength = 60;
public object Create(ActorInitializer init) { return new ChronoshiftPaletteEffect(this); }
public override object Create(ActorInitializer init) { return new ChronoshiftPaletteEffect(this); }
}
public class ChronoshiftPaletteEffect : IPaletteModifier, ITick

View File

@@ -16,7 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
[Desc("Palette effect used for blinking \"animations\" on actors.")]
class LightPaletteRotatorInfo : ITraitInfo
class LightPaletteRotatorInfo : TraitInfo
{
[Desc("Palettes this effect should not apply to.")]
public readonly HashSet<string> ExcludePalettes = new HashSet<string>();
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("Palette indices to rotate through.")]
public readonly int[] RotationIndices = { 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 238, 237, 236, 235, 234, 233, 232, 231 };
public object Create(ActorInitializer init) { return new LightPaletteRotator(this); }
public override object Create(ActorInitializer init) { return new LightPaletteRotator(this); }
}
class LightPaletteRotator : ITick, IPaletteModifier

View File

@@ -20,7 +20,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
class PortableChronoInfo : ITraitInfo, Requires<IMoveInfo>
class PortableChronoInfo : TraitInfo, Requires<IMoveInfo>
{
[Desc("Cooldown in ticks until the unit can teleport.")]
public readonly int ChargeDelay = 500;
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Cnc.Traits
[VoiceReference]
public readonly string Voice = "Action";
public object Create(ActorInitializer init) { return new PortableChrono(init.Self, this); }
public override object Create(ActorInitializer init) { return new PortableChrono(init.Self, this); }
}
class PortableChrono : IIssueOrder, IResolveOrder, ITick, ISelectionBar, IOrderVoice, ISync

View File

@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
public class WithBuildingBibInfo : ITraitInfo, Requires<BuildingInfo>, IRenderActorPreviewSpritesInfo, IActorPreviewInitInfo, Requires<RenderSpritesInfo>
public class WithBuildingBibInfo : TraitInfo, Requires<BuildingInfo>, IRenderActorPreviewSpritesInfo, IActorPreviewInitInfo, Requires<RenderSpritesInfo>
{
[SequenceReference]
public readonly string Sequence = "bib";
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Cnc.Traits
public readonly bool HasMinibib = false;
public object Create(ActorInitializer init) { return new WithBuildingBib(init.Self, this); }
public override object Create(ActorInitializer init) { return new WithBuildingBib(init.Self, this); }
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
{

View File

@@ -21,7 +21,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits.Render
{
[Desc("Renders the cargo loaded into the unit.")]
public class WithCargoInfo : ITraitInfo, Requires<CargoInfo>, Requires<BodyOrientationInfo>
public class WithCargoInfo : TraitInfo, Requires<CargoInfo>, Requires<BodyOrientationInfo>
{
[Desc("Cargo position relative to turret or body in (forward, right, up) triples. The default offset should be in the middle of the list.")]
public readonly WVec[] LocalOffset = { WVec.Zero };
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
[Desc("Passenger CargoType to display.")]
public readonly HashSet<string> DisplayTypes = new HashSet<string>();
public object Create(ActorInitializer init) { return new WithCargo(init.Self, this); }
public override object Create(ActorInitializer init) { return new WithCargo(init.Self, this); }
}
public class WithCargo : ITick, IRender, INotifyPassengerEntered, INotifyPassengerExited

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits.Render
{
public class WithLandingCraftAnimationInfo : ITraitInfo, Requires<IMoveInfo>, Requires<WithSpriteBodyInfo>, Requires<CargoInfo>
public class WithLandingCraftAnimationInfo : TraitInfo, Requires<IMoveInfo>, Requires<WithSpriteBodyInfo>, Requires<CargoInfo>
{
public readonly HashSet<string> OpenTerrainTypes = new HashSet<string> { "Clear" };
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
[Desc("Which sprite body to play the animation on.")]
public readonly string Body = "body";
public object Create(ActorInitializer init) { return new WithLandingCraftAnimation(init, this); }
public override object Create(ActorInitializer init) { return new WithLandingCraftAnimation(init, this); }
}
public class WithLandingCraftAnimation : ITick

View File

@@ -16,12 +16,12 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits.Render
{
[Desc("Provides an overlay for the Tiberian Dawn hover craft.")]
public class WithRoofInfo : ITraitInfo, Requires<RenderSpritesInfo>
public class WithRoofInfo : TraitInfo, Requires<RenderSpritesInfo>
{
[SequenceReference]
public readonly string Sequence = "roof";
public object Create(ActorInitializer init) { return new WithRoof(init.Self, this); }
public override object Create(ActorInitializer init) { return new WithRoof(init.Self, this); }
}
public class WithRoof

View File

@@ -16,7 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits.Render
{
[Desc("This actor displays a charge-up animation before firing.")]
public class WithTeslaChargeAnimationInfo : ITraitInfo, Requires<WithSpriteBodyInfo>, Requires<RenderSpritesInfo>
public class WithTeslaChargeAnimationInfo : TraitInfo, Requires<WithSpriteBodyInfo>, Requires<RenderSpritesInfo>
{
[SequenceReference]
[Desc("Sequence to use for charge animation.")]
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
[Desc("Which sprite body to play the animation on.")]
public readonly string Body = "body";
public object Create(ActorInitializer init) { return new WithTeslaChargeAnimation(init, this); }
public override object Create(ActorInitializer init) { return new WithTeslaChargeAnimation(init, this); }
}
public class WithTeslaChargeAnimation : INotifyTeslaCharging

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits.Render
{
[Desc("Rendered together with AttackCharge.")]
public class WithTeslaChargeOverlayInfo : ITraitInfo, Requires<RenderSpritesInfo>
public class WithTeslaChargeOverlayInfo : TraitInfo, Requires<RenderSpritesInfo>
{
[SequenceReference]
[Desc("Sequence name to use")]
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
[Desc("Custom palette is a player palette BaseName")]
public readonly bool IsPlayerPalette = false;
public object Create(ActorInitializer init) { return new WithTeslaChargeOverlay(init, this); }
public override object Create(ActorInitializer init) { return new WithTeslaChargeOverlay(init, this); }
}
public class WithTeslaChargeOverlay : INotifyTeslaCharging, INotifyDamageStateChanged, INotifySold

View File

@@ -21,7 +21,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits.Render
{
// TODO: This trait is hacky and should go away as soon as we support granting a condition on docking, in favor of toggling two regular WithVoxelBodies
public class WithVoxelUnloadBodyInfo : ITraitInfo, IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>
public class WithVoxelUnloadBodyInfo : TraitInfo, IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>
{
[Desc("Voxel sequence name to use when docked to a refinery.")]
public readonly string UnloadSequence = "unload";
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
[Desc("Defines if the Voxel should have a shadow.")]
public readonly bool ShowShadow = true;
public object Create(ActorInitializer init) { return new WithVoxelUnloadBody(init.Self, this); }
public override object Create(ActorInitializer init) { return new WithVoxelUnloadBody(init.Self, this); }
public IEnumerable<ModelAnimation> RenderPreviewVoxels(
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p)

View File

@@ -20,7 +20,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits.Render
{
public class WithVoxelWalkerBodyInfo : ITraitInfo, IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>, Requires<IMoveInfo>, Requires<IFacingInfo>
public class WithVoxelWalkerBodyInfo : TraitInfo, IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>, Requires<IMoveInfo>, Requires<IFacingInfo>
{
public readonly string Sequence = "idle";
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
[Desc("Defines if the Voxel should have a shadow.")]
public readonly bool ShowShadow = true;
public object Create(ActorInitializer init) { return new WithVoxelWalkerBody(init.Self, this); }
public override object Create(ActorInitializer init) { return new WithVoxelWalkerBody(init.Self, this); }
public IEnumerable<ModelAnimation> RenderPreviewVoxels(
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p)

View File

@@ -19,7 +19,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
public class TDGunboatInfo : ITraitInfo, IPositionableInfo, IFacingInfo, IMoveInfo, IActorPreviewInitInfo
public class TDGunboatInfo : TraitInfo, IPositionableInfo, IFacingInfo, IMoveInfo, IActorPreviewInitInfo
{
public readonly int Speed = 28;
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("Facing to use for actor previews (map editor, color picker, etc). Only 64 and 192 supported.")]
public readonly int PreviewFacing = 64;
public virtual object Create(ActorInitializer init) { return new TDGunboat(init, this); }
public override object Create(ActorInitializer init) { return new TDGunboat(init, this); }
public int GetInitialFacing() { return InitialFacing; }

View File

@@ -18,13 +18,13 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("A special case trait that re-grants a timed external condition when this actor transforms.",
"This trait does not work with permanently granted external conditions.",
"This trait changes the external condition source, so cannot be used for conditions that may later be revoked")]
public class TransferTimedExternalConditionOnTransformInfo : ITraitInfo, Requires<TransformsInfo>
public class TransferTimedExternalConditionOnTransformInfo : TraitInfo, Requires<TransformsInfo>
{
[FieldLoader.Require]
[Desc("External condition to transfer")]
public readonly string Condition = null;
public object Create(ActorInitializer init) { return new TransferTimedExternalConditionOnTransform(this); }
public override object Create(ActorInitializer init) { return new TransferTimedExternalConditionOnTransform(this); }
}
public class TransferTimedExternalConditionOnTransform : IConditionTimerWatcher, INotifyTransform

View File

@@ -19,7 +19,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
[Desc("Adds the hard-coded shroud palette to the game")]
class ShroudPaletteInfo : ITraitInfo
class ShroudPaletteInfo : TraitInfo
{
[PaletteDefinition]
[FieldLoader.Require]
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("Palette type")]
public readonly bool Fog = false;
public object Create(ActorInitializer init) { return new ShroudPalette(this); }
public override object Create(ActorInitializer init) { return new ShroudPalette(this); }
}
class ShroudPalette : ILoadsPalettes, IProvidesAssetBrowserPalettes

View File

@@ -19,14 +19,14 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
[Desc("Adds the hard-coded shroud palette to the game")]
class TSShroudPaletteInfo : ITraitInfo
class TSShroudPaletteInfo : TraitInfo
{
[PaletteDefinition]
[FieldLoader.Require]
[Desc("Internal palette name")]
public readonly string Name = "shroud";
public object Create(ActorInitializer init) { return new TSShroudPalette(this); }
public override object Create(ActorInitializer init) { return new TSShroudPalette(this); }
}
class TSShroudPalette : ILoadsPalettes, IProvidesAssetBrowserPalettes

View File

@@ -15,7 +15,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc.Traits
{
public class VoxelNormalsPaletteInfo : ITraitInfo
public class VoxelNormalsPaletteInfo : TraitInfo
{
[PaletteDefinition]
public readonly string Name = "normals";
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("Can be TiberianSun or RedAlert2")]
public readonly NormalType Type = NormalType.TiberianSun;
public object Create(ActorInitializer init) { return new VoxelNormalsPalette(this); }
public override object Create(ActorInitializer init) { return new VoxelNormalsPalette(this); }
}
public class VoxelNormalsPalette : ILoadsPalettes

View File

@@ -26,11 +26,11 @@ namespace OpenRA.Mods.Common.Lint
this.emitError = emitError;
foreach (var actorInfo in rules.Actors)
foreach (var traitInfo in actorInfo.Value.TraitInfos<ITraitInfo>())
foreach (var traitInfo in actorInfo.Value.TraitInfos<TraitInfo>())
CheckTrait(actorInfo.Value, traitInfo, rules);
}
void CheckTrait(ActorInfo actorInfo, ITraitInfo traitInfo, Ruleset rules)
void CheckTrait(ActorInfo actorInfo, TraitInfo traitInfo, Ruleset rules)
{
var actualType = traitInfo.GetType();
foreach (var field in actualType.GetFields())
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Lint
}
void CheckActorReference(ActorInfo actorInfo,
ITraitInfo traitInfo,
TraitInfo traitInfo,
FieldInfo fieldInfo,
IReadOnlyDictionary<string, ActorInfo> dict,
ActorReferenceAttribute attribute)
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Lint
}
void CheckWeaponReference(ActorInfo actorInfo,
ITraitInfo traitInfo,
TraitInfo traitInfo,
FieldInfo fieldInfo,
IReadOnlyDictionary<string, WeaponInfo> dict,
WeaponReferenceAttribute attribute)
@@ -99,7 +99,7 @@ namespace OpenRA.Mods.Common.Lint
}
void CheckVoiceReference(ActorInfo actorInfo,
ITraitInfo traitInfo,
TraitInfo traitInfo,
FieldInfo fieldInfo,
IReadOnlyDictionary<string, SoundInfo> dict,
VoiceSetReferenceAttribute attribute)

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Lint
var granted = new HashSet<string>();
var consumed = new HashSet<string>();
foreach (var trait in actorInfo.Value.TraitInfos<ITraitInfo>())
foreach (var trait in actorInfo.Value.TraitInfos<TraitInfo>())
{
var fieldConsumed = trait.GetType().GetFields()
.Where(x => x.HasAttribute<ConsumedConditionReferenceAttribute>())

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Lint
foreach (var actorInfo in rules.Actors)
{
foreach (var traitInfo in actorInfo.Value.TraitInfos<ITraitInfo>())
foreach (var traitInfo in actorInfo.Value.TraitInfos<TraitInfo>())
{
var fields = traitInfo.GetType().GetFields().Where(f => f.HasAttribute<LocomotorReferenceAttribute>());
foreach (var field in fields)

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Lint
{
foreach (var actorInfo in rules.Actors)
{
foreach (var traitInfo in actorInfo.Value.TraitInfos<ITraitInfo>())
foreach (var traitInfo in actorInfo.Value.TraitInfos<TraitInfo>())
{
var fields = traitInfo.GetType().GetFields();
foreach (var field in fields.Where(x => x.HasAttribute<NotificationReferenceAttribute>()))

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Lint
foreach (var actorInfo in rules.Actors)
{
foreach (var traitInfo in actorInfo.Value.TraitInfos<ITraitInfo>())
foreach (var traitInfo in actorInfo.Value.TraitInfos<TraitInfo>())
{
var fields = traitInfo.GetType().GetFields();
foreach (var field in fields.Where(x => x.HasAttribute<PaletteReferenceAttribute>()))
@@ -115,7 +115,7 @@ namespace OpenRA.Mods.Common.Lint
{
foreach (var actorInfo in rules.Actors)
{
foreach (var traitInfo in actorInfo.Value.TraitInfos<ITraitInfo>())
foreach (var traitInfo in actorInfo.Value.TraitInfos<TraitInfo>())
{
var fields = traitInfo.GetType().GetFields();
foreach (var field in fields.Where(x => x.HasAttribute<PaletteDefinitionAttribute>()))

View File

@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Lint
}
}
foreach (var traitInfo in actorInfo.Value.TraitInfos<ITraitInfo>())
foreach (var traitInfo in actorInfo.Value.TraitInfos<TraitInfo>())
{
var fields = traitInfo.GetType().GetFields();
foreach (var field in fields)
@@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Lint
}
void CheckDefinitions(string image, SequenceReferenceAttribute sequenceReference,
KeyValuePair<string, ActorInfo> actorInfo, string sequence, string faction, FieldInfo field, ITraitInfo traitInfo)
KeyValuePair<string, ActorInfo> actorInfo, string sequence, string faction, FieldInfo field, TraitInfo traitInfo)
{
var definitions = sequenceDefinitions.FirstOrDefault(n => n.Key == image.ToLowerInvariant());
if (definitions != null)

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Lint
{
foreach (var actorInfo in rules.Actors)
{
foreach (var traitInfo in actorInfo.Value.TraitInfos<ITraitInfo>())
foreach (var traitInfo in actorInfo.Value.TraitInfos<TraitInfo>())
{
var fields = traitInfo.GetType().GetFields().Where(f => f.HasAttribute<VoiceSetReferenceAttribute>());
foreach (var field in fields)
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Lint
{
var soundInfo = rules.Voices[voiceSet.ToLowerInvariant()];
foreach (var traitInfo in actorInfo.TraitInfos<ITraitInfo>())
foreach (var traitInfo in actorInfo.TraitInfos<TraitInfo>())
{
var fields = traitInfo.GetType().GetFields().Where(f => f.HasAttribute<VoiceReferenceAttribute>());
foreach (var field in fields)

View File

@@ -14,7 +14,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Orders
{
public class EnterAlliedActorTargeter<T> : UnitOrderTargeter where T : ITraitInfo
public class EnterAlliedActorTargeter<T> : UnitOrderTargeter where T : ITraitInfoInterface
{
readonly Func<Actor, TargetModifiers, bool> canTarget;
readonly Func<Actor, bool> useEnterCursor;

View File

@@ -19,11 +19,11 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Scripting
{
[Desc("Part of the new Lua API.")]
public class LuaScriptInfo : ITraitInfo, Requires<SpawnMapActorsInfo>
public class LuaScriptInfo : TraitInfo, Requires<SpawnMapActorsInfo>
{
public readonly HashSet<string> Scripts = new HashSet<string>();
public object Create(ActorInitializer init) { return new LuaScript(this); }
public override object Create(ActorInitializer init) { return new LuaScript(this); }
}
public class LuaScript : ITick, IWorldLoaded, INotifyActorDisposing

View File

@@ -28,9 +28,9 @@ namespace OpenRA.Mods.Common.Scripting
}
[Desc("Allows map scripts to attach triggers to this actor via the Triggers global.")]
public class ScriptTriggersInfo : ITraitInfo
public class ScriptTriggersInfo : TraitInfo
{
public object Create(ActorInitializer init) { return new ScriptTriggers(init.World, init.Self); }
public override object Create(ActorInitializer init) { return new ScriptTriggers(init.World, init.Self); }
}
public sealed class ScriptTriggers : INotifyIdle, INotifyDamage, INotifyKilled, INotifyProduction, INotifyOtherProduction,

View File

@@ -15,7 +15,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Tag trait for actors with `DeliversCash`.")]
public class AcceptsDeliveredCashInfo : ITraitInfo
public class AcceptsDeliveredCashInfo : TraitInfo
{
[Desc("Accepted `DeliversCash` types. Leave empty to accept all types.")]
public readonly HashSet<string> ValidTypes = new HashSet<string>();
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Play a randomly selected sound from this list when accepting cash.")]
public readonly string[] Sounds = { };
public object Create(ActorInitializer init) { return new AcceptsDeliveredCash(init.Self, this); }
public override object Create(ActorInitializer init) { return new AcceptsDeliveredCash(init.Self, this); }
}
public class AcceptsDeliveredCash : INotifyCashTransfer

View File

@@ -15,7 +15,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Tag trait for actors with `DeliversExperience`.")]
public class AcceptsDeliveredExperienceInfo : ITraitInfo, Requires<GainsExperienceInfo>
public class AcceptsDeliveredExperienceInfo : TraitInfo, Requires<GainsExperienceInfo>
{
[Desc("Accepted `DeliversExperience` types. Leave empty to accept all types.")]
public readonly HashSet<string> ValidTypes = new HashSet<string>();
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Stance the delivering actor needs to enter.")]
public readonly Stance ValidStances = Stance.Ally;
public object Create(ActorInitializer init) { return new AcceptsDeliveredExperience(init.Self, this); }
public override object Create(ActorInitializer init) { return new AcceptsDeliveredExperience(init.Self, this); }
}
public class AcceptsDeliveredExperience

View File

@@ -16,7 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Causes aircraft husks that are spawned in the air to crash to the ground.")]
public class FallsToEarthInfo : ITraitInfo, IRulesetLoaded, Requires<AircraftInfo>
public class FallsToEarthInfo : TraitInfo, IRulesetLoaded, Requires<AircraftInfo>
{
[WeaponReference]
[Desc("Explosion weapon that triggers when hitting ground.")]
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits
public WeaponInfo ExplosionWeapon { get; private set; }
public object Create(ActorInitializer init) { return new FallsToEarth(init, this); }
public override object Create(ActorInitializer init) { return new FallsToEarth(init, this); }
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
{
if (string.IsNullOrEmpty(Explosion))

View File

@@ -16,7 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Actor has a limited amount of ammo, after using it all the actor must reload in some way.")]
public class AmmoPoolInfo : ITraitInfo
public class AmmoPoolInfo : TraitInfo
{
[Desc("Name of this ammo pool, used to link reload traits to this pool.")]
public readonly string Name = "primary";
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("The condition to grant to self for each ammo point in this pool.")]
public readonly string AmmoCondition = null;
public object Create(ActorInitializer init) { return new AmmoPool(init.Self, this); }
public override object Create(ActorInitializer init) { return new AmmoPool(init.Self, this); }
}
public class AmmoPool : INotifyCreated, INotifyAttack, ISync

View File

@@ -20,7 +20,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Provides access to the attack-move command, which will make the actor automatically engage viable targets while moving to the destination.")]
class AttackMoveInfo : ITraitInfo, Requires<IMoveInfo>
class AttackMoveInfo : TraitInfo, Requires<IMoveInfo>
{
[VoiceReference]
public readonly string Voice = "Action";
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Can the actor be ordered to move in to shroud?")]
public readonly bool MoveIntoShroud = true;
public object Create(ActorInitializer init) { return new AttackMove(init.Self, this); }
public override object Create(ActorInitializer init) { return new AttackMove(init.Self, this); }
}
class AttackMove : IResolveOrder, IOrderVoice

View File

@@ -15,7 +15,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
public class BodyOrientationInfo : ITraitInfo
public class BodyOrientationInfo : TraitInfo
{
[Desc("Number of facings for gameplay calculations. -1 indicates auto-detection from another trait.")]
public readonly int QuantizedFacings = -1;
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits
return Util.QuantizeFacing(facing, facings) * (256 / facings);
}
public virtual object Create(ActorInitializer init) { return new BodyOrientation(init, this); }
public override object Create(ActorInitializer init) { return new BodyOrientation(init, this); }
}
public class BodyOrientation : ISync

View File

@@ -243,7 +243,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
return relative.Clamp(0.0f, 999.0f);
}
static float SumOfValues<TTraitInfo>(IEnumerable<Actor> actors, Func<Actor, int> getValue) where TTraitInfo : ITraitInfo
static float SumOfValues<TTraitInfo>(IEnumerable<Actor> actors, Func<Actor, int> getValue) where TTraitInfo : ITraitInfoInterface
{
var sum = 0;
foreach (var a in actors)
@@ -253,7 +253,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
return sum;
}
static float Average<TTraitInfo>(IEnumerable<Actor> actors, Func<Actor, int> getValue) where TTraitInfo : ITraitInfo
static float Average<TTraitInfo>(IEnumerable<Actor> actors, Func<Actor, int> getValue) where TTraitInfo : ITraitInfoInterface
{
var sum = 0;
var countActors = 0;

View File

@@ -20,7 +20,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
class BridgeInfo : ITraitInfo, IRulesetLoaded, Requires<HealthInfo>, Requires<BuildingInfo>
class BridgeInfo : TraitInfo, IRulesetLoaded, Requires<HealthInfo>, Requires<BuildingInfo>
{
public readonly bool Long = false;
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Types of damage that this bridge causes to units over/in path of it while being destroyed/repaired. Leave empty for no damage types.")]
public readonly BitSet<DamageType> DamageTypes = default(BitSet<DamageType>);
public object Create(ActorInitializer init) { return new Bridge(init.Self, this); }
public override object Create(ActorInitializer init) { return new Bridge(init.Self, this); }
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
{

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Allows bridges to be targeted for demolition and repair.")]
class BridgeHutInfo : IDemolishableInfo, ITraitInfo
class BridgeHutInfo : TraitInfo, IDemolishableInfo
{
[Desc("Bridge types to act on")]
public readonly string[] Types = { "GroundLevelBridge" };
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits
public bool IsValidTarget(ActorInfo actorInfo, Actor saboteur) { return false; } // TODO: bridges don't support frozen under fog
public object Create(ActorInitializer init) { return new BridgeHut(init.World, this); }
public override object Create(ActorInitializer init) { return new BridgeHut(init.World, this); }
}
class BridgeHut : INotifyCreated, IDemolishable, ITick

View File

@@ -15,7 +15,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Placeholder actor used for dead segments and bridge end ramps.")]
class BridgePlaceholderInfo : ITraitInfo
class BridgePlaceholderInfo : TraitInfo
{
public readonly string Type = "GroundLevelBridge";
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly CVec[] NeighbourOffsets = { };
public object Create(ActorInitializer init) { return new BridgePlaceholder(init.Self, this); }
public override object Create(ActorInitializer init) { return new BridgePlaceholder(init.Self, this); }
}
class BridgePlaceholder : IBridgeSegment, INotifyAddedToWorld, INotifyRemovedFromWorld

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
OccupiedPassableTransitOnly = '+'
}
public class BuildingInfo : ITraitInfo, IOccupySpaceInfo, IPlaceBuildingDecorationInfo
public class BuildingInfo : TraitInfo, IOccupySpaceInfo, IPlaceBuildingDecorationInfo
{
[Desc("Where you are allowed to place the building (Water, Clear, ...)")]
public readonly HashSet<string> TerrainTypes = new HashSet<string>();
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string[] UndeploySounds = { };
public virtual object Create(ActorInitializer init) { return new Building(init, this); }
public override object Create(ActorInitializer init) { return new Building(init, this); }
protected static object LoadFootprint(MiniYaml yaml)
{

View File

@@ -15,9 +15,9 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("A dictionary of buildings placed on the map. Attach this to the world actor.")]
public class BuildingInfluenceInfo : ITraitInfo
public class BuildingInfluenceInfo : TraitInfo
{
public object Create(ActorInitializer init) { return new BuildingInfluence(init.World); }
public override object Create(ActorInitializer init) { return new BuildingInfluence(init.World); }
}
public class BuildingInfluence

View File

@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Bridge actor that can't be passed underneath.")]
class GroundLevelBridgeInfo : ITraitInfo, IRulesetLoaded, Requires<BuildingInfo>, Requires<IHealthInfo>
class GroundLevelBridgeInfo : TraitInfo, IRulesetLoaded, Requires<BuildingInfo>, Requires<IHealthInfo>
{
public readonly string TerrainType = "Bridge";
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits
DemolishWeaponInfo = weapon;
}
public object Create(ActorInitializer init) { return new GroundLevelBridge(init.Self, this); }
public override object Create(ActorInitializer init) { return new GroundLevelBridge(init.Self, this); }
}
class GroundLevelBridge : IBridgeSegment, INotifyAddedToWorld, INotifyRemovedFromWorld

View File

@@ -16,11 +16,11 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Allows bridges to be targeted for demolition and repair.")]
class LegacyBridgeHutInfo : IDemolishableInfo, ITraitInfo
class LegacyBridgeHutInfo : TraitInfo, IDemolishableInfo
{
public bool IsValidTarget(ActorInfo actorInfo, Actor saboteur) { return false; } // TODO: bridges don't support frozen under fog
public object Create(ActorInitializer init) { return new LegacyBridgeHut(init); }
public override object Create(ActorInitializer init) { return new LegacyBridgeHut(init); }
}
class LegacyBridgeHut : IDemolishable

View File

@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits
}
[Desc("Place the second actor in line to build more of the same at once (used for walls).")]
public class LineBuildInfo : ITraitInfo
public class LineBuildInfo : TraitInfo
{
[Desc("The maximum allowed length of the line.")]
public readonly int Range = 5;
@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Delete generated segments when destroyed or sold.")]
public readonly bool SegmentsRequireNode = false;
public object Create(ActorInitializer init) { return new LineBuild(init, this); }
public override object Create(ActorInitializer init) { return new LineBuild(init, this); }
}
public class LineBuild : INotifyKilled, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyLineBuildSegmentsChanged

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Used to waypoint units after production or repair is finished.")]
public class RallyPointInfo : ITraitInfo
public class RallyPointInfo : TraitInfo
{
public readonly string Image = "rallypoint";
@@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("The speech notification to play when setting a new rallypoint.")]
public readonly string Notification = null;
public object Create(ActorInitializer init) { return new RallyPoint(init.Self, this); }
public override object Create(ActorInitializer init) { return new RallyPoint(init.Self, this); }
}
public class RallyPoint : IIssueOrder, IResolveOrder, INotifyOwnerChanged, INotifyCreated

View File

@@ -21,7 +21,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
public class RefineryInfo : IAcceptResourcesInfo, Requires<WithSpriteBodyInfo>
public class RefineryInfo : TraitInfo, Requires<WithSpriteBodyInfo>, IAcceptResourcesInfo
{
[Desc("Actual harvester facing when docking, 0-255 counter-clock-wise.")]
public readonly int DockAngle = 0;
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int TickVelocity = 2;
public readonly int TickRate = 10;
public virtual object Create(ActorInitializer init) { return new Refinery(init.Self, this); }
public override object Create(ActorInitializer init) { return new Refinery(init.Self, this); }
}
public class Refinery : INotifyCreated, ITick, IAcceptResources, INotifySold, INotifyCapture,

View File

@@ -16,13 +16,13 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("This actor will play a fire animation over its body and take damage over time.")]
class BurnsInfo : ITraitInfo, Requires<RenderSpritesInfo>
class BurnsInfo : TraitInfo, Requires<RenderSpritesInfo>
{
public readonly string Anim = "1";
public readonly int Damage = 1;
public readonly int Interval = 8;
public object Create(ActorInitializer init) { return new Burns(init.Self, this); }
public override object Create(ActorInitializer init) { return new Burns(init.Self, this); }
}
class Burns : ITick, ISync

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
}
[Desc("Manages Captures and Capturable traits on an actor.")]
public class CaptureManagerInfo : ITraitInfo
public class CaptureManagerInfo : TraitInfo
{
[GrantedConditionReference]
[Desc("Condition granted when capturing an actor.")]
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Should units friendly to the capturing actor auto-target this actor while it is being captured?")]
public readonly bool PreventsAutoTarget = true;
public virtual object Create(ActorInitializer init) { return new CaptureManager(this); }
public override object Create(ActorInitializer init) { return new CaptureManager(this); }
public bool CanBeTargetedBy(FrozenActor frozenActor, Actor captor, Captures captures)
{

View File

@@ -21,7 +21,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("This actor can transport Passenger actors.")]
public class CargoInfo : ITraitInfo, Requires<IOccupySpaceInfo>
public class CargoInfo : TraitInfo, Requires<IOccupySpaceInfo>
{
[Desc("The maximum sum of Passenger.Weight that this actor can support.")]
public readonly int MaxWeight = 0;
@@ -82,7 +82,7 @@ namespace OpenRA.Mods.Common.Traits
[GrantedConditionReference]
public IEnumerable<string> LinterPassengerConditions { get { return PassengerConditions.Values; } }
public object Create(ActorInitializer init) { return new Cargo(init, this); }
public override object Create(ActorInitializer init) { return new Cargo(init, this); }
}
public class Cargo : IIssueOrder, IResolveOrder, IOrderVoice, INotifyCreated, INotifyKilled,

View File

@@ -15,9 +15,9 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
public class CarryableHarvesterInfo : ITraitInfo
public class CarryableHarvesterInfo : TraitInfo
{
public object Create(ActorInitializer init) { return new CarryableHarvester(); }
public override object Create(ActorInitializer init) { return new CarryableHarvester(); }
}
public class CarryableHarvester : INotifyCreated, INotifyHarvesterAction

View File

@@ -21,7 +21,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Transports actors with the `Carryable` trait.")]
public class CarryallInfo : ITraitInfo, Requires<BodyOrientationInfo>, Requires<AircraftInfo>
public class CarryallInfo : TraitInfo, Requires<BodyOrientationInfo>, Requires<AircraftInfo>
{
[Desc("Delay (in ticks) on the ground while attaching an actor to the carryall.")]
public readonly int BeforeLoadDelay = 0;
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string Voice = "Action";
public virtual object Create(ActorInitializer init) { return new Carryall(init.Self, this); }
public override object Create(ActorInitializer init) { return new Carryall(init.Self, this); }
}
public class Carryall : INotifyKilled, ISync, ITick, IRender, INotifyActorDisposing, IIssueOrder, IResolveOrder,

View File

@@ -14,12 +14,12 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Modifies the terrain type underneath the actors location.")]
class ChangesTerrainInfo : ITraitInfo, Requires<ImmobileInfo>
class ChangesTerrainInfo : TraitInfo, Requires<ImmobileInfo>
{
[FieldLoader.Require]
public readonly string TerrainType = null;
public object Create(ActorInitializer init) { return new ChangesTerrain(this); }
public override object Create(ActorInitializer init) { return new ChangesTerrain(this); }
}
class ChangesTerrain : INotifyAddedToWorld, INotifyRemovedFromWorld

View File

@@ -21,9 +21,9 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Displays fireports, muzzle offsets, and hit areas in developer mode.")]
public class CombatDebugOverlayInfo : ITraitInfo
public class CombatDebugOverlayInfo : TraitInfo
{
public object Create(ActorInitializer init) { return new CombatDebugOverlay(init.Self); }
public override object Create(ActorInitializer init) { return new CombatDebugOverlay(init.Self); }
}
public class CombatDebugOverlay : IRenderAnnotations, INotifyDamage, INotifyCreated

View File

@@ -16,14 +16,12 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
/// <summary>Use as base class for *Info to subclass of ConditionalTrait. (See ConditionalTrait.)</summary>
public abstract class ConditionalTraitInfo : IObservesVariablesInfo, IRulesetLoaded
public abstract class ConditionalTraitInfo : TraitInfo, IObservesVariablesInfo, IRulesetLoaded
{
[ConsumedConditionReference]
[Desc("Boolean expression defining the condition to enable this trait.")]
public readonly BooleanExpression RequiresCondition = null;
public abstract object Create(ActorInitializer init);
// HACK: A shim for all the ActorPreview code that used to query UpgradeMinEnabledLevel directly
// This can go away after we introduce an InitialConditions ActorInit and have the traits query the
// condition directly

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
}
[Desc("Allows a condition to be granted from an external source (Lua, warheads, etc).")]
public class ExternalConditionInfo : ITraitInfo
public class ExternalConditionInfo : TraitInfo
{
[GrantedConditionReference]
[FieldLoader.Require]
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("If > 0, restrict the number of times that this condition can be granted by any source.")]
public readonly int TotalCap = 0;
public object Create(ActorInitializer init) { return new ExternalCondition(init.Self, this); }
public override object Create(ActorInitializer init) { return new ExternalCondition(init.Self, this); }
}
public class ExternalCondition : ITick, INotifyCreated

View File

@@ -15,7 +15,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Grants a condition to this actor when it is owned by an AI bot.")]
public class GrantConditionOnBotOwnerInfo : ITraitInfo
public class GrantConditionOnBotOwnerInfo : TraitInfo
{
[FieldLoader.Require]
[GrantedConditionReference]
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Bot types that trigger the condition.")]
public readonly string[] Bots = { };
public object Create(ActorInitializer init) { return new GrantConditionOnBotOwner(init, this); }
public override object Create(ActorInitializer init) { return new GrantConditionOnBotOwner(init, this); }
}
public class GrantConditionOnBotOwner : INotifyCreated, INotifyOwnerChanged

View File

@@ -14,7 +14,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Applies a condition to the actor at specified damage states.")]
public class GrantConditionOnDamageStateInfo : ITraitInfo, Requires<IHealthInfo>
public class GrantConditionOnDamageStateInfo : TraitInfo, Requires<IHealthInfo>
{
[FieldLoader.Require]
[GrantedConditionReference]
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Is the condition irrevocable once it has been activated?")]
public readonly bool GrantPermanently = false;
public object Create(ActorInitializer init) { return new GrantConditionOnDamageState(init.Self, this); }
public override object Create(ActorInitializer init) { return new GrantConditionOnDamageState(init.Self, this); }
}
public class GrantConditionOnDamageState : INotifyDamageStateChanged, INotifyCreated

View File

@@ -14,7 +14,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Applies a condition to the actor at when its health is between 2 specific values.")]
public class GrantConditionOnHealthInfo : ITraitInfo, IRulesetLoaded, Requires<IHealthInfo>
public class GrantConditionOnHealthInfo : TraitInfo, IRulesetLoaded, Requires<IHealthInfo>
{
[FieldLoader.Require]
[GrantedConditionReference]
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Is the condition irrevokable once it has been granted?")]
public readonly bool GrantPermanently = false;
public object Create(ActorInitializer init) { return new GrantConditionOnHealth(init.Self, this); }
public override object Create(ActorInitializer init) { return new GrantConditionOnHealth(init.Self, this); }
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
{

View File

@@ -13,7 +13,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
public class GrantConditionOnLineBuildDirectionInfo : ITraitInfo, Requires<LineBuildInfo>
public class GrantConditionOnLineBuildDirectionInfo : TraitInfo, Requires<LineBuildInfo>
{
[FieldLoader.Require]
[GrantedConditionReference]
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Line build direction to trigger the condition.")]
public readonly LineBuildDirection Direction = LineBuildDirection.X;
public object Create(ActorInitializer init) { return new GrantConditionOnLineBuildDirection(init, this); }
public override object Create(ActorInitializer init) { return new GrantConditionOnLineBuildDirection(init, this); }
}
public class GrantConditionOnLineBuildDirection : INotifyCreated

View File

@@ -15,7 +15,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Grants a condition to this actor when the player has stored resources.")]
public class GrantConditionOnPlayerResourcesInfo : ITraitInfo
public class GrantConditionOnPlayerResourcesInfo : TraitInfo
{
[FieldLoader.Require]
[GrantedConditionReference]
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Enable condition when the amount of stored resources is greater than this.")]
public readonly int Threshold = 0;
public object Create(ActorInitializer init) { return new GrantConditionOnPlayerResources(this); }
public override object Create(ActorInitializer init) { return new GrantConditionOnPlayerResources(this); }
}
public class GrantConditionOnPlayerResources : INotifyCreated, INotifyOwnerChanged, ITick

View File

@@ -15,7 +15,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Grants a condition to the actor this is attached to when prerequisites are available.")]
public class GrantConditionOnPrerequisiteInfo : ITraitInfo
public class GrantConditionOnPrerequisiteInfo : TraitInfo
{
[FieldLoader.Require]
[GrantedConditionReference]
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("List of required prerequisites.")]
public readonly string[] Prerequisites = { };
public object Create(ActorInitializer init) { return new GrantConditionOnPrerequisite(init.Self, this); }
public override object Create(ActorInitializer init) { return new GrantConditionOnPrerequisite(init.Self, this); }
}
public class GrantConditionOnPrerequisite : INotifyCreated, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyOwnerChanged

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Grants a condition when this actor produces a specific actor.")]
public class GrantConditionOnProductionInfo : ITraitInfo
public class GrantConditionOnProductionInfo : TraitInfo
{
[FieldLoader.Require]
[GrantedConditionReference]
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly bool ShowSelectionBar = true;
public readonly Color SelectionBarColor = Color.Magenta;
public object Create(ActorInitializer init) { return new GrantConditionOnProduction(init.Self, this); }
public override object Create(ActorInitializer init) { return new GrantConditionOnProduction(init.Self, this); }
}
public class GrantConditionOnProduction : INotifyProduction, ITick, ISync, ISelectionBar

View File

@@ -14,7 +14,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
public class GrantConditionOnTerrainInfo : ITraitInfo
public class GrantConditionOnTerrainInfo : TraitInfo
{
[FieldLoader.Require]
[GrantedConditionReference]
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Terrain names to trigger the condition.")]
public readonly string[] TerrainTypes = { };
public object Create(ActorInitializer init) { return new GrantConditionOnTerrain(init, this); }
public override object Create(ActorInitializer init) { return new GrantConditionOnTerrain(init, this); }
}
public class GrantConditionOnTerrain : ITick

View File

@@ -13,14 +13,14 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
public class GrantConditionWhileAimingInfo : ITraitInfo
public class GrantConditionWhileAimingInfo : TraitInfo
{
[FieldLoader.Require]
[GrantedConditionReference]
[Desc("The condition to grant while aiming.")]
public readonly string Condition = null;
object ITraitInfo.Create(ActorInitializer init) { return new GrantConditionWhileAiming(this); }
public override object Create(ActorInitializer init) { return new GrantConditionWhileAiming(this); }
}
public class GrantConditionWhileAiming : INotifyAiming

View File

@@ -16,7 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Grant a condition to the crushing actor.")]
public class GrantExternalConditionToCrusherInfo : ITraitInfo
public class GrantExternalConditionToCrusherInfo : TraitInfo
{
[Desc("The condition to apply on a crush attempt. Must be included among the crusher actor's ExternalCondition traits.")]
public readonly string WarnCrushCondition = null;
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Duration of the condition applied on a successful crush (in ticks). Set to 0 for a permanent condition.")]
public readonly int OnCrushDuration = 0;
public virtual object Create(ActorInitializer init) { return new GrantExternalConditionToCrusher(init.Self, this); }
public override object Create(ActorInitializer init) { return new GrantExternalConditionToCrusher(init.Self, this); }
}
public class GrantExternalConditionToCrusher : INotifyCrushed

View File

@@ -15,14 +15,14 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits.Conditions
{
[Desc("Grants a random condition from a predefined list to the actor when created.")]
public class GrantRandomConditionInfo : ITraitInfo
public class GrantRandomConditionInfo : TraitInfo
{
[FieldLoader.Require]
[GrantedConditionReference]
[Desc("List of conditions to grant from.")]
public readonly string[] Conditions = null;
public object Create(ActorInitializer init) { return new GrantRandomCondition(init.Self, this); }
public override object Create(ActorInitializer init) { return new GrantRandomCondition(init.Self, this); }
}
public class GrantRandomCondition : INotifyCreated

View File

@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Draw a colored contrail behind this actor when they move.")]
class ContrailInfo : ITraitInfo, Requires<BodyOrientationInfo>
class ContrailInfo : TraitInfo, Requires<BodyOrientationInfo>
{
[Desc("Position relative to body")]
public readonly WVec Offset = WVec.Zero;
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Use player remap color instead of a custom color?")]
public readonly bool UsePlayerColor = true;
public object Create(ActorInitializer init) { return new Contrail(init.Self, this); }
public override object Create(ActorInitializer init) { return new Contrail(init.Self, this); }
}
class Contrail : ITick, IRender, INotifyAddedToWorld

View File

@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
public class CrateInfo : ITraitInfo, IPositionableInfo, Requires<RenderSpritesInfo>
public class CrateInfo : TraitInfo, IPositionableInfo, Requires<RenderSpritesInfo>
{
[Desc("Length of time (in seconds) until the crate gets removed automatically. " +
"A value of zero disables auto-removal.")]
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Define actors that can collect crates by setting this into the Crushes field from the Mobile trait.")]
public readonly string CrushClass = "crate";
public object Create(ActorInitializer init) { return new Crate(init, this); }
public override object Create(ActorInitializer init) { return new Crate(init, this); }
public IReadOnlyDictionary<CPos, SubCell> OccupiedCells(ActorInfo info, CPos location, SubCell subCell = SubCell.Any)
{

View File

@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Donate money to actors with the `AcceptsDeliveredCash` trait.")]
class DeliversCashInfo : ITraitInfo
class DeliversCashInfo : TraitInfo
{
[Desc("The amount of cash the owner receives.")]
public readonly int Payload = 500;
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string Voice = "Action";
public object Create(ActorInitializer init) { return new DeliversCash(this); }
public override object Create(ActorInitializer init) { return new DeliversCash(this); }
}
class DeliversCash : IIssueOrder, IResolveOrder, IOrderVoice, INotifyCashTransfer

View File

@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("This actor can grant experience levels equal to it's own current level via entering to other actors with the `AcceptsDeliveredExperience` trait.")]
class DeliversExperienceInfo : ITraitInfo, Requires<GainsExperienceInfo>
class DeliversExperienceInfo : TraitInfo, Requires<GainsExperienceInfo>
{
[Desc("The amount of experience the donating player receives.")]
public readonly int PlayerExperience = 0;
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string Voice = "Action";
public object Create(ActorInitializer init) { return new DeliversExperience(init, this); }
public override object Create(ActorInitializer init) { return new DeliversExperience(init, this); }
}
class DeliversExperience : IIssueOrder, IResolveOrder, IOrderVoice

View File

@@ -16,7 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Handle demolitions from C4 explosives.")]
public class DemolishableInfo : ConditionalTraitInfo, IDemolishableInfo, ITraitInfo
public class DemolishableInfo : ConditionalTraitInfo, IDemolishableInfo
{
public bool IsValidTarget(ActorInfo actorInfo, Actor saboteur) { return true; }

View File

@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
class DemolitionInfo : ITraitInfo
class DemolitionInfo : TraitInfo
{
[Desc("Delay to demolish the target once the explosive device is planted. " +
"Measured in game ticks. Default is 1.8 seconds.")]
@@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string Cursor = "c4";
public object Create(ActorInitializer init) { return new Demolition(this); }
public override object Create(ActorInitializer init) { return new Demolition(this); }
}
class Demolition : IIssueOrder, IResolveOrder, IOrderVoice

View File

@@ -20,7 +20,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("This actor can interact with TunnelEntrances to move through TerrainTunnels.")]
public class EntersTunnelsInfo : ITraitInfo, Requires<IMoveInfo>, IObservesVariablesInfo
public class EntersTunnelsInfo : TraitInfo, Requires<IMoveInfo>, IObservesVariablesInfo
{
public readonly string EnterCursor = "enter";
public readonly string EnterBlockedCursor = "enter-blocked";
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Boolean expression defining the condition under which the regular (non-force) enter cursor is disabled.")]
public readonly BooleanExpression RequireForceMoveCondition = null;
public object Create(ActorInitializer init) { return new EntersTunnels(init.Self, this); }
public override object Create(ActorInitializer init) { return new EntersTunnels(init.Self, this); }
}
public class EntersTunnels : IIssueOrder, IResolveOrder, IOrderVoice, IObservesVariables

View File

@@ -19,7 +19,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Displays `Exit` data for factories.")]
public class ExitsDebugOverlayInfo : ITraitInfo, Requires<ExitInfo>
public class ExitsDebugOverlayInfo : TraitInfo, Requires<ExitInfo>
{
[Desc("Should cell vectors be drawn for each perimeter cell?")]
public readonly bool DrawPerimiterCellVectors = true;
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Should lines be drawn for each exit (from spawn offset to the center of the exit cell)?")]
public readonly bool DrawSpawnOffsetLines = true;
object ITraitInfo.Create(ActorInitializer init) { return new ExitsDebugOverlay(init.Self, this); }
public override object Create(ActorInitializer init) { return new ExitsDebugOverlay(init.Self, this); }
}
public class ExitsDebugOverlay : IRenderAnnotationsWhenSelected

View File

@@ -16,7 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("This actor triggers an explosion on itself when transitioning to a specific damage state.")]
public class ExplosionOnDamageTransitionInfo : ITraitInfo, IRulesetLoaded, Requires<IHealthInfo>
public class ExplosionOnDamageTransitionInfo : TraitInfo, IRulesetLoaded, Requires<IHealthInfo>
{
[WeaponReference]
[FieldLoader.Require]
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
public WeaponInfo WeaponInfo { get; private set; }
public object Create(ActorInitializer init) { return new ExplosionOnDamageTransition(this, init.Self); }
public override object Create(ActorInitializer init) { return new ExplosionOnDamageTransition(this, init.Self); }
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
{

View File

@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("This actor's experience increases when it has killed a GivesExperience actor.")]
public class GainsExperienceInfo : ITraitInfo
public class GainsExperienceInfo : TraitInfo
{
[FieldLoader.Require]
[Desc("Condition to grant at each level.",
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
[NotificationReference("Sounds")]
public readonly string LevelUpNotification = null;
public object Create(ActorInitializer init) { return new GainsExperience(init, this); }
public override object Create(ActorInitializer init) { return new GainsExperience(init, this); }
}
public class GainsExperience : INotifyCreated, ISync, IResolveOrder, ITransformActorInitModifier

View File

@@ -15,7 +15,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("This actor gives experience to a GainsExperience actor when they are killed.")]
class GivesExperienceInfo : ITraitInfo
class GivesExperienceInfo : TraitInfo
{
[Desc("If -1, use the value of the unit cost.")]
public readonly int Experience = -1;
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Percentage of the `Experience` value that is being granted to the player owning the killing actor.")]
public readonly int PlayerExperienceModifier = 0;
public object Create(ActorInitializer init) { return new GivesExperience(init.Self, this); }
public override object Create(ActorInitializer init) { return new GivesExperience(init.Self, this); }
}
class GivesExperience : INotifyKilled

Some files were not shown because too many files have changed in this diff Show More