Replace ITraitInfo interface with TraitInfo class.
This commit is contained in:
@@ -32,7 +32,7 @@ namespace OpenRA
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly string Name;
|
public readonly string Name;
|
||||||
readonly TypeDictionary traits = new TypeDictionary();
|
readonly TypeDictionary traits = new TypeDictionary();
|
||||||
List<ITraitInfo> constructOrderCache = null;
|
List<TraitInfo> constructOrderCache = null;
|
||||||
|
|
||||||
public ActorInfo(ObjectCreator creator, string name, MiniYaml node)
|
public ActorInfo(ObjectCreator creator, string name, MiniYaml node)
|
||||||
{
|
{
|
||||||
@@ -64,7 +64,7 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActorInfo(string name, params ITraitInfo[] traitInfos)
|
public ActorInfo(string name, params TraitInfo[] traitInfos)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
foreach (var t in traitInfos)
|
foreach (var t in traitInfos)
|
||||||
@@ -72,7 +72,7 @@ namespace OpenRA
|
|||||||
traits.TrimExcess();
|
traits.TrimExcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
static ITraitInfo LoadTraitInfo(ObjectCreator creator, string traitName, MiniYaml my)
|
static TraitInfo LoadTraitInfo(ObjectCreator creator, string traitName, MiniYaml my)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(my.Value))
|
if (!string.IsNullOrEmpty(my.Value))
|
||||||
throw new YamlException("Junk value `{0}` on trait node {1}"
|
throw new YamlException("Junk value `{0}` on trait node {1}"
|
||||||
@@ -80,7 +80,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
// HACK: The linter does not want to crash when a trait doesn't exist but only print an error instead
|
// HACK: The linter does not want to crash when a trait doesn't exist but only print an error instead
|
||||||
// ObjectCreator will only return null to signal us to abort here if the linter is running
|
// ObjectCreator will only return null to signal us to abort here if the linter is running
|
||||||
var info = creator.CreateObject<ITraitInfo>(traitName + "Info");
|
var info = creator.CreateObject<TraitInfo>(traitName + "Info");
|
||||||
if (info == null)
|
if (info == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@@ -97,12 +97,12 @@ namespace OpenRA
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<ITraitInfo> TraitsInConstructOrder()
|
public IEnumerable<TraitInfo> TraitsInConstructOrder()
|
||||||
{
|
{
|
||||||
if (constructOrderCache != null)
|
if (constructOrderCache != null)
|
||||||
return constructOrderCache;
|
return constructOrderCache;
|
||||||
|
|
||||||
var source = traits.WithInterface<ITraitInfo>().Select(i => new
|
var source = traits.WithInterface<TraitInfo>().Select(i => new
|
||||||
{
|
{
|
||||||
Trait = i,
|
Trait = i,
|
||||||
Type = i.GetType(),
|
Type = i.GetType(),
|
||||||
@@ -148,7 +148,7 @@ namespace OpenRA
|
|||||||
return constructOrderCache;
|
return constructOrderCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<Type> PrerequisitesOf(ITraitInfo info)
|
public static IEnumerable<Type> PrerequisitesOf(TraitInfo info)
|
||||||
{
|
{
|
||||||
return info
|
return info
|
||||||
.GetType()
|
.GetType()
|
||||||
|
|||||||
@@ -12,9 +12,9 @@
|
|||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
[Desc("Checks for pause related desyncs. Attach this to the world actor.")]
|
[Desc("Checks for pause related desyncs. Attach this to the world actor.")]
|
||||||
public class DebugPauseStateInfo : ITraitInfo
|
public class DebugPauseStateInfo : TraitInfo
|
||||||
{
|
{
|
||||||
public object Create(ActorInitializer init) { return new DebugPauseState(init.World); }
|
public override object Create(ActorInitializer init) { return new DebugPauseState(init.World); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DebugPauseState : ISync
|
public class DebugPauseState : ISync
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ using OpenRA.Primitives;
|
|||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
[Desc("Add this to the World actor definition.")]
|
[Desc("Add this to the World actor definition.")]
|
||||||
public class FixedColorPaletteInfo : ITraitInfo
|
public class FixedColorPaletteInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[PaletteReference]
|
[PaletteReference]
|
||||||
[Desc("The name of the palette to base off.")]
|
[Desc("The name of the palette to base off.")]
|
||||||
@@ -37,7 +37,7 @@ namespace OpenRA.Traits
|
|||||||
[Desc("Allow palette modifiers to change the palette.")]
|
[Desc("Allow palette modifiers to change the palette.")]
|
||||||
public readonly bool AllowModifiers = true;
|
public readonly bool AllowModifiers = true;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new FixedColorPalette(this); }
|
public override object Create(ActorInitializer init) { return new FixedColorPalette(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FixedColorPalette : ILoadsPalettes
|
public class FixedColorPalette : ILoadsPalettes
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ namespace OpenRA.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Desc("Required for FrozenUnderFog to work. Attach this to the player actor.")]
|
[Desc("Required for FrozenUnderFog to work. Attach this to the player actor.")]
|
||||||
public class FrozenActorLayerInfo : Requires<ShroudInfo>, ITraitInfo
|
public class FrozenActorLayerInfo : TraitInfo, Requires<ShroudInfo>
|
||||||
{
|
{
|
||||||
[Desc("Size of partition bins (cells)")]
|
[Desc("Size of partition bins (cells)")]
|
||||||
public readonly int BinSize = 10;
|
public readonly int BinSize = 10;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new FrozenActorLayer(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new FrozenActorLayer(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FrozenActor
|
public class FrozenActor
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ using OpenRA.Primitives;
|
|||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
[Desc("Define a player palette by swapping palette indices.")]
|
[Desc("Define a player palette by swapping palette indices.")]
|
||||||
public class IndexedPlayerPaletteInfo : ITraitInfo, IRulesetLoaded
|
public class IndexedPlayerPaletteInfo : TraitInfo, IRulesetLoaded
|
||||||
{
|
{
|
||||||
[PaletteReference]
|
[PaletteReference]
|
||||||
[Desc("The name of the palette to base off.")]
|
[Desc("The name of the palette to base off.")]
|
||||||
@@ -35,7 +35,7 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public readonly Dictionary<string, int[]> PlayerIndex;
|
public readonly Dictionary<string, int[]> PlayerIndex;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new IndexedPlayerPalette(this); }
|
public override object Create(ActorInitializer init) { return new IndexedPlayerPalette(this); }
|
||||||
|
|
||||||
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ using OpenRA.Primitives;
|
|||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
[Desc("Add this to the Player actor definition.")]
|
[Desc("Add this to the Player actor definition.")]
|
||||||
public class PlayerColorPaletteInfo : ITraitInfo
|
public class PlayerColorPaletteInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[PaletteReference]
|
[PaletteReference]
|
||||||
[Desc("The name of the palette to base off.")]
|
[Desc("The name of the palette to base off.")]
|
||||||
@@ -34,7 +34,7 @@ namespace OpenRA.Traits
|
|||||||
[Desc("Allow palette modifiers to change the palette.")]
|
[Desc("Allow palette modifiers to change the palette.")]
|
||||||
public readonly bool AllowModifiers = true;
|
public readonly bool AllowModifiers = true;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new PlayerColorPalette(this); }
|
public override object Create(ActorInitializer init) { return new PlayerColorPalette(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PlayerColorPalette : ILoadsPlayerPalettes
|
public class PlayerColorPalette : ILoadsPlayerPalettes
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ using OpenRA.Primitives;
|
|||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
[Desc("Add this to the Player actor definition.")]
|
[Desc("Add this to the Player actor definition.")]
|
||||||
public class PlayerHighlightPaletteInfo : ITraitInfo
|
public class PlayerHighlightPaletteInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[PaletteDefinition(true)]
|
[PaletteDefinition(true)]
|
||||||
[Desc("The prefix for the resulting player palettes")]
|
[Desc("The prefix for the resulting player palettes")]
|
||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Traits
|
|||||||
[Desc("Index set to be fully transparent/invisible.")]
|
[Desc("Index set to be fully transparent/invisible.")]
|
||||||
public readonly int TransparentIndex = 0;
|
public readonly int TransparentIndex = 0;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new PlayerHighlightPalette(this); }
|
public override object Create(ActorInitializer init) { return new PlayerHighlightPalette(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PlayerHighlightPalette : ILoadsPlayerPalettes
|
public class PlayerHighlightPalette : ILoadsPlayerPalettes
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ using System.Collections.Generic;
|
|||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
[Desc("Required for shroud and fog visibility checks. Add this to the player actor.")]
|
[Desc("Required for shroud and fog visibility checks. Add this to the player actor.")]
|
||||||
public class ShroudInfo : ITraitInfo, ILobbyOptions
|
public class ShroudInfo : TraitInfo, ILobbyOptions
|
||||||
{
|
{
|
||||||
[Translate]
|
[Translate]
|
||||||
[Desc("Descriptive label for the fog checkbox in the lobby.")]
|
[Desc("Descriptive label for the fog checkbox in the lobby.")]
|
||||||
@@ -65,7 +65,7 @@ namespace OpenRA.Traits
|
|||||||
FogCheckboxVisible, FogCheckboxDisplayOrder, FogCheckboxEnabled, FogCheckboxLocked);
|
FogCheckboxVisible, FogCheckboxDisplayOrder, FogCheckboxEnabled, FogCheckboxLocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new Shroud(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new Shroud(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Shroud : ISync, INotifyCreated, ITick
|
public class Shroud : ISync, INotifyCreated, ITick
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace OpenRA.Traits
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class DamageType { DamageType() { } }
|
public sealed class DamageType { DamageType() { } }
|
||||||
|
|
||||||
public interface IHealthInfo : ITraitInfo
|
public interface IHealthInfo : ITraitInfoInterface
|
||||||
{
|
{
|
||||||
int MaxHP { get; }
|
int MaxHP { get; }
|
||||||
}
|
}
|
||||||
@@ -324,9 +324,17 @@ namespace OpenRA.Traits
|
|||||||
public interface IFacingInfo : ITraitInfoInterface { int GetInitialFacing(); }
|
public interface IFacingInfo : ITraitInfoInterface { int GetInitialFacing(); }
|
||||||
|
|
||||||
public interface ITraitInfoInterface { }
|
public interface ITraitInfoInterface { }
|
||||||
public interface ITraitInfo : ITraitInfoInterface { object Create(ActorInitializer init); }
|
|
||||||
|
|
||||||
public class TraitInfo<T> : ITraitInfo where T : new() { public virtual object Create(ActorInitializer init) { return new T(); } }
|
public abstract class TraitInfo : ITraitInfoInterface
|
||||||
|
{
|
||||||
|
public abstract object Create(ActorInitializer init);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TraitInfo<T> : TraitInfo where T : new()
|
||||||
|
{
|
||||||
|
public override object Create(ActorInitializer init) { return new T(); }
|
||||||
|
}
|
||||||
|
|
||||||
public interface ILobbyCustomRulesIgnore { }
|
public interface ILobbyCustomRulesIgnore { }
|
||||||
|
|
||||||
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:InterfaceNamesMustBeginWithI", Justification = "Not a real interface, but more like a tag.")]
|
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:InterfaceNamesMustBeginWithI", Justification = "Not a real interface, but more like a tag.")]
|
||||||
@@ -541,7 +549,7 @@ namespace OpenRA.Traits
|
|||||||
public interface ICreationActivity { Activity GetCreationActivity(); }
|
public interface ICreationActivity { Activity GetCreationActivity(); }
|
||||||
|
|
||||||
[RequireExplicitImplementation]
|
[RequireExplicitImplementation]
|
||||||
public interface IObservesVariablesInfo : ITraitInfo { }
|
public interface IObservesVariablesInfo : ITraitInfoInterface { }
|
||||||
|
|
||||||
public delegate void VariableObserverNotifier(Actor self, IReadOnlyDictionary<string, int> variables);
|
public delegate void VariableObserverNotifier(Actor self, IReadOnlyDictionary<string, int> variables);
|
||||||
public struct VariableObserver
|
public struct VariableObserver
|
||||||
|
|||||||
@@ -30,12 +30,12 @@ namespace OpenRA.Traits
|
|||||||
public override string ToString() { return "{0}->{1}".F(Actor.Info.Name, Bounds.GetType().Name); }
|
public override string ToString() { return "{0}->{1}".F(Actor.Info.Name, Bounds.GetType().Name); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ScreenMapInfo : ITraitInfo
|
public class ScreenMapInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[Desc("Size of partition bins (world pixels)")]
|
[Desc("Size of partition bins (world pixels)")]
|
||||||
public readonly int BinSize = 250;
|
public readonly int BinSize = 250;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new ScreenMap(init.World, this); }
|
public override object Create(ActorInitializer init) { return new ScreenMap(init.World, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ScreenMap : IWorldLoaded
|
public class ScreenMap : IWorldLoaded
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ using OpenRA.Graphics;
|
|||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
public class ScreenShakerInfo : ITraitInfo
|
public class ScreenShakerInfo : TraitInfo
|
||||||
{
|
{
|
||||||
public readonly float2 MinMultiplier = new float2(-3, -3);
|
public readonly float2 MinMultiplier = new float2(-3, -3);
|
||||||
public readonly float2 MaxMultiplier = new float2(3, 3);
|
public readonly float2 MaxMultiplier = new float2(3, 3);
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new ScreenShaker(this); }
|
public override object Create(ActorInitializer init) { return new ScreenShaker(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ScreenShaker : ITick, IWorldLoaded
|
public class ScreenShaker : ITick, IWorldLoaded
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[Desc("Implements the special case handling for the Chronoshiftable return on a construction yard.",
|
[Desc("Implements the special case handling for the Chronoshiftable return on a construction yard.",
|
||||||
"If ReturnOriginalActorOnCondition evaluates true and the actor is not being sold then OriginalActor will be returned to the origin.",
|
"If ReturnOriginalActorOnCondition evaluates true and the actor is not being sold then OriginalActor will be returned to the origin.",
|
||||||
"Otherwise, a vortex animation is played and damage is dealt each tick, ignoring modifiers.")]
|
"Otherwise, a vortex animation is played and damage is dealt each tick, ignoring modifiers.")]
|
||||||
public class ConyardChronoReturnInfo : IObservesVariablesInfo, Requires<HealthInfo>, Requires<WithSpriteBodyInfo>
|
public class ConyardChronoReturnInfo : TraitInfo, Requires<HealthInfo>, Requires<WithSpriteBodyInfo>, IObservesVariablesInfo
|
||||||
{
|
{
|
||||||
[SequenceReference]
|
[SequenceReference]
|
||||||
[Desc("Sequence name with the baked-in vortex animation")]
|
[Desc("Sequence name with the baked-in vortex animation")]
|
||||||
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[Desc("The color the bar of the 'return-to-origin' logic has.")]
|
[Desc("The color the bar of the 'return-to-origin' logic has.")]
|
||||||
public readonly Color TimeBarColor = Color.White;
|
public readonly Color TimeBarColor = Color.White;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new ConyardChronoReturn(init, this); }
|
public override object Create(ActorInitializer init) { return new ConyardChronoReturn(init, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ConyardChronoReturn : ITick, ISync, IObservesVariables, ISelectionBar, INotifySold,
|
public class ConyardChronoReturn : ITick, ISync, IObservesVariables, ISelectionBar, INotifySold,
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Desc("Provides access to the disguise command, which makes the actor appear to be another player's actor.")]
|
[Desc("Provides access to the disguise command, which makes the actor appear to be another player's actor.")]
|
||||||
class DisguiseInfo : ITraitInfo
|
class DisguiseInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[VoiceReference]
|
[VoiceReference]
|
||||||
public readonly string Voice = "Action";
|
public readonly string Voice = "Action";
|
||||||
@@ -96,7 +96,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[GrantedConditionReference]
|
[GrantedConditionReference]
|
||||||
public IEnumerable<string> LinterConditions { get { return DisguisedAsConditions.Values; } }
|
public IEnumerable<string> LinterConditions { get { return DisguisedAsConditions.Values; } }
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new Disguise(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new Disguise(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class Disguise : IEffectiveOwner, IIssueOrder, IResolveOrder, IOrderVoice, IRadarColorModifier, INotifyAttack,
|
class Disguise : IEffectiveOwner, IIssueOrder, IResolveOrder, IOrderVoice, IRadarColorModifier, INotifyAttack,
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
using FrozenActorAction = Action<FrozenUnderFogUpdatedByGps, FrozenActorLayer, GpsWatcher, FrozenActor>;
|
using FrozenActorAction = Action<FrozenUnderFogUpdatedByGps, FrozenActorLayer, GpsWatcher, FrozenActor>;
|
||||||
|
|
||||||
[Desc("Updates frozen actors of actors that change owners, are sold or die whilst having an active GPS power.")]
|
[Desc("Updates frozen actors of actors that change owners, are sold or die whilst having an active GPS power.")]
|
||||||
public class FrozenUnderFogUpdatedByGpsInfo : ITraitInfo, Requires<FrozenUnderFogInfo>
|
public class FrozenUnderFogUpdatedByGpsInfo : TraitInfo, Requires<FrozenUnderFogInfo>
|
||||||
{
|
{
|
||||||
public object Create(ActorInitializer init) { return new FrozenUnderFogUpdatedByGps(init); }
|
public override object Create(ActorInitializer init) { return new FrozenUnderFogUpdatedByGps(init); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FrozenUnderFogUpdatedByGps : INotifyOwnerChanged, INotifyActorDisposing, IOnGpsRefreshed
|
public class FrozenUnderFogUpdatedByGps : INotifyOwnerChanged, INotifyActorDisposing, IOnGpsRefreshed
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
[Desc("Show an indicator revealing the actor underneath the fog when a GPSWatcher is activated.")]
|
[Desc("Show an indicator revealing the actor underneath the fog when a GPSWatcher is activated.")]
|
||||||
class GpsDotInfo : ITraitInfo
|
class GpsDotInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[Desc("Sprite collection for symbols.")]
|
[Desc("Sprite collection for symbols.")]
|
||||||
public readonly string Image = "gpsdot";
|
public readonly string Image = "gpsdot";
|
||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[PaletteReference(true)]
|
[PaletteReference(true)]
|
||||||
public readonly string IndicatorPalettePrefix = "player";
|
public readonly string IndicatorPalettePrefix = "player";
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new GpsDot(this); }
|
public override object Create(ActorInitializer init) { return new GpsDot(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class GpsDot : INotifyCreated, INotifyAddedToWorld, INotifyRemovedFromWorld
|
class GpsDot : INotifyCreated, INotifyAddedToWorld, INotifyRemovedFromWorld
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
[Desc("Required for `GpsPower`. Attach this to the player actor.")]
|
[Desc("Required for `GpsPower`. Attach this to the player actor.")]
|
||||||
class GpsWatcherInfo : ITraitInfo
|
class GpsWatcherInfo : TraitInfo
|
||||||
{
|
{
|
||||||
public object Create(ActorInitializer init) { return new GpsWatcher(init.Self.Owner); }
|
public override object Create(ActorInitializer init) { return new GpsWatcher(init.Self.Owner); }
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IOnGpsRefreshed { void OnGpsRefresh(Actor self, Player player); }
|
interface IOnGpsRefreshed { void OnGpsRefresh(Actor self, Player player); }
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
public class HarvesterHuskModifierInfo : ITraitInfo, Requires<HarvesterInfo>
|
public class HarvesterHuskModifierInfo : TraitInfo, Requires<HarvesterInfo>
|
||||||
{
|
{
|
||||||
[ActorReference]
|
[ActorReference]
|
||||||
public readonly string FullHuskActor = null;
|
public readonly string FullHuskActor = null;
|
||||||
public readonly int FullnessThreshold = 50;
|
public readonly int FullnessThreshold = 50;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new HarvesterHuskModifier(this); }
|
public override object Create(ActorInitializer init) { return new HarvesterHuskModifier(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class HarvesterHuskModifier : IHuskModifier
|
public class HarvesterHuskModifier : IHuskModifier
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
[Desc("Funds are transferred from the owner to the infiltrator.")]
|
[Desc("Funds are transferred from the owner to the infiltrator.")]
|
||||||
class InfiltrateForCashInfo : ITraitInfo
|
class InfiltrateForCashInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")]
|
[Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")]
|
||||||
public readonly BitSet<TargetableType> Types = default(BitSet<TargetableType>);
|
public readonly BitSet<TargetableType> Types = default(BitSet<TargetableType>);
|
||||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[Desc("Whether to show the cash tick indicators rising from the actor.")]
|
[Desc("Whether to show the cash tick indicators rising from the actor.")]
|
||||||
public readonly bool ShowTicks = true;
|
public readonly bool ShowTicks = true;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new InfiltrateForCash(this); }
|
public override object Create(ActorInitializer init) { return new InfiltrateForCash(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class InfiltrateForCash : INotifyInfiltrated
|
class InfiltrateForCash : INotifyInfiltrated
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
[Desc("Steal and reset the owner's exploration.")]
|
[Desc("Steal and reset the owner's exploration.")]
|
||||||
class InfiltrateForExplorationInfo : ITraitInfo
|
class InfiltrateForExplorationInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")]
|
[Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")]
|
||||||
public readonly BitSet<TargetableType> Types = default(BitSet<TargetableType>);
|
public readonly BitSet<TargetableType> Types = default(BitSet<TargetableType>);
|
||||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[Desc("Sound the perpetrator will hear after successful infiltration.")]
|
[Desc("Sound the perpetrator will hear after successful infiltration.")]
|
||||||
public readonly string InfiltrationNotification = null;
|
public readonly string InfiltrationNotification = null;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new InfiltrateForExploration(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new InfiltrateForExploration(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class InfiltrateForExploration : INotifyInfiltrated
|
class InfiltrateForExploration : INotifyInfiltrated
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
class InfiltrateForPowerOutageInfo : ITraitInfo
|
class InfiltrateForPowerOutageInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")]
|
[Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")]
|
||||||
public readonly BitSet<TargetableType> Types = default(BitSet<TargetableType>);
|
public readonly BitSet<TargetableType> Types = default(BitSet<TargetableType>);
|
||||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[Desc("Sound the perpetrator will hear after successful infiltration.")]
|
[Desc("Sound the perpetrator will hear after successful infiltration.")]
|
||||||
public readonly string InfiltrationNotification = null;
|
public readonly string InfiltrationNotification = null;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new InfiltrateForPowerOutage(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new InfiltrateForPowerOutage(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class InfiltrateForPowerOutage : INotifyOwnerChanged, INotifyInfiltrated
|
class InfiltrateForPowerOutage : INotifyOwnerChanged, INotifyInfiltrated
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
class InfiltrateForSupportPowerInfo : ITraitInfo
|
class InfiltrateForSupportPowerInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[ActorReference]
|
[ActorReference]
|
||||||
[FieldLoader.Require]
|
[FieldLoader.Require]
|
||||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[Desc("Sound the perpetrator will hear after successful infiltration.")]
|
[Desc("Sound the perpetrator will hear after successful infiltration.")]
|
||||||
public readonly string InfiltrationNotification = null;
|
public readonly string InfiltrationNotification = null;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new InfiltrateForSupportPower(this); }
|
public override object Create(ActorInitializer init) { return new InfiltrateForSupportPower(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class InfiltrateForSupportPower : INotifyInfiltrated
|
class InfiltrateForSupportPower : INotifyInfiltrated
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
class InfiltrateForSupportPowerResetInfo : ITraitInfo
|
class InfiltrateForSupportPowerResetInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")]
|
[Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")]
|
||||||
public readonly BitSet<TargetableType> Types = default(BitSet<TargetableType>);
|
public readonly BitSet<TargetableType> Types = default(BitSet<TargetableType>);
|
||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[Desc("Sound the perpetrator will hear after successful infiltration.")]
|
[Desc("Sound the perpetrator will hear after successful infiltration.")]
|
||||||
public readonly string InfiltrationNotification = null;
|
public readonly string InfiltrationNotification = null;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new InfiltrateForSupportPowerReset(this); }
|
public override object Create(ActorInitializer init) { return new InfiltrateForSupportPowerReset(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class InfiltrateForSupportPowerReset : INotifyInfiltrated
|
class InfiltrateForSupportPowerReset : INotifyInfiltrated
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
[Desc("Transform into a different actor type.")]
|
[Desc("Transform into a different actor type.")]
|
||||||
class InfiltrateForTransformInfo : ITraitInfo
|
class InfiltrateForTransformInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[ActorReference]
|
[ActorReference]
|
||||||
[FieldLoader.Require]
|
[FieldLoader.Require]
|
||||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")]
|
[Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")]
|
||||||
public readonly BitSet<TargetableType> Types = default(BitSet<TargetableType>);
|
public readonly BitSet<TargetableType> Types = default(BitSet<TargetableType>);
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new InfiltrateForTransform(init, this); }
|
public override object Create(ActorInitializer init) { return new InfiltrateForTransform(init, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class InfiltrateForTransform : INotifyInfiltrated
|
class InfiltrateForTransform : INotifyInfiltrated
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
class MadTankInfo : ITraitInfo, IRulesetLoaded, Requires<ExplodesInfo>, Requires<WithFacingSpriteBodyInfo>
|
class MadTankInfo : TraitInfo, IRulesetLoaded, Requires<ExplodesInfo>, Requires<WithFacingSpriteBodyInfo>
|
||||||
{
|
{
|
||||||
[SequenceReference]
|
[SequenceReference]
|
||||||
public readonly string ThumpSequence = "piston";
|
public readonly string ThumpSequence = "piston";
|
||||||
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[Desc("Types of damage that this trait causes to self while self-destructing. Leave empty for no damage types.")]
|
[Desc("Types of damage that this trait causes to self while self-destructing. Leave empty for no damage types.")]
|
||||||
public readonly BitSet<DamageType> DamageTypes = default(BitSet<DamageType>);
|
public readonly BitSet<DamageType> DamageTypes = default(BitSet<DamageType>);
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new MadTank(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new MadTank(init.Self, this); }
|
||||||
|
|
||||||
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
class MineInfo : ITraitInfo
|
class MineInfo : TraitInfo
|
||||||
{
|
{
|
||||||
public readonly BitSet<CrushClass> CrushClasses = default(BitSet<CrushClass>);
|
public readonly BitSet<CrushClass> CrushClasses = default(BitSet<CrushClass>);
|
||||||
public readonly bool AvoidFriendly = true;
|
public readonly bool AvoidFriendly = true;
|
||||||
public readonly bool BlockFriendly = true;
|
public readonly bool BlockFriendly = true;
|
||||||
public readonly BitSet<CrushClass> DetonateClasses = default(BitSet<CrushClass>);
|
public readonly BitSet<CrushClass> DetonateClasses = default(BitSet<CrushClass>);
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new Mine(this); }
|
public override object Create(ActorInitializer init) { return new Mine(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class Mine : ICrushable, INotifyCrushed
|
class Mine : ICrushable, INotifyCrushed
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
public class MinelayerInfo : ITraitInfo, Requires<RearmableInfo>
|
public class MinelayerInfo : TraitInfo, Requires<RearmableInfo>
|
||||||
{
|
{
|
||||||
[ActorReference]
|
[ActorReference]
|
||||||
public readonly string Mine = "minv";
|
public readonly string Mine = "minv";
|
||||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[Desc("Sprite overlay to use for minefield cells hidden behind fog or shroud.")]
|
[Desc("Sprite overlay to use for minefield cells hidden behind fog or shroud.")]
|
||||||
public readonly string TileUnknownName = "build-unknown";
|
public readonly string TileUnknownName = "build-unknown";
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new Minelayer(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new Minelayer(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Minelayer : IIssueOrder, IResolveOrder, ISync, IIssueDeployOrder, IOrderVoice, ITick
|
public class Minelayer : IIssueOrder, IResolveOrder, ISync, IIssueDeployOrder, IOrderVoice, ITick
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
[Desc("Apply palette full screen rotations during chronoshifts. Add this to the world actor.")]
|
[Desc("Apply palette full screen rotations during chronoshifts. Add this to the world actor.")]
|
||||||
public class ChronoshiftPaletteEffectInfo : ITraitInfo
|
public class ChronoshiftPaletteEffectInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[Desc("Measured in ticks.")]
|
[Desc("Measured in ticks.")]
|
||||||
public readonly int ChronoEffectLength = 60;
|
public readonly int ChronoEffectLength = 60;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new ChronoshiftPaletteEffect(this); }
|
public override object Create(ActorInitializer init) { return new ChronoshiftPaletteEffect(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ChronoshiftPaletteEffect : IPaletteModifier, ITick
|
public class ChronoshiftPaletteEffect : IPaletteModifier, ITick
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
[Desc("Palette effect used for blinking \"animations\" on actors.")]
|
[Desc("Palette effect used for blinking \"animations\" on actors.")]
|
||||||
class LightPaletteRotatorInfo : ITraitInfo
|
class LightPaletteRotatorInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[Desc("Palettes this effect should not apply to.")]
|
[Desc("Palettes this effect should not apply to.")]
|
||||||
public readonly HashSet<string> ExcludePalettes = new HashSet<string>();
|
public readonly HashSet<string> ExcludePalettes = new HashSet<string>();
|
||||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[Desc("Palette indices to rotate through.")]
|
[Desc("Palette indices to rotate through.")]
|
||||||
public readonly int[] RotationIndices = { 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 238, 237, 236, 235, 234, 233, 232, 231 };
|
public readonly int[] RotationIndices = { 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 238, 237, 236, 235, 234, 233, 232, 231 };
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new LightPaletteRotator(this); }
|
public override object Create(ActorInitializer init) { return new LightPaletteRotator(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class LightPaletteRotator : ITick, IPaletteModifier
|
class LightPaletteRotator : ITick, IPaletteModifier
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
class PortableChronoInfo : ITraitInfo, Requires<IMoveInfo>
|
class PortableChronoInfo : TraitInfo, Requires<IMoveInfo>
|
||||||
{
|
{
|
||||||
[Desc("Cooldown in ticks until the unit can teleport.")]
|
[Desc("Cooldown in ticks until the unit can teleport.")]
|
||||||
public readonly int ChargeDelay = 500;
|
public readonly int ChargeDelay = 500;
|
||||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[VoiceReference]
|
[VoiceReference]
|
||||||
public readonly string Voice = "Action";
|
public readonly string Voice = "Action";
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new PortableChrono(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new PortableChrono(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class PortableChrono : IIssueOrder, IResolveOrder, ITick, ISelectionBar, IOrderVoice, ISync
|
class PortableChrono : IIssueOrder, IResolveOrder, ITick, ISelectionBar, IOrderVoice, ISync
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
public class WithBuildingBibInfo : ITraitInfo, Requires<BuildingInfo>, IRenderActorPreviewSpritesInfo, IActorPreviewInitInfo, Requires<RenderSpritesInfo>
|
public class WithBuildingBibInfo : TraitInfo, Requires<BuildingInfo>, IRenderActorPreviewSpritesInfo, IActorPreviewInitInfo, Requires<RenderSpritesInfo>
|
||||||
{
|
{
|
||||||
[SequenceReference]
|
[SequenceReference]
|
||||||
public readonly string Sequence = "bib";
|
public readonly string Sequence = "bib";
|
||||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
|
|
||||||
public readonly bool HasMinibib = false;
|
public readonly bool HasMinibib = false;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new WithBuildingBib(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new WithBuildingBib(init.Self, this); }
|
||||||
|
|
||||||
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
|
public IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Cnc.Traits.Render
|
namespace OpenRA.Mods.Cnc.Traits.Render
|
||||||
{
|
{
|
||||||
[Desc("Renders the cargo loaded into the unit.")]
|
[Desc("Renders the cargo loaded into the unit.")]
|
||||||
public class WithCargoInfo : ITraitInfo, Requires<CargoInfo>, Requires<BodyOrientationInfo>
|
public class WithCargoInfo : TraitInfo, Requires<CargoInfo>, Requires<BodyOrientationInfo>
|
||||||
{
|
{
|
||||||
[Desc("Cargo position relative to turret or body in (forward, right, up) triples. The default offset should be in the middle of the list.")]
|
[Desc("Cargo position relative to turret or body in (forward, right, up) triples. The default offset should be in the middle of the list.")]
|
||||||
public readonly WVec[] LocalOffset = { WVec.Zero };
|
public readonly WVec[] LocalOffset = { WVec.Zero };
|
||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
|
|||||||
[Desc("Passenger CargoType to display.")]
|
[Desc("Passenger CargoType to display.")]
|
||||||
public readonly HashSet<string> DisplayTypes = new HashSet<string>();
|
public readonly HashSet<string> DisplayTypes = new HashSet<string>();
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new WithCargo(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new WithCargo(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WithCargo : ITick, IRender, INotifyPassengerEntered, INotifyPassengerExited
|
public class WithCargo : ITick, IRender, INotifyPassengerEntered, INotifyPassengerExited
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Traits.Render
|
namespace OpenRA.Mods.Cnc.Traits.Render
|
||||||
{
|
{
|
||||||
public class WithLandingCraftAnimationInfo : ITraitInfo, Requires<IMoveInfo>, Requires<WithSpriteBodyInfo>, Requires<CargoInfo>
|
public class WithLandingCraftAnimationInfo : TraitInfo, Requires<IMoveInfo>, Requires<WithSpriteBodyInfo>, Requires<CargoInfo>
|
||||||
{
|
{
|
||||||
public readonly HashSet<string> OpenTerrainTypes = new HashSet<string> { "Clear" };
|
public readonly HashSet<string> OpenTerrainTypes = new HashSet<string> { "Clear" };
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
|
|||||||
[Desc("Which sprite body to play the animation on.")]
|
[Desc("Which sprite body to play the animation on.")]
|
||||||
public readonly string Body = "body";
|
public readonly string Body = "body";
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new WithLandingCraftAnimation(init, this); }
|
public override object Create(ActorInitializer init) { return new WithLandingCraftAnimation(init, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WithLandingCraftAnimation : ITick
|
public class WithLandingCraftAnimation : ITick
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Cnc.Traits.Render
|
namespace OpenRA.Mods.Cnc.Traits.Render
|
||||||
{
|
{
|
||||||
[Desc("Provides an overlay for the Tiberian Dawn hover craft.")]
|
[Desc("Provides an overlay for the Tiberian Dawn hover craft.")]
|
||||||
public class WithRoofInfo : ITraitInfo, Requires<RenderSpritesInfo>
|
public class WithRoofInfo : TraitInfo, Requires<RenderSpritesInfo>
|
||||||
{
|
{
|
||||||
[SequenceReference]
|
[SequenceReference]
|
||||||
public readonly string Sequence = "roof";
|
public readonly string Sequence = "roof";
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new WithRoof(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new WithRoof(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WithRoof
|
public class WithRoof
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Cnc.Traits.Render
|
namespace OpenRA.Mods.Cnc.Traits.Render
|
||||||
{
|
{
|
||||||
[Desc("This actor displays a charge-up animation before firing.")]
|
[Desc("This actor displays a charge-up animation before firing.")]
|
||||||
public class WithTeslaChargeAnimationInfo : ITraitInfo, Requires<WithSpriteBodyInfo>, Requires<RenderSpritesInfo>
|
public class WithTeslaChargeAnimationInfo : TraitInfo, Requires<WithSpriteBodyInfo>, Requires<RenderSpritesInfo>
|
||||||
{
|
{
|
||||||
[SequenceReference]
|
[SequenceReference]
|
||||||
[Desc("Sequence to use for charge animation.")]
|
[Desc("Sequence to use for charge animation.")]
|
||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
|
|||||||
[Desc("Which sprite body to play the animation on.")]
|
[Desc("Which sprite body to play the animation on.")]
|
||||||
public readonly string Body = "body";
|
public readonly string Body = "body";
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new WithTeslaChargeAnimation(init, this); }
|
public override object Create(ActorInitializer init) { return new WithTeslaChargeAnimation(init, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WithTeslaChargeAnimation : INotifyTeslaCharging
|
public class WithTeslaChargeAnimation : INotifyTeslaCharging
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Cnc.Traits.Render
|
namespace OpenRA.Mods.Cnc.Traits.Render
|
||||||
{
|
{
|
||||||
[Desc("Rendered together with AttackCharge.")]
|
[Desc("Rendered together with AttackCharge.")]
|
||||||
public class WithTeslaChargeOverlayInfo : ITraitInfo, Requires<RenderSpritesInfo>
|
public class WithTeslaChargeOverlayInfo : TraitInfo, Requires<RenderSpritesInfo>
|
||||||
{
|
{
|
||||||
[SequenceReference]
|
[SequenceReference]
|
||||||
[Desc("Sequence name to use")]
|
[Desc("Sequence name to use")]
|
||||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
|
|||||||
[Desc("Custom palette is a player palette BaseName")]
|
[Desc("Custom palette is a player palette BaseName")]
|
||||||
public readonly bool IsPlayerPalette = false;
|
public readonly bool IsPlayerPalette = false;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new WithTeslaChargeOverlay(init, this); }
|
public override object Create(ActorInitializer init) { return new WithTeslaChargeOverlay(init, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WithTeslaChargeOverlay : INotifyTeslaCharging, INotifyDamageStateChanged, INotifySold
|
public class WithTeslaChargeOverlay : INotifyTeslaCharging, INotifyDamageStateChanged, INotifySold
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Cnc.Traits.Render
|
namespace OpenRA.Mods.Cnc.Traits.Render
|
||||||
{
|
{
|
||||||
// TODO: This trait is hacky and should go away as soon as we support granting a condition on docking, in favor of toggling two regular WithVoxelBodies
|
// TODO: This trait is hacky and should go away as soon as we support granting a condition on docking, in favor of toggling two regular WithVoxelBodies
|
||||||
public class WithVoxelUnloadBodyInfo : ITraitInfo, IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>
|
public class WithVoxelUnloadBodyInfo : TraitInfo, IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>
|
||||||
{
|
{
|
||||||
[Desc("Voxel sequence name to use when docked to a refinery.")]
|
[Desc("Voxel sequence name to use when docked to a refinery.")]
|
||||||
public readonly string UnloadSequence = "unload";
|
public readonly string UnloadSequence = "unload";
|
||||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
|
|||||||
[Desc("Defines if the Voxel should have a shadow.")]
|
[Desc("Defines if the Voxel should have a shadow.")]
|
||||||
public readonly bool ShowShadow = true;
|
public readonly bool ShowShadow = true;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new WithVoxelUnloadBody(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new WithVoxelUnloadBody(init.Self, this); }
|
||||||
|
|
||||||
public IEnumerable<ModelAnimation> RenderPreviewVoxels(
|
public IEnumerable<ModelAnimation> RenderPreviewVoxels(
|
||||||
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p)
|
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Traits.Render
|
namespace OpenRA.Mods.Cnc.Traits.Render
|
||||||
{
|
{
|
||||||
public class WithVoxelWalkerBodyInfo : ITraitInfo, IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>, Requires<IMoveInfo>, Requires<IFacingInfo>
|
public class WithVoxelWalkerBodyInfo : TraitInfo, IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>, Requires<IMoveInfo>, Requires<IFacingInfo>
|
||||||
{
|
{
|
||||||
public readonly string Sequence = "idle";
|
public readonly string Sequence = "idle";
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
|
|||||||
|
|
||||||
[Desc("Defines if the Voxel should have a shadow.")]
|
[Desc("Defines if the Voxel should have a shadow.")]
|
||||||
public readonly bool ShowShadow = true;
|
public readonly bool ShowShadow = true;
|
||||||
public object Create(ActorInitializer init) { return new WithVoxelWalkerBody(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new WithVoxelWalkerBody(init.Self, this); }
|
||||||
|
|
||||||
public IEnumerable<ModelAnimation> RenderPreviewVoxels(
|
public IEnumerable<ModelAnimation> RenderPreviewVoxels(
|
||||||
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p)
|
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, Func<WRot> orientation, int facings, PaletteReference p)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
public class TDGunboatInfo : ITraitInfo, IPositionableInfo, IFacingInfo, IMoveInfo, IActorPreviewInitInfo
|
public class TDGunboatInfo : TraitInfo, IPositionableInfo, IFacingInfo, IMoveInfo, IActorPreviewInitInfo
|
||||||
{
|
{
|
||||||
public readonly int Speed = 28;
|
public readonly int Speed = 28;
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[Desc("Facing to use for actor previews (map editor, color picker, etc). Only 64 and 192 supported.")]
|
[Desc("Facing to use for actor previews (map editor, color picker, etc). Only 64 and 192 supported.")]
|
||||||
public readonly int PreviewFacing = 64;
|
public readonly int PreviewFacing = 64;
|
||||||
|
|
||||||
public virtual object Create(ActorInitializer init) { return new TDGunboat(init, this); }
|
public override object Create(ActorInitializer init) { return new TDGunboat(init, this); }
|
||||||
|
|
||||||
public int GetInitialFacing() { return InitialFacing; }
|
public int GetInitialFacing() { return InitialFacing; }
|
||||||
|
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[Desc("A special case trait that re-grants a timed external condition when this actor transforms.",
|
[Desc("A special case trait that re-grants a timed external condition when this actor transforms.",
|
||||||
"This trait does not work with permanently granted external conditions.",
|
"This trait does not work with permanently granted external conditions.",
|
||||||
"This trait changes the external condition source, so cannot be used for conditions that may later be revoked")]
|
"This trait changes the external condition source, so cannot be used for conditions that may later be revoked")]
|
||||||
public class TransferTimedExternalConditionOnTransformInfo : ITraitInfo, Requires<TransformsInfo>
|
public class TransferTimedExternalConditionOnTransformInfo : TraitInfo, Requires<TransformsInfo>
|
||||||
{
|
{
|
||||||
[FieldLoader.Require]
|
[FieldLoader.Require]
|
||||||
[Desc("External condition to transfer")]
|
[Desc("External condition to transfer")]
|
||||||
public readonly string Condition = null;
|
public readonly string Condition = null;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new TransferTimedExternalConditionOnTransform(this); }
|
public override object Create(ActorInitializer init) { return new TransferTimedExternalConditionOnTransform(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TransferTimedExternalConditionOnTransform : IConditionTimerWatcher, INotifyTransform
|
public class TransferTimedExternalConditionOnTransform : IConditionTimerWatcher, INotifyTransform
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
[Desc("Adds the hard-coded shroud palette to the game")]
|
[Desc("Adds the hard-coded shroud palette to the game")]
|
||||||
class ShroudPaletteInfo : ITraitInfo
|
class ShroudPaletteInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[PaletteDefinition]
|
[PaletteDefinition]
|
||||||
[FieldLoader.Require]
|
[FieldLoader.Require]
|
||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[Desc("Palette type")]
|
[Desc("Palette type")]
|
||||||
public readonly bool Fog = false;
|
public readonly bool Fog = false;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new ShroudPalette(this); }
|
public override object Create(ActorInitializer init) { return new ShroudPalette(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class ShroudPalette : ILoadsPalettes, IProvidesAssetBrowserPalettes
|
class ShroudPalette : ILoadsPalettes, IProvidesAssetBrowserPalettes
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
[Desc("Adds the hard-coded shroud palette to the game")]
|
[Desc("Adds the hard-coded shroud palette to the game")]
|
||||||
class TSShroudPaletteInfo : ITraitInfo
|
class TSShroudPaletteInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[PaletteDefinition]
|
[PaletteDefinition]
|
||||||
[FieldLoader.Require]
|
[FieldLoader.Require]
|
||||||
[Desc("Internal palette name")]
|
[Desc("Internal palette name")]
|
||||||
public readonly string Name = "shroud";
|
public readonly string Name = "shroud";
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new TSShroudPalette(this); }
|
public override object Create(ActorInitializer init) { return new TSShroudPalette(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class TSShroudPalette : ILoadsPalettes, IProvidesAssetBrowserPalettes
|
class TSShroudPalette : ILoadsPalettes, IProvidesAssetBrowserPalettes
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Traits
|
namespace OpenRA.Mods.Cnc.Traits
|
||||||
{
|
{
|
||||||
public class VoxelNormalsPaletteInfo : ITraitInfo
|
public class VoxelNormalsPaletteInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[PaletteDefinition]
|
[PaletteDefinition]
|
||||||
public readonly string Name = "normals";
|
public readonly string Name = "normals";
|
||||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[Desc("Can be TiberianSun or RedAlert2")]
|
[Desc("Can be TiberianSun or RedAlert2")]
|
||||||
public readonly NormalType Type = NormalType.TiberianSun;
|
public readonly NormalType Type = NormalType.TiberianSun;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new VoxelNormalsPalette(this); }
|
public override object Create(ActorInitializer init) { return new VoxelNormalsPalette(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class VoxelNormalsPalette : ILoadsPalettes
|
public class VoxelNormalsPalette : ILoadsPalettes
|
||||||
|
|||||||
@@ -26,11 +26,11 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
this.emitError = emitError;
|
this.emitError = emitError;
|
||||||
|
|
||||||
foreach (var actorInfo in rules.Actors)
|
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);
|
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();
|
var actualType = traitInfo.GetType();
|
||||||
foreach (var field in actualType.GetFields())
|
foreach (var field in actualType.GetFields())
|
||||||
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CheckActorReference(ActorInfo actorInfo,
|
void CheckActorReference(ActorInfo actorInfo,
|
||||||
ITraitInfo traitInfo,
|
TraitInfo traitInfo,
|
||||||
FieldInfo fieldInfo,
|
FieldInfo fieldInfo,
|
||||||
IReadOnlyDictionary<string, ActorInfo> dict,
|
IReadOnlyDictionary<string, ActorInfo> dict,
|
||||||
ActorReferenceAttribute attribute)
|
ActorReferenceAttribute attribute)
|
||||||
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CheckWeaponReference(ActorInfo actorInfo,
|
void CheckWeaponReference(ActorInfo actorInfo,
|
||||||
ITraitInfo traitInfo,
|
TraitInfo traitInfo,
|
||||||
FieldInfo fieldInfo,
|
FieldInfo fieldInfo,
|
||||||
IReadOnlyDictionary<string, WeaponInfo> dict,
|
IReadOnlyDictionary<string, WeaponInfo> dict,
|
||||||
WeaponReferenceAttribute attribute)
|
WeaponReferenceAttribute attribute)
|
||||||
@@ -99,7 +99,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CheckVoiceReference(ActorInfo actorInfo,
|
void CheckVoiceReference(ActorInfo actorInfo,
|
||||||
ITraitInfo traitInfo,
|
TraitInfo traitInfo,
|
||||||
FieldInfo fieldInfo,
|
FieldInfo fieldInfo,
|
||||||
IReadOnlyDictionary<string, SoundInfo> dict,
|
IReadOnlyDictionary<string, SoundInfo> dict,
|
||||||
VoiceSetReferenceAttribute attribute)
|
VoiceSetReferenceAttribute attribute)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
var granted = new HashSet<string>();
|
var granted = new HashSet<string>();
|
||||||
var consumed = 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()
|
var fieldConsumed = trait.GetType().GetFields()
|
||||||
.Where(x => x.HasAttribute<ConsumedConditionReferenceAttribute>())
|
.Where(x => x.HasAttribute<ConsumedConditionReferenceAttribute>())
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
|
|
||||||
foreach (var actorInfo in rules.Actors)
|
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>());
|
var fields = traitInfo.GetType().GetFields().Where(f => f.HasAttribute<LocomotorReferenceAttribute>());
|
||||||
foreach (var field in fields)
|
foreach (var field in fields)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
{
|
{
|
||||||
foreach (var actorInfo in rules.Actors)
|
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();
|
var fields = traitInfo.GetType().GetFields();
|
||||||
foreach (var field in fields.Where(x => x.HasAttribute<NotificationReferenceAttribute>()))
|
foreach (var field in fields.Where(x => x.HasAttribute<NotificationReferenceAttribute>()))
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
|
|
||||||
foreach (var actorInfo in rules.Actors)
|
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();
|
var fields = traitInfo.GetType().GetFields();
|
||||||
foreach (var field in fields.Where(x => x.HasAttribute<PaletteReferenceAttribute>()))
|
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 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();
|
var fields = traitInfo.GetType().GetFields();
|
||||||
foreach (var field in fields.Where(x => x.HasAttribute<PaletteDefinitionAttribute>()))
|
foreach (var field in fields.Where(x => x.HasAttribute<PaletteDefinitionAttribute>()))
|
||||||
|
|||||||
@@ -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();
|
var fields = traitInfo.GetType().GetFields();
|
||||||
foreach (var field in fields)
|
foreach (var field in fields)
|
||||||
@@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CheckDefinitions(string image, SequenceReferenceAttribute sequenceReference,
|
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());
|
var definitions = sequenceDefinitions.FirstOrDefault(n => n.Key == image.ToLowerInvariant());
|
||||||
if (definitions != null)
|
if (definitions != null)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
{
|
{
|
||||||
foreach (var actorInfo in rules.Actors)
|
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>());
|
var fields = traitInfo.GetType().GetFields().Where(f => f.HasAttribute<VoiceSetReferenceAttribute>());
|
||||||
foreach (var field in fields)
|
foreach (var field in fields)
|
||||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Lint
|
|||||||
{
|
{
|
||||||
var soundInfo = rules.Voices[voiceSet.ToLowerInvariant()];
|
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>());
|
var fields = traitInfo.GetType().GetFields().Where(f => f.HasAttribute<VoiceReferenceAttribute>());
|
||||||
foreach (var field in fields)
|
foreach (var field in fields)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Orders
|
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, TargetModifiers, bool> canTarget;
|
||||||
readonly Func<Actor, bool> useEnterCursor;
|
readonly Func<Actor, bool> useEnterCursor;
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Scripting
|
namespace OpenRA.Mods.Common.Scripting
|
||||||
{
|
{
|
||||||
[Desc("Part of the new Lua API.")]
|
[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 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
|
public class LuaScript : ITick, IWorldLoaded, INotifyActorDisposing
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Desc("Allows map scripts to attach triggers to this actor via the Triggers global.")]
|
[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,
|
public sealed class ScriptTriggers : INotifyIdle, INotifyDamage, INotifyKilled, INotifyProduction, INotifyOtherProduction,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Tag trait for actors with `DeliversCash`.")]
|
[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.")]
|
[Desc("Accepted `DeliversCash` types. Leave empty to accept all types.")]
|
||||||
public readonly HashSet<string> ValidTypes = new HashSet<string>();
|
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.")]
|
[Desc("Play a randomly selected sound from this list when accepting cash.")]
|
||||||
public readonly string[] Sounds = { };
|
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
|
public class AcceptsDeliveredCash : INotifyCashTransfer
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Tag trait for actors with `DeliversExperience`.")]
|
[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.")]
|
[Desc("Accepted `DeliversExperience` types. Leave empty to accept all types.")]
|
||||||
public readonly HashSet<string> ValidTypes = new HashSet<string>();
|
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.")]
|
[Desc("Stance the delivering actor needs to enter.")]
|
||||||
public readonly Stance ValidStances = Stance.Ally;
|
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
|
public class AcceptsDeliveredExperience
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Causes aircraft husks that are spawned in the air to crash to the ground.")]
|
[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]
|
[WeaponReference]
|
||||||
[Desc("Explosion weapon that triggers when hitting ground.")]
|
[Desc("Explosion weapon that triggers when hitting ground.")]
|
||||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public WeaponInfo ExplosionWeapon { get; private set; }
|
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)
|
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(Explosion))
|
if (string.IsNullOrEmpty(Explosion))
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.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.")]
|
[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.")]
|
[Desc("Name of this ammo pool, used to link reload traits to this pool.")]
|
||||||
public readonly string Name = "primary";
|
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.")]
|
[Desc("The condition to grant to self for each ammo point in this pool.")]
|
||||||
public readonly string AmmoCondition = null;
|
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
|
public class AmmoPool : INotifyCreated, INotifyAttack, ISync
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.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.")]
|
[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]
|
[VoiceReference]
|
||||||
public readonly string Voice = "Action";
|
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?")]
|
[Desc("Can the actor be ordered to move in to shroud?")]
|
||||||
public readonly bool MoveIntoShroud = true;
|
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
|
class AttackMove : IResolveOrder, IOrderVoice
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.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.")]
|
[Desc("Number of facings for gameplay calculations. -1 indicates auto-detection from another trait.")]
|
||||||
public readonly int QuantizedFacings = -1;
|
public readonly int QuantizedFacings = -1;
|
||||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return Util.QuantizeFacing(facing, facings) * (256 / facings);
|
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
|
public class BodyOrientation : ISync
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
|||||||
return relative.Clamp(0.0f, 999.0f);
|
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;
|
var sum = 0;
|
||||||
foreach (var a in actors)
|
foreach (var a in actors)
|
||||||
@@ -253,7 +253,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
|||||||
return sum;
|
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 sum = 0;
|
||||||
var countActors = 0;
|
var countActors = 0;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.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;
|
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.")]
|
[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 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)
|
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Allows bridges to be targeted for demolition and repair.")]
|
[Desc("Allows bridges to be targeted for demolition and repair.")]
|
||||||
class BridgeHutInfo : IDemolishableInfo, ITraitInfo
|
class BridgeHutInfo : TraitInfo, IDemolishableInfo
|
||||||
{
|
{
|
||||||
[Desc("Bridge types to act on")]
|
[Desc("Bridge types to act on")]
|
||||||
public readonly string[] Types = { "GroundLevelBridge" };
|
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 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
|
class BridgeHut : INotifyCreated, IDemolishable, ITick
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Placeholder actor used for dead segments and bridge end ramps.")]
|
[Desc("Placeholder actor used for dead segments and bridge end ramps.")]
|
||||||
class BridgePlaceholderInfo : ITraitInfo
|
class BridgePlaceholderInfo : TraitInfo
|
||||||
{
|
{
|
||||||
public readonly string Type = "GroundLevelBridge";
|
public readonly string Type = "GroundLevelBridge";
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public readonly CVec[] NeighbourOffsets = { };
|
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
|
class BridgePlaceholder : IBridgeSegment, INotifyAddedToWorld, INotifyRemovedFromWorld
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
OccupiedPassableTransitOnly = '+'
|
OccupiedPassableTransitOnly = '+'
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BuildingInfo : ITraitInfo, IOccupySpaceInfo, IPlaceBuildingDecorationInfo
|
public class BuildingInfo : TraitInfo, IOccupySpaceInfo, IPlaceBuildingDecorationInfo
|
||||||
{
|
{
|
||||||
[Desc("Where you are allowed to place the building (Water, Clear, ...)")]
|
[Desc("Where you are allowed to place the building (Water, Clear, ...)")]
|
||||||
public readonly HashSet<string> TerrainTypes = new HashSet<string>();
|
public readonly HashSet<string> TerrainTypes = new HashSet<string>();
|
||||||
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public readonly string[] UndeploySounds = { };
|
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)
|
protected static object LoadFootprint(MiniYaml yaml)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("A dictionary of buildings placed on the map. Attach this to the world actor.")]
|
[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
|
public class BuildingInfluence
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Bridge actor that can't be passed underneath.")]
|
[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";
|
public readonly string TerrainType = "Bridge";
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
DemolishWeaponInfo = weapon;
|
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
|
class GroundLevelBridge : IBridgeSegment, INotifyAddedToWorld, INotifyRemovedFromWorld
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Allows bridges to be targeted for demolition and repair.")]
|
[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 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
|
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).")]
|
[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.")]
|
[Desc("The maximum allowed length of the line.")]
|
||||||
public readonly int Range = 5;
|
public readonly int Range = 5;
|
||||||
@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Delete generated segments when destroyed or sold.")]
|
[Desc("Delete generated segments when destroyed or sold.")]
|
||||||
public readonly bool SegmentsRequireNode = false;
|
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
|
public class LineBuild : INotifyKilled, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyLineBuildSegmentsChanged
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Used to waypoint units after production or repair is finished.")]
|
[Desc("Used to waypoint units after production or repair is finished.")]
|
||||||
public class RallyPointInfo : ITraitInfo
|
public class RallyPointInfo : TraitInfo
|
||||||
{
|
{
|
||||||
public readonly string Image = "rallypoint";
|
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.")]
|
[Desc("The speech notification to play when setting a new rallypoint.")]
|
||||||
public readonly string Notification = null;
|
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
|
public class RallyPoint : IIssueOrder, IResolveOrder, INotifyOwnerChanged, INotifyCreated
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.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.")]
|
[Desc("Actual harvester facing when docking, 0-255 counter-clock-wise.")]
|
||||||
public readonly int DockAngle = 0;
|
public readonly int DockAngle = 0;
|
||||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public readonly int TickVelocity = 2;
|
public readonly int TickVelocity = 2;
|
||||||
public readonly int TickRate = 10;
|
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,
|
public class Refinery : INotifyCreated, ITick, IAcceptResources, INotifySold, INotifyCapture,
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("This actor will play a fire animation over its body and take damage over time.")]
|
[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 string Anim = "1";
|
||||||
public readonly int Damage = 1;
|
public readonly int Damage = 1;
|
||||||
public readonly int Interval = 8;
|
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
|
class Burns : ITick, ISync
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Desc("Manages Captures and Capturable traits on an actor.")]
|
[Desc("Manages Captures and Capturable traits on an actor.")]
|
||||||
public class CaptureManagerInfo : ITraitInfo
|
public class CaptureManagerInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[GrantedConditionReference]
|
[GrantedConditionReference]
|
||||||
[Desc("Condition granted when capturing an actor.")]
|
[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?")]
|
[Desc("Should units friendly to the capturing actor auto-target this actor while it is being captured?")]
|
||||||
public readonly bool PreventsAutoTarget = true;
|
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)
|
public bool CanBeTargetedBy(FrozenActor frozenActor, Actor captor, Captures captures)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("This actor can transport Passenger actors.")]
|
[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.")]
|
[Desc("The maximum sum of Passenger.Weight that this actor can support.")]
|
||||||
public readonly int MaxWeight = 0;
|
public readonly int MaxWeight = 0;
|
||||||
@@ -82,7 +82,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[GrantedConditionReference]
|
[GrantedConditionReference]
|
||||||
public IEnumerable<string> LinterPassengerConditions { get { return PassengerConditions.Values; } }
|
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,
|
public class Cargo : IIssueOrder, IResolveOrder, IOrderVoice, INotifyCreated, INotifyKilled,
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.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
|
public class CarryableHarvester : INotifyCreated, INotifyHarvesterAction
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Transports actors with the `Carryable` trait.")]
|
[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.")]
|
[Desc("Delay (in ticks) on the ground while attaching an actor to the carryall.")]
|
||||||
public readonly int BeforeLoadDelay = 0;
|
public readonly int BeforeLoadDelay = 0;
|
||||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[VoiceReference]
|
[VoiceReference]
|
||||||
public readonly string Voice = "Action";
|
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,
|
public class Carryall : INotifyKilled, ISync, ITick, IRender, INotifyActorDisposing, IIssueOrder, IResolveOrder,
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Modifies the terrain type underneath the actors location.")]
|
[Desc("Modifies the terrain type underneath the actors location.")]
|
||||||
class ChangesTerrainInfo : ITraitInfo, Requires<ImmobileInfo>
|
class ChangesTerrainInfo : TraitInfo, Requires<ImmobileInfo>
|
||||||
{
|
{
|
||||||
[FieldLoader.Require]
|
[FieldLoader.Require]
|
||||||
public readonly string TerrainType = null;
|
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
|
class ChangesTerrain : INotifyAddedToWorld, INotifyRemovedFromWorld
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Displays fireports, muzzle offsets, and hit areas in developer mode.")]
|
[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
|
public class CombatDebugOverlay : IRenderAnnotations, INotifyDamage, INotifyCreated
|
||||||
|
|||||||
@@ -16,14 +16,12 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
/// <summary>Use as base class for *Info to subclass of ConditionalTrait. (See ConditionalTrait.)</summary>
|
/// <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]
|
[ConsumedConditionReference]
|
||||||
[Desc("Boolean expression defining the condition to enable this trait.")]
|
[Desc("Boolean expression defining the condition to enable this trait.")]
|
||||||
public readonly BooleanExpression RequiresCondition = null;
|
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
|
// 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
|
// This can go away after we introduce an InitialConditions ActorInit and have the traits query the
|
||||||
// condition directly
|
// condition directly
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Desc("Allows a condition to be granted from an external source (Lua, warheads, etc).")]
|
[Desc("Allows a condition to be granted from an external source (Lua, warheads, etc).")]
|
||||||
public class ExternalConditionInfo : ITraitInfo
|
public class ExternalConditionInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[GrantedConditionReference]
|
[GrantedConditionReference]
|
||||||
[FieldLoader.Require]
|
[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.")]
|
[Desc("If > 0, restrict the number of times that this condition can be granted by any source.")]
|
||||||
public readonly int TotalCap = 0;
|
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
|
public class ExternalCondition : ITick, INotifyCreated
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Grants a condition to this actor when it is owned by an AI bot.")]
|
[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]
|
[FieldLoader.Require]
|
||||||
[GrantedConditionReference]
|
[GrantedConditionReference]
|
||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Bot types that trigger the condition.")]
|
[Desc("Bot types that trigger the condition.")]
|
||||||
public readonly string[] Bots = { };
|
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
|
public class GrantConditionOnBotOwner : INotifyCreated, INotifyOwnerChanged
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Applies a condition to the actor at specified damage states.")]
|
[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]
|
[FieldLoader.Require]
|
||||||
[GrantedConditionReference]
|
[GrantedConditionReference]
|
||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Is the condition irrevocable once it has been activated?")]
|
[Desc("Is the condition irrevocable once it has been activated?")]
|
||||||
public readonly bool GrantPermanently = false;
|
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
|
public class GrantConditionOnDamageState : INotifyDamageStateChanged, INotifyCreated
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Applies a condition to the actor at when its health is between 2 specific values.")]
|
[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]
|
[FieldLoader.Require]
|
||||||
[GrantedConditionReference]
|
[GrantedConditionReference]
|
||||||
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Is the condition irrevokable once it has been granted?")]
|
[Desc("Is the condition irrevokable once it has been granted?")]
|
||||||
public readonly bool GrantPermanently = false;
|
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)
|
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
public class GrantConditionOnLineBuildDirectionInfo : ITraitInfo, Requires<LineBuildInfo>
|
public class GrantConditionOnLineBuildDirectionInfo : TraitInfo, Requires<LineBuildInfo>
|
||||||
{
|
{
|
||||||
[FieldLoader.Require]
|
[FieldLoader.Require]
|
||||||
[GrantedConditionReference]
|
[GrantedConditionReference]
|
||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Line build direction to trigger the condition.")]
|
[Desc("Line build direction to trigger the condition.")]
|
||||||
public readonly LineBuildDirection Direction = LineBuildDirection.X;
|
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
|
public class GrantConditionOnLineBuildDirection : INotifyCreated
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Grants a condition to this actor when the player has stored resources.")]
|
[Desc("Grants a condition to this actor when the player has stored resources.")]
|
||||||
public class GrantConditionOnPlayerResourcesInfo : ITraitInfo
|
public class GrantConditionOnPlayerResourcesInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[FieldLoader.Require]
|
[FieldLoader.Require]
|
||||||
[GrantedConditionReference]
|
[GrantedConditionReference]
|
||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Enable condition when the amount of stored resources is greater than this.")]
|
[Desc("Enable condition when the amount of stored resources is greater than this.")]
|
||||||
public readonly int Threshold = 0;
|
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
|
public class GrantConditionOnPlayerResources : INotifyCreated, INotifyOwnerChanged, ITick
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Grants a condition to the actor this is attached to when prerequisites are available.")]
|
[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]
|
[FieldLoader.Require]
|
||||||
[GrantedConditionReference]
|
[GrantedConditionReference]
|
||||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("List of required prerequisites.")]
|
[Desc("List of required prerequisites.")]
|
||||||
public readonly string[] 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
|
public class GrantConditionOnPrerequisite : INotifyCreated, INotifyAddedToWorld, INotifyRemovedFromWorld, INotifyOwnerChanged
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Grants a condition when this actor produces a specific actor.")]
|
[Desc("Grants a condition when this actor produces a specific actor.")]
|
||||||
public class GrantConditionOnProductionInfo : ITraitInfo
|
public class GrantConditionOnProductionInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[FieldLoader.Require]
|
[FieldLoader.Require]
|
||||||
[GrantedConditionReference]
|
[GrantedConditionReference]
|
||||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public readonly bool ShowSelectionBar = true;
|
public readonly bool ShowSelectionBar = true;
|
||||||
public readonly Color SelectionBarColor = Color.Magenta;
|
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
|
public class GrantConditionOnProduction : INotifyProduction, ITick, ISync, ISelectionBar
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
public class GrantConditionOnTerrainInfo : ITraitInfo
|
public class GrantConditionOnTerrainInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[FieldLoader.Require]
|
[FieldLoader.Require]
|
||||||
[GrantedConditionReference]
|
[GrantedConditionReference]
|
||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Terrain names to trigger the condition.")]
|
[Desc("Terrain names to trigger the condition.")]
|
||||||
public readonly string[] TerrainTypes = { };
|
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
|
public class GrantConditionOnTerrain : ITick
|
||||||
|
|||||||
@@ -13,14 +13,14 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
public class GrantConditionWhileAimingInfo : ITraitInfo
|
public class GrantConditionWhileAimingInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[FieldLoader.Require]
|
[FieldLoader.Require]
|
||||||
[GrantedConditionReference]
|
[GrantedConditionReference]
|
||||||
[Desc("The condition to grant while aiming.")]
|
[Desc("The condition to grant while aiming.")]
|
||||||
public readonly string Condition = null;
|
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
|
public class GrantConditionWhileAiming : INotifyAiming
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Grant a condition to the crushing actor.")]
|
[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.")]
|
[Desc("The condition to apply on a crush attempt. Must be included among the crusher actor's ExternalCondition traits.")]
|
||||||
public readonly string WarnCrushCondition = null;
|
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.")]
|
[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 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
|
public class GrantExternalConditionToCrusher : INotifyCrushed
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits.Conditions
|
namespace OpenRA.Mods.Common.Traits.Conditions
|
||||||
{
|
{
|
||||||
[Desc("Grants a random condition from a predefined list to the actor when created.")]
|
[Desc("Grants a random condition from a predefined list to the actor when created.")]
|
||||||
public class GrantRandomConditionInfo : ITraitInfo
|
public class GrantRandomConditionInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[FieldLoader.Require]
|
[FieldLoader.Require]
|
||||||
[GrantedConditionReference]
|
[GrantedConditionReference]
|
||||||
[Desc("List of conditions to grant from.")]
|
[Desc("List of conditions to grant from.")]
|
||||||
public readonly string[] Conditions = null;
|
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
|
public class GrantRandomCondition : INotifyCreated
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Draw a colored contrail behind this actor when they move.")]
|
[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")]
|
[Desc("Position relative to body")]
|
||||||
public readonly WVec Offset = WVec.Zero;
|
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?")]
|
[Desc("Use player remap color instead of a custom color?")]
|
||||||
public readonly bool UsePlayerColor = true;
|
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
|
class Contrail : ITick, IRender, INotifyAddedToWorld
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.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. " +
|
[Desc("Length of time (in seconds) until the crate gets removed automatically. " +
|
||||||
"A value of zero disables auto-removal.")]
|
"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.")]
|
[Desc("Define actors that can collect crates by setting this into the Crushes field from the Mobile trait.")]
|
||||||
public readonly string CrushClass = "crate";
|
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)
|
public IReadOnlyDictionary<CPos, SubCell> OccupiedCells(ActorInfo info, CPos location, SubCell subCell = SubCell.Any)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Donate money to actors with the `AcceptsDeliveredCash` trait.")]
|
[Desc("Donate money to actors with the `AcceptsDeliveredCash` trait.")]
|
||||||
class DeliversCashInfo : ITraitInfo
|
class DeliversCashInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[Desc("The amount of cash the owner receives.")]
|
[Desc("The amount of cash the owner receives.")]
|
||||||
public readonly int Payload = 500;
|
public readonly int Payload = 500;
|
||||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[VoiceReference]
|
[VoiceReference]
|
||||||
public readonly string Voice = "Action";
|
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
|
class DeliversCash : IIssueOrder, IResolveOrder, IOrderVoice, INotifyCashTransfer
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.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.")]
|
[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.")]
|
[Desc("The amount of experience the donating player receives.")]
|
||||||
public readonly int PlayerExperience = 0;
|
public readonly int PlayerExperience = 0;
|
||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[VoiceReference]
|
[VoiceReference]
|
||||||
public readonly string Voice = "Action";
|
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
|
class DeliversExperience : IIssueOrder, IResolveOrder, IOrderVoice
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Handle demolitions from C4 explosives.")]
|
[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; }
|
public bool IsValidTarget(ActorInfo actorInfo, Actor saboteur) { return true; }
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
class DemolitionInfo : ITraitInfo
|
class DemolitionInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[Desc("Delay to demolish the target once the explosive device is planted. " +
|
[Desc("Delay to demolish the target once the explosive device is planted. " +
|
||||||
"Measured in game ticks. Default is 1.8 seconds.")]
|
"Measured in game ticks. Default is 1.8 seconds.")]
|
||||||
@@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public readonly string Cursor = "c4";
|
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
|
class Demolition : IIssueOrder, IResolveOrder, IOrderVoice
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("This actor can interact with TunnelEntrances to move through TerrainTunnels.")]
|
[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 EnterCursor = "enter";
|
||||||
public readonly string EnterBlockedCursor = "enter-blocked";
|
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.")]
|
[Desc("Boolean expression defining the condition under which the regular (non-force) enter cursor is disabled.")]
|
||||||
public readonly BooleanExpression RequireForceMoveCondition = null;
|
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
|
public class EntersTunnels : IIssueOrder, IResolveOrder, IOrderVoice, IObservesVariables
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Displays `Exit` data for factories.")]
|
[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?")]
|
[Desc("Should cell vectors be drawn for each perimeter cell?")]
|
||||||
public readonly bool DrawPerimiterCellVectors = true;
|
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)?")]
|
[Desc("Should lines be drawn for each exit (from spawn offset to the center of the exit cell)?")]
|
||||||
public readonly bool DrawSpawnOffsetLines = true;
|
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
|
public class ExitsDebugOverlay : IRenderAnnotationsWhenSelected
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("This actor triggers an explosion on itself when transitioning to a specific damage state.")]
|
[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]
|
[WeaponReference]
|
||||||
[FieldLoader.Require]
|
[FieldLoader.Require]
|
||||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public WeaponInfo WeaponInfo { get; private set; }
|
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)
|
public void RulesetLoaded(Ruleset rules, ActorInfo ai)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("This actor's experience increases when it has killed a GivesExperience actor.")]
|
[Desc("This actor's experience increases when it has killed a GivesExperience actor.")]
|
||||||
public class GainsExperienceInfo : ITraitInfo
|
public class GainsExperienceInfo : TraitInfo
|
||||||
{
|
{
|
||||||
[FieldLoader.Require]
|
[FieldLoader.Require]
|
||||||
[Desc("Condition to grant at each level.",
|
[Desc("Condition to grant at each level.",
|
||||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[NotificationReference("Sounds")]
|
[NotificationReference("Sounds")]
|
||||||
public readonly string LevelUpNotification = null;
|
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
|
public class GainsExperience : INotifyCreated, ISync, IResolveOrder, ITransformActorInitModifier
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("This actor gives experience to a GainsExperience actor when they are killed.")]
|
[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.")]
|
[Desc("If -1, use the value of the unit cost.")]
|
||||||
public readonly int Experience = -1;
|
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.")]
|
[Desc("Percentage of the `Experience` value that is being granted to the player owning the killing actor.")]
|
||||||
public readonly int PlayerExperienceModifier = 0;
|
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
|
class GivesExperience : INotifyKilled
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user