Replace ITraitInfo interface with TraitInfo class.
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user