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

@@ -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

View File

@@ -16,12 +16,12 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("The player can give this unit the order to follow and protect friendly units with the Guardable trait.")]
public class GuardInfo : ITraitInfo, Requires<IMoveInfo>
public class GuardInfo : TraitInfo, Requires<IMoveInfo>
{
[VoiceReference]
public readonly string Voice = "Action";
public object Create(ActorInitializer init) { return new Guard(this); }
public override object Create(ActorInitializer init) { return new Guard(this); }
}
public class Guard : IResolveOrder, IOrderVoice, INotifyCreated

View File

@@ -21,7 +21,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
public class HarvesterInfo : ITraitInfo, Requires<MobileInfo>
public class HarvesterInfo : TraitInfo, Requires<MobileInfo>
{
public readonly HashSet<string> DeliveryBuildings = new HashSet<string>();
@@ -84,7 +84,7 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string DeliverVoice = "Action";
public object Create(ActorInitializer init) { return new Harvester(init.Self, this); }
public override object Create(ActorInitializer init) { return new Harvester(init.Self, this); }
}
public class Harvester : IIssueOrder, IResolveOrder, IOrderVoice,

View File

@@ -16,7 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
public class HealthInfo : IHealthInfo, IRulesetLoaded, IEditorActorOptions
public class HealthInfo : TraitInfo, IHealthInfo, IRulesetLoaded, IEditorActorOptions
{
[Desc("HitPoints")]
public readonly int HP = 0;
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Display order for the health slider in the map editor")]
public readonly int EditorHealthDisplayOrder = 2;
public virtual object Create(ActorInitializer init) { return new Health(init, this); }
public override object Create(ActorInitializer init) { return new Health(init, this); }
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
{

View File

@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Spawns remains of a husk actor with the correct facing.")]
public class HuskInfo : ITraitInfo, IPositionableInfo, IFacingInfo, IActorPreviewInitInfo
public class HuskInfo : TraitInfo, IPositionableInfo, IFacingInfo, IActorPreviewInitInfo
{
public readonly HashSet<string> AllowedTerrain = new HashSet<string>();
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
yield return new FacingInit(PreviewFacing);
}
public object Create(ActorInitializer init) { return new Husk(init, this); }
public override object Create(ActorInitializer init) { return new Husk(init, this); }
public int GetInitialFacing() { return 128; }

View File

@@ -15,10 +15,10 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
class ImmobileInfo : ITraitInfo, IOccupySpaceInfo
class ImmobileInfo : TraitInfo, IOccupySpaceInfo
{
public readonly bool OccupiesSpace = true;
public object Create(ActorInitializer init) { return new Immobile(init, this); }
public override object Create(ActorInitializer init) { return new Immobile(init, this); }
public IReadOnlyDictionary<CPos, SubCell> OccupiedCells(ActorInfo info, CPos location, SubCell subCell = SubCell.Any)
{

View File

@@ -14,7 +14,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Makes the unit automatically run around when taking damage.")]
class ScaredyCatInfo : ITraitInfo, Requires<MobileInfo>
class ScaredyCatInfo : TraitInfo, Requires<MobileInfo>
{
[Desc("Chance (out of 100) the unit has to enter panic mode when attacked.")]
public readonly int PanicChance = 100;
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
[SequenceReference(null, true)]
public readonly string PanicSequencePrefix = "panic-";
public object Create(ActorInitializer init) { return new ScaredyCat(init.Self, this); }
public override object Create(ActorInitializer init) { return new ScaredyCat(init.Self, this); }
}
class ScaredyCat : ITick, INotifyIdle, INotifyDamage, INotifyAttack, ISpeedModifier, ISync, IRenderInfantrySequenceModifier

View File

@@ -14,7 +14,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
public class TerrainModifiesDamageInfo : ITraitInfo
public class TerrainModifiesDamageInfo : TraitInfo
{
[FieldLoader.Require]
[Desc("Damage percentage for specific terrain types. 120 = 120%, 80 = 80%, etc.")]
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Modify healing damage? For example: A friendly medic.")]
public readonly bool ModifyHealing = false;
public object Create(ActorInitializer init) { return new TerrainModifiesDamage(init.Self, this); }
public override object Create(ActorInitializer init) { return new TerrainModifiesDamage(init.Self, this); }
}
public class TerrainModifiesDamage : IDamageModifier

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Used to enable mouse interaction on actors that are not Selectable.")]
public class InteractableInfo : ITraitInfo, IMouseBoundsInfo
public class InteractableInfo : TraitInfo, IMouseBoundsInfo
{
[Desc("Defines a custom rectangle for mouse interaction with the actor.",
"If null, the engine will guess an appropriate size based on the With*Body trait.",
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
"If null, Bounds will be used instead")]
public readonly int[] DecorationBounds = null;
public virtual object Create(ActorInitializer init) { return new Interactable(this); }
public override object Create(ActorInitializer init) { return new Interactable(this); }
}
public class Interactable : INotifyCreated, IMouseBounds

View File

@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("This actor is selectable. Defines bounds of selectable area, selection class, selection priority and selection priority modifiers.")]
public class IsometricSelectableInfo : ITraitInfo, IMouseBoundsInfo, ISelectableInfo, IRulesetLoaded, Requires<BuildingInfo>
public class IsometricSelectableInfo : TraitInfo, IMouseBoundsInfo, ISelectableInfo, IRulesetLoaded, Requires<BuildingInfo>
{
[Desc("Defines a custom rectangle for mouse interaction with the actor.",
"If null, the engine will guess an appropriate size based on the building's footprint.",
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits
[VoiceReference]
public readonly string Voice = "Select";
public object Create(ActorInitializer init) { return new IsometricSelectable(init.Self, this); }
public override object Create(ActorInitializer init) { return new IsometricSelectable(init.Self, this); }
int ISelectableInfo.Priority { get { return Priority; } }
SelectionPriorityModifiers ISelectableInfo.PriorityModifiers { get { return PriorityModifiers; } }

View File

@@ -19,12 +19,12 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("This actor will remain visible (but not updated visually) under fog, once discovered.")]
public class FrozenUnderFogInfo : ITraitInfo, Requires<BuildingInfo>, IDefaultVisibilityInfo
public class FrozenUnderFogInfo : TraitInfo, Requires<BuildingInfo>, IDefaultVisibilityInfo
{
[Desc("Players with these stances can always see the actor.")]
public readonly Stance AlwaysVisibleStances = Stance.Ally;
public object Create(ActorInitializer init) { return new FrozenUnderFog(init, this); }
public override object Create(ActorInitializer init) { return new FrozenUnderFog(init, this); }
}
public class FrozenUnderFog : ICreatesFrozenActors, IRenderModifier, IDefaultVisibility, ITick, ITickRender, ISync, INotifyCreated, INotifyOwnerChanged, INotifyActorDisposing

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("The actor stays invisible under the shroud.")]
public class HiddenUnderShroudInfo : ITraitInfo, IDefaultVisibilityInfo
public class HiddenUnderShroudInfo : TraitInfo, IDefaultVisibilityInfo
{
[Desc("Players with these stances can always see the actor.")]
public readonly Stance AlwaysVisibleStances = Stance.Ally;
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
"Footprint (reveal when any footprint cell is visible).")]
public readonly VisibilityType Type = VisibilityType.Footprint;
public virtual object Create(ActorInitializer init) { return new HiddenUnderShroud(this); }
public override object Create(ActorInitializer init) { return new HiddenUnderShroud(this); }
}
public class HiddenUnderShroud : IDefaultVisibility, IRenderModifier

View File

@@ -14,12 +14,12 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Actors with this trait must be destroyed for a game to end.")]
public class MustBeDestroyedInfo : ITraitInfo
public class MustBeDestroyedInfo : TraitInfo
{
[Desc("In a short game only actors that have this value set to true need to be destroyed.")]
public bool RequiredForShortGame = false;
public object Create(ActorInitializer init) { return new MustBeDestroyed(this); }
public override object Create(ActorInitializer init) { return new MustBeDestroyed(this); }
}
public class MustBeDestroyed

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
using GUtil = OpenRA.Graphics.Util;
[Desc("Used for bursted one-colored whole screen effects. Add this to the world actor.")]
public class FlashPaletteEffectInfo : ITraitInfo
public class FlashPaletteEffectInfo : TraitInfo
{
public readonly HashSet<string> ExcludePalettes = new HashSet<string> { "cursor", "chrome", "colorpicker", "fog", "shroud" };
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Set this when using multiple independent flash effects.")]
public readonly string Type = null;
public object Create(ActorInitializer init) { return new FlashPaletteEffect(this); }
public override object Create(ActorInitializer init) { return new FlashPaletteEffect(this); }
}
public class FlashPaletteEffect : IPaletteModifier, ITick

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Used for day/night effects.")]
public class GlobalLightingPaletteEffectInfo : ITraitInfo, ILobbyCustomRulesIgnore
public class GlobalLightingPaletteEffectInfo : TraitInfo, ILobbyCustomRulesIgnore
{
[Desc("Do not modify graphics that use any palette in this list.")]
public readonly HashSet<string> ExcludePalettes = new HashSet<string> { "cursor", "chrome", "colorpicker", "fog", "shroud", "alpha" };
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly float Blue = 1f;
public readonly float Ambient = 1f;
public object Create(ActorInitializer init) { return new GlobalLightingPaletteEffect(this); }
public override object Create(ActorInitializer init) { return new GlobalLightingPaletteEffect(this); }
}
public class GlobalLightingPaletteEffect : IPaletteModifier

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Fades the world from/to black at the start/end of the game, and can (optionally) desaturate the world")]
public class MenuPaletteEffectInfo : ITraitInfo
public class MenuPaletteEffectInfo : TraitInfo
{
[Desc("Time (in ticks) to fade between states")]
public readonly int FadeLength = 10;
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Effect style to fade to when opening the in-game menu. Accepts values of None, Black or Desaturated.")]
public readonly MenuPaletteEffect.EffectType MenuEffect = MenuPaletteEffect.EffectType.None;
public object Create(ActorInitializer init) { return new MenuPaletteEffect(this); }
public override object Create(ActorInitializer init) { return new MenuPaletteEffect(this); }
}
public class MenuPaletteEffect : IPaletteModifier, IRender, IWorldLoaded, INotifyGameLoaded

View File

@@ -16,7 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Palette effect used for sprinkle \"animations\".")]
class RotationPaletteEffectInfo : ITraitInfo
class RotationPaletteEffectInfo : TraitInfo
{
[Desc("Defines to which palettes this effect should be applied to.",
"If none specified, it applies to all palettes not explicitly excluded.")]
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Step towards next color index per tick.")]
public readonly float RotationStep = .25f;
public object Create(ActorInitializer init) { return new RotationPaletteEffect(init.World, this); }
public override object Create(ActorInitializer init) { return new RotationPaletteEffect(init.World, this); }
}
class RotationPaletteEffect : ITick, IPaletteModifier

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("This unit can spawn and eject other actors while flying.")]
public class ParaDropInfo : ITraitInfo, Requires<CargoInfo>
public class ParaDropInfo : TraitInfo, Requires<CargoInfo>
{
[Desc("Distance around the drop-point to unload troops.")]
public readonly WDist DropRange = WDist.FromCells(4);
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Sound to play when dropping.")]
public readonly string ChuteSound = null;
public object Create(ActorInitializer init) { return new ParaDrop(init.Self, this); }
public override object Create(ActorInitializer init) { return new ParaDrop(init.Self, this); }
}
public class ParaDrop : ITick, ISync, INotifyRemovedFromWorld

