UpgradeManager after IUpgradables
This commit is contained in:
@@ -15,12 +15,12 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
class PoisonedByTiberiumInfo : UpgradableTraitInfo, ITraitInfo
|
class PoisonedByTiberiumInfo : UpgradableTraitInfo
|
||||||
{
|
{
|
||||||
[WeaponReference] public readonly string Weapon = "Tiberium";
|
[WeaponReference] public readonly string Weapon = "Tiberium";
|
||||||
public readonly string[] Resources = { "Tiberium", "BlueTiberium" };
|
public readonly string[] Resources = { "Tiberium", "BlueTiberium" };
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new PoisonedByTiberium(this); }
|
public override object Create(ActorInitializer init) { return new PoisonedByTiberium(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class PoisonedByTiberium : UpgradableTrait<PoisonedByTiberiumInfo>, ITick, ISync
|
class PoisonedByTiberium : UpgradableTrait<PoisonedByTiberiumInfo>, ITick, ISync
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Desc("Allows you to attach weapons to the unit (use @IdentifierSuffix for > 1)")]
|
[Desc("Allows you to attach weapons to the unit (use @IdentifierSuffix for > 1)")]
|
||||||
public class ArmamentInfo : UpgradableTraitInfo, ITraitInfo, Requires<AttackBaseInfo>
|
public class ArmamentInfo : UpgradableTraitInfo, Requires<AttackBaseInfo>
|
||||||
{
|
{
|
||||||
public readonly string Name = "primary";
|
public readonly string Name = "primary";
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Use multiple muzzle images if non-zero")]
|
[Desc("Use multiple muzzle images if non-zero")]
|
||||||
public readonly int MuzzleSplitFacings = 0;
|
public readonly int MuzzleSplitFacings = 0;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new Armament(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new Armament(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Armament : UpgradableTrait<ArmamentInfo>, ITick, IExplodeModifier
|
public class Armament : UpgradableTrait<ArmamentInfo>, ITick, IExplodeModifier
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
[VoiceReference] public readonly string Voice = "Action";
|
[VoiceReference] public readonly string Voice = "Action";
|
||||||
|
|
||||||
public abstract object Create(ActorInitializer init);
|
public override abstract object Create(ActorInitializer init);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class AttackBase : UpgradableTrait<AttackBaseInfo>, IIssueOrder, IResolveOrder, IOrderVoice, ISync
|
public abstract class AttackBase : UpgradableTrait<AttackBaseInfo>, IIssueOrder, IResolveOrder, IOrderVoice, ISync
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Building can be repaired by the repair button.")]
|
[Desc("Building can be repaired by the repair button.")]
|
||||||
public class RepairableBuildingInfo : UpgradableTraitInfo, ITraitInfo, Requires<HealthInfo>
|
public class RepairableBuildingInfo : UpgradableTraitInfo, Requires<HealthInfo>
|
||||||
{
|
{
|
||||||
public readonly int RepairPercent = 20;
|
public readonly int RepairPercent = 20;
|
||||||
public readonly int RepairInterval = 24;
|
public readonly int RepairInterval = 24;
|
||||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Suffixed by the interal repairing player name.")]
|
[Desc("Suffixed by the interal repairing player name.")]
|
||||||
public readonly string IndicatorPalettePrefix = "player";
|
public readonly string IndicatorPalettePrefix = "player";
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new RepairableBuilding(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new RepairableBuilding(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RepairableBuilding : UpgradableTrait<RepairableBuildingInfo>, ITick
|
public class RepairableBuilding : UpgradableTrait<RepairableBuildingInfo>, ITick
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("This unit can cloak and uncloak in specific situations.")]
|
[Desc("This unit can cloak and uncloak in specific situations.")]
|
||||||
public class CloakInfo : UpgradableTraitInfo, ITraitInfo
|
public class CloakInfo : UpgradableTraitInfo
|
||||||
{
|
{
|
||||||
[Desc("Measured in game ticks.")]
|
[Desc("Measured in game ticks.")]
|
||||||
public readonly int InitialDelay = 10;
|
public readonly int InitialDelay = 10;
|
||||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public readonly string[] CloakTypes = { "Cloak" };
|
public readonly string[] CloakTypes = { "Cloak" };
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new Cloak(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new Cloak(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Cloak : UpgradableTrait<CloakInfo>, IRenderModifier, INotifyDamageStateChanged, INotifyAttack, ITick, IVisibilityModifier, IRadarColorModifier
|
public class Cloak : UpgradableTrait<CloakInfo>, IRenderModifier, INotifyDamageStateChanged, INotifyAttack, ITick, IVisibilityModifier, IRadarColorModifier
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Actor can reveal Cloak actors in a specified range.")]
|
[Desc("Actor can reveal Cloak actors in a specified range.")]
|
||||||
public class DetectCloakedInfo : UpgradableTraitInfo, ITraitInfo
|
public class DetectCloakedInfo : UpgradableTraitInfo
|
||||||
{
|
{
|
||||||
[Desc("Specific cloak classifications I can reveal.")]
|
[Desc("Specific cloak classifications I can reveal.")]
|
||||||
public readonly string[] CloakTypes = { "Cloak" };
|
public readonly string[] CloakTypes = { "Cloak" };
|
||||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Measured in cells.")]
|
[Desc("Measured in cells.")]
|
||||||
public readonly int Range = 5;
|
public readonly int Range = 5;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new DetectCloaked(this); }
|
public override object Create(ActorInitializer init) { return new DetectCloaked(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DetectCloaked : UpgradableTrait<DetectCloakedInfo>
|
public class DetectCloaked : UpgradableTrait<DetectCloakedInfo>
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
class KillsSelfInfo : UpgradableTraitInfo, ITraitInfo
|
class KillsSelfInfo : UpgradableTraitInfo
|
||||||
{
|
{
|
||||||
[Desc("Remove the actor from the world (and destroy it) instead of killing it.")]
|
[Desc("Remove the actor from the world (and destroy it) instead of killing it.")]
|
||||||
public readonly bool RemoveInstead = false;
|
public readonly bool RemoveInstead = false;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new KillsSelf(this); }
|
public override object Create(ActorInitializer init) { return new KillsSelf(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class KillsSelf : UpgradableTrait<KillsSelfInfo>, INotifyAddedToWorld
|
class KillsSelf : UpgradableTrait<KillsSelfInfo>, INotifyAddedToWorld
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Display a colored overlay when a timed upgrade is active.")]
|
[Desc("Display a colored overlay when a timed upgrade is active.")]
|
||||||
public class UpgradeOverlayInfo : UpgradableTraitInfo, ITraitInfo
|
public class UpgradeOverlayInfo : UpgradableTraitInfo
|
||||||
{
|
{
|
||||||
[Desc("Palette to use when rendering the overlay")]
|
[Desc("Palette to use when rendering the overlay")]
|
||||||
public readonly string Palette = "invuln";
|
public readonly string Palette = "invuln";
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new UpgradeOverlay(this); }
|
public override object Create(ActorInitializer init) { return new UpgradeOverlay(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UpgradeOverlay : UpgradableTrait<UpgradeOverlayInfo>, IRenderModifier
|
public class UpgradeOverlay : UpgradableTrait<UpgradeOverlayInfo>, IRenderModifier
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("The player can disable the power individually on this actor.")]
|
[Desc("The player can disable the power individually on this actor.")]
|
||||||
public class CanPowerDownInfo : UpgradableTraitInfo, ITraitInfo, Requires<PowerInfo>
|
public class CanPowerDownInfo : UpgradableTraitInfo, Requires<PowerInfo>
|
||||||
{
|
{
|
||||||
[Desc("Restore power when this trait is disabled.")]
|
[Desc("Restore power when this trait is disabled.")]
|
||||||
public readonly bool CancelWhenDisabled = false;
|
public readonly bool CancelWhenDisabled = false;
|
||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public readonly string IndicatorPalette = "chrome";
|
public readonly string IndicatorPalette = "chrome";
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new CanPowerDown(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new CanPowerDown(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CanPowerDown : UpgradableTrait<CanPowerDownInfo>, IPowerModifier, IResolveOrder, IDisable, INotifyOwnerChanged
|
public class CanPowerDown : UpgradableTrait<CanPowerDownInfo>, IPowerModifier, IResolveOrder, IDisable, INotifyOwnerChanged
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
public class PowerInfo : UpgradableTraitInfo, ITraitInfo
|
public class PowerInfo : UpgradableTraitInfo
|
||||||
{
|
{
|
||||||
[Desc("If negative, it will drain power. If positive, it will provide power.")]
|
[Desc("If negative, it will drain power. If positive, it will provide power.")]
|
||||||
public readonly int Amount = 0;
|
public readonly int Amount = 0;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new Power(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new Power(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Power : UpgradableTrait<PowerInfo>, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyOwnerChanged
|
public class Power : UpgradableTrait<PowerInfo>, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyOwnerChanged
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public object Create(ActorInitializer init) { return new TimedUpgradeBar(init.Self, this); }
|
public object Create(ActorInitializer init) { return new TimedUpgradeBar(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class TimedUpgradeBar : ISelectionBar
|
class TimedUpgradeBar : ISelectionBar, INotifyCreated
|
||||||
{
|
{
|
||||||
readonly TimedUpgradeBarInfo info;
|
readonly TimedUpgradeBarInfo info;
|
||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
@@ -36,7 +36,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
this.self = self;
|
this.self = self;
|
||||||
this.info = info;
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Created(Actor self)
|
||||||
|
{
|
||||||
self.Trait<UpgradeManager>().RegisterWatcher(info.Upgrade, Update);
|
self.Trait<UpgradeManager>().RegisterWatcher(info.Upgrade, Update);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Desc("Displays a custom animation if conditions are satisfied.")]
|
[Desc("Displays a custom animation if conditions are satisfied.")]
|
||||||
public class WithDecorationInfo : UpgradableTraitInfo, ITraitInfo
|
public class WithDecorationInfo : UpgradableTraitInfo
|
||||||
{
|
{
|
||||||
[Desc("Image used for this decoration. Defaults to the actor's type.")]
|
[Desc("Image used for this decoration. Defaults to the actor's type.")]
|
||||||
public readonly string Image = null;
|
public readonly string Image = null;
|
||||||
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Should this be visible to enemy players?")]
|
[Desc("Should this be visible to enemy players?")]
|
||||||
public readonly bool ShowToEnemies = false;
|
public readonly bool ShowToEnemies = false;
|
||||||
|
|
||||||
public virtual object Create(ActorInitializer init) { return new WithDecoration(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new WithDecoration(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WithDecoration : UpgradableTrait<WithDecorationInfo>, IRender
|
public class WithDecoration : UpgradableTrait<WithDecorationInfo>, IRender
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Renders a decorative animation on units and buildings.")]
|
[Desc("Renders a decorative animation on units and buildings.")]
|
||||||
public class WithIdleOverlayInfo : UpgradableTraitInfo, ITraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>, Requires<IBodyOrientationInfo>
|
public class WithIdleOverlayInfo : UpgradableTraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>, Requires<IBodyOrientationInfo>
|
||||||
{
|
{
|
||||||
[Desc("Sequence name to use")]
|
[Desc("Sequence name to use")]
|
||||||
[SequenceReference] public readonly string Sequence = "idle-overlay";
|
[SequenceReference] public readonly string Sequence = "idle-overlay";
|
||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public readonly bool PauseOnLowPower = false;
|
public readonly bool PauseOnLowPower = false;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new WithIdleOverlay(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new WithIdleOverlay(init.Self, this); }
|
||||||
|
|
||||||
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
|
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
public class WithInfantryBodyInfo : UpgradableTraitInfo, ITraitInfo, IQuantizeBodyOrientationInfo, IRenderActorPreviewSpritesInfo,
|
public class WithInfantryBodyInfo : UpgradableTraitInfo, IQuantizeBodyOrientationInfo, IRenderActorPreviewSpritesInfo,
|
||||||
Requires<IMoveInfo>, Requires<RenderSpritesInfo>
|
Requires<IMoveInfo>, Requires<RenderSpritesInfo>
|
||||||
{
|
{
|
||||||
public readonly int MinIdleWaitTicks = 30;
|
public readonly int MinIdleWaitTicks = 30;
|
||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[SequenceReference] public readonly string[] IdleSequences = { };
|
[SequenceReference] public readonly string[] IdleSequences = { };
|
||||||
[SequenceReference] public readonly string[] StandSequences = { "stand" };
|
[SequenceReference] public readonly string[] StandSequences = { "stand" };
|
||||||
|
|
||||||
public virtual object Create(ActorInitializer init) { return new WithInfantryBody(init, this); }
|
public override object Create(ActorInitializer init) { return new WithInfantryBody(init, this); }
|
||||||
|
|
||||||
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
|
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Renders the MuzzleSequence from the Armament trait.")]
|
[Desc("Renders the MuzzleSequence from the Armament trait.")]
|
||||||
class WithMuzzleFlashInfo : UpgradableTraitInfo, ITraitInfo, Requires<RenderSpritesInfo>, Requires<AttackBaseInfo>, Requires<ArmamentInfo>
|
class WithMuzzleFlashInfo : UpgradableTraitInfo, Requires<RenderSpritesInfo>, Requires<AttackBaseInfo>, Requires<ArmamentInfo>
|
||||||
{
|
{
|
||||||
[Desc("Ignore the weapon position, and always draw relative to the center of the actor")]
|
[Desc("Ignore the weapon position, and always draw relative to the center of the actor")]
|
||||||
public readonly bool IgnoreOffset = false;
|
public readonly bool IgnoreOffset = false;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new WithMuzzleFlash(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new WithMuzzleFlash(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class WithMuzzleFlash : UpgradableTrait<WithMuzzleFlashInfo>, INotifyAttack, IRender, ITick
|
class WithMuzzleFlash : UpgradableTrait<WithMuzzleFlashInfo>, INotifyAttack, IRender, ITick
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Default trait for rendering sprite-based actors.")]
|
[Desc("Default trait for rendering sprite-based actors.")]
|
||||||
public class WithSpriteBodyInfo : UpgradableTraitInfo, ITraitInfo, IRenderActorPreviewSpritesInfo, IQuantizeBodyOrientationInfo,
|
public class WithSpriteBodyInfo : UpgradableTraitInfo, IRenderActorPreviewSpritesInfo, IQuantizeBodyOrientationInfo,
|
||||||
Requires<RenderSpritesInfo>
|
Requires<RenderSpritesInfo>
|
||||||
{
|
{
|
||||||
[Desc("Animation to play when the actor is created.")]
|
[Desc("Animation to play when the actor is created.")]
|
||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Animation to play when the actor is idle.")]
|
[Desc("Animation to play when the actor is idle.")]
|
||||||
[SequenceReference] public readonly string Sequence = "idle";
|
[SequenceReference] public readonly string Sequence = "idle";
|
||||||
|
|
||||||
public virtual object Create(ActorInitializer init) { return new WithSpriteBody(init, this); }
|
public override object Create(ActorInitializer init) { return new WithSpriteBody(init, this); }
|
||||||
|
|
||||||
public virtual IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
|
public virtual IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Renders turrets for units with the Turreted trait.")]
|
[Desc("Renders turrets for units with the Turreted trait.")]
|
||||||
public class WithTurretInfo : UpgradableTraitInfo, ITraitInfo, IRenderActorPreviewSpritesInfo,
|
public class WithTurretInfo : UpgradableTraitInfo, IRenderActorPreviewSpritesInfo,
|
||||||
Requires<RenderSpritesInfo>, Requires<TurretedInfo>, Requires<IBodyOrientationInfo>
|
Requires<RenderSpritesInfo>, Requires<TurretedInfo>, Requires<IBodyOrientationInfo>
|
||||||
{
|
{
|
||||||
[Desc("Sequence name to use")]
|
[Desc("Sequence name to use")]
|
||||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Render recoil")]
|
[Desc("Render recoil")]
|
||||||
public readonly bool Recoils = true;
|
public readonly bool Recoils = true;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new WithTurret(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new WithTurret(init.Self, this); }
|
||||||
|
|
||||||
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
|
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Attach this to actors which should be able to regenerate their health points.")]
|
[Desc("Attach this to actors which should be able to regenerate their health points.")]
|
||||||
class SelfHealingInfo : UpgradableTraitInfo, ITraitInfo, Requires<HealthInfo>
|
class SelfHealingInfo : UpgradableTraitInfo, Requires<HealthInfo>
|
||||||
{
|
{
|
||||||
public readonly int Step = 5;
|
public readonly int Step = 5;
|
||||||
public readonly int Ticks = 5;
|
public readonly int Ticks = 5;
|
||||||
public readonly float HealIfBelow = .5f;
|
public readonly float HealIfBelow = .5f;
|
||||||
public readonly int DamageCooldown = 0;
|
public readonly int DamageCooldown = 0;
|
||||||
|
|
||||||
public virtual object Create(ActorInitializer init) { return new SelfHealing(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new SelfHealing(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class SelfHealing : UpgradableTrait<SelfHealingInfo>, ITick, INotifyDamage
|
class SelfHealing : UpgradableTrait<SelfHealingInfo>, ITick, INotifyDamage
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Actor can be sold")]
|
[Desc("Actor can be sold")]
|
||||||
public class SellableInfo : UpgradableTraitInfo, ITraitInfo
|
public class SellableInfo : UpgradableTraitInfo
|
||||||
{
|
{
|
||||||
public readonly int RefundPercent = 50;
|
public readonly int RefundPercent = 50;
|
||||||
public readonly string[] SellSounds = { };
|
public readonly string[] SellSounds = { };
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new Sellable(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new Sellable(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Sellable : UpgradableTrait<SellableInfo>, IResolveOrder, IProvideTooltipInfo
|
public class Sellable : UpgradableTrait<SellableInfo>, IResolveOrder, IProvideTooltipInfo
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
public abstract class SupportPowerInfo : UpgradableTraitInfo, ITraitInfo
|
public abstract class SupportPowerInfo : UpgradableTraitInfo
|
||||||
{
|
{
|
||||||
[Desc("Measured in seconds.")]
|
[Desc("Measured in seconds.")]
|
||||||
public readonly int ChargeTime = 0;
|
public readonly int ChargeTime = 0;
|
||||||
@@ -54,7 +54,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public readonly int RadarPingDuration = 5 * 25;
|
public readonly int RadarPingDuration = 5 * 25;
|
||||||
|
|
||||||
public readonly string OrderName;
|
public readonly string OrderName;
|
||||||
public abstract object Create(ActorInitializer init);
|
|
||||||
|
|
||||||
public SupportPowerInfo() { OrderName = GetType().Name + "Order"; }
|
public SupportPowerInfo() { OrderName = GetType().Name + "Order"; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
public class DisableUpgradeInfo : UpgradableTraitInfo, ITraitInfo
|
public class DisableUpgradeInfo : UpgradableTraitInfo
|
||||||
{
|
{
|
||||||
public object Create(ActorInitializer init) { return new DisableUpgrade(this); }
|
public override object Create(ActorInitializer init) { return new DisableUpgrade(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DisableUpgrade : UpgradableTrait<DisableUpgradeInfo>, IDisable, IDisableMove
|
public class DisableUpgrade : UpgradableTrait<DisableUpgradeInfo>, IDisable, IDisableMove
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
/// <summary>Use as base class for *Info to subclass of UpgradableTrait. (See UpgradableTrait.)</summary>
|
/// <summary>Use as base class for *Info to subclass of UpgradableTrait. (See UpgradableTrait.)</summary>
|
||||||
public abstract class UpgradableTraitInfo
|
public abstract class UpgradableTraitInfo : IUpgradableInfo
|
||||||
{
|
{
|
||||||
[UpgradeUsedReference]
|
[UpgradeUsedReference]
|
||||||
[Desc("The upgrade types which can enable or disable this trait.")]
|
[Desc("The upgrade types which can enable or disable this trait.")]
|
||||||
@@ -32,6 +32,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
[Desc("The maximum upgrade level that this trait will accept.")]
|
[Desc("The maximum upgrade level that this trait will accept.")]
|
||||||
public readonly int UpgradeMaxAcceptedLevel = 1;
|
public readonly int UpgradeMaxAcceptedLevel = 1;
|
||||||
|
|
||||||
|
public abstract object Create(ActorInitializer init);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Attach this to a unit to enable dynamic upgrades by warheads, experience, crates, support powers, etc.")]
|
[Desc("Attach this to a unit to enable dynamic upgrades by warheads, experience, crates, support powers, etc.")]
|
||||||
public class UpgradeManagerInfo : ITraitInfo
|
public class UpgradeManagerInfo : ITraitInfo, Requires<IUpgradableInfo>
|
||||||
{
|
{
|
||||||
public object Create(ActorInitializer init) { return new UpgradeManager(init); }
|
public object Create(ActorInitializer init) { return new UpgradeManager(init); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
void UpgradeLevelChanged(Actor self, string type, int oldLevel, int newLevel);
|
void UpgradeLevelChanged(Actor self, string type, int oldLevel, int newLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Implement to construct before UpgradeManager
|
||||||
|
public interface IUpgradableInfo : ITraitInfo { }
|
||||||
|
|
||||||
public interface INotifyHarvesterAction
|
public interface INotifyHarvesterAction
|
||||||
{
|
{
|
||||||
void MovingToResources(Actor self, CPos targetCell, Activity next);
|
void MovingToResources(Actor self, CPos targetCell, Activity next);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.D2k.Traits
|
namespace OpenRA.Mods.D2k.Traits
|
||||||
{
|
{
|
||||||
[Desc("This actor makes noise, which causes them to be targeted by actors with the Sandworm trait.")]
|
[Desc("This actor makes noise, which causes them to be targeted by actors with the Sandworm trait.")]
|
||||||
public class AttractsWormsInfo : UpgradableTraitInfo, ITraitInfo
|
public class AttractsWormsInfo : UpgradableTraitInfo
|
||||||
{
|
{
|
||||||
[Desc("How much noise this actor produces.")]
|
[Desc("How much noise this actor produces.")]
|
||||||
public readonly int Intensity = 0;
|
public readonly int Intensity = 0;
|
||||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.D2k.Traits
|
|||||||
[Desc("Ranges at which each Falloff step is defined. Overrides Spread.")]
|
[Desc("Ranges at which each Falloff step is defined. Overrides Spread.")]
|
||||||
public WRange[] Range = null;
|
public WRange[] Range = null;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new AttractsWorms(init, this); }
|
public override object Create(ActorInitializer init) { return new AttractsWorms(init, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AttractsWorms : UpgradableTrait<AttractsWormsInfo>
|
public class AttractsWorms : UpgradableTrait<AttractsWormsInfo>
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
public class InvulnerabilityUpgradeInfo : UpgradableTraitInfo, ITraitInfo
|
public class InvulnerabilityUpgradeInfo : UpgradableTraitInfo
|
||||||
{
|
{
|
||||||
public object Create(ActorInitializer init) { return new InvulnerabilityUpgrade(this); }
|
public override object Create(ActorInitializer init) { return new InvulnerabilityUpgrade(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class InvulnerabilityUpgrade : UpgradableTrait<InvulnerabilityUpgradeInfo>, IDamageModifier
|
public class InvulnerabilityUpgrade : UpgradableTrait<InvulnerabilityUpgradeInfo>, IDamageModifier
|
||||||
|
|||||||
Reference in New Issue
Block a user