Use expression body syntax
This commit is contained in:
@@ -28,13 +28,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly DomainIndex domainIndex;
|
||||
readonly Color? targetLineColor;
|
||||
|
||||
protected Target Target
|
||||
{
|
||||
get
|
||||
{
|
||||
return useLastVisibleTarget ? lastVisibleTarget : target;
|
||||
}
|
||||
}
|
||||
protected Target Target => useLastVisibleTarget ? lastVisibleTarget : target;
|
||||
|
||||
Target target;
|
||||
Target lastVisibleTarget;
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common
|
||||
this.value = (int)value;
|
||||
}
|
||||
|
||||
public virtual SubCell Value { get { return (SubCell)value; } }
|
||||
public virtual SubCell Value => (SubCell)value;
|
||||
|
||||
public void Initialize(MiniYaml yaml)
|
||||
{
|
||||
|
||||
@@ -50,10 +50,10 @@ namespace OpenRA.Mods.Common.AudioLoaders
|
||||
|
||||
public sealed class WavFormat : ISoundFormat
|
||||
{
|
||||
public int Channels { get { return channels; } }
|
||||
public int SampleBits { get { return sampleBits; } }
|
||||
public int SampleRate { get { return sampleRate; } }
|
||||
public float LengthInSeconds { get { return WavReader.WaveLength(sourceStream); } }
|
||||
public int Channels => channels;
|
||||
public int SampleBits => sampleBits;
|
||||
public int SampleRate => sampleRate;
|
||||
public float LengthInSeconds => WavReader.WaveLength(sourceStream);
|
||||
public Stream GetPCMInputStream() { return wavStreamFactory(); }
|
||||
public void Dispose() { sourceStream.Dispose(); }
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
throw new InvalidOperationException("Section does not exist in map or rules: " + s);
|
||||
}
|
||||
|
||||
public IEnumerable<IniSection> Sections { get { return sections.Values; } }
|
||||
public IEnumerable<IniSection> Sections => sections.Values;
|
||||
}
|
||||
|
||||
public class IniSection : IEnumerable<KeyValuePair<string, string>>
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.FileSystem
|
||||
}
|
||||
|
||||
public string Name { get; private set; }
|
||||
public IEnumerable<string> Contents { get { return index.Keys; } }
|
||||
public IEnumerable<string> Contents => index.Keys;
|
||||
|
||||
readonly Dictionary<string, Entry> index = new Dictionary<string, Entry>();
|
||||
readonly Stream s;
|
||||
@@ -132,7 +132,7 @@ namespace OpenRA.Mods.Common.FileSystem
|
||||
return index.ContainsKey(filename);
|
||||
}
|
||||
|
||||
public IReadOnlyDictionary<string, Entry> Index { get { return new ReadOnlyDictionary<string, Entry>(index); } }
|
||||
public IReadOnlyDictionary<string, Entry> Index => new ReadOnlyDictionary<string, Entry>(index);
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
{
|
||||
public readonly ActorInfo Actor;
|
||||
public readonly WorldRenderer WorldRenderer;
|
||||
public World World { get { return WorldRenderer.World; } }
|
||||
public World World => WorldRenderer.World;
|
||||
|
||||
readonly ActorReference reference;
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public WPos Pos { get { return pos; } }
|
||||
public int ZOffset { get { return zOffset; } }
|
||||
public bool IsDecoration { get { return true; } }
|
||||
public WPos Pos => pos;
|
||||
public int ZOffset => zOffset;
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new BeamRenderable(pos, zOffset, length, shape, width, color); }
|
||||
public IRenderable OffsetBy(WVec vec) { return new BeamRenderable(pos + vec, zOffset, length, shape, width, color); }
|
||||
|
||||
@@ -34,9 +34,9 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
this.filled = filled;
|
||||
}
|
||||
|
||||
public WPos Pos { get { return centerPosition; } }
|
||||
public int ZOffset { get { return 0; } }
|
||||
public bool IsDecoration { get { return true; } }
|
||||
public WPos Pos => centerPosition;
|
||||
public int ZOffset => 0;
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new CircleAnnotationRenderable(centerPosition, radius, width, color, filled); }
|
||||
public IRenderable OffsetBy(WVec vec) { return new CircleAnnotationRenderable(centerPosition + vec, radius, width, color, filled); }
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
{
|
||||
public class ContrailRenderable : IRenderable, IFinalizedRenderable
|
||||
{
|
||||
public int Length { get { return trail.Length; } }
|
||||
public int Length => trail.Length;
|
||||
|
||||
readonly World world;
|
||||
readonly Color color;
|
||||
@@ -45,9 +45,9 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
this.zOffset = zOffset;
|
||||
}
|
||||
|
||||
public WPos Pos { get { return trail[Index(next - 1)]; } }
|
||||
public int ZOffset { get { return zOffset; } }
|
||||
public bool IsDecoration { get { return true; } }
|
||||
public WPos Pos => trail[Index(next - 1)];
|
||||
public int ZOffset => zOffset;
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new ContrailRenderable(world, (WPos[])trail.Clone(), width, next, length, skip, color, newOffset); }
|
||||
public IRenderable OffsetBy(WVec vec) { return new ContrailRenderable(world, trail.Select(pos => pos + vec).ToArray(), width, next, length, skip, color, zOffset); }
|
||||
|
||||
@@ -99,21 +99,21 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
this.exception = exception;
|
||||
}
|
||||
|
||||
public string Filename { get { return exception.FileName; } }
|
||||
public string Filename => exception.FileName;
|
||||
|
||||
string ISpriteSequence.Name { get { throw exception; } }
|
||||
int ISpriteSequence.Start { get { throw exception; } }
|
||||
int ISpriteSequence.Length { get { throw exception; } }
|
||||
int ISpriteSequence.Stride { get { throw exception; } }
|
||||
int ISpriteSequence.Facings { get { throw exception; } }
|
||||
int ISpriteSequence.Tick { get { throw exception; } }
|
||||
int ISpriteSequence.ZOffset { get { throw exception; } }
|
||||
int ISpriteSequence.ShadowStart { get { throw exception; } }
|
||||
int ISpriteSequence.ShadowZOffset { get { throw exception; } }
|
||||
int[] ISpriteSequence.Frames { get { throw exception; } }
|
||||
Rectangle ISpriteSequence.Bounds { get { throw exception; } }
|
||||
bool ISpriteSequence.IgnoreWorldTint { get { throw exception; } }
|
||||
float ISpriteSequence.Scale { get { throw exception; } }
|
||||
string ISpriteSequence.Name => throw exception;
|
||||
int ISpriteSequence.Start => throw exception;
|
||||
int ISpriteSequence.Length => throw exception;
|
||||
int ISpriteSequence.Stride => throw exception;
|
||||
int ISpriteSequence.Facings => throw exception;
|
||||
int ISpriteSequence.Tick => throw exception;
|
||||
int ISpriteSequence.ZOffset => throw exception;
|
||||
int ISpriteSequence.ShadowStart => throw exception;
|
||||
int ISpriteSequence.ShadowZOffset => throw exception;
|
||||
int[] ISpriteSequence.Frames => throw exception;
|
||||
Rectangle ISpriteSequence.Bounds => throw exception;
|
||||
bool ISpriteSequence.IgnoreWorldTint => throw exception;
|
||||
float ISpriteSequence.Scale => throw exception;
|
||||
Sprite ISpriteSequence.GetSprite(int frame) { throw exception; }
|
||||
Sprite ISpriteSequence.GetSprite(int frame, WAngle facing) { throw exception; }
|
||||
Sprite ISpriteSequence.GetShadow(int frame, WAngle facing) { throw exception; }
|
||||
|
||||
@@ -42,9 +42,9 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
this.borderWidth = borderWidth;
|
||||
}
|
||||
|
||||
public WPos Pos { get { return centerPosition; } }
|
||||
public int ZOffset { get { return zOffset; } }
|
||||
public bool IsDecoration { get { return true; } }
|
||||
public WPos Pos => centerPosition;
|
||||
public int ZOffset => zOffset;
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset)
|
||||
{
|
||||
|
||||
@@ -46,12 +46,12 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
this.bounds = bounds;
|
||||
}
|
||||
|
||||
public WPos Pos { get { return pos; } }
|
||||
public bool DisplayHealth { get { return displayHealth; } }
|
||||
public bool DisplayExtra { get { return displayExtra; } }
|
||||
public WPos Pos => pos;
|
||||
public bool DisplayHealth => displayHealth;
|
||||
public bool DisplayExtra => displayExtra;
|
||||
|
||||
public int ZOffset { get { return 0; } }
|
||||
public bool IsDecoration { get { return true; } }
|
||||
public int ZOffset => 0;
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return this; }
|
||||
public IRenderable OffsetBy(WVec vec) { return new IsometricSelectionBarsAnnotationRenderable(pos + vec, actor, bounds); }
|
||||
|
||||
@@ -48,10 +48,10 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public WPos Pos { get { return pos; } }
|
||||
public WPos Pos => pos;
|
||||
|
||||
public int ZOffset { get { return 0; } }
|
||||
public bool IsDecoration { get { return true; } }
|
||||
public int ZOffset => 0;
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return this; }
|
||||
public IRenderable OffsetBy(WVec vec) { return new IsometricSelectionBoxAnnotationRenderable(pos + vec, bounds, color); }
|
||||
|
||||
@@ -39,9 +39,9 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
this.endColor = endColor;
|
||||
}
|
||||
|
||||
public WPos Pos { get { return start; } }
|
||||
public int ZOffset { get { return 0; } }
|
||||
public bool IsDecoration { get { return true; } }
|
||||
public WPos Pos => start;
|
||||
public int ZOffset => 0;
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new LineAnnotationRenderable(start, end, width, startColor, endColor); }
|
||||
public IRenderable OffsetBy(WVec vec) { return new LineAnnotationRenderable(start + vec, end + vec, width, startColor, endColor); }
|
||||
|
||||
@@ -65,14 +65,14 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
this.tintModifiers = tintModifiers;
|
||||
}
|
||||
|
||||
public WPos Pos { get { return pos; } }
|
||||
public PaletteReference Palette { get { return palette; } }
|
||||
public int ZOffset { get { return zOffset; } }
|
||||
public bool IsDecoration { get { return false; } }
|
||||
public WPos Pos => pos;
|
||||
public PaletteReference Palette => palette;
|
||||
public int ZOffset => zOffset;
|
||||
public bool IsDecoration => false;
|
||||
|
||||
public float Alpha { get { return alpha; } }
|
||||
public float3 Tint { get { return tint; } }
|
||||
public TintModifiers TintModifiers { get { return tintModifiers; } }
|
||||
public float Alpha => alpha;
|
||||
public float3 Tint => tint;
|
||||
public TintModifiers TintModifiers => tintModifiers;
|
||||
|
||||
public IPalettedRenderable WithPalette(PaletteReference newPalette)
|
||||
{
|
||||
|
||||
@@ -30,9 +30,9 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public WPos Pos { get { return effectivePos; } }
|
||||
public int ZOffset { get { return 0; } }
|
||||
public bool IsDecoration { get { return true; } }
|
||||
public WPos Pos => effectivePos;
|
||||
public int ZOffset => 0;
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new PolygonAnnotationRenderable(vertices, effectivePos, width, color); }
|
||||
public IRenderable OffsetBy(WVec vec) { return new PolygonAnnotationRenderable(vertices.Select(v => v + vec).ToArray(), effectivePos + vec, width, color); }
|
||||
|
||||
@@ -40,9 +40,9 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
angle = new WAngle(ticks * info.HelixAngleDeltaPerTick.Angle);
|
||||
}
|
||||
|
||||
public WPos Pos { get { return pos; } }
|
||||
public int ZOffset { get { return zOffset; } }
|
||||
public bool IsDecoration { get { return true; } }
|
||||
public WPos Pos => pos;
|
||||
public int ZOffset => zOffset;
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new RailgunHelixRenderable(pos, newOffset, railgun, info, ticks); }
|
||||
public IRenderable OffsetBy(WVec vec) { return new RailgunHelixRenderable(pos + vec, zOffset, railgun, info, ticks); }
|
||||
|
||||
@@ -39,9 +39,9 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
this.borderWidth = borderWidth;
|
||||
}
|
||||
|
||||
public WPos Pos { get { return centerPosition; } }
|
||||
public int ZOffset { get { return zOffset; } }
|
||||
public bool IsDecoration { get { return true; } }
|
||||
public WPos Pos => centerPosition;
|
||||
public int ZOffset => zOffset;
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new RangeCircleAnnotationRenderable(centerPosition, radius, newOffset, color, width, borderColor, borderWidth); }
|
||||
public IRenderable OffsetBy(WVec vec) { return new RangeCircleAnnotationRenderable(centerPosition + vec, radius, zOffset, color, width, borderColor, borderWidth); }
|
||||
|
||||
@@ -37,12 +37,12 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
this.decorationBounds = decorationBounds;
|
||||
}
|
||||
|
||||
public WPos Pos { get { return pos; } }
|
||||
public bool DisplayHealth { get { return displayHealth; } }
|
||||
public bool DisplayExtra { get { return displayExtra; } }
|
||||
public WPos Pos => pos;
|
||||
public bool DisplayHealth => displayHealth;
|
||||
public bool DisplayExtra => displayExtra;
|
||||
|
||||
public int ZOffset { get { return 0; } }
|
||||
public bool IsDecoration { get { return true; } }
|
||||
public int ZOffset => 0;
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return this; }
|
||||
public IRenderable OffsetBy(WVec vec) { return new SelectionBarsAnnotationRenderable(pos + vec, actor, decorationBounds); }
|
||||
|
||||
@@ -30,10 +30,10 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public WPos Pos { get { return pos; } }
|
||||
public WPos Pos => pos;
|
||||
|
||||
public int ZOffset { get { return 0; } }
|
||||
public bool IsDecoration { get { return true; } }
|
||||
public int ZOffset => 0;
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return this; }
|
||||
public IRenderable OffsetBy(WVec vec) { return new SelectionBoxAnnotationRenderable(pos + vec, decorationBounds, color); }
|
||||
|
||||
@@ -42,9 +42,9 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
ChromeMetrics.Get<Color>("TextContrastColorLight"),
|
||||
text) { }
|
||||
|
||||
public WPos Pos { get { return pos; } }
|
||||
public int ZOffset { get { return zOffset; } }
|
||||
public bool IsDecoration { get { return true; } }
|
||||
public WPos Pos => pos;
|
||||
public int ZOffset => zOffset;
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new TextAnnotationRenderable(font, pos, zOffset, color, text); }
|
||||
public IRenderable OffsetBy(WVec vec) { return new TextAnnotationRenderable(font, pos + vec, zOffset, color, text); }
|
||||
|
||||
@@ -51,10 +51,10 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
shadowPalette = shadow;
|
||||
}
|
||||
|
||||
public WPos Pos { get { return effectiveWorldPos; } }
|
||||
public PaletteReference Palette { get { return palette; } }
|
||||
public int ZOffset { get { return zOffset; } }
|
||||
public bool IsDecoration { get { return false; } }
|
||||
public WPos Pos => effectiveWorldPos;
|
||||
public PaletteReference Palette => palette;
|
||||
public int ZOffset => zOffset;
|
||||
public bool IsDecoration => false;
|
||||
|
||||
public IPalettedRenderable WithPalette(PaletteReference newPalette)
|
||||
{
|
||||
|
||||
@@ -44,9 +44,9 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
ChromeMetrics.Get<Color>("TextContrastColorLight"),
|
||||
text) { }
|
||||
|
||||
public WPos Pos { get { return effectiveWorldPos; } }
|
||||
public int ZOffset { get { return zOffset; } }
|
||||
public bool IsDecoration { get { return true; } }
|
||||
public WPos Pos => effectiveWorldPos;
|
||||
public int ZOffset => zOffset;
|
||||
public bool IsDecoration => true;
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new UITextRenderable(font, effectiveWorldPos, screenPos, zOffset, color, text); }
|
||||
public IRenderable OffsetBy(WVec vec) { return new UITextRenderable(font, effectiveWorldPos + vec, screenPos, zOffset, color, text); }
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.HitShapes
|
||||
{
|
||||
public class CircleShape : IHitShape
|
||||
{
|
||||
public WDist OuterRadius { get { return Radius; } }
|
||||
public WDist OuterRadius => Radius;
|
||||
|
||||
[FieldLoader.Require]
|
||||
public readonly WDist Radius = new WDist(426);
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace OpenRA.Mods.Common.Orders
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool ClearSelectionOnLeftClick { get { return false; } }
|
||||
public override bool ClearSelectionOnLeftClick => false;
|
||||
|
||||
static IEnumerable<Actor> FriendlyGuardableUnits(World world, MouseInput mi)
|
||||
{
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Pathfinder
|
||||
|
||||
public abstract IEnumerable<(CPos Cell, int Cost)> Considered { get; }
|
||||
|
||||
public Player Owner { get { return Graph.Actor.Owner; } }
|
||||
public Player Owner => Graph.Actor.Owner;
|
||||
public int MaxCost { get; protected set; }
|
||||
public bool Debug { get; set; }
|
||||
protected Func<CPos, int> heuristic;
|
||||
@@ -176,7 +176,7 @@ namespace OpenRA.Mods.Common.Pathfinder
|
||||
return isGoal(location);
|
||||
}
|
||||
|
||||
public bool CanExpand { get { return !OpenQueue.Empty; } }
|
||||
public bool CanExpand => !OpenQueue.Empty;
|
||||
public abstract CPos Expand();
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
|
||||
@@ -222,8 +222,8 @@ namespace OpenRA.Mods.Common.Pathfinder
|
||||
|
||||
public CellInfo this[CPos pos]
|
||||
{
|
||||
get { return (pos.Layer == 0 ? groundInfo : customLayerInfo[pos.Layer].Info)[pos]; }
|
||||
set { (pos.Layer == 0 ? groundInfo : customLayerInfo[pos.Layer].Info)[pos] = value; }
|
||||
get => (pos.Layer == 0 ? groundInfo : customLayerInfo[pos.Layer].Info)[pos];
|
||||
set => (pos.Layer == 0 ? groundInfo : customLayerInfo[pos.Layer].Info)[pos] = value;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
||||
@@ -30,10 +30,7 @@ namespace OpenRA.Mods.Common.Pathfinder
|
||||
return LayerPoolTable.GetValue(world, CreateLayerPool);
|
||||
}
|
||||
|
||||
public override IEnumerable<(CPos, int)> Considered
|
||||
{
|
||||
get { return considered; }
|
||||
}
|
||||
public override IEnumerable<(CPos, int)> Considered => considered;
|
||||
|
||||
LinkedList<(CPos, int)> considered;
|
||||
|
||||
|
||||
@@ -103,13 +103,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
bool isTailTravelling;
|
||||
bool continueTracking = true;
|
||||
|
||||
bool IsBeamComplete
|
||||
{
|
||||
get
|
||||
{
|
||||
return !isHeadTravelling && headTicks >= length && !isTailTravelling && tailTicks >= length;
|
||||
}
|
||||
}
|
||||
bool IsBeamComplete => !isHeadTravelling && headTicks >= length && !isTailTravelling && tailTicks >= length;
|
||||
|
||||
public AreaBeam(AreaBeamInfo info, ProjectileArgs args, Color color)
|
||||
{
|
||||
|
||||
@@ -159,6 +159,6 @@ namespace OpenRA.Mods.Common.Effects
|
||||
return anim.Render(pos, wr.Palette(weaponPalette));
|
||||
}
|
||||
|
||||
public float FractionComplete { get { return ticks * 1f / impactDelay; } }
|
||||
public float FractionComplete => ticks * 1f / impactDelay;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,14 +19,14 @@ namespace OpenRA.Mods.Common.Scripting.Global
|
||||
public AngleGlobal(ScriptContext context)
|
||||
: base(context) { }
|
||||
|
||||
public WAngle North { get { return WAngle.Zero; } }
|
||||
public WAngle NorthWest { get { return new WAngle(128); } }
|
||||
public WAngle West { get { return new WAngle(256); } }
|
||||
public WAngle SouthWest { get { return new WAngle(384); } }
|
||||
public WAngle South { get { return new WAngle(512); } }
|
||||
public WAngle SouthEast { get { return new WAngle(640); } }
|
||||
public WAngle East { get { return new WAngle(768); } }
|
||||
public WAngle NorthEast { get { return new WAngle(896); } }
|
||||
public WAngle North => WAngle.Zero;
|
||||
public WAngle NorthWest => new WAngle(128);
|
||||
public WAngle West => new WAngle(256);
|
||||
public WAngle SouthWest => new WAngle(384);
|
||||
public WAngle South => new WAngle(512);
|
||||
public WAngle SouthEast => new WAngle(640);
|
||||
public WAngle East => new WAngle(768);
|
||||
public WAngle NorthEast => new WAngle(896);
|
||||
|
||||
[Desc("Create an arbitrary angle.")]
|
||||
public WAngle New(int a) { return new WAngle(a); }
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("The center of the visible viewport.")]
|
||||
public WPos Position
|
||||
{
|
||||
get { return Context.WorldRenderer.Viewport.CenterPosition; }
|
||||
set { Context.WorldRenderer.Viewport.Center(value); }
|
||||
get => Context.WorldRenderer.Viewport.CenterPosition;
|
||||
set => Context.WorldRenderer.Viewport.Center(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,41 +51,41 @@ namespace OpenRA.Mods.Common.Scripting.Global
|
||||
throw new LuaException("Invalid rrggbb[aa] hex string.");
|
||||
}
|
||||
|
||||
public Color Aqua { get { return Color.Aqua; } }
|
||||
public Color Black { get { return Color.Black; } }
|
||||
public Color Blue { get { return Color.Blue; } }
|
||||
public Color Brown { get { return Color.Brown; } }
|
||||
public Color Cyan { get { return Color.Cyan; } }
|
||||
public Color DarkBlue { get { return Color.DarkBlue; } }
|
||||
public Color DarkCyan { get { return Color.DarkCyan; } }
|
||||
public Color DarkGray { get { return Color.DarkGray; } }
|
||||
public Color DarkGreen { get { return Color.DarkGreen; } }
|
||||
public Color DarkOrange { get { return Color.DarkOrange; } }
|
||||
public Color DarkRed { get { return Color.DarkRed; } }
|
||||
public Color Fuchsia { get { return Color.Fuchsia; } }
|
||||
public Color Gold { get { return Color.Gold; } }
|
||||
public Color Gray { get { return Color.Gray; } }
|
||||
public Color Green { get { return Color.Green; } }
|
||||
public Color LawnGreen { get { return Color.LawnGreen; } }
|
||||
public Color LightBlue { get { return Color.LightBlue; } }
|
||||
public Color LightCyan { get { return Color.LightCyan; } }
|
||||
public Color LightGray { get { return Color.LightGray; } }
|
||||
public Color LightGreen { get { return Color.LightGreen; } }
|
||||
public Color LightYellow { get { return Color.LightYellow; } }
|
||||
public Color Lime { get { return Color.Lime; } }
|
||||
public Color LimeGreen { get { return Color.LimeGreen; } }
|
||||
public Color Magenta { get { return Color.Magenta; } }
|
||||
public Color Maroon { get { return Color.Maroon; } }
|
||||
public Color Navy { get { return Color.Navy; } }
|
||||
public Color Olive { get { return Color.Olive; } }
|
||||
public Color Orange { get { return Color.Orange; } }
|
||||
public Color OrangeRed { get { return Color.OrangeRed; } }
|
||||
public Color Purple { get { return Color.Purple; } }
|
||||
public Color Red { get { return Color.Red; } }
|
||||
public Color Salmon { get { return Color.Salmon; } }
|
||||
public Color SkyBlue { get { return Color.SkyBlue; } }
|
||||
public Color Teal { get { return Color.Teal; } }
|
||||
public Color Yellow { get { return Color.Yellow; } }
|
||||
public Color White { get { return Color.White; } }
|
||||
public Color Aqua => Color.Aqua;
|
||||
public Color Black => Color.Black;
|
||||
public Color Blue => Color.Blue;
|
||||
public Color Brown => Color.Brown;
|
||||
public Color Cyan => Color.Cyan;
|
||||
public Color DarkBlue => Color.DarkBlue;
|
||||
public Color DarkCyan => Color.DarkCyan;
|
||||
public Color DarkGray => Color.DarkGray;
|
||||
public Color DarkGreen => Color.DarkGreen;
|
||||
public Color DarkOrange => Color.DarkOrange;
|
||||
public Color DarkRed => Color.DarkRed;
|
||||
public Color Fuchsia => Color.Fuchsia;
|
||||
public Color Gold => Color.Gold;
|
||||
public Color Gray => Color.Gray;
|
||||
public Color Green => Color.Green;
|
||||
public Color LawnGreen => Color.LawnGreen;
|
||||
public Color LightBlue => Color.LightBlue;
|
||||
public Color LightCyan => Color.LightCyan;
|
||||
public Color LightGray => Color.LightGray;
|
||||
public Color LightGreen => Color.LightGreen;
|
||||
public Color LightYellow => Color.LightYellow;
|
||||
public Color Lime => Color.Lime;
|
||||
public Color LimeGreen => Color.LimeGreen;
|
||||
public Color Magenta => Color.Magenta;
|
||||
public Color Maroon => Color.Maroon;
|
||||
public Color Navy => Color.Navy;
|
||||
public Color Olive => Color.Olive;
|
||||
public Color Orange => Color.Orange;
|
||||
public Color OrangeRed => Color.OrangeRed;
|
||||
public Color Purple => Color.Purple;
|
||||
public Color Red => Color.Red;
|
||||
public Color Salmon => Color.Salmon;
|
||||
public Color SkyBlue => Color.SkyBlue;
|
||||
public Color Teal => Color.Teal;
|
||||
public Color Yellow => Color.Yellow;
|
||||
public Color White => Color.White;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
public CPos New(int x, int y) { return new CPos(x, y); }
|
||||
|
||||
[Desc("The cell coordinate origin.")]
|
||||
public CPos Zero { get { return CPos.Zero; } }
|
||||
public CPos Zero => CPos.Zero;
|
||||
}
|
||||
|
||||
[ScriptGlobal("CVec")]
|
||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
public CVec New(int x, int y) { return new CVec(x, y); }
|
||||
|
||||
[Desc("The cell zero-vector.")]
|
||||
public CVec Zero { get { return CVec.Zero; } }
|
||||
public CVec Zero => CVec.Zero;
|
||||
}
|
||||
|
||||
[ScriptGlobal("WPos")]
|
||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
public WPos New(int x, int y, int z) { return new WPos(x, y, z); }
|
||||
|
||||
[Desc("The world coordinate origin.")]
|
||||
public WPos Zero { get { return WPos.Zero; } }
|
||||
public WPos Zero => WPos.Zero;
|
||||
}
|
||||
|
||||
[ScriptGlobal("WVec")]
|
||||
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
public WVec New(int x, int y, int z) { return new WVec(x, y, z); }
|
||||
|
||||
[Desc("The world zero-vector.")]
|
||||
public WVec Zero { get { return WVec.Zero; } }
|
||||
public WVec Zero => WVec.Zero;
|
||||
}
|
||||
|
||||
[ScriptGlobal("WDist")]
|
||||
|
||||
@@ -28,16 +28,10 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("True on the 31st of October.")]
|
||||
public bool IsHalloween
|
||||
{
|
||||
get { return DateTime.Today.Month == 10 && DateTime.Today.Day == 31; }
|
||||
}
|
||||
public bool IsHalloween => DateTime.Today.Month == 10 && DateTime.Today.Day == 31;
|
||||
|
||||
[Desc("Get the current game time (in ticks).")]
|
||||
public int GameTime
|
||||
{
|
||||
get { return Context.World.WorldTick; }
|
||||
}
|
||||
public int GameTime => Context.World.WorldTick;
|
||||
|
||||
[Desc("Converts the number of seconds into game time (ticks).")]
|
||||
public int Seconds(int seconds)
|
||||
@@ -54,10 +48,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("Return or set the time limit (in ticks). When setting, the time limit will count from now. Setting the time limit to 0 will disable it.")]
|
||||
public int TimeLimit
|
||||
{
|
||||
get
|
||||
{
|
||||
return tlm != null ? tlm.TimeLimit : 0;
|
||||
}
|
||||
get => tlm != null ? tlm.TimeLimit : 0;
|
||||
|
||||
set
|
||||
{
|
||||
@@ -71,10 +62,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("The notification string used for custom time limit warnings. See the TimeLimitManager trait documentation for details.")]
|
||||
public string TimeLimitNotification
|
||||
{
|
||||
get
|
||||
{
|
||||
return tlm != null ? tlm.Notification : null;
|
||||
}
|
||||
get => tlm != null ? tlm.Notification : null;
|
||||
|
||||
set
|
||||
{
|
||||
|
||||
@@ -40,25 +40,25 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
|
||||
public double Red
|
||||
{
|
||||
get { return hasLighting ? lighting.Red : 1d; }
|
||||
get => hasLighting ? lighting.Red : 1d;
|
||||
set { if (hasLighting) lighting.Red = (float)value; }
|
||||
}
|
||||
|
||||
public double Green
|
||||
{
|
||||
get { return hasLighting ? lighting.Green : 1d; }
|
||||
get => hasLighting ? lighting.Green : 1d;
|
||||
set { if (hasLighting) lighting.Green = (float)value; }
|
||||
}
|
||||
|
||||
public double Blue
|
||||
{
|
||||
get { return hasLighting ? lighting.Blue : 1d; }
|
||||
get => hasLighting ? lighting.Blue : 1d;
|
||||
set { if (hasLighting) lighting.Blue = (float)value; }
|
||||
}
|
||||
|
||||
public double Ambient
|
||||
{
|
||||
get { return hasLighting ? lighting.Ambient : 1d; }
|
||||
get => hasLighting ? lighting.Ambient : 1d;
|
||||
set { if (hasLighting) lighting.Ambient = (float)value; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,27 +49,15 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
return FilteredObjects(actors, filter).ToArray();
|
||||
}
|
||||
|
||||
// HACK: This api method abuses the coordinate system, and should be removed
|
||||
// in favour of proper actor queries. See #8549.
|
||||
[Desc("Returns the location of the top-left corner of the map (assuming zero terrain height).")]
|
||||
public WPos TopLeft
|
||||
{
|
||||
get
|
||||
{
|
||||
// HACK: This api method abuses the coordinate system, and should be removed
|
||||
// in favour of proper actor queries. See #8549.
|
||||
return Context.World.Map.ProjectedTopLeft;
|
||||
}
|
||||
}
|
||||
public WPos TopLeft => Context.World.Map.ProjectedTopLeft;
|
||||
|
||||
// HACK: This api method abuses the coordinate system, and should be removed
|
||||
// in favour of proper actor queries. See #8549.
|
||||
[Desc("Returns the location of the bottom-right corner of the map (assuming zero terrain height).")]
|
||||
public WPos BottomRight
|
||||
{
|
||||
get
|
||||
{
|
||||
// HACK: This api method abuses the coordinate system, and should be removed
|
||||
// in favour of proper actor queries. See #8549.
|
||||
return Context.World.Map.ProjectedBottomRight;
|
||||
}
|
||||
}
|
||||
public WPos BottomRight => Context.World.Map.ProjectedBottomRight;
|
||||
|
||||
[Desc("Returns a random cell inside the visible region of the map.")]
|
||||
public CPos RandomCell()
|
||||
@@ -109,10 +97,10 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("Returns true if there is only one human player.")]
|
||||
public bool IsSinglePlayer { get { return Context.World.LobbyInfo.NonBotPlayers.Count() == 1; } }
|
||||
public bool IsSinglePlayer => Context.World.LobbyInfo.NonBotPlayers.Count() == 1;
|
||||
|
||||
[Desc("Returns true if this is a shellmap and the player has paused animations.")]
|
||||
public bool IsPausedShellmap { get { return Context.World.Type == WorldType.Shellmap && gameSettings.PauseShellmap; } }
|
||||
public bool IsPausedShellmap => Context.World.Type == WorldType.Shellmap && gameSettings.PauseShellmap;
|
||||
|
||||
[Desc("Returns the value of a `ScriptLobbyDropdown` selected in the game lobby.")]
|
||||
public LuaValue LobbyOption(string id)
|
||||
@@ -127,10 +115,10 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("Returns a table of all the actors that were specified in the map file.")]
|
||||
public Actor[] NamedActors { get { return sma.Actors.Values.ToArray(); } }
|
||||
public Actor[] NamedActors => sma.Actors.Values.ToArray();
|
||||
|
||||
[Desc("Returns the actor that was specified with a given name in " +
|
||||
"the map file (or nil, if the actor is dead or not found).")]
|
||||
"the map file (or nil, if the actor is dead or not found).")]
|
||||
public Actor NamedActor(string actorName)
|
||||
{
|
||||
if (!sma.Actors.TryGetValue(actorName, out var ret))
|
||||
@@ -155,6 +143,6 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("Returns a table of all the actors that are currently on the map/in the world.")]
|
||||
public Actor[] ActorsInWorld { get { return world.Actors.ToArray(); } }
|
||||
public Actor[] ActorsInWorld => world.Actors.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,6 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
disposed = true;
|
||||
}
|
||||
|
||||
public bool FatalErrorOccurred { get { return context.FatalErrorOccurred; } }
|
||||
public bool FatalErrorOccurred => context.FatalErrorOccurred;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,16 +27,16 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("The actor's amount of experience.")]
|
||||
public int Experience { get { return exp.Experience; } }
|
||||
public int Experience => exp.Experience;
|
||||
|
||||
[Desc("The actor's level.")]
|
||||
public int Level { get { return exp.Level; } }
|
||||
public int Level => exp.Level;
|
||||
|
||||
[Desc("The actor's maximum possible level.")]
|
||||
public int MaxLevel { get { return exp.MaxLevel; } }
|
||||
public int MaxLevel => exp.MaxLevel;
|
||||
|
||||
[Desc("Returns true if the actor can gain a level.")]
|
||||
public bool CanGainLevel { get { return exp.CanGainLevel; } }
|
||||
public bool CanGainLevel => exp.CanGainLevel;
|
||||
|
||||
[Desc("Gives the actor experience. If 'silent' is true, no animation or sound will be played if the actor levels up.")]
|
||||
public void GiveExperience(int amount, bool silent = false)
|
||||
|
||||
@@ -31,10 +31,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("Specifies whether the actor is in the world.")]
|
||||
public bool IsInWorld
|
||||
{
|
||||
get
|
||||
{
|
||||
return Self.IsInWorld;
|
||||
}
|
||||
get => Self.IsInWorld;
|
||||
|
||||
set
|
||||
{
|
||||
@@ -46,18 +43,15 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("Specifies whether the actor is alive or dead.")]
|
||||
public bool IsDead { get { return Self.IsDead; } }
|
||||
public bool IsDead => Self.IsDead;
|
||||
|
||||
[Desc("Specifies whether the actor is idle (not performing any activities).")]
|
||||
public bool IsIdle { get { return Self.IsIdle; } }
|
||||
public bool IsIdle => Self.IsIdle;
|
||||
|
||||
[Desc("The player that owns the actor.")]
|
||||
public Player Owner
|
||||
{
|
||||
get
|
||||
{
|
||||
return Self.Owner;
|
||||
}
|
||||
get => Self.Owner;
|
||||
|
||||
set
|
||||
{
|
||||
@@ -70,7 +64,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("The type of the actor (e.g. \"e1\").")]
|
||||
public string Type { get { return Self.Info.Name; } }
|
||||
public string Type => Self.Info.Name;
|
||||
|
||||
[Desc("Test whether an actor has a specific property.")]
|
||||
public bool HasProperty(string name)
|
||||
@@ -116,10 +110,10 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("The actor position in cell coordinates.")]
|
||||
public CPos Location { get { return Self.Location; } }
|
||||
public CPos Location => Self.Location;
|
||||
|
||||
[Desc("The actor position in world coordinates.")]
|
||||
public WPos CenterPosition { get { return Self.CenterPosition; } }
|
||||
public WPos CenterPosition => Self.CenterPosition;
|
||||
|
||||
[Desc("The direction that the actor is facing.")]
|
||||
public WAngle Facing
|
||||
@@ -170,10 +164,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("Current actor stance. Returns nil if this actor doesn't support stances.")]
|
||||
public string Stance
|
||||
{
|
||||
get
|
||||
{
|
||||
return autotarget?.Stance.ToString();
|
||||
}
|
||||
get => autotarget?.Stance.ToString();
|
||||
|
||||
set
|
||||
{
|
||||
@@ -200,7 +191,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("Specifies whether or not the actor supports 'tags'.")]
|
||||
public bool IsTaggable { get { return scriptTags != null; } }
|
||||
public bool IsTaggable => scriptTags != null;
|
||||
|
||||
[Desc("Add a tag to the actor. Returns true on success, false otherwise (for example the actor may already have the given tag).")]
|
||||
public bool AddTag(string tag)
|
||||
|
||||
@@ -29,12 +29,12 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("Current health of the actor.")]
|
||||
public int Health
|
||||
{
|
||||
get { return health.HP; }
|
||||
set { health.InflictDamage(Self, Self, new Damage(health.HP - value), true); }
|
||||
get => health.HP;
|
||||
set => health.InflictDamage(Self, Self, new Damage(health.HP - value), true);
|
||||
}
|
||||
|
||||
[Desc("Maximum health of the actor.")]
|
||||
public int MaxHealth { get { return health.MaxHP; } }
|
||||
public int MaxHealth => health.MaxHP;
|
||||
|
||||
[Desc("Kill the actor. damageTypes may be omitted, specified as a string, or as table of strings.")]
|
||||
public void Kill(object damageTypes = null)
|
||||
|
||||
@@ -67,6 +67,6 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("Whether the actor can move (false if immobilized).")]
|
||||
public bool IsMobile { get { return !mobile.IsTraitDisabled && !mobile.IsTraitPaused; } }
|
||||
public bool IsMobile => !mobile.IsTraitDisabled && !mobile.IsTraitPaused;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,15 +28,9 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
|
||||
public int Experience
|
||||
{
|
||||
get
|
||||
{
|
||||
return exp.Experience;
|
||||
}
|
||||
get => exp.Experience;
|
||||
|
||||
set
|
||||
{
|
||||
exp.GiveExperience(value - exp.Experience);
|
||||
}
|
||||
set => exp.GiveExperience(value - exp.Experience);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,22 +25,22 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
: base(context, player) { }
|
||||
|
||||
[Desc("The player's internal name.")]
|
||||
public string InternalName { get { return Player.InternalName; } }
|
||||
public string InternalName => Player.InternalName;
|
||||
|
||||
[Desc("The player's name.")]
|
||||
public string Name { get { return Player.PlayerName; } }
|
||||
public string Name => Player.PlayerName;
|
||||
|
||||
[Desc("The player's color.")]
|
||||
public Color Color { get { return Player.Color; } }
|
||||
public Color Color => Player.Color;
|
||||
|
||||
[Desc("The player's faction.")]
|
||||
public string Faction { get { return Player.Faction.InternalName; } }
|
||||
public string Faction => Player.Faction.InternalName;
|
||||
|
||||
[Desc("The player's spawnpoint ID.")]
|
||||
public int Spawn { get { return Player.SpawnPoint; } }
|
||||
public int Spawn => Player.SpawnPoint;
|
||||
|
||||
[Desc("The player's home/starting location.")]
|
||||
public CPos HomeLocation { get { return Player.HomeLocation; } }
|
||||
public CPos HomeLocation => Player.HomeLocation;
|
||||
|
||||
[Desc("The player's team ID.")]
|
||||
public int Team
|
||||
@@ -63,13 +63,13 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("Returns true if the player is a bot.")]
|
||||
public bool IsBot { get { return Player.IsBot; } }
|
||||
public bool IsBot => Player.IsBot;
|
||||
|
||||
[Desc("Returns true if the player is non combatant.")]
|
||||
public bool IsNonCombatant { get { return Player.NonCombatant; } }
|
||||
public bool IsNonCombatant => Player.NonCombatant;
|
||||
|
||||
[Desc("Returns true if the player is the local player.")]
|
||||
public bool IsLocalPlayer { get { return Player == (Player.World.RenderPlayer ?? Player.World.LocalPlayer); } }
|
||||
public bool IsLocalPlayer => Player == (Player.World.RenderPlayer ?? Player.World.LocalPlayer);
|
||||
|
||||
[Desc("Returns all living actors staying inside the world for this player.")]
|
||||
public Actor[] GetActors()
|
||||
|
||||
@@ -27,21 +27,21 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("The combined value of units killed by this player.")]
|
||||
public int KillsCost { get { return stats.KillsCost; } }
|
||||
public int KillsCost => stats.KillsCost;
|
||||
|
||||
[Desc("The combined value of all units lost by this player.")]
|
||||
public int DeathsCost { get { return stats.DeathsCost; } }
|
||||
public int DeathsCost => stats.DeathsCost;
|
||||
|
||||
[Desc("The total number of units killed by this player.")]
|
||||
public int UnitsKilled { get { return stats.UnitsKilled; } }
|
||||
public int UnitsKilled => stats.UnitsKilled;
|
||||
|
||||
[Desc("The total number of units lost by this player.")]
|
||||
public int UnitsLost { get { return stats.UnitsDead; } }
|
||||
public int UnitsLost => stats.UnitsDead;
|
||||
|
||||
[Desc("The total number of buildings killed by this player.")]
|
||||
public int BuildingsKilled { get { return stats.BuildingsKilled; } }
|
||||
public int BuildingsKilled => stats.BuildingsKilled;
|
||||
|
||||
[Desc("The total number of buildings lost by this player.")]
|
||||
public int BuildingsLost { get { return stats.BuildingsDead; } }
|
||||
public int BuildingsLost => stats.BuildingsDead;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,23 +29,14 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("Returns the total of the power the player has.")]
|
||||
public int PowerProvided
|
||||
{
|
||||
get { return pm.PowerProvided; }
|
||||
}
|
||||
public int PowerProvided => pm.PowerProvided;
|
||||
|
||||
[Desc("Returns the power used by the player.")]
|
||||
public int PowerDrained
|
||||
{
|
||||
get { return pm.PowerDrained; }
|
||||
}
|
||||
public int PowerDrained => pm.PowerDrained;
|
||||
|
||||
[Desc("Returns the player's power state " +
|
||||
"(\"Normal\", \"Low\" or \"Critical\").")]
|
||||
public string PowerState
|
||||
{
|
||||
get { return pm.PowerState.ToString(); }
|
||||
}
|
||||
"(\"Normal\", \"Low\" or \"Critical\").")]
|
||||
public string PowerState => pm.PowerState.ToString();
|
||||
|
||||
[Desc("Triggers low power for the chosen amount of ticks.")]
|
||||
public void TriggerPowerOutage(int ticks)
|
||||
|
||||
@@ -92,10 +92,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
|
||||
return Self.Location;
|
||||
}
|
||||
set
|
||||
{
|
||||
rp.Path = new List<CPos> { value };
|
||||
}
|
||||
set => rp.Path = new List<CPos> { value };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,8 +110,8 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("Query or set the factory's primary building status.")]
|
||||
public bool IsPrimaryBuilding
|
||||
{
|
||||
get { return pb.IsPrimary; }
|
||||
set { pb.SetPrimaryProducer(Self, value); }
|
||||
get => pb.IsPrimary;
|
||||
set => pb.SetPrimaryProducer(Self, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,18 +30,18 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("The amount of harvestable resources held by the player.")]
|
||||
public int Resources
|
||||
{
|
||||
get { return pr.Resources; }
|
||||
set { pr.Resources = value.Clamp(0, pr.ResourceCapacity); }
|
||||
get => pr.Resources;
|
||||
set => pr.Resources = value.Clamp(0, pr.ResourceCapacity);
|
||||
}
|
||||
|
||||
[Desc("The maximum resource storage of the player.")]
|
||||
public int ResourceCapacity { get { return pr.ResourceCapacity; } }
|
||||
public int ResourceCapacity => pr.ResourceCapacity;
|
||||
|
||||
[Desc("The amount of cash held by the player.")]
|
||||
public int Cash
|
||||
{
|
||||
get { return pr.Cash; }
|
||||
set { pr.Cash = Math.Max(0, value); }
|
||||
get => pr.Cash;
|
||||
set => pr.Cash = Math.Max(0, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,13 +30,13 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("Returns references to passengers inside the transport.")]
|
||||
public Actor[] Passengers { get { return cargo.Passengers.ToArray(); } }
|
||||
public Actor[] Passengers => cargo.Passengers.ToArray();
|
||||
|
||||
[Desc("Specifies whether transport has any passengers.")]
|
||||
public bool HasPassengers { get { return cargo.Passengers.Any(); } }
|
||||
public bool HasPassengers => cargo.Passengers.Any();
|
||||
|
||||
[Desc("Specifies the amount of passengers.")]
|
||||
public int PassengerCount { get { return cargo.Passengers.Count(); } }
|
||||
public int PassengerCount => cargo.Passengers.Count();
|
||||
|
||||
[Desc("Teleport an existing actor inside this transport.")]
|
||||
public void LoadPassenger(Actor a)
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Server
|
||||
static readonly int ConnTimeout = 60000; // Drop unresponsive clients after 60 seconds
|
||||
|
||||
// TickTimeout is in microseconds
|
||||
public int TickTimeout { get { return PingInterval * 100; } }
|
||||
public int TickTimeout => PingInterval * 100;
|
||||
|
||||
long lastPing = 0;
|
||||
long lastConnReport = 0;
|
||||
|
||||
@@ -48,10 +48,10 @@ namespace OpenRA.Mods.Common.SpriteLoaders
|
||||
{
|
||||
public SpriteFrameType Type { get; private set; }
|
||||
public Size Size { get; private set; }
|
||||
public Size FrameSize { get { return Size; } }
|
||||
public float2 Offset { get { return float2.Zero; } }
|
||||
public Size FrameSize => Size;
|
||||
public float2 Offset => float2.Zero;
|
||||
public byte[] Data { get; private set; }
|
||||
public bool DisableExportPadding { get { return false; } }
|
||||
public bool DisableExportPadding => false;
|
||||
|
||||
public DdsFrame(Stream stream)
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.SpriteLoaders
|
||||
public Size FrameSize { get; set; }
|
||||
public float2 Offset { get; set; }
|
||||
public byte[] Data { get; set; }
|
||||
public bool DisableExportPadding { get { return false; } }
|
||||
public bool DisableExportPadding => false;
|
||||
}
|
||||
|
||||
public bool TryParseSprite(Stream s, out ISpriteFrame[] frames, out TypeDictionary metadata)
|
||||
|
||||
@@ -20,12 +20,12 @@ namespace OpenRA.Mods.Common.SpriteLoaders
|
||||
{
|
||||
class ShpTSFrame : ISpriteFrame
|
||||
{
|
||||
public SpriteFrameType Type { get { return SpriteFrameType.Indexed8; } }
|
||||
public SpriteFrameType Type => SpriteFrameType.Indexed8;
|
||||
public Size Size { get; private set; }
|
||||
public Size FrameSize { get; private set; }
|
||||
public float2 Offset { get; private set; }
|
||||
public byte[] Data { get; set; }
|
||||
public bool DisableExportPadding { get { return false; } }
|
||||
public bool DisableExportPadding => false;
|
||||
|
||||
public readonly uint FileOffset;
|
||||
public readonly byte Format;
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.SpriteLoaders
|
||||
public Size FrameSize { get; private set; }
|
||||
public float2 Offset { get; private set; }
|
||||
public byte[] Data { get; private set; }
|
||||
public bool DisableExportPadding { get { return false; } }
|
||||
public bool DisableExportPadding => false;
|
||||
|
||||
public TgaFrame()
|
||||
{
|
||||
|
||||
@@ -118,10 +118,7 @@ namespace OpenRA.Mods.Common.Terrain
|
||||
.Select(y => (TerrainTemplateInfo)new DefaultTerrainTemplateInfo(this, y)).ToDictionary(t => t.Id).AsReadOnly();
|
||||
}
|
||||
|
||||
public TerrainTypeInfo this[byte index]
|
||||
{
|
||||
get { return TerrainInfo[index]; }
|
||||
}
|
||||
public TerrainTypeInfo this[byte index] => TerrainInfo[index];
|
||||
|
||||
public byte GetTerrainIndex(string type)
|
||||
{
|
||||
@@ -157,18 +154,18 @@ namespace OpenRA.Mods.Common.Terrain
|
||||
return info != null;
|
||||
}
|
||||
|
||||
string ITerrainInfo.Id { get { return Id; } }
|
||||
TerrainTypeInfo[] ITerrainInfo.TerrainTypes { get { return TerrainInfo; } }
|
||||
string ITerrainInfo.Id => Id;
|
||||
TerrainTypeInfo[] ITerrainInfo.TerrainTypes => TerrainInfo;
|
||||
TerrainTileInfo ITerrainInfo.GetTerrainInfo(TerrainTile r) { return GetTileInfo(r); }
|
||||
bool ITerrainInfo.TryGetTerrainInfo(TerrainTile r, out TerrainTileInfo info) { return TryGetTileInfo(r, out info); }
|
||||
Color[] ITerrainInfo.HeightDebugColors { get { return HeightDebugColors; } }
|
||||
Color[] ITerrainInfo.HeightDebugColors => HeightDebugColors;
|
||||
IEnumerable<Color> ITerrainInfo.RestrictedPlayerColors { get { return TerrainInfo.Where(ti => ti.RestrictPlayerColor).Select(ti => ti.Color); } }
|
||||
float ITerrainInfo.MinHeightColorBrightness { get { return MinHeightColorBrightness; } }
|
||||
float ITerrainInfo.MaxHeightColorBrightness { get { return MaxHeightColorBrightness; } }
|
||||
TerrainTile ITerrainInfo.DefaultTerrainTile { get { return new TerrainTile(Templates.First().Key, 0); } }
|
||||
float ITerrainInfo.MinHeightColorBrightness => MinHeightColorBrightness;
|
||||
float ITerrainInfo.MaxHeightColorBrightness => MaxHeightColorBrightness;
|
||||
TerrainTile ITerrainInfo.DefaultTerrainTile => new TerrainTile(Templates.First().Key, 0);
|
||||
|
||||
string[] ITemplatedTerrainInfo.EditorTemplateOrder { get { return EditorTemplateOrder; } }
|
||||
IReadOnlyDictionary<ushort, TerrainTemplateInfo> ITemplatedTerrainInfo.Templates { get { return Templates; } }
|
||||
string[] ITemplatedTerrainInfo.EditorTemplateOrder => EditorTemplateOrder;
|
||||
IReadOnlyDictionary<ushort, TerrainTemplateInfo> ITemplatedTerrainInfo.Templates => Templates;
|
||||
|
||||
void ITerrainInfoNotifyMapCreated.MapCreated(Map map)
|
||||
{
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace OpenRA.Mods.Common.Terrain
|
||||
return template.Sprites[start * template.Stride + r.Index];
|
||||
}
|
||||
|
||||
public Sprite MissingTile { get { return missingTile; } }
|
||||
public Sprite MissingTile => missingTile;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
||||
@@ -88,16 +88,13 @@ namespace OpenRA.Mods.Common.Terrain
|
||||
return tile;
|
||||
}
|
||||
|
||||
public TerrainTileInfo this[int index] { get { return tileInfo[index]; } }
|
||||
public TerrainTileInfo this[int index] => tileInfo[index];
|
||||
|
||||
public bool Contains(int index)
|
||||
{
|
||||
return index >= 0 && index < tileInfo.Length;
|
||||
}
|
||||
|
||||
public int TilesCount
|
||||
{
|
||||
get { return tileInfo.Length; }
|
||||
}
|
||||
public int TilesCount => tileInfo.Length;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public ActorSpawner(ActorSpawnerInfo info)
|
||||
: base(info) { }
|
||||
|
||||
public HashSet<string> Types { get { return Info.Types; } }
|
||||
public HashSet<string> Types => Info.Types;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
RemoveCellsFromPlayerShroud(self, p);
|
||||
}
|
||||
|
||||
public virtual WDist Range { get { return CachedTraitDisabled ? WDist.Zero : Info.Range; } }
|
||||
public virtual WDist Range => CachedTraitDisabled ? WDist.Zero : Info.Range;
|
||||
|
||||
void INotifyMoving.MovementTypeChanged(Actor self, MovementType type)
|
||||
{
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public IReadOnlyDictionary<CPos, SubCell> OccupiedCells(ActorInfo info, CPos location, SubCell subCell = SubCell.Any) { return new ReadOnlyDictionary<CPos, SubCell>(); }
|
||||
|
||||
bool IOccupySpaceInfo.SharesCell { get { return false; } }
|
||||
bool IOccupySpaceInfo.SharesCell => false;
|
||||
|
||||
// Used to determine if an aircraft can spawn landed
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
@@ -232,30 +232,30 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Sync]
|
||||
public WAngle Facing
|
||||
{
|
||||
get { return orientation.Yaw; }
|
||||
set { orientation = orientation.WithYaw(value); }
|
||||
get => orientation.Yaw;
|
||||
set => orientation = orientation.WithYaw(value);
|
||||
}
|
||||
|
||||
public WAngle Pitch
|
||||
{
|
||||
get { return orientation.Pitch; }
|
||||
set { orientation = orientation.WithPitch(value); }
|
||||
get => orientation.Pitch;
|
||||
set => orientation = orientation.WithPitch(value);
|
||||
}
|
||||
|
||||
public WAngle Roll
|
||||
{
|
||||
get { return orientation.Roll; }
|
||||
set { orientation = orientation.WithRoll(value); }
|
||||
get => orientation.Roll;
|
||||
set => orientation = orientation.WithRoll(value);
|
||||
}
|
||||
|
||||
public WRot Orientation { get { return orientation; } }
|
||||
public WRot Orientation => orientation;
|
||||
|
||||
[Sync]
|
||||
public WPos CenterPosition { get; private set; }
|
||||
|
||||
public CPos TopLeft { get { return self.World.Map.CellContaining(CenterPosition); } }
|
||||
public WAngle TurnSpeed { get { return !IsTraitDisabled && !IsTraitPaused ? Info.TurnSpeed : WAngle.Zero; } }
|
||||
public WAngle? IdleTurnSpeed { get { return Info.IdleTurnSpeed; } }
|
||||
public CPos TopLeft => self.World.Map.CellContaining(CenterPosition);
|
||||
public WAngle TurnSpeed => !IsTraitDisabled && !IsTraitPaused ? Info.TurnSpeed : WAngle.Zero;
|
||||
public WAngle? IdleTurnSpeed => Info.IdleTurnSpeed;
|
||||
|
||||
public Actor ReservedActor { get; private set; }
|
||||
public bool MayYieldReservation { get; private set; }
|
||||
@@ -272,7 +272,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return self.CenterPosition - new WVec(WDist.Zero, WDist.Zero, self.World.Map.DistanceAboveTerrain(self.CenterPosition));
|
||||
}
|
||||
|
||||
public bool AtLandAltitude { get { return self.World.Map.DistanceAboveTerrain(GetPosition()) == LandAltitude; } }
|
||||
public bool AtLandAltitude => self.World.Map.DistanceAboveTerrain(GetPosition()) == LandAltitude;
|
||||
|
||||
bool airborne;
|
||||
bool cruising;
|
||||
@@ -595,10 +595,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return allowedToEnterRearmer || allowedToEnterRepairer;
|
||||
}
|
||||
|
||||
public int MovementSpeed
|
||||
{
|
||||
get { return !IsTraitDisabled && !IsTraitPaused ? Util.ApplyPercentageModifiers(Info.Speed, speedModifiers) : 0; }
|
||||
}
|
||||
public int MovementSpeed => !IsTraitDisabled && !IsTraitPaused ? Util.ApplyPercentageModifiers(Info.Speed, speedModifiers) : 0;
|
||||
|
||||
public (CPos Cell, SubCell SubCell)[] OccupiedCells()
|
||||
{
|
||||
@@ -967,10 +964,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public MovementType CurrentMovementTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
return movementTypes;
|
||||
}
|
||||
get => movementTypes;
|
||||
|
||||
set
|
||||
{
|
||||
@@ -1247,7 +1241,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
readonly Aircraft aircraft;
|
||||
|
||||
public string OrderID { get; protected set; }
|
||||
public int OrderPriority { get { return 4; } }
|
||||
public int OrderPriority => 4;
|
||||
public bool IsQueued { get; protected set; }
|
||||
|
||||
public AircraftMoveOrderTargeter(Aircraft aircraft)
|
||||
|
||||
@@ -60,8 +60,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
// We return init.Self.Owner if there's no effective owner
|
||||
bool IEffectiveOwner.Disguised { get { return true; } }
|
||||
Player IEffectiveOwner.Owner { get { return effectiveOwner; } }
|
||||
bool IEffectiveOwner.Disguised => true;
|
||||
Player IEffectiveOwner.Owner => effectiveOwner;
|
||||
|
||||
void INotifyCreated.Created(Actor self)
|
||||
{
|
||||
|
||||
@@ -59,8 +59,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Sync]
|
||||
public int CurrentAmmoCount { get; private set; }
|
||||
|
||||
public bool HasAmmo { get { return CurrentAmmoCount > 0; } }
|
||||
public bool HasFullAmmo { get { return CurrentAmmoCount == Info.Ammo; } }
|
||||
public bool HasAmmo => CurrentAmmoCount > 0;
|
||||
public bool HasFullAmmo => CurrentAmmoCount == Info.Ammo;
|
||||
|
||||
public AmmoPool(Actor self, AmmoPoolInfo info)
|
||||
{
|
||||
|
||||
@@ -363,7 +363,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool IsReloading { get { return FireDelay > 0 || IsTraitDisabled; } }
|
||||
public virtual bool IsReloading => FireDelay > 0 || IsTraitDisabled;
|
||||
|
||||
public WVec MuzzleOffset(Actor self, Barrel b)
|
||||
{
|
||||
@@ -396,6 +396,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return WRot.FromYaw(b.Yaw).Rotate(turret != null ? turret.WorldOrientation : self.Orientation);
|
||||
}
|
||||
|
||||
public Actor Actor { get { return self; } }
|
||||
public Actor Actor => self;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Sync]
|
||||
public bool IsAiming { get; set; }
|
||||
|
||||
public IEnumerable<Armament> Armaments { get { return getArmaments(); } }
|
||||
public IEnumerable<Armament> Armaments => getArmaments();
|
||||
|
||||
protected IFacing facing;
|
||||
protected IPositionable positionable;
|
||||
|
||||
@@ -155,6 +155,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool ClearSelectionOnLeftClick { get { return false; } }
|
||||
public override bool ClearSelectionOnLeftClick => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public WDist MinimumDistance { get { return info.MinDistance; } }
|
||||
public WDist MinimumDistance => info.MinDistance;
|
||||
|
||||
// No longer want to be carried
|
||||
void ICallForTransport.MovementCancelled(Actor self) { MovementCancelled(self); }
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Sync]
|
||||
int nextScanTime = 0;
|
||||
|
||||
public UnitStance Stance { get { return stance; } }
|
||||
public UnitStance Stance => stance;
|
||||
|
||||
[Sync]
|
||||
public Actor Aggressor;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public BlocksProjectiles(Actor self, BlocksProjectilesInfo info)
|
||||
: base(info) { }
|
||||
|
||||
WDist IBlocksProjectiles.BlockingHeight { get { return Info.Height; } }
|
||||
WDist IBlocksProjectiles.BlockingHeight => Info.Height;
|
||||
|
||||
public static bool AnyBlockingActorAt(World world, WPos pos)
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
readonly Lazy<int> quantizedFacings;
|
||||
|
||||
[Sync]
|
||||
public int QuantizedFacings { get { return quantizedFacings.Value; } }
|
||||
public int QuantizedFacings => quantizedFacings.Value;
|
||||
|
||||
public BodyOrientation(ActorInitializer init, BodyOrientationInfo info)
|
||||
{
|
||||
@@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
});
|
||||
}
|
||||
|
||||
public WAngle CameraPitch { get { return info.CameraPitch; } }
|
||||
public WAngle CameraPitch => info.CameraPitch;
|
||||
|
||||
public WVec LocalToWorld(WVec vec)
|
||||
{
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return randomConstructionYard != null ? randomConstructionYard.Location : initialBaseCenter;
|
||||
}
|
||||
|
||||
public CPos DefenseCenter { get { return defenseCenter; } }
|
||||
public CPos DefenseCenter => defenseCenter;
|
||||
|
||||
readonly World world;
|
||||
readonly Player player;
|
||||
@@ -194,10 +194,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
defenseCenter = newLocation;
|
||||
}
|
||||
|
||||
bool IBotRequestPauseUnitProduction.PauseUnitProduction
|
||||
{
|
||||
get { return !IsTraitDisabled && !HasAdequateRefineryCount; }
|
||||
}
|
||||
bool IBotRequestPauseUnitProduction.PauseUnitProduction => !IsTraitDisabled && !HasAdequateRefineryCount;
|
||||
|
||||
void IBotTick.BotTick(IBot bot)
|
||||
{
|
||||
@@ -261,25 +258,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return info != null && world.IsCellBuildable(x, null, info);
|
||||
}
|
||||
|
||||
public bool HasAdequateRefineryCount
|
||||
{
|
||||
get
|
||||
{
|
||||
// Require at least one refinery, unless we can't build it.
|
||||
return !Info.RefineryTypes.Any() ||
|
||||
AIUtils.CountBuildingByCommonName(Info.RefineryTypes, player) >= MinimumRefineryCount ||
|
||||
AIUtils.CountBuildingByCommonName(Info.PowerTypes, player) == 0 ||
|
||||
AIUtils.CountBuildingByCommonName(Info.ConstructionYardTypes, player) == 0;
|
||||
}
|
||||
}
|
||||
// Require at least one refinery, unless we can't build it.
|
||||
public bool HasAdequateRefineryCount =>
|
||||
!Info.RefineryTypes.Any() ||
|
||||
AIUtils.CountBuildingByCommonName(Info.RefineryTypes, player) >= MinimumRefineryCount ||
|
||||
AIUtils.CountBuildingByCommonName(Info.PowerTypes, player) == 0 ||
|
||||
AIUtils.CountBuildingByCommonName(Info.ConstructionYardTypes, player) == 0;
|
||||
|
||||
int MinimumRefineryCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return AIUtils.CountBuildingByCommonName(Info.BarracksTypes, player) > 0 ? Info.InititalMinimumRefineryCount + Info.AdditionalMinimumRefineryCount : Info.InititalMinimumRefineryCount;
|
||||
}
|
||||
}
|
||||
int MinimumRefineryCount => AIUtils.CountBuildingByCommonName(Info.BarracksTypes, player) > 0 ? Info.InititalMinimumRefineryCount + Info.AdditionalMinimumRefineryCount : Info.InititalMinimumRefineryCount;
|
||||
|
||||
List<MiniYamlNode> IGameSaveTraitData.IssueTraitData(Actor self)
|
||||
{
|
||||
|
||||
@@ -68,23 +68,17 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
||||
FuzzyStateMachine.Update(this);
|
||||
}
|
||||
|
||||
public bool IsValid { get { return Units.Any(); } }
|
||||
public bool IsValid => Units.Any();
|
||||
|
||||
public Actor TargetActor
|
||||
{
|
||||
get { return Target.Actor; }
|
||||
set { Target = Target.FromActor(value); }
|
||||
get => Target.Actor;
|
||||
set => Target = Target.FromActor(value);
|
||||
}
|
||||
|
||||
public bool IsTargetValid
|
||||
{
|
||||
get { return Target.IsValidFor(Units.FirstOrDefault()) && !Target.Actor.Info.HasTraitInfo<HuskInfo>(); }
|
||||
}
|
||||
public bool IsTargetValid => Target.IsValidFor(Units.FirstOrDefault()) && !Target.Actor.Info.HasTraitInfo<HuskInfo>();
|
||||
|
||||
public bool IsTargetVisible
|
||||
{
|
||||
get { return TargetActor.CanBeViewedByPlayer(Bot.Player); }
|
||||
}
|
||||
public bool IsTargetVisible => TargetActor.CanBeViewedByPlayer(Bot.Player);
|
||||
|
||||
public WPos CenterPosition { get { return Units.Select(u => u.CenterPosition).Average(); } }
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return RangeCircleRenderables(wr);
|
||||
}
|
||||
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
|
||||
|
||||
float ISelectionBar.GetValue()
|
||||
{
|
||||
@@ -130,6 +130,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
Color ISelectionBar.GetColor() { return Color.Purple; }
|
||||
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
|
||||
bool ISelectionBar.DisplayWhenEmpty => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Dictionary<CPos, byte> footprint;
|
||||
|
||||
public LegacyBridgeHut Hut { get; private set; }
|
||||
public bool IsDangling { get { return isDangling.Value; } }
|
||||
public bool IsDangling => isDangling.Value;
|
||||
|
||||
public Bridge(Actor self, BridgeInfo info)
|
||||
{
|
||||
|
||||
@@ -236,6 +236,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
public bool Repairing { get { return repairStep < segmentLocations.Count; } }
|
||||
public bool Repairing => repairStep < segmentLocations.Count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,10 +75,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
string IBridgeSegment.Type { get { return Info.Type; } }
|
||||
DamageState IBridgeSegment.DamageState { get { return Info.DamageState; } }
|
||||
bool IBridgeSegment.Valid { get { return self.IsInWorld; } }
|
||||
CVec[] IBridgeSegment.NeighbourOffsets { get { return Info.NeighbourOffsets; } }
|
||||
CPos IBridgeSegment.Location { get { return self.Location; } }
|
||||
string IBridgeSegment.Type => Info.Type;
|
||||
DamageState IBridgeSegment.DamageState => Info.DamageState;
|
||||
bool IBridgeSegment.Valid => self.IsInWorld;
|
||||
CVec[] IBridgeSegment.NeighbourOffsets => Info.NeighbourOffsets;
|
||||
CPos IBridgeSegment.Location => self.Location;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return new ReadOnlyDictionary<CPos, SubCell>(occupied);
|
||||
}
|
||||
|
||||
bool IOccupySpaceInfo.SharesCell { get { return false; } }
|
||||
bool IOccupySpaceInfo.SharesCell => false;
|
||||
|
||||
public IEnumerable<IRenderable> RenderAnnotations(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
|
||||
{
|
||||
@@ -270,7 +270,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
(CPos, SubCell)[] targetableCells;
|
||||
CPos[] transitOnlyCells;
|
||||
|
||||
public CPos TopLeft { get { return topLeft; } }
|
||||
public CPos TopLeft => topLeft;
|
||||
public WPos CenterPosition { get; private set; }
|
||||
|
||||
public Building(ActorInitializer init, BuildingInfo info)
|
||||
|
||||
@@ -129,6 +129,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
void IPlaceBuildingPreview.Tick() { TickInner(); }
|
||||
|
||||
int2 IPlaceBuildingPreview.TopLeftScreenOffset { get { return topLeftScreenOffset; } }
|
||||
int2 IPlaceBuildingPreview.TopLeftScreenOffset => topLeftScreenOffset;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,12 +136,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return blockedPositions.Any(loc => self.World.ActorMap.GetActorsAt(loc).Any(a => a != self));
|
||||
}
|
||||
|
||||
WDist IBlocksProjectiles.BlockingHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return new WDist(Info.BlocksProjectilesHeight.Length * (OpenPosition - Position) / OpenPosition);
|
||||
}
|
||||
}
|
||||
WDist IBlocksProjectiles.BlockingHeight => new WDist(Info.BlocksProjectilesHeight.Length * (OpenPosition - Position) / OpenPosition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
readonly HashSet<string> noAreaTypes = new HashSet<string>();
|
||||
|
||||
public HashSet<string> AreaTypes { get { return !IsTraitDisabled ? Info.AreaTypes : noAreaTypes; } }
|
||||
public HashSet<string> AreaTypes => !IsTraitDisabled ? Info.AreaTypes : noAreaTypes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,10 +117,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
});
|
||||
}
|
||||
|
||||
string IBridgeSegment.Type { get { return Info.Type; } }
|
||||
DamageState IBridgeSegment.DamageState { get { return self.GetDamageState(); } }
|
||||
bool IBridgeSegment.Valid { get { return self.IsInWorld; } }
|
||||
CVec[] IBridgeSegment.NeighbourOffsets { get { return Info.NeighbourOffsets; } }
|
||||
CPos IBridgeSegment.Location { get { return self.Location; } }
|
||||
string IBridgeSegment.Type => Info.Type;
|
||||
DamageState IBridgeSegment.DamageState => self.GetDamageState();
|
||||
bool IBridgeSegment.Valid => self.IsInWorld;
|
||||
CVec[] IBridgeSegment.NeighbourOffsets => Info.NeighbourOffsets;
|
||||
CPos IBridgeSegment.Location => self.Location;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
public Bridge FirstBridge { get; private set; }
|
||||
public Bridge Bridge { get; private set; }
|
||||
public DamageState BridgeDamageState { get { return Bridge.AggregateDamageState(); } }
|
||||
public bool Repairing { get { return repairDirections > 0; } }
|
||||
public DamageState BridgeDamageState => Bridge.AggregateDamageState();
|
||||
public bool Repairing => repairDirections > 0;
|
||||
int repairDirections = 0;
|
||||
|
||||
public LegacyBridgeHut(ActorInitializer init, LegacyBridgeHutInfo info)
|
||||
|
||||
@@ -132,8 +132,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
this.cursor = cursor;
|
||||
}
|
||||
|
||||
public string OrderID { get { return "SetRallyPoint"; } }
|
||||
public int OrderPriority { get { return 0; } }
|
||||
public string OrderID => "SetRallyPoint";
|
||||
public int OrderPriority => 0;
|
||||
public bool TargetOverridesSelection(Actor self, in Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
|
||||
public bool ForceSet { get; private set; }
|
||||
public bool IsQueued { get; protected set; }
|
||||
|
||||
@@ -69,12 +69,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Sync]
|
||||
bool preventDock = false;
|
||||
|
||||
public bool AllowDocking { get { return !preventDock; } }
|
||||
public CVec DeliveryOffset { get { return info.DockOffset; } }
|
||||
public WAngle DeliveryAngle { get { return info.DockAngle; } }
|
||||
public bool IsDragRequired { get { return info.IsDragRequired; } }
|
||||
public WVec DragOffset { get { return info.DragOffset; } }
|
||||
public int DragLength { get { return info.DragLength; } }
|
||||
public bool AllowDocking => !preventDock;
|
||||
public CVec DeliveryOffset => info.DockOffset;
|
||||
public WAngle DeliveryAngle => info.DockAngle;
|
||||
public bool IsDragRequired => info.IsDragRequired;
|
||||
public WVec DragOffset => info.DragOffset;
|
||||
public int DragLength => info.DragLength;
|
||||
|
||||
public Refinery(Actor self, RefineryInfo info)
|
||||
{
|
||||
|
||||
@@ -186,8 +186,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
this.aircraft = aircraft;
|
||||
}
|
||||
|
||||
public string OrderID { get { return "Move"; } }
|
||||
public int OrderPriority { get { return 4; } }
|
||||
public string OrderID => "Move";
|
||||
public int OrderPriority => 4;
|
||||
public bool IsQueued { get; protected set; }
|
||||
|
||||
public bool CanTarget(Actor self, in Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||
|
||||
@@ -177,8 +177,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
rejectMove = !self.AcceptsOrder("Move");
|
||||
}
|
||||
|
||||
public string OrderID { get { return "Move"; } }
|
||||
public int OrderPriority { get { return 4; } }
|
||||
public string OrderID => "Move";
|
||||
public int OrderPriority => 4;
|
||||
public bool IsQueued { get; protected set; }
|
||||
|
||||
public bool CanTarget(Actor self, in Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
|
||||
|
||||
@@ -51,6 +51,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
Color ISelectionBar.GetColor() { return Info.Color; }
|
||||
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
|
||||
bool ISelectionBar.DisplayWhenEmpty => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
Color ISelectionBar.GetColor() { return Info.Color; }
|
||||
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
|
||||
bool ISelectionBar.DisplayWhenEmpty => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly Dictionary<string, string> PassengerConditions = new Dictionary<string, string>();
|
||||
|
||||
[GrantedConditionReference]
|
||||
public IEnumerable<string> LinterPassengerConditions { get { return PassengerConditions.Values; } }
|
||||
public IEnumerable<string> LinterPassengerConditions => PassengerConditions.Values;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new Cargo(init, this); }
|
||||
}
|
||||
@@ -108,13 +108,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
readonly CachedTransform<CPos, IEnumerable<CPos>> currentAdjacentCells;
|
||||
|
||||
public IEnumerable<CPos> CurrentAdjacentCells
|
||||
{
|
||||
get { return currentAdjacentCells.Update(self.Location); }
|
||||
}
|
||||
public IEnumerable<CPos> CurrentAdjacentCells => currentAdjacentCells.Update(self.Location);
|
||||
|
||||
public IEnumerable<Actor> Passengers { get { return cargo; } }
|
||||
public int PassengerCount { get { return cargo.Count; } }
|
||||
public IEnumerable<Actor> Passengers => cargo;
|
||||
public int PassengerCount => cargo.Count;
|
||||
|
||||
enum State { Free, Locked }
|
||||
State state = State.Free;
|
||||
|
||||
@@ -52,9 +52,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
IDelayCarryallPickup[] delayPickups;
|
||||
|
||||
public Actor Carrier { get; private set; }
|
||||
public bool Reserved { get { return state != State.Free; } }
|
||||
public bool Reserved => state != State.Free;
|
||||
public CPos? Destination { get; protected set; }
|
||||
public bool WantsTransport { get { return Destination != null && !IsTraitDisabled; } }
|
||||
public bool WantsTransport => Destination != null && !IsTraitDisabled;
|
||||
|
||||
protected enum State { Free, Reserved, Locked }
|
||||
protected State state = State.Free;
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
HashSet<string> IOverrideAircraftLanding.LandableTerrainTypes { get { return landableTerrainTypes ?? aircraft.Info.LandableTerrainTypes; } }
|
||||
HashSet<string> IOverrideAircraftLanding.LandableTerrainTypes => landableTerrainTypes ?? aircraft.Info.LandableTerrainTypes;
|
||||
|
||||
public virtual bool AttachCarryable(Actor self, Actor carryable)
|
||||
{
|
||||
@@ -399,8 +399,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
readonly AircraftInfo aircraftInfo;
|
||||
readonly CarryallInfo info;
|
||||
|
||||
public string OrderID { get { return "DeliverUnit"; } }
|
||||
public int OrderPriority { get { return 6; } }
|
||||
public string OrderID => "DeliverUnit";
|
||||
public int OrderPriority => 6;
|
||||
public bool IsQueued { get; protected set; }
|
||||
public bool TargetOverridesSelection(Actor self, in Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
base.Created(self);
|
||||
}
|
||||
|
||||
public bool Cloaked { get { return !IsTraitDisabled && !IsTraitPaused && remainingTime <= 0; } }
|
||||
public bool Cloaked => !IsTraitDisabled && !IsTraitPaused && remainingTime <= 0;
|
||||
|
||||
public void Uncloak() { Uncloak(Info.CloakDelay); }
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
yield return r;
|
||||
}
|
||||
|
||||
bool IRenderAnnotations.SpatiallyPartitionable { get { return true; } }
|
||||
bool IRenderAnnotations.SpatiallyPartitionable => true;
|
||||
|
||||
IEnumerable<IRenderable> RenderArmaments(Actor self, AttackBase attack)
|
||||
{
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
int deployedToken = Actor.InvalidConditionToken;
|
||||
int undeployedToken = Actor.InvalidConditionToken;
|
||||
|
||||
public DeployState DeployState { get { return deployState; } }
|
||||
public DeployState DeployState => deployState;
|
||||
|
||||
public GrantConditionOnDeploy(ActorInitializer init, GrantConditionOnDeployInfo info)
|
||||
: base(info)
|
||||
|
||||
@@ -79,6 +79,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
Color ISelectionBar.GetColor() { return info.SelectionBarColor; }
|
||||
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
|
||||
bool ISelectionBar.DisplayWhenEmpty => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return new ReadOnlyDictionary<CPos, SubCell>(occupied);
|
||||
}
|
||||
|
||||
bool IOccupySpaceInfo.SharesCell { get { return false; } }
|
||||
bool IOccupySpaceInfo.SharesCell => false;
|
||||
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
{
|
||||
@@ -176,7 +176,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
self.Dispose();
|
||||
}
|
||||
|
||||
public CPos TopLeft { get { return Location; } }
|
||||
public CPos TopLeft => Location;
|
||||
public (CPos, SubCell)[] OccupiedCells() { return new[] { (Location, SubCell.FullCell) }; }
|
||||
|
||||
public WPos CenterPosition { get; private set; }
|
||||
|
||||
@@ -101,6 +101,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return true; } }
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly Dictionary<int, string> Conditions = null;
|
||||
|
||||
[GrantedConditionReference]
|
||||
public IEnumerable<string> LinterConditions { get { return Conditions.Values; } }
|
||||
public IEnumerable<string> LinterConditions => Conditions.Values;
|
||||
|
||||
[Desc("Image for the level up sprite.")]
|
||||
public readonly string LevelUpImage = null;
|
||||
@@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
GiveExperience(initialExperience, info.SuppressLevelupAnimation);
|
||||
}
|
||||
|
||||
public bool CanGainLevel { get { return Level < MaxLevel; } }
|
||||
public bool CanGainLevel => Level < MaxLevel;
|
||||
|
||||
public void GiveLevels(int numLevels, bool silent = false)
|
||||
{
|
||||
|
||||
@@ -214,9 +214,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool IsFull { get { return contents.Values.Sum() == Info.Capacity; } }
|
||||
public bool IsEmpty { get { return contents.Values.Sum() == 0; } }
|
||||
public int Fullness { get { return contents.Values.Sum() * 100 / Info.Capacity; } }
|
||||
public bool IsFull => contents.Values.Sum() == Info.Capacity;
|
||||
public bool IsEmpty => contents.Values.Sum() == 0;
|
||||
public int Fullness => contents.Values.Sum() * 100 / Info.Capacity;
|
||||
|
||||
void UpdateCondition(Actor self)
|
||||
{
|
||||
@@ -366,8 +366,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
class HarvestOrderTargeter : IOrderTargeter
|
||||
{
|
||||
public string OrderID { get { return "Harvest"; } }
|
||||
public int OrderPriority { get { return 10; } }
|
||||
public string OrderID => "Harvest";
|
||||
public int OrderPriority => 10;
|
||||
public bool IsQueued { get; protected set; }
|
||||
public bool TargetOverridesSelection(Actor self, in Target target, List<Actor> actorsAt, CPos xy, TargetModifiers modifiers) { return true; }
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
throw new YamlException("Actors with Health need at least one HitShape trait!");
|
||||
}
|
||||
|
||||
int IHealthInfo.MaxHP { get { return HP; } }
|
||||
int IHealthInfo.MaxHP => HP;
|
||||
|
||||
IEnumerable<EditorActorOption> IEditorActorOptions.ActorOptions(ActorInfo ai, World world)
|
||||
{
|
||||
@@ -78,10 +78,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
DisplayHP = hp;
|
||||
}
|
||||
|
||||
public int HP { get { return hp; } }
|
||||
public int HP => hp;
|
||||
public int MaxHP { get; private set; }
|
||||
|
||||
public bool IsDead { get { return hp <= 0; } }
|
||||
public bool IsDead => hp <= 0;
|
||||
public bool RemoveOnDeath = true;
|
||||
|
||||
public DamageState DamageState
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
base.Created(self);
|
||||
}
|
||||
|
||||
bool ITargetablePositions.AlwaysEnabled { get { return Info.RequiresCondition == null; } }
|
||||
bool ITargetablePositions.AlwaysEnabled => Info.RequiresCondition == null;
|
||||
|
||||
IEnumerable<WPos> ITargetablePositions.TargetablePositions(Actor self)
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user