View File

@@ -18,7 +18,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Can be paradropped by a ParaDrop actor.")]
public class ParachutableInfo : ITraitInfo, Requires<IPositionableInfo>
public class ParachutableInfo : TraitInfo, Requires<IPositionableInfo>
{
[Desc("If we land on invalid terrain for my actor type should we be killed?")]
public readonly bool KilledOnImpassableTerrain = true;
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("The condition to grant to self while parachuting.")]
public readonly string ParachutingCondition = null;
public object Create(ActorInitializer init) { return new Parachutable(init.Self, this); }
public override object Create(ActorInitializer init) { return new Parachutable(init.Self, this); }
}
public class Parachutable : INotifyParachute

View File

@@ -20,7 +20,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("This actor can enter Cargo actors.")]
public class PassengerInfo : ITraitInfo, IObservesVariablesInfo
public class PassengerInfo : TraitInfo, IObservesVariablesInfo
{
public readonly string CargoType = null;
@@ -47,7 +47,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 Passenger(this); }
public override object Create(ActorInitializer init) { return new Passenger(this); }
}
public class Passenger : IIssueOrder, IResolveOrder, IOrderVoice, INotifyRemovedFromWorld, INotifyEnteredCargo, INotifyExitedCargo, INotifyKilled, IObservesVariables

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Traits
{
[Desc("Plays an audio notification and shows a radar ping when a building is attacked.",
"Attach this to the player actor.")]
public class BaseAttackNotifierInfo : ITraitInfo
public class BaseAttackNotifierInfo : TraitInfo
{
[Desc("Minimum duration (in seconds) between notification events.")]
public readonly int NotifyInterval = 30;
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits
"Won't play a notification to allies if this is null.")]
public string AllyNotification = null;
public object Create(ActorInitializer init) { return new BaseAttackNotifier(init.Self, this); }
public override object Create(ActorInitializer init) { return new BaseAttackNotifier(init.Self, this); }
}
public class BaseAttackNotifier : INotifyDamage

