Fix and enable SA1133, SA1134 style rules.

This commit is contained in:
Paul Chote
2019-05-23 18:43:21 +00:00
committed by abcdefg30
parent fbf9461890
commit 78a70be0d4
214 changed files with 1012 additions and 432 deletions

View File

@@ -16,7 +16,9 @@ namespace OpenRA.Mods.Common
{
public class FacingInit : IActorInit<int>
{
[FieldFromYamlKey] readonly int value = 128;
[FieldFromYamlKey]
readonly int value = 128;
public FacingInit() { }
public FacingInit(int init) { value = init; }
public int Value(World world) { return value; }
@@ -25,13 +27,16 @@ namespace OpenRA.Mods.Common
public class DynamicFacingInit : IActorInit<Func<int>>
{
readonly Func<int> func;
public DynamicFacingInit(Func<int> func) { this.func = func; }
public Func<int> Value(World world) { return func; }
}
public class SubCellInit : IActorInit<SubCell>
{
[FieldFromYamlKey] readonly byte value = (byte)SubCell.FullCell;
[FieldFromYamlKey]
readonly byte value = (byte)SubCell.FullCell;
public SubCellInit() { }
public SubCellInit(byte init) { value = init; }
public SubCellInit(SubCell init) { value = (byte)init; }
@@ -40,7 +45,9 @@ namespace OpenRA.Mods.Common
public class CenterPositionInit : IActorInit<WPos>
{
[FieldFromYamlKey] readonly WPos value = WPos.Zero;
[FieldFromYamlKey]
readonly WPos value = WPos.Zero;
public CenterPositionInit() { }
public CenterPositionInit(WPos init) { value = init; }
public WPos Value(World world) { return value; }
@@ -49,7 +56,8 @@ namespace OpenRA.Mods.Common
// Allows maps / transformations to specify the faction variant of an actor.
public class FactionInit : IActorInit<string>
{
[FieldFromYamlKey] public readonly string Faction;
[FieldFromYamlKey]
public readonly string Faction;
public FactionInit() { }
public FactionInit(string faction) { Faction = faction; }
@@ -58,7 +66,8 @@ namespace OpenRA.Mods.Common
public class EffectiveOwnerInit : IActorInit<Player>
{
[FieldFromYamlKey] readonly Player value = null;
[FieldFromYamlKey]
readonly Player value = null;
public EffectiveOwnerInit() { }
public EffectiveOwnerInit(Player owner) { value = owner; }

View File

@@ -49,8 +49,11 @@ namespace OpenRA
public readonly string Title;
[FieldLoader.Ignore] public readonly MiniYaml IDFiles;
[FieldLoader.Ignore] public readonly List<MiniYamlNode> Install;
[FieldLoader.Ignore]
public readonly MiniYaml IDFiles;
[FieldLoader.Ignore]
public readonly List<MiniYamlNode> Install;
public ModSource(MiniYaml yaml)
{

View File

@@ -82,9 +82,15 @@ namespace OpenRA.Mods.Common.Projectiles
readonly Color color;
readonly WDist speed;
[Sync] WPos headPos;
[Sync] WPos tailPos;
[Sync] WPos target;
[Sync]
WPos headPos;
[Sync]
WPos tailPos;
[Sync]
WPos target;
int length;
int towardsTargetFacing;
int headTicks;

View File

@@ -33,11 +33,13 @@ namespace OpenRA.Mods.Common.Projectiles
[Desc("Image to display.")]
public readonly string Image = null;
[SequenceReference("Image")]
[Desc("Loop a randomly chosen sequence of Image from this list while this projectile is moving.")]
[SequenceReference("Image")] public readonly string[] Sequences = { "idle" };
public readonly string[] Sequences = { "idle" };
[PaletteReference]
[Desc("The palette used to draw this projectile.")]
[PaletteReference] public readonly string Palette = "effect";
public readonly string Palette = "effect";
[Desc("Palette is a player palette BaseName")]
public readonly bool IsPlayerPalette = false;
@@ -45,14 +47,16 @@ namespace OpenRA.Mods.Common.Projectiles
[Desc("Does this projectile have a shadow?")]
public readonly bool Shadow = false;
[PaletteReference]
[Desc("Palette to use for this projectile's shadow if Shadow is true.")]
[PaletteReference] public readonly string ShadowPalette = "shadow";
public readonly string ShadowPalette = "shadow";
[Desc("Trail animation.")]
public readonly string TrailImage = null;
[SequenceReference("TrailImage")]
[Desc("Loop a randomly chosen sequence of TrailImage from this list while this projectile is moving.")]
[SequenceReference("TrailImage")] public readonly string[] TrailSequences = { "idle" };
public readonly string[] TrailSequences = { "idle" };
[Desc("Interval in ticks between each spawned Trail animation.")]
public readonly int TrailInterval = 2;
@@ -60,8 +64,9 @@ namespace OpenRA.Mods.Common.Projectiles
[Desc("Delay in ticks until trail animation is spawned.")]
public readonly int TrailDelay = 1;
[PaletteReference("TrailUsePlayerPalette")]
[Desc("Palette used to render the trail sequence.")]
[PaletteReference("TrailUsePlayerPalette")] public readonly string TrailPalette = "effect";
public readonly string TrailPalette = "effect";
[Desc("Use the Player Palette to render the trail sequence.")]
public readonly bool TrailUsePlayerPalette = false;

View File

@@ -20,21 +20,25 @@ namespace OpenRA.Mods.Common.Projectiles
{
public readonly string Image = null;
[SequenceReference("Image")]
[Desc("Loop a randomly chosen sequence of Image from this list while falling.")]
[SequenceReference("Image")] public readonly string[] Sequences = { "idle" };
public readonly string[] Sequences = { "idle" };
[SequenceReference("Image")]
[Desc("Sequence to play when launched. Skipped if null or empty.")]
[SequenceReference("Image")] public readonly string OpenSequence = null;
public readonly string OpenSequence = null;
[PaletteReference]
[Desc("The palette used to draw this projectile.")]
[PaletteReference] public readonly string Palette = "effect";
public readonly string Palette = "effect";
[Desc("Palette is a player palette BaseName")]
public readonly bool IsPlayerPalette = false;
public readonly bool Shadow = false;
[PaletteReference] public readonly string ShadowPalette = "shadow";
[PaletteReference]
public readonly string ShadowPalette = "shadow";
[Desc("Projectile movement vector per tick (forward, right, up), use negative values for opposite directions.")]
public readonly WVec Velocity = WVec.Zero;

View File

@@ -75,19 +75,23 @@ namespace OpenRA.Mods.Common.Projectiles
[Desc("Impact animation.")]
public readonly string HitAnim = null;
[SequenceReference("HitAnim")]
[Desc("Sequence of impact animation to use.")]
[SequenceReference("HitAnim")] public readonly string HitAnimSequence = "idle";
public readonly string HitAnimSequence = "idle";
[PaletteReference] public readonly string HitAnimPalette = "effect";
[PaletteReference]
public readonly string HitAnimPalette = "effect";
[Desc("Image containing launch effect sequence.")]
public readonly string LaunchEffectImage = null;
[SequenceReference("LaunchEffectImage")]
[Desc("Launch effect sequence to play.")]
[SequenceReference("LaunchEffectImage")] public readonly string LaunchEffectSequence = null;
public readonly string LaunchEffectSequence = null;
[PaletteReference]
[Desc("Palette to use for launch effect.")]
[PaletteReference] public readonly string LaunchEffectPalette = "effect";
public readonly string LaunchEffectPalette = "effect";
public IProjectile Create(ProjectileArgs args)
{

View File

@@ -26,11 +26,13 @@ namespace OpenRA.Mods.Common.Projectiles
[Desc("Name of the image containing the projectile sequence.")]
public readonly string Image = null;
[SequenceReference("Image")]
[Desc("Loop a randomly chosen sequence of Image from this list while this projectile is moving.")]
[SequenceReference("Image")] public readonly string[] Sequences = { "idle" };
public readonly string[] Sequences = { "idle" };
[PaletteReference]
[Desc("Palette used to render the projectile sequence.")]
[PaletteReference] public readonly string Palette = "effect";
public readonly string Palette = "effect";
[Desc("Palette is a player palette BaseName")]
public readonly bool IsPlayerPalette = false;
@@ -101,11 +103,13 @@ namespace OpenRA.Mods.Common.Projectiles
[Desc("Image that contains the trail animation.")]
public readonly string TrailImage = null;
[SequenceReference("TrailImage")]
[Desc("Loop a randomly chosen sequence of TrailImage from this list while this projectile is moving.")]
[SequenceReference("TrailImage")] public readonly string[] TrailSequences = { "idle" };
public readonly string[] TrailSequences = { "idle" };
[PaletteReference("TrailUsePlayerPalette")]
[Desc("Palette used to render the trail sequence.")]
[PaletteReference("TrailUsePlayerPalette")] public readonly string TrailPalette = "effect";
public readonly string TrailPalette = "effect";
[Desc("Use the Player Palette to render the trail sequence.")]
public readonly bool TrailUsePlayerPalette = false;

View File

@@ -19,7 +19,8 @@ namespace OpenRA.Mods.Common.SpriteLoaders
{
public class ShpD2Loader : ISpriteLoader
{
[Flags] enum FormatFlags : int
[Flags]
enum FormatFlags : int
{
PaletteTable = 1,
NotLCWCompressed = 2,

View File

@@ -33,9 +33,14 @@ namespace OpenRA.Mods.Common.Traits
readonly HashSet<PPos> footprint;
[Sync] CPos cachedLocation;
[Sync] WDist cachedRange;
[Sync] protected bool CachedTraitDisabled { get; private set; }
[Sync]
CPos cachedLocation;
[Sync]
WDist cachedRange;
[Sync]
protected bool CachedTraitDisabled { get; private set; }
protected abstract void AddCellsToPlayerShroud(Actor self, Player player, PPos[] uv);
protected abstract void RemoveCellsFromPlayerShroud(Actor self, Player player);

View File

@@ -58,7 +58,8 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Types of damage that are caused while crushing. Leave empty for no damage types.")]
public readonly BitSet<DamageType> CrushDamageTypes = default(BitSet<DamageType>);
[VoiceReference] public readonly string Voice = "Action";
[VoiceReference]
public readonly string Voice = "Action";
[GrantedConditionReference]
[Desc("The condition to grant to self while airborne.")]
@@ -184,8 +185,12 @@ namespace OpenRA.Mods.Common.Traits
IEnumerable<int> speedModifiers;
INotifyMoving[] notifyMoving;
[Sync] public int Facing { get; set; }
[Sync] public WPos CenterPosition { get; private set; }
[Sync]
public int Facing { get; set; }
[Sync]
public WPos CenterPosition { get; private set; }
public CPos TopLeft { get { return self.World.Map.CellContaining(CenterPosition); } }
public int TurnSpeed { get { return Info.TurnSpeed; } }
public Actor ReservedActor { get; private set; }

View File

@@ -27,9 +27,15 @@ namespace OpenRA.Mods.Common.Traits
public class AttackBomber : AttackBase, ITick, ISync, INotifyRemovedFromWorld
{
readonly AttackBomberInfo info;
[Sync] Target target;
[Sync] bool inAttackRange;
[Sync] bool facingTarget = true;
[Sync]
Target target;
[Sync]
bool inAttackRange;
[Sync]
bool facingTarget = true;
public event Action<Actor> OnRemovedFromWorld = self => { };
public event Action<Actor> OnEnteredAttackRange = self => { };

View File

@@ -63,9 +63,11 @@ namespace OpenRA.Mods.Common.Traits
ConditionManager conditionManager;
// HACK: Temporarily needed until Rearm activity is gone for good
[Sync] public int RemainingTicks;
[Sync]
public int RemainingTicks;
[Sync] int currentAmmo;
[Sync]
int currentAmmo;
public AmmoPool(Actor self, AmmoPoolInfo info)
{

View File

@@ -29,7 +29,8 @@ namespace OpenRA.Mods.Common.Traits
{
public readonly string Name = "primary";
[WeaponReference, FieldLoader.Require]
[WeaponReference]
[FieldLoader.Require]
[Desc("Has to be defined in weapons.yaml as well.")]
public readonly string Weapon = null;
@@ -55,8 +56,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Muzzle flash sequence to render")]
public readonly string MuzzleSequence = null;
[PaletteReference]
[Desc("Palette to render Muzzle flash sequence in")]
[PaletteReference] public readonly string MuzzlePalette = "effect";
public readonly string MuzzlePalette = "effect";
[Desc("Use multiple muzzle images if non-zero")]
public readonly int MuzzleSplitFacings = 0;

View File

@@ -37,7 +37,8 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Force-fire mode ignores actors and targets the ground instead.")]
public readonly bool ForceFireIgnoresActors = false;
[VoiceReference] public readonly string Voice = "Action";
[VoiceReference]
public readonly string Voice = "Action";
[Desc("Tolerance for attack angle. Range [0, 128], 128 covers 360 degrees.")]
public readonly int FacingTolerance = 128;
@@ -58,7 +59,9 @@ namespace OpenRA.Mods.Common.Traits
readonly string attackOrderName = "Attack";
readonly string forceAttackOrderName = "ForceAttack";
[Sync] public bool IsAiming { get; set; }
[Sync]
public bool IsAiming { get; set; }
public IEnumerable<Armament> Armaments { get { return getArmaments(); } }
protected IFacing facing;

View File

@@ -44,7 +44,8 @@ namespace OpenRA.Mods.Common.Traits
public FirePort[] Ports { get; private set; }
[PaletteReference] public readonly string MuzzlePalette = "effect";
[PaletteReference]
public readonly string MuzzlePalette = "effect";
public override object Create(ActorInitializer init) { return new AttackGarrisoned(init.Self, this); }
public override void RulesetLoaded(Ruleset rules, ActorInfo ai)

View File

@@ -22,7 +22,8 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Provides access to the attack-move command, which will make the actor automatically engage viable targets while moving to the destination.")]
class AttackMoveInfo : ITraitInfo, Requires<IMoveInfo>
{
[VoiceReference] public readonly string Voice = "Action";
[VoiceReference]
public readonly string Voice = "Action";
[GrantedConditionReference]
[Desc("The condition to grant to self while an attack-move is active.")]

View File

@@ -127,11 +127,13 @@ namespace OpenRA.Mods.Common.Traits
public class AutoTarget : ConditionalTrait<AutoTargetInfo>, INotifyIdle, INotifyDamage, ITick, IResolveOrder, ISync, INotifyCreated, INotifyOwnerChanged
{
public readonly IEnumerable<AttackBase> ActiveAttackBases;
[Sync] int nextScanTime = 0;
[Sync]
int nextScanTime = 0;
public UnitStance Stance { get { return stance; } }
[Sync] public Actor Aggressor;
[Sync]
public Actor Aggressor;
// NOT SYNCED: do not refer to this anywhere other than UI code
public UnitStance PredictedStance;
@@ -441,7 +443,9 @@ namespace OpenRA.Mods.Common.Traits
public class StanceInit : IActorInit<UnitStance>
{
[FieldFromYamlKey] readonly UnitStance value = UnitStance.AttackAnything;
[FieldFromYamlKey]
readonly UnitStance value = UnitStance.AttackAnything;
public StanceInit() { }
public StanceInit(UnitStance init) { value = init; }
public UnitStance Value(World world) { return value; }

View File

@@ -66,7 +66,8 @@ namespace OpenRA.Mods.Common.Traits
readonly BodyOrientationInfo info;
readonly Lazy<int> quantizedFacings;
[Sync] public int QuantizedFacings { get { return quantizedFacings.Value; } }
[Sync]
public int QuantizedFacings { get { return quantizedFacings.Value; } }
public BodyOrientation(ActorInitializer init, BodyOrientationInfo info)
{

View File

@@ -34,11 +34,13 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Force a specific faction variant, overriding the faction of the producing actor.")]
public readonly string ForceFaction = null;
[SequenceReference]
[Desc("Sequence of the actor that contains the icon.")]
[SequenceReference] public readonly string Icon = "icon";
public readonly string Icon = "icon";
[PaletteReference]
[Desc("Palette used for the production icon.")]
[PaletteReference] public readonly string IconPalette = "chrome";
public readonly string IconPalette = "chrome";
[Desc("Base build time in frames (-1 indicates to use the unit's Value).")]
public readonly int BuildDuration = -1;
@@ -49,8 +51,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Sort order for the production palette. Smaller numbers are presented earlier.")]
public readonly int BuildPaletteOrder = 9999;
[Translate]
[Desc("Text shown in the production tooltip.")]
[Translate] public readonly string Description = "";
public readonly string Description = "";
public static string GetInitialFaction(ActorInfo ai, string defaultFaction)
{

View File

@@ -40,8 +40,9 @@ namespace OpenRA.Mods.Common.Traits
public readonly int[] NorthOffset = null;
public readonly int[] SouthOffset = null;
[WeaponReference]
[Desc("The name of the weapon to use when demolishing the bridge")]
[WeaponReference] public readonly string DemolishWeapon = "Demolish";
public readonly string DemolishWeapon = "Demolish";
public WeaponInfo DemolishWeaponInfo { get; private set; }

View File

@@ -21,8 +21,9 @@ namespace OpenRA.Mods.Common.Traits
public readonly DamageState DamageState = DamageState.Undamaged;
[ActorReference]
[Desc("Actor type to replace with on repair.")]
[ActorReference] public readonly string ReplaceWithActor = null;
public readonly string ReplaceWithActor = null;
public readonly CVec[] NeighbourOffsets = { };

View File

@@ -247,7 +247,9 @@ namespace OpenRA.Mods.Common.Traits
{
public readonly BuildingInfo Info;
[Sync] readonly CPos topLeft;
[Sync]
readonly CPos topLeft;
readonly Actor self;
readonly BuildingInfluence influence;

View File

@@ -18,7 +18,8 @@ namespace OpenRA.Mods.Common.Traits
"If you want more than one unit to appear copy this section and assign IDs like FreeActor@2, ...")]
public class FreeActorInfo : ConditionalTraitInfo
{
[ActorReference, FieldLoader.Require]
[ActorReference]
[FieldLoader.Require]
[Desc("Name of the actor.")]
public readonly string Actor = null;

View File

@@ -19,7 +19,8 @@ namespace OpenRA.Mods.Common.Traits
"If you want more than one unit to be delivered, copy this section and assign IDs like FreeActorWithDelivery@2, ...")]
public class FreeActorWithDeliveryInfo : FreeActorInfo
{
[ActorReference, FieldLoader.Require]
[ActorReference]
[FieldLoader.Require]
[Desc("Name of the delivering actor. This actor must have the `Carryall` trait")]
public readonly string DeliveringActor = null;

View File

@@ -42,7 +42,10 @@ namespace OpenRA.Mods.Common.Traits
public readonly IEnumerable<CPos> Footprint;
public readonly int OpenPosition;
[Sync] public int Position { get; private set; }
[Sync]
public int Position { get; private set; }
int desiredPosition;
int remainingOpenTime;

View File

@@ -26,8 +26,9 @@ namespace OpenRA.Mods.Common.Traits
public readonly CVec[] NeighbourOffsets = { };
[WeaponReference]
[Desc("The name of the weapon to use when demolishing the bridge")]
[WeaponReference] public readonly string DemolishWeapon = "Demolish";
public readonly string DemolishWeapon = "Demolish";
public WeaponInfo DemolishWeaponInfo { get; private set; }

View File

@@ -18,7 +18,9 @@ namespace OpenRA.Mods.Common.Traits
public enum LineBuildDirection { Unset, X, Y }
public class LineBuildDirectionInit : IActorInit<LineBuildDirection>
{
[FieldFromYamlKey] readonly LineBuildDirection value = LineBuildDirection.Unset;
[FieldFromYamlKey]
readonly LineBuildDirection value = LineBuildDirection.Unset;
public LineBuildDirectionInit() { }
public LineBuildDirectionInit(LineBuildDirection init) { value = init; }
public LineBuildDirection Value(World world) { return value; }
@@ -26,7 +28,9 @@ namespace OpenRA.Mods.Common.Traits
public class LineBuildParentInit : IActorInit<Actor[]>
{
[FieldFromYamlKey] public readonly string[] ParentNames = new string[0];
[FieldFromYamlKey]
public readonly string[] ParentNames = new string[0];
readonly Actor[] parents = null;
public LineBuildParentInit() { }

View File

@@ -20,13 +20,18 @@ namespace OpenRA.Mods.Common.Traits
public class RallyPointInfo : ITraitInfo
{
public readonly string Image = "rallypoint";
[SequenceReference("Image")] public readonly string FlagSequence = "flag";
[SequenceReference("Image")] public readonly string CirclesSequence = "circles";
[SequenceReference("Image")]
public readonly string FlagSequence = "flag";
[SequenceReference("Image")]
public readonly string CirclesSequence = "circles";
public readonly string Cursor = "ability";
[PaletteReference("IsPlayerPalette")]
[Desc("Custom indicator palette name")]
[PaletteReference("IsPlayerPalette")] public readonly string Palette = "player";
public readonly string Palette = "player";
[Desc("Custom palette is a player palette BaseName")]
public readonly bool IsPlayerPalette = true;
@@ -40,7 +45,9 @@ namespace OpenRA.Mods.Common.Traits
{
const string OrderID = "SetRallyPoint";
[Sync] public CPos Location;
[Sync]
public CPos Location;
public RallyPointInfo Info;
public string PaletteName { get; private set; }

View File

@@ -63,8 +63,11 @@ namespace OpenRA.Mods.Common.Traits
int currentDisplayTick = 0;
int currentDisplayValue = 0;
[Sync] Actor dockedHarv = null;
[Sync] bool preventDock = false;
[Sync]
Actor dockedHarv = null;
[Sync]
bool preventDock = false;
public bool AllowDocking { get { return !preventDock; } }
public CVec DeliveryOffset { get { return info.DockOffset; } }

View File

@@ -28,7 +28,8 @@ namespace OpenRA.Mods.Common.Traits
class Burns : ITick, ISync
{
readonly BurnsInfo info;
[Sync] int ticks;
[Sync]
int ticks;
public Burns(Actor self, BurnsInfo info)
{

View File

@@ -50,7 +50,8 @@ namespace OpenRA.Mods.Common.Traits
public readonly string EnterCursor = "enter";
public readonly string EnterBlockedCursor = "enter-blocked";
[VoiceReference] public readonly string Voice = "Action";
[VoiceReference]
public readonly string Voice = "Action";
public override object Create(ActorInitializer init) { return new Captures(init.Self, this); }
}

View File

@@ -43,8 +43,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Terrain types that this actor is allowed to eject actors onto. Leave empty for all terrain types.")]
public readonly HashSet<string> UnloadTerrainTypes = new HashSet<string>();
[VoiceReference]
[Desc("Voice to play when ordered to unload the passengers.")]
[VoiceReference] public readonly string UnloadVoice = "Action";
public readonly string UnloadVoice = "Action";
[Desc("Which direction the passenger will face (relative to the transport) when unloading.")]
public readonly int PassengerFacing = 128;

View File

@@ -75,7 +75,8 @@ namespace OpenRA.Mods.Common.Traits
readonly Actor self;
// The actor we are currently carrying.
[Sync] public Actor Carryable { get; private set; }
[Sync]
public Actor Carryable { get; private set; }
public CarryallState State { get; private set; }
int cachedFacing;

View File

@@ -40,7 +40,8 @@ namespace OpenRA.Mods.Common.Traits
{
readonly CashTricklerInfo info;
PlayerResources resources;
[Sync] public int Ticks { get; private set; }
[Sync]
public int Ticks { get; private set; }
public CashTrickler(CashTricklerInfo info)
: base(info)

View File

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

View File

@@ -53,7 +53,8 @@ namespace OpenRA.Mods.Common.Traits
public readonly string CloakSound = null;
public readonly string UncloakSound = null;
[PaletteReference("IsPlayerPalette")] public readonly string Palette = "cloak";
[PaletteReference("IsPlayerPalette")]
public readonly string Palette = "cloak";
public readonly bool IsPlayerPalette = false;
public readonly BitSet<CloakType> CloakTypes = new BitSet<CloakType>("Cloak");
@@ -68,7 +69,9 @@ namespace OpenRA.Mods.Common.Traits
public class Cloak : PausableConditionalTrait<CloakInfo>, IRenderModifier, INotifyDamage, INotifyUnload, INotifyDemolition, INotifyInfiltration,
INotifyAttack, ITick, IVisibilityModifier, IRadarColorModifier, INotifyCreated, INotifyHarvesterAction
{
[Sync] int remainingTime;
[Sync]
int remainingTime;
bool isDocking;
ConditionManager conditionManager;
Cloak[] otherCloaks;

View File

@@ -51,7 +51,8 @@ namespace OpenRA.Mods.Common.Traits
yield return new VariableObserver(RequiredConditionsChanged, Info.RequiresCondition.Variables);
}
[Sync] public bool IsTraitDisabled { get; private set; }
[Sync]
public bool IsTraitDisabled { get; private set; }
public ConditionalTrait(InfoType info)
{

View File

@@ -54,7 +54,8 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Skip make/deploy animation?")]
public readonly bool SkipMakeAnimation = false;
[VoiceReference] public readonly string Voice = "Action";
[VoiceReference]
public readonly string Voice = "Action";
public override object Create(ActorInitializer init) { return new GrantConditionOnDeploy(init, this); }
}

View File

@@ -44,7 +44,9 @@ namespace OpenRA.Mods.Common.Traits
ConditionManager conditionManager;
int token = ConditionManager.InvalidConditionToken;
[Sync] int ticks;
[Sync]
int ticks;
public GrantConditionOnProduction(Actor self, GrantConditionOnProductionInfo info)
{

View File

@@ -38,7 +38,8 @@ namespace OpenRA.Mods.Common.Traits
/// </summary>
public abstract class PausableConditionalTrait<InfoType> : ConditionalTrait<InfoType> where InfoType : PausableConditionalTraitInfo
{
[Sync] public bool IsTraitPaused { get; private set; }
[Sync]
public bool IsTraitPaused { get; private set; }
protected PausableConditionalTrait(InfoType info) : base(info) { IsTraitPaused = info.PausedByDefault; }

View File

@@ -46,7 +46,8 @@ namespace OpenRA.Mods.Common.Traits
int conditionToken = ConditionManager.InvalidConditionToken;
// If the trait is paused this may be true with no condition granted
[Sync] bool enabled = false;
[Sync]
bool enabled = false;
public ToggleConditionOnOrder(Actor self, ToggleConditionOnOrderInfo info)
: base(info) { }

View File

@@ -79,8 +79,11 @@ namespace OpenRA.Mods.Common.Traits
readonly CrateInfo info;
bool collected;
[Sync] int ticks;
[Sync] public CPos Location;
[Sync]
int ticks;
[Sync]
public CPos Location;
public Crate(ActorInitializer init, CrateInfo info)
{

View File

@@ -23,17 +23,20 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Image containing the crate effect animation sequence.")]
public readonly string Image = "crate-effects";
[SequenceReference("Image")]
[Desc("Animation sequence played when collected. Leave empty for no effect.")]
[SequenceReference("Image")] public readonly string Sequence = null;
public readonly string Sequence = null;
[PaletteReference]
[Desc("Palette to draw the animation in.")]
[PaletteReference] public readonly string Palette = "effect";
public readonly string Palette = "effect";
[Desc("Audio clip to play when the crate is collected.")]
public readonly string Sound = null;
[NotificationReference("Speech")]
[Desc("Notification to play when the crate is collected.")]
[NotificationReference("Speech")] public readonly string Notification = null;
public readonly string Notification = null;
[Desc("The earliest time (in ticks) that this crate action can occur on.")]
public readonly int TimeDelay = 0;
@@ -41,8 +44,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Only allow this crate action when the collector has these prerequisites")]
public readonly string[] Prerequisites = { };
[ActorReference]
[Desc("Actor types that this crate action will not occur for.")]
[ActorReference] public string[] ExcludedActorTypes = { };
public string[] ExcludedActorTypes = { };
public override object Create(ActorInitializer init) { return new CrateAction(init.Self, this); }
}

View File

@@ -17,8 +17,10 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Fires a weapon at the location when collected.")]
class ExplodeCrateActionInfo : CrateActionInfo
{
[WeaponReference]
[FieldLoader.Require]
[Desc("The weapon to fire upon collection.")]
[WeaponReference, FieldLoader.Require] public string Weapon = null;
public string Weapon = null;
public override object Create(ActorInitializer init) { return new ExplodeCrateAction(init.Self, this); }
}

View File

@@ -19,8 +19,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Spawns units when collected.")]
class GiveUnitCrateActionInfo : CrateActionInfo
{
[ActorReference]
[FieldLoader.Require]
[Desc("The list of units to spawn.")]
[ActorReference, FieldLoader.Require]
public readonly string[] Units = { };
[Desc("Factions that are allowed to trigger this action.")]

View File

@@ -17,8 +17,10 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Gives a supportpower to the collector.")]
class SupportPowerCrateActionInfo : CrateActionInfo
{
[ActorReference]
[FieldLoader.Require]
[Desc("Which proxy actor, which grants the support power, to spawn.")]
[ActorReference, FieldLoader.Require] public readonly string Proxy = null;
public readonly string Proxy = null;
public override object Create(ActorInitializer init) { return new SupportPowerCrateAction(init.Self, this); }
}

View File

@@ -18,8 +18,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("This actor receives damage from the given weapon when on the specified terrain type.")]
class DamagedByTerrainInfo : ConditionalTraitInfo, Requires<IHealthInfo>
{
[FieldLoader.Require]
[Desc("Amount of damage received per DamageInterval ticks.")]
[FieldLoader.Require] public readonly int Damage = 0;
public readonly int Damage = 0;
[Desc("Delay between receiving damage.")]
public readonly int DamageInterval = 0;
@@ -27,8 +28,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Apply the damage using these damagetypes.")]
public readonly BitSet<DamageType> DamageTypes = default(BitSet<DamageType>);
[FieldLoader.Require]
[Desc("Terrain types where the actor will take damage.")]
[FieldLoader.Require] public readonly string[] Terrain = { };
public readonly string[] Terrain = { };
[Desc("Percentage health below which the actor will not receive further damage.")]
public readonly int DamageThreshold = 0;
@@ -43,8 +45,11 @@ namespace OpenRA.Mods.Common.Traits
{
readonly IHealth health;
[Sync] int damageTicks;
[Sync] int damageThreshold;
[Sync]
int damageTicks;
[Sync]
int damageThreshold;
public DamagedByTerrain(Actor self, DamagedByTerrainInfo info) : base(info)
{

View File

@@ -32,7 +32,8 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Sound to play when delivering cash")]
public readonly string[] Sounds = { };
[VoiceReference] public readonly string Voice = "Action";
[VoiceReference]
public readonly string Voice = "Action";
public object Create(ActorInitializer init) { return new DeliversCash(this); }
}

View File

@@ -26,7 +26,8 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Identifier checked against AcceptsDeliveredExperience.ValidTypes. Only needed if the latter is not empty.")]
public readonly string Type = null;
[VoiceReference] public readonly string Voice = "Action";
[VoiceReference]
public readonly string Voice = "Action";
public object Create(ActorInitializer init) { return new DeliversExperience(init, this); }
}

View File

@@ -37,8 +37,9 @@ namespace OpenRA.Mods.Common.Traits
"Possible values are Exit, Suicide, Dispose.")]
public readonly EnterBehaviour EnterBehaviour = EnterBehaviour.Exit;
[VoiceReference]
[Desc("Voice string when planting explosive charges.")]
[VoiceReference] public readonly string Voice = "Action";
public readonly string Voice = "Action";
public readonly Stance TargetStances = Stance.Enemy | Stance.Neutral;
public readonly Stance ForceTargetStances = Stance.Enemy | Stance.Neutral | Stance.Ally;

View File

@@ -24,7 +24,8 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Uses the \"EngineerRepairable\" trait to determine repairability.")]
public readonly BitSet<EngineerRepairType> Types = default(BitSet<EngineerRepairType>);
[VoiceReference] public readonly string Voice = "Action";
[VoiceReference]
public readonly string Voice = "Action";
[Desc("Behaviour when entering the structure.",
"Possible values are Exit, Suicide, Dispose.")]

View File

@@ -23,7 +23,8 @@ namespace OpenRA.Mods.Common.Traits
public readonly string EnterCursor = "enter";
public readonly string EnterBlockedCursor = "enter-blocked";
[VoiceReference] public readonly string Voice = "Action";
[VoiceReference]
public readonly string Voice = "Action";
public object Create(ActorInitializer init) { return new EntersTunnels(init.Self, this); }
}

View File

@@ -32,7 +32,9 @@ namespace OpenRA.Mods.Common.Traits
{
readonly ExperienceTricklerInfo info;
GainsExperience gainsExperience;
[Sync] int ticks;
[Sync]
int ticks;
public ExperienceTrickler(Actor self, ExperienceTricklerInfo info)
: base(info)

View File

@@ -23,10 +23,13 @@ namespace OpenRA.Mods.Common.Traits
[Desc("This actor explodes when killed.")]
public class ExplodesInfo : ConditionalTraitInfo, Requires<IHealthInfo>
{
[WeaponReference, FieldLoader.Require, Desc("Default weapon to use for explosion if ammo/payload is loaded.")]
[WeaponReference]
[FieldLoader.Require]
[Desc("Default weapon to use for explosion if ammo/payload is loaded.")]
public readonly string Weapon = null;
[WeaponReference, Desc("Fallback weapon to use for explosion if empty (no ammo/payload).")]
[WeaponReference]
[Desc("Fallback weapon to use for explosion if empty (no ammo/payload).")]
public readonly string EmptyWeapon = "UnitExplode";
[Desc("Chance that the explosion will use Weapon instead of EmptyWeapon when exploding, provided the actor has ammo/payload.")]

View File

@@ -18,7 +18,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("This actor triggers an explosion on itself when transitioning to a specific damage state.")]
public class ExplosionOnDamageTransitionInfo : ITraitInfo, IRulesetLoaded, Requires<IHealthInfo>
{
[WeaponReference, FieldLoader.Require, Desc("Weapon to use for explosion.")]
[WeaponReference]
[FieldLoader.Require]
[Desc("Weapon to use for explosion.")]
public readonly string Weapon = null;
[Desc("At which damage state explosion will trigger.")]

View File

@@ -32,11 +32,13 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Image for the level up sprite.")]
public readonly string LevelUpImage = null;
[SequenceReference("Image")]
[Desc("Sequence for the level up sprite. Needs to be present on Image.")]
[SequenceReference("Image")] public readonly string LevelUpSequence = "levelup";
public readonly string LevelUpSequence = "levelup";
[PaletteReference]
[Desc("Palette for the level up sprite.")]
[PaletteReference] public readonly string LevelUpPalette = "effect";
public readonly string LevelUpPalette = "effect";
[Desc("Multiplier to apply to the Conditions keys. Defaults to the actor's value.")]
public readonly int ExperienceModifier = -1;
@@ -60,9 +62,11 @@ namespace OpenRA.Mods.Common.Traits
ConditionManager conditionManager;
// Stored as a percentage of our value
[Sync] int experience = 0;
[Sync]
int experience = 0;
[Sync] public int Level { get; private set; }
[Sync]
public int Level { get; private set; }
public readonly int MaxLevel;
public GainsExperience(ActorInitializer init, GainsExperienceInfo info)
@@ -137,7 +141,9 @@ namespace OpenRA.Mods.Common.Traits
class ExperienceInit : IActorInit<int>
{
[FieldFromYamlKey] readonly int value;
[FieldFromYamlKey]
readonly int value;
public ExperienceInit() { }
public ExperienceInit(int init) { value = init; }
public int Value(World world) { return value; }

View File

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

View File

@@ -78,8 +78,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Condition to grant while empty.")]
public readonly string EmptyCondition = null;
[VoiceReference] public readonly string HarvestVoice = "Action";
[VoiceReference] public readonly string DeliverVoice = "Action";
[VoiceReference]
public readonly string HarvestVoice = "Action";
[VoiceReference]
public readonly string DeliverVoice = "Action";
public object Create(ActorInitializer init) { return new Harvester(init.Self, this); }
}
@@ -97,11 +100,20 @@ namespace OpenRA.Mods.Common.Traits
int conditionToken = ConditionManager.InvalidConditionToken;
HarvesterResourceMultiplier[] resourceMultipliers;
[Sync] public bool LastSearchFailed;
[Sync] public Actor OwnerLinkedProc = null;
[Sync] public Actor LastLinkedProc = null;
[Sync] public Actor LinkedProc = null;
[Sync] int currentUnloadTicks;
[Sync]
public bool LastSearchFailed;
[Sync]
public Actor OwnerLinkedProc = null;
[Sync]
public Actor LastLinkedProc = null;
[Sync]
public Actor LinkedProc = null;
[Sync]
int currentUnloadTicks;
[Sync]
public int ContentValue

View File

@@ -60,7 +60,8 @@ namespace OpenRA.Mods.Common.Traits
INotifyKilled[] notifyKilled;
INotifyKilled[] notifyKilledPlayer;
[Sync] int hp;
[Sync]
int hp;
public int DisplayHP { get; private set; }
@@ -232,7 +233,9 @@ namespace OpenRA.Mods.Common.Traits
public class HealthInit : IActorInit<int>
{
[FieldFromYamlKey] readonly int value = 100;
[FieldFromYamlKey]
readonly int value = 100;
readonly bool allowZero;
public HealthInit() { }
public HealthInit(int init)

View File

@@ -60,9 +60,14 @@ namespace OpenRA.Mods.Common.Traits
readonly int dragSpeed;
readonly WPos finalPosition;
[Sync] public CPos TopLeft { get; private set; }
[Sync] public WPos CenterPosition { get; private set; }
[Sync] public int Facing { get; set; }
[Sync]
public CPos TopLeft { get; private set; }
[Sync]
public WPos CenterPosition { get; private set; }
[Sync]
public int Facing { get; set; }
public int TurnSpeed { get { return 0; } }
@@ -159,7 +164,9 @@ namespace OpenRA.Mods.Common.Traits
public class HuskSpeedInit : IActorInit<int>
{
[FieldFromYamlKey] readonly int value = 0;
[FieldFromYamlKey]
readonly int value = 0;
public HuskSpeedInit() { }
public HuskSpeedInit(int init) { value = init; }
public int Value(World world) { return value; }

View File

@@ -33,8 +33,12 @@ namespace OpenRA.Mods.Common.Traits
class Immobile : IOccupySpace, ISync, INotifyAddedToWorld, INotifyRemovedFromWorld
{
[Sync] readonly CPos location;
[Sync] readonly WPos position;
[Sync]
readonly CPos location;
[Sync]
readonly WPos position;
readonly Pair<CPos, SubCell>[] occupied;
public Immobile(ActorInitializer init, ImmobileInfo info)

View File

@@ -25,7 +25,8 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Chance (out of 100) the unit has to enter panic mode when attacked.")]
public readonly int AttackPanicChance = 20;
[SequenceReference(null, true)] public readonly string PanicSequencePrefix = "panic-";
[SequenceReference(null, true)]
public readonly string PanicSequencePrefix = "panic-";
public object Create(ActorInitializer init) { return new ScaredyCat(init.Self, this); }
}
@@ -34,8 +35,10 @@ namespace OpenRA.Mods.Common.Traits
{
readonly ScaredyCatInfo info;
readonly Mobile mobile;
[Sync] readonly Actor self;
[Sync] int panicStartedTick;
readonly Actor self;
[Sync]
int panicStartedTick;
bool Panicking { get { return panicStartedTick > 0; } }
bool IRenderInfantrySequenceModifier.IsModifyingSequence { get { return Panicking; } }

View File

@@ -34,7 +34,8 @@ namespace OpenRA.Mods.Common.Traits
public readonly WVec ProneOffset = new WVec(500, 0, 0);
[SequenceReference(null, true)] public readonly string ProneSequencePrefix = "prone-";
[SequenceReference(null, true)]
public readonly string ProneSequencePrefix = "prone-";
public override object Create(ActorInitializer init) { return new TakeCover(init, this); }
}
@@ -42,7 +43,9 @@ namespace OpenRA.Mods.Common.Traits
public class TakeCover : Turreted, INotifyDamage, IDamageModifier, ISpeedModifier, ISync, IRenderInfantrySequenceModifier
{
readonly TakeCoverInfo info;
[Sync] int remainingProneTime = 0;
[Sync]
int remainingProneTime = 0;
bool IsProne { get { return remainingProneTime > 0; } }
bool IRenderInfantrySequenceModifier.IsModifyingSequence { get { return IsProne; } }

View File

@@ -24,8 +24,9 @@ namespace OpenRA.Mods.Common.Traits
public class MobileInfo : PausableConditionalTraitInfo, IMoveInfo, IPositionableInfo, IFacingInfo, IActorPreviewInitInfo,
IEditorActorOptions
{
[LocomotorReference]
[FieldLoader.Require]
[Desc("Which Locomotor does this trait use. Must be defined on the World actor.")]
[LocomotorReference, FieldLoader.Require]
public readonly string Locomotor = null;
public readonly int InitialFacing = 0;
@@ -38,7 +39,8 @@ namespace OpenRA.Mods.Common.Traits
public readonly string Cursor = "move";
public readonly string BlockedCursor = "move-blocked";
[VoiceReference] public readonly string Voice = "Action";
[VoiceReference]
public readonly string Voice = "Action";
[Desc("Facing to use for actor previews (map editor, color picker, etc)")]
public readonly int PreviewFacing = 92;
@@ -157,7 +159,8 @@ namespace OpenRA.Mods.Common.Traits
INotifyFinishedMoving[] notifyFinishedMoving;
#region IFacing
[Sync] public int Facing
[Sync]
public int Facing
{
get { return facing; }
set { facing = value; }
@@ -166,13 +169,20 @@ namespace OpenRA.Mods.Common.Traits
public int TurnSpeed { get { return Info.TurnSpeed; } }
#endregion
[Sync] public CPos FromCell { get { return fromCell; } }
[Sync] public CPos ToCell { get { return toCell; } }
[Sync]
public CPos FromCell { get { return fromCell; } }
[Sync] public int PathHash; // written by Move.EvalPath, to temporarily debug this crap.
[Sync]
public CPos ToCell { get { return toCell; } }
[Sync]
public int PathHash; // written by Move.EvalPath, to temporarily debug this crap.
#region IOccupySpace
[Sync] public WPos CenterPosition { get; private set; }
[Sync]
public WPos CenterPosition { get; private set; }
public CPos TopLeft { get { return ToCell; } }
public Pair<CPos, SubCell>[] OccupiedCells()

View File

@@ -29,7 +29,8 @@ namespace OpenRA.Mods.Common.Traits
public class FrozenUnderFog : ICreatesFrozenActors, IRenderModifier, IDefaultVisibility, ITick, ITickRender, ISync, INotifyCreated, INotifyOwnerChanged, INotifyActorDisposing
{
[Sync] public int VisibilityHash;
[Sync]
public int VisibilityHash;
readonly FrozenUnderFogInfo info;
readonly bool startsRevealed;

View File

@@ -19,8 +19,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Display a colored overlay when a timed condition is active.")]
public class WithColoredOverlayInfo : ConditionalTraitInfo
{
[PaletteReference]
[Desc("Palette to use when rendering the overlay")]
[PaletteReference] public readonly string Palette = "invuln";
public readonly string Palette = "invuln";
public override object Create(ActorInitializer init) { return new WithColoredOverlay(this); }
}

View File

@@ -39,8 +39,11 @@ namespace OpenRA.Mods.Common.Traits
public event Action<Actor> OnEnteredDropRange = self => { };
public event Action<Actor> OnExitedDropRange = self => { };
[Sync] bool inDropRange;
[Sync] Target target;
[Sync]
bool inDropRange;
[Sync]
Target target;
bool checkForSuitableCell;

View File

@@ -29,15 +29,19 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Image where Ground/WaterCorpseSequence is looked up.")]
public readonly string Image = "explosion";
[SequenceReference("Image")] public readonly string GroundCorpseSequence = null;
[SequenceReference("Image")]
public readonly string GroundCorpseSequence = null;
[PaletteReference] public readonly string GroundCorpsePalette = "effect";
[PaletteReference]
public readonly string GroundCorpsePalette = "effect";
public readonly string GroundImpactSound = null;
[SequenceReference("Image")] public readonly string WaterCorpseSequence = null;
[SequenceReference("Image")]
public readonly string WaterCorpseSequence = null;
[PaletteReference] public readonly string WaterCorpsePalette = "effect";
[PaletteReference]
public readonly string WaterCorpsePalette = "effect";
[Desc("Terrain types on which to display WaterCorpseSequence.")]
public readonly HashSet<string> WaterTerrainTypes = new HashSet<string> { "Water" };

View File

@@ -46,7 +46,8 @@ namespace OpenRA.Mods.Common.Traits
[GrantedConditionReference]
public IEnumerable<string> LinterCargoConditions { get { return CargoConditions.Values; } }
[VoiceReference] public readonly string Voice = "Action";
[VoiceReference]
public readonly string Voice = "Action";
public object Create(ActorInitializer init) { return new Passenger(this); }
}

View File

@@ -21,8 +21,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Delay for the end game notification in milliseconds.")]
public readonly int NotificationDelay = 1500;
[Translate]
[Desc("Description of the objective.")]
[Translate] public readonly string Objective = "Destroy all opposition!";
public readonly string Objective = "Destroy all opposition!";
[Desc("Disable the win/loss messages and audio notifications?")]
public readonly bool SuppressNotifications = false;

View File

@@ -76,13 +76,26 @@ namespace OpenRA.Mods.Common.Traits
readonly DeveloperModeInfo info;
public bool Enabled { get; private set; }
[Sync] bool fastCharge;
[Sync] bool allTech;
[Sync] bool fastBuild;
[Sync] bool disableShroud;
[Sync] bool pathDebug;
[Sync] bool unlimitedPower;
[Sync] bool buildAnywhere;
[Sync]
bool fastCharge;
[Sync]
bool allTech;
[Sync]
bool fastBuild;
[Sync]
bool disableShroud;
[Sync]
bool pathDebug;
[Sync]
bool unlimitedPower;
[Sync]
bool buildAnywhere;
public bool FastCharge { get { return Enabled && fastCharge; } }
public bool AllTech { get { return Enabled && allTech; } }

View File

@@ -25,12 +25,20 @@ namespace OpenRA.Mods.Common.Traits
public readonly string Notification = "Beacon";
public readonly bool IsPlayerPalette = true;
[PaletteReference("IsPlayerPalette")] public readonly string Palette = "player";
[PaletteReference("IsPlayerPalette")]
public readonly string Palette = "player";
public readonly string BeaconImage = "beacon";
[SequenceReference("BeaconImage")] public readonly string BeaconSequence = null;
[SequenceReference("BeaconImage")] public readonly string ArrowSequence = "arrow";
[SequenceReference("BeaconImage")] public readonly string CircleSequence = "circles";
[SequenceReference("BeaconImage")]
public readonly string BeaconSequence = null;
[SequenceReference("BeaconImage")]
public readonly string ArrowSequence = "arrow";
[SequenceReference("BeaconImage")]
public readonly string CircleSequence = "circles";
public object Create(ActorInitializer init) { return new PlaceBeacon(init.Self, this); }
}

View File

@@ -21,11 +21,13 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Allows the player to execute build orders.", " Attach this to the player actor.")]
public class PlaceBuildingInfo : ITraitInfo
{
[PaletteReference]
[Desc("Palette to use for rendering the placement sprite.")]
[PaletteReference] public readonly string Palette = TileSet.TerrainPaletteInternalName;
public readonly string Palette = TileSet.TerrainPaletteInternalName;
[PaletteReference]
[Desc("Palette to use for rendering the placement sprite for line build segments.")]
[PaletteReference] public readonly string LineBuildSegmentPalette = TileSet.TerrainPaletteInternalName;
public readonly string LineBuildSegmentPalette = TileSet.TerrainPaletteInternalName;
[Desc("Play NewOptionsNotification this many ticks after building placement.")]
public readonly int NewOptionsNotificationDelay = 10;

View File

@@ -23,7 +23,8 @@ namespace OpenRA.Mods.Common.Traits
public class PlayerExperience : ISync
{
[Sync] public int Experience { get; private set; }
[Sync]
public int Experience { get; private set; }
public void GiveExperience(int num)
{

View File

@@ -83,10 +83,14 @@ namespace OpenRA.Mods.Common.Traits
Cash = info.DefaultCash;
}
[Sync] public int Cash;
[Sync]
public int Cash;
[Sync] public int Resources;
[Sync] public int ResourceCapacity;
[Sync]
public int Resources;
[Sync]
public int ResourceCapacity;
public int Earned;
public int Spent;

View File

@@ -115,10 +115,13 @@ namespace OpenRA.Mods.Common.Traits
public Actor Actor { get { return self; } }
[Sync] public bool Enabled { get; protected set; }
[Sync]
public bool Enabled { get; protected set; }
public string Faction { get; private set; }
[Sync] public bool IsValidFaction { get; private set; }
[Sync]
public bool IsValidFaction { get; private set; }
public ProductionQueue(ActorInitializer init, Actor playerActor, ProductionQueueInfo info)
{

View File

@@ -36,8 +36,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Delay for the end game notification in milliseconds.")]
public readonly int NotificationDelay = 1500;
[Translate]
[Desc("Description of the objective")]
[Translate] public readonly string Objective = "Hold all the strategic positions!";
public readonly string Objective = "Hold all the strategic positions!";
[Desc("Disable the win/loss messages and audio notifications?")]
public readonly bool SuppressNotifications = false;
@@ -49,7 +50,9 @@ namespace OpenRA.Mods.Common.Traits
{
readonly StrategicVictoryConditionsInfo info;
[Sync] public int TicksLeft;
[Sync]
public int TicksLeft;
readonly Player player;
readonly MissionObjectives mo;
readonly bool shortGame;

View File

@@ -34,10 +34,14 @@ namespace OpenRA.Mods.Common.Traits
readonly Dictionary<Actor, int> powerDrain = new Dictionary<Actor, int>();
[Sync] int totalProvided;
[Sync]
int totalProvided;
public int PowerProvided { get { return totalProvided; } }
[Sync] int totalDrained;
[Sync]
int totalDrained;
public int PowerDrained { get { return totalDrained; } }
public int ExcessPower { get { return totalProvided - totalDrained; } }

View File

@@ -110,7 +110,9 @@ namespace OpenRA.Mods.Common.Traits
public class ProductionSpawnLocationInit : IActorInit<CPos>
{
[FieldFromYamlKey] readonly CPos value = CPos.Zero;
[FieldFromYamlKey]
readonly CPos value = CPos.Zero;
public ProductionSpawnLocationInit() { }
public ProductionSpawnLocationInit(CPos init) { value = init; }
public CPos Value(World world) { return value; }

View File

@@ -20,8 +20,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Deliver the unit in production via paradrop.")]
public class ProductionParadropInfo : ProductionInfo, Requires<ExitInfo>
{
[ActorReference(typeof(AircraftInfo))]
[Desc("Cargo aircraft used. Must have Aircraft trait.")]
[ActorReference(typeof(AircraftInfo))] public readonly string ActorType = "badr";
public readonly string ActorType = "badr";
[Desc("Sound to play when dropping the unit.")]
public readonly string ChuteSound = null;

View File

@@ -19,7 +19,8 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Derive facings from sprite body sequence.")]
public class QuantizeFacingsFromSequenceInfo : ConditionalTraitInfo, IQuantizeBodyOrientationInfo, Requires<RenderSpritesInfo>
{
[Desc("Defines sequence to derive facings from."), SequenceReference]
[SequenceReference]
[Desc("Defines sequence to derive facings from.")]
public readonly string Sequence = "idle";
public int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string race)

View File

@@ -16,7 +16,9 @@ namespace OpenRA.Mods.Common.Traits.Radar
{
public class RadarColorFromTerrainInfo : ITraitInfo
{
[FieldLoader.Require] public readonly string Terrain;
[FieldLoader.Require]
public readonly string Terrain;
public object Create(ActorInitializer init) { return new RadarColorFromTerrain(init.Self, Terrain); }
}

View File

@@ -17,9 +17,10 @@ namespace OpenRA.Mods.Common.Traits
{
public class RearmableInfo : ITraitInfo
{
[Desc("Actors that this actor can dock to and get rearmed by.")]
[ActorReference]
[FieldLoader.Require]
[ActorReference] public readonly HashSet<string> RearmActors = new HashSet<string> { };
[Desc("Actors that this actor can dock to and get rearmed by.")]
public readonly HashSet<string> RearmActors = new HashSet<string> { };
[Desc("Name(s) of AmmoPool(s) that use this trait to rearm.")]
public readonly HashSet<string> AmmoPools = new HashSet<string> { "primary" };

View File

@@ -47,7 +47,8 @@ namespace OpenRA.Mods.Common.Traits
{
AmmoPool ammoPool;
[Sync] int remainingTicks;
[Sync]
int remainingTicks;
public ReloadAmmoPool(ReloadAmmoPoolInfo info)
: base(info) { }

View File

@@ -25,7 +25,8 @@ namespace OpenRA.Mods.Common.Traits.Render
[SequenceReference("Image")]
public readonly string[] Sequences = { "idle" };
[PaletteReference] public readonly string Palette = "effect";
[PaletteReference]
public readonly string Palette = "effect";
[Desc("Only leave trail on listed terrain types. Leave empty to leave trail on all terrain types.")]
public readonly HashSet<string> TerrainTypes = new HashSet<string>();

View File

@@ -33,11 +33,13 @@ namespace OpenRA.Mods.Common.Traits.Render
[Desc("A dictionary of faction-specific image overrides.")]
public readonly Dictionary<string, string> FactionImages = null;
[PaletteReference]
[Desc("Custom palette name")]
[PaletteReference] public readonly string Palette = null;
public readonly string Palette = null;
[PaletteReference(true)]
[Desc("Custom PlayerColorPalette: BaseName")]
[PaletteReference(true)] public readonly string PlayerPalette = "player";
public readonly string PlayerPalette = "player";
[Desc("Change the sprite image size.")]
public readonly float Scale = 1f;

View File

@@ -31,12 +31,18 @@ namespace OpenRA.Mods.Common.Traits.Render
public readonly string Image = null;
[Desc("Custom palette name")]
[PaletteReference] public readonly string Palette = null;
[PaletteReference]
public readonly string Palette = null;
[PaletteReference]
[Desc("Custom PlayerColorPalette: BaseName")]
[PaletteReference] public readonly string PlayerPalette = "player";
[PaletteReference] public readonly string NormalsPalette = "normals";
[PaletteReference] public readonly string ShadowPalette = "shadow";
public readonly string PlayerPalette = "player";
[PaletteReference]
public readonly string NormalsPalette = "normals";
[PaletteReference]
public readonly string ShadowPalette = "shadow";
[Desc("Change the image size.")]
public readonly float Scale = 12;

View File

@@ -20,7 +20,8 @@ namespace OpenRA.Mods.Common.Traits.Render
{
public class SelectionDecorationsInfo : ITraitInfo, Requires<IDecorationBoundsInfo>
{
[PaletteReference] public readonly string Palette = "chrome";
[PaletteReference]
public readonly string Palette = "chrome";
[Desc("Health bar, production progress bar etc.")]
public readonly bool RenderSelectionBars = true;

View File

@@ -24,11 +24,13 @@ namespace OpenRA.Mods.Common.Traits.Render
[Desc("Image used for the overlay.")]
public readonly string Image = null;
[SequenceReference("Image")]
[Desc("Sequence used for the overlay (cannot be animated).")]
[SequenceReference("Image")] public readonly string Sequence = null;
public readonly string Sequence = null;
[PaletteReference]
[Desc("Palette to render the sprite in. Reference the world actor's PaletteFrom* traits.")]
[PaletteReference] public readonly string Palette = "chrome";
public readonly string Palette = "chrome";
[Desc("Point on the production icon's used as reference for offsetting the overlay. ",
"Possible values are combinations of Center, Top, Bottom, Left, Right.")]

View File

@@ -17,8 +17,9 @@ namespace OpenRA.Mods.Common.Traits.Render
[Desc("Replaces the building animation when it accepts a cash delivery unit.")]
public class WithAcceptDeliveredCashAnimationInfo : ConditionalTraitInfo, Requires<WithSpriteBodyInfo>
{
[SequenceReference]
[Desc("Sequence name to use")]
[SequenceReference] public readonly string Sequence = "active";
public readonly string Sequence = "active";
[Desc("Which sprite body to play the animation on.")]
public readonly string Body = "body";

View File

@@ -19,9 +19,10 @@ namespace OpenRA.Mods.Common.Traits.Render
[Desc("Armament name")]
public readonly string Armament = "primary";
[Desc("Displayed while targeting.")]
[SequenceReference]
[FieldLoader.Require]
[SequenceReference] public readonly string Sequence = null;
[Desc("Displayed while targeting.")]
public readonly string Sequence = null;
[Desc("Which sprite body to modify.")]
public readonly string Body = "body";

View File

@@ -19,8 +19,9 @@ namespace OpenRA.Mods.Common.Traits.Render
[Desc("Armament name")]
public readonly string Armament = "primary";
[SequenceReference]
[Desc("Displayed while attacking.")]
[SequenceReference] public readonly string Sequence = null;
public readonly string Sequence = null;
[Desc("Delay in ticks before animation starts, either relative to attack preparation or attack.")]
public readonly int Delay = 0;

View File

@@ -17,12 +17,14 @@ namespace OpenRA.Mods.Common.Traits.Render
[Desc("Rendered together with an attack.")]
public class WithAttackOverlayInfo : ITraitInfo, Requires<RenderSpritesInfo>
{
[SequenceReference]
[FieldLoader.Require]
[Desc("Sequence name to use")]
[SequenceReference] public readonly string Sequence = null;
public readonly string Sequence = null;
[PaletteReference("IsPlayerPalette")]
[Desc("Custom palette name")]
[PaletteReference("IsPlayerPalette")] public readonly string Palette = null;
public readonly string Palette = null;
[Desc("Custom palette is a player palette BaseName")]
public readonly bool IsPlayerPalette = false;

View File

@@ -17,7 +17,8 @@ namespace OpenRA.Mods.Common.Traits.Render
[Desc("Changes the animation when the actor constructed a building.")]
public class WithBuildingPlacedAnimationInfo : ConditionalTraitInfo, Requires<WithSpriteBodyInfo>
{
[Desc("Sequence name to use"), SequenceReference]
[SequenceReference]
[Desc("Sequence name to use")]
public readonly string Sequence = "build";
[Desc("Which sprite body to play the animation on.")]

View File

@@ -17,14 +17,16 @@ namespace OpenRA.Mods.Common.Traits.Render
[Desc("Rendered when the actor constructed a building.")]
public class WithBuildingPlacedOverlayInfo : ConditionalTraitInfo, Requires<RenderSpritesInfo>, Requires<BodyOrientationInfo>
{
[SequenceReference]
[Desc("Sequence name to use")]
[SequenceReference] public readonly string Sequence = "crane-overlay";
public readonly string Sequence = "crane-overlay";
[Desc("Position relative to body")]
public readonly WVec Offset = WVec.Zero;
[PaletteReference("IsPlayerPalette")]
[Desc("Custom palette name")]
[PaletteReference("IsPlayerPalette")] public readonly string Palette = null;
public readonly string Palette = null;
[Desc("Custom palette is a player palette BaseName")]
public readonly bool IsPlayerPalette = false;

View File

@@ -21,8 +21,9 @@ namespace OpenRA.Mods.Common.Traits.Render
[Desc("Sequence to use for the charge levels.")]
public readonly string Sequence = "active";
[PaletteReference("IsPlayerPalette")]
[Desc("Custom palette name")]
[PaletteReference("IsPlayerPalette")] public readonly string Palette = null;
public readonly string Palette = null;
[Desc("Custom palette is a player palette BaseName")]
public readonly bool IsPlayerPalette = false;

View File

@@ -27,9 +27,14 @@ namespace OpenRA.Mods.Common.Traits.Render
[Desc("Terrain types on which to display WaterSequence.")]
public readonly HashSet<string> WaterTerrainTypes = new HashSet<string> { "Water" };
[SequenceReference] public readonly string IdleSequence = "idle";
[SequenceReference] public readonly string WaterSequence = null;
[SequenceReference] public readonly string LandSequence = null;
[SequenceReference]
public readonly string IdleSequence = "idle";
[SequenceReference]
public readonly string WaterSequence = null;
[SequenceReference]
public readonly string LandSequence = null;
public object Create(ActorInitializer init) { return new WithCrateBody(init.Self, this); }

View File

@@ -20,9 +20,14 @@ namespace OpenRA.Mods.Common.Traits.Render
{
public readonly string Image = "smoke_m";
[SequenceReference("Image")] public readonly string IdleSequence = "idle";
[SequenceReference("Image")] public readonly string LoopSequence = "loop";
[SequenceReference("Image")] public readonly string EndSequence = "end";
[SequenceReference("Image")]
public readonly string IdleSequence = "idle";
[SequenceReference("Image")]
public readonly string LoopSequence = "loop";
[SequenceReference("Image")]
public readonly string EndSequence = "end";
[Desc("Damage types that this should be used for (defined on the warheads).",
"Leave empty to disable all filtering.")]

View File

@@ -20,11 +20,13 @@ namespace OpenRA.Mods.Common.Traits.Render
[Desc("This actor has a death animation.")]
public class WithDeathAnimationInfo : ConditionalTraitInfo, Requires<RenderSpritesInfo>
{
[SequenceReference(null, true)]
[Desc("Sequence prefix to play when this actor is killed by a warhead.")]
[SequenceReference(null, true)] public readonly string DeathSequence = "die";
public readonly string DeathSequence = "die";
[PaletteReference("DeathPaletteIsPlayerPalette")]
[Desc("The palette used for `DeathSequence`.")]
[PaletteReference("DeathPaletteIsPlayerPalette")] public readonly string DeathSequencePalette = "player";
public readonly string DeathSequencePalette = "player";
[Desc("Custom death animation palette is a player palette BaseName")]
public readonly bool DeathPaletteIsPlayerPalette = true;
@@ -32,11 +34,13 @@ namespace OpenRA.Mods.Common.Traits.Render
[Desc("Should DeathType-specific sequences be used (sequence name = DeathSequence + DeathType).")]
public readonly bool UseDeathTypeSuffix = true; // TODO: check the complete sequence with lint rules
[SequenceReference]
[Desc("Sequence to play when this actor is crushed.")]
[SequenceReference] public readonly string CrushedSequence = null;
public readonly string CrushedSequence = null;
[PaletteReference("CrushedPaletteIsPlayerPalette")]
[Desc("The palette used for `CrushedSequence`.")]
[PaletteReference("CrushedPaletteIsPlayerPalette")] public readonly string CrushedSequencePalette = "effect";
public readonly string CrushedSequencePalette = "effect";
[Desc("Custom crushed animation palette is a player palette BaseName")]
public readonly bool CrushedPaletteIsPlayerPalette = false;
@@ -45,8 +49,9 @@ namespace OpenRA.Mods.Common.Traits.Render
"Is only used if UseDeathTypeSuffix is `True`.")]
public readonly Dictionary<string, string[]> DeathTypes = new Dictionary<string, string[]>();
[SequenceReference]
[Desc("Sequence to use when the actor is killed by some non-standard means (e.g. suicide).")]
[SequenceReference] public readonly string FallbackSequence = null;
public readonly string FallbackSequence = null;
public override object Create(ActorInitializer init) { return new WithDeathAnimation(init.Self, this); }
}

View File

@@ -39,8 +39,9 @@ namespace OpenRA.Mods.Common.Traits.Render
[Desc("Sequence used for this decoration (can be animated).")]
public readonly string Sequence = null;
[PaletteReference("IsPlayerPalette")]
[Desc("Palette to render the sprite in. Reference the world actor's PaletteFrom* traits.")]
[PaletteReference("IsPlayerPalette")] public readonly string Palette = "chrome";
public readonly string Palette = "chrome";
[Desc("Custom palette is a player palette BaseName")]
public readonly bool IsPlayerPalette = false;

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