View File

@@ -16,7 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
public class ConquestVictoryConditionsInfo : ITraitInfo, Requires<MissionObjectivesInfo>
public class ConquestVictoryConditionsInfo : TraitInfo, Requires<MissionObjectivesInfo>
{
[Desc("Delay for the end game notification in milliseconds.")]
public readonly int NotificationDelay = 1500;
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Disable the win/loss messages and audio notifications?")]
public readonly bool SuppressNotifications = false;
public object Create(ActorInitializer init) { return new ConquestVictoryConditions(init.Self, this); }
public override object Create(ActorInitializer init) { return new ConquestVictoryConditions(init.Self, this); }
}
public class ConquestVictoryConditions : ITick, INotifyWinStateChanged, INotifyTimeLimit

View File

@@ -17,7 +17,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Attach this to the player actor.")]
public class DeveloperModeInfo : ITraitInfo, ILobbyOptions
public class DeveloperModeInfo : TraitInfo, ILobbyOptions
{
[Translate]
[Desc("Descriptive label for the developer mode checkbox in the lobby.")]
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Traits
yield return new LobbyBooleanOption("cheats", CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked);
}
public object Create(ActorInitializer init) { return new DeveloperMode(this); }
public override object Create(ActorInitializer init) { return new DeveloperMode(this); }
}
public class DeveloperMode : IResolveOrder, ISync, INotifyCreated, IUnlocksRenderPlayer

View File

@@ -14,7 +14,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("A placeholder bot that doesn't do anything.")]
public sealed class DummyBotInfo : ITraitInfo, IBotInfo
public sealed class DummyBotInfo : TraitInfo, IBotInfo
{
[Desc("Human-readable name this bot uses.")]
public readonly string Name = "Unnamed Bot";
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
string IBotInfo.Name { get { return Name; } }
public object Create(ActorInitializer init) { return new DummyBot(this); }
public override object Create(ActorInitializer init) { return new DummyBot(this); }
}
public sealed class DummyBot : IBot

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits
{
[Desc("Tracks neutral and enemy actors' visibility and notifies the player.",
"Attach this to the player actor. The actors to track need the 'AnnounceOnSeen' trait.")]
class EnemyWatcherInfo : ITraitInfo
class EnemyWatcherInfo : TraitInfo
{
[Desc("Interval in ticks between scanning for enemies.")]
public readonly int ScanInterval = 25;
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Minimal ticks in-between notifications.")]
public readonly int NotificationInterval = 750;
public object Create(ActorInitializer init) { return new EnemyWatcher(this); }
public override object Create(ActorInitializer init) { return new EnemyWatcher(this); }
}
class EnemyWatcher : ITick

View File

@@ -17,9 +17,9 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Attach this to the player actor.")]
public class GrantConditionOnPrerequisiteManagerInfo : ITraitInfo, Requires<TechTreeInfo>
public class GrantConditionOnPrerequisiteManagerInfo : TraitInfo, Requires<TechTreeInfo>
{
public object Create(ActorInitializer init) { return new GrantConditionOnPrerequisiteManager(init); }
public override object Create(ActorInitializer init) { return new GrantConditionOnPrerequisiteManager(init); }
}
public class GrantConditionOnPrerequisiteManager : ITechTreeElement

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Traits
{
[Desc("Plays an audio notification and shows a radar ping when a harvester is attacked.",
"Attach this to the player actor.")]
public class HarvesterAttackNotifierInfo : ITraitInfo
public class HarvesterAttackNotifierInfo : TraitInfo
{
[Desc("Minimum duration (in seconds) between notification events.")]
public readonly int NotifyInterval = 30;
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("The audio notification type to play.")]
public string Notification = "HarvesterAttack";
public object Create(ActorInitializer init) { return new HarvesterAttackNotifier(init.Self, this); }
public override object Create(ActorInitializer init) { return new HarvesterAttackNotifier(init.Self, this); }
}
public class HarvesterAttackNotifier : INotifyDamage

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits
}
}
public class MissionObjectivesInfo : ITraitInfo
public class MissionObjectivesInfo : TraitInfo
{
[Desc("Set this to true if multiple cooperative players have a distinct set of " +
"objectives that each of them has to complete to win the game. This is mainly " +
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Traits
[NotificationReference("Speech")]
public readonly string LeaveNotification = null;
public object Create(ActorInitializer init) { return new MissionObjectives(init.World, this); }
public override object Create(ActorInitializer init) { return new MissionObjectives(init.World, this); }
}
public class MissionObjectives : INotifyWinStateChanged, ISync, IResolveOrder
@@ -259,14 +259,14 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Provides game mode progress information for players.",
"Goes on WorldActor - observers don't have a player it can live on.",
"Current options for PanelName are 'SKIRMISH_STATS' and 'MISSION_OBJECTIVES'.")]
public class ObjectivesPanelInfo : ITraitInfo
public class ObjectivesPanelInfo : TraitInfo
{
public string PanelName = null;
[Desc("in ms")]
public int ExitDelay = 1400;
public object Create(ActorInitializer init) { return new ObjectivesPanel(this); }
public override object Create(ActorInitializer init) { return new ObjectivesPanel(this); }
}
public class ObjectivesPanel : IObjectivesPanel

View File

@@ -19,7 +19,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Bot that uses BotModules.")]
public sealed class ModularBotInfo : IBotInfo, ITraitInfo
public sealed class ModularBotInfo : TraitInfo, IBotInfo
{
[FieldLoader.Require]
[Desc("Internal id for this bot.")]
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits
string IBotInfo.Name { get { return Name; } }
public object Create(ActorInitializer init) { return new ModularBot(this, init); }
public override object Create(ActorInitializer init) { return new ModularBot(this, init); }
}
public sealed class ModularBot : ITick, IBot, INotifyDamage

View File

@@ -15,7 +15,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("A beacon that is constructed from a circle sprite that is animated once and a moving arrow sprite.")]
public class PlaceBeaconInfo : ITraitInfo
public class PlaceBeaconInfo : TraitInfo
{
public readonly int Duration = 30 * 25;
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits
[SequenceReference("BeaconImage")]
public readonly string CircleSequence = "circles";
public object Create(ActorInitializer init) { return new PlaceBeacon(init.Self, this); }
public override object Create(ActorInitializer init) { return new PlaceBeacon(init.Self, this); }
}
public class PlaceBeacon : IResolveOrder

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
public class PlaceBuildingInit : IActorInit { }
[Desc("Allows the player to execute build orders.", " Attach this to the player actor.")]
public class PlaceBuildingInfo : ITraitInfo
public class PlaceBuildingInfo : TraitInfo
{
[Desc("Play NewOptionsNotification this many ticks after building placement.")]
public readonly int NewOptionsNotificationDelay = 10;
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Hotkey to toggle between PlaceBuildingVariants when placing a structure.")]
public HotkeyReference ToggleVariantKey = new HotkeyReference();
public object Create(ActorInitializer init) { return new PlaceBuilding(this); }
public override object Create(ActorInitializer init) { return new PlaceBuilding(this); }
}
public class PlaceBuilding : IResolveOrder, ITick

View File

@@ -16,9 +16,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("This trait can be used to track player experience based on units killed with the `GivesExperience` trait.",
"It can also be used as a point score system in scripted maps, for example.",
"Attach this to the player actor.")]
public class PlayerExperienceInfo : ITraitInfo
public class PlayerExperienceInfo : TraitInfo
{
public object Create(ActorInitializer init) { return new PlayerExperience(); }
public override object Create(ActorInitializer init) { return new PlayerExperience(); }
}
public class PlayerExperience : ISync

View File

@@ -17,9 +17,9 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
public class PlayerRadarTerrainInfo : ITraitInfo, Requires<ShroudInfo>
public class PlayerRadarTerrainInfo : TraitInfo, Requires<ShroudInfo>
{
public object Create(ActorInitializer init)
public override object Create(ActorInitializer init)
{
return new PlayerRadarTerrain(init.Self);
}

View File

@@ -16,7 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
public class PlayerResourcesInfo : ITraitInfo, ILobbyOptions
public class PlayerResourcesInfo : TraitInfo, ILobbyOptions
{
[Translate]
[Desc("Descriptive label for the starting cash option in the lobby.")]
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits
new ReadOnlyDictionary<string, string>(startingCash), DefaultCash.ToString(), DefaultCashDropdownLocked);
}
public object Create(ActorInitializer init) { return new PlayerResources(init.Self, this); }
public override object Create(ActorInitializer init) { return new PlayerResources(init.Self, this); }
}
public class PlayerResources : ISync

View File

@@ -20,9 +20,9 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Attach this to the player actor to collect observer stats.")]
public class PlayerStatisticsInfo : ITraitInfo
public class PlayerStatisticsInfo : TraitInfo
{
public object Create(ActorInitializer init) { return new PlayerStatistics(init.Self); }
public override object Create(ActorInitializer init) { return new PlayerStatistics(init.Self); }
}
public class PlayerStatistics : ITick, IResolveOrder, INotifyCreated, IWorldLoaded
@@ -200,7 +200,7 @@ namespace OpenRA.Mods.Common.Traits
}
[Desc("Attach this to a unit to update observer stats.")]
public class UpdatesPlayerStatisticsInfo : ITraitInfo
public class UpdatesPlayerStatisticsInfo : TraitInfo
{
[Desc("Add to army value in statistics")]
public bool AddToArmyValue = false;
@@ -209,7 +209,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Count this actor as a different type in the spectator army display.")]
public string OverrideActor = null;
public object Create(ActorInitializer init) { return new UpdatesPlayerStatistics(this, init.Self); }
public override object Create(ActorInitializer init) { return new UpdatesPlayerStatistics(this, init.Self); }
}
public class UpdatesPlayerStatistics : INotifyKilled, INotifyCreated, INotifyOwnerChanged, INotifyActorDisposing

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Attach this to an actor (usually a building) to let it produce units or construct buildings.",
"If one builds another actor of this type, he will get a separate queue to create two actors",
"at the same time. Will only work together with the Production: trait.")]
public class ProductionQueueInfo : ITraitInfo
public class ProductionQueueInfo : TraitInfo
{
[FieldLoader.Require]
[Desc("What kind of production will be added (e.g. Building, Infantry, Vehicle, ...)")]
@@ -88,7 +88,7 @@ namespace OpenRA.Mods.Common.Traits
"The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string CancelledAudio = null;
public virtual object Create(ActorInitializer init) { return new ProductionQueue(init, init.Self.Owner.PlayerActor, this); }
public override object Create(ActorInitializer init) { return new ProductionQueue(init, init.Self.Owner.PlayerActor, this); }
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
{

View File

@@ -10,10 +10,11 @@
#endregion
using System.Collections.Generic;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
public class ProvidesTechPrerequisiteInfo : ITechTreePrerequisiteInfo
public class ProvidesTechPrerequisiteInfo : TraitInfo, ITechTreePrerequisiteInfo
{
[Desc("Internal id for this tech level.")]
public readonly string Id;
@@ -27,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
IEnumerable<string> ITechTreePrerequisiteInfo.Prerequisites(ActorInfo info) { return Prerequisites; }
public object Create(ActorInitializer init) { return new ProvidesTechPrerequisite(this, init); }
public override object Create(ActorInitializer init) { return new ProvidesTechPrerequisite(this, init); }
}
public class ProvidesTechPrerequisite : ITechTreePrerequisite

View File

@@ -14,7 +14,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Provides the player with an audible warning when their storage is nearing full.")]
public class ResourceStorageWarningInfo : ITraitInfo, Requires<PlayerResourcesInfo>
public class ResourceStorageWarningInfo : TraitInfo, Requires<PlayerResourcesInfo>
{
[Desc("Interval, in seconds, at which to check if more storage is needed.")]
public readonly int AdviceInterval = 20;
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("The speech to play for the warning.")]
public readonly string Notification = "SilosNeeded";
public object Create(ActorInitializer init) { return new ResourceStorageWarning(init.Self, this); }
public override object Create(ActorInitializer init) { return new ResourceStorageWarning(init.Self, this); }
}
public class ResourceStorageWarning : ITick

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits
public class StrategicPoint { }
[Desc("Allows King of the Hill (KotH) style gameplay.")]
public class StrategicVictoryConditionsInfo : ITraitInfo, Requires<MissionObjectivesInfo>
public class StrategicVictoryConditionsInfo : TraitInfo, Requires<MissionObjectivesInfo>
{
[Desc("Amount of time (in game ticks) that the player has to hold all the strategic points.", "Defaults to 7500 ticks (5 minutes at default speed).")]
public readonly int HoldDuration = 7500;
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Disable the win/loss messages and audio notifications?")]
public readonly bool SuppressNotifications = false;
public object Create(ActorInitializer init) { return new StrategicVictoryConditions(init.Self, this); }
public override object Create(ActorInitializer init) { return new StrategicVictoryConditions(init.Self, this); }
}
public class StrategicVictoryConditions : ITick, ISync, INotifyWinStateChanged, INotifyTimeLimit

View File

@@ -18,9 +18,9 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Manages build limits and pre-requisites.", " Attach this to the player actor.")]
public class TechTreeInfo : ITraitInfo
public class TechTreeInfo : TraitInfo
{
public object Create(ActorInitializer init) { return new TechTree(init); }
public override object Create(ActorInitializer init) { return new TechTree(init); }
}
public class TechTree

View File

@@ -20,7 +20,7 @@ using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Traits
{
[Desc("This trait allows setting a time limit on matches. Attach this to the World actor.")]
public class TimeLimitManagerInfo : ITraitInfo, ILobbyOptions, IRulesetLoaded
public class TimeLimitManagerInfo : TraitInfo, ILobbyOptions, IRulesetLoaded
{
[Desc("Label that will be shown for the time limit option in the lobby.")]
public readonly string TimeLimitLabel = "Time Limit";
@@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Traits
new ReadOnlyDictionary<string, string>(timelimits), TimeLimitDefault.ToString(), TimeLimitLocked);
}
public object Create(ActorInitializer init) { return new TimeLimitManager(init.Self, this); }
public override object Create(ActorInitializer init) { return new TimeLimitManager(init.Self, this); }
}
public class TimeLimitManager : INotifyTimeLimit, ITick, IWorldLoaded

View File

@@ -16,7 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
public class PluggableInfo : ITraitInfo
public class PluggableInfo : TraitInfo
{
[Desc("Footprint cell offset where a plug can be placed.")]
public readonly CVec Offset = CVec.Zero;
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits
get { return Requirements.Values.SelectMany(r => r.Variables).Distinct(); }
}
public object Create(ActorInitializer init) { return new Pluggable(init, this); }
public override object Create(ActorInitializer init) { return new Pluggable(init, this); }
}
public class Pluggable : IObservesVariables, INotifyCreated

View File

@@ -16,14 +16,14 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("Attach this to the player actor.")]
public class PowerManagerInfo : ITraitInfo, Requires<DeveloperModeInfo>
public class PowerManagerInfo : TraitInfo, Requires<DeveloperModeInfo>
{
public readonly int AdviceInterval = 250;
[NotificationReference("Speech")]
public readonly string SpeechNotification = null;
public object Create(ActorInitializer init) { return new PowerManager(init.Self, this); }
public override object Create(ActorInitializer init) { return new PowerManager(init.Self, this); }
}
public class PowerManager : INotifyCreated, ITick, ISync, IResolveOrder

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