Silence IDE0290.
This rule recommends use of primary constructors. Apply the suggestions on simple POCOs, adjusting some to readonly/structs/records at the same time. For more complex classes, the use of primary constructors is more distracting than helpful, so silence the rule. IDEs can still offer fixes for using primary constructors, but it will not show up as a build issue.
This commit is contained in:
committed by
Gustas Kažukauskas
parent
3de6a5fd5a
commit
36660b89e9
@@ -72,7 +72,7 @@ dotnet_diagnostic.IDE0211.severity = warning
|
|||||||
|
|
||||||
# IDE0290 Use primary constructor
|
# IDE0290 Use primary constructor
|
||||||
#csharp_style_prefer_primary_constructors = true
|
#csharp_style_prefer_primary_constructors = true
|
||||||
dotnet_diagnostic.IDE0290.severity = suggestion # TODO: Consider enabling
|
dotnet_diagnostic.IDE0290.severity = silent
|
||||||
|
|
||||||
# IDE0330 Prefer 'System.Threading.Lock'
|
# IDE0330 Prefer 'System.Threading.Lock'
|
||||||
#csharp_prefer_system_threading_lock = true
|
#csharp_prefer_system_threading_lock = true
|
||||||
|
|||||||
@@ -841,9 +841,8 @@ namespace OpenRA
|
|||||||
|
|
||||||
// Mirrors DescriptionAttribute from System.ComponentModel but we don't want to have to use that everywhere.
|
// Mirrors DescriptionAttribute from System.ComponentModel but we don't want to have to use that everywhere.
|
||||||
[AttributeUsage(AttributeTargets.All)]
|
[AttributeUsage(AttributeTargets.All)]
|
||||||
public sealed class DescAttribute : Attribute
|
public sealed class DescAttribute(params string[] lines) : Attribute
|
||||||
{
|
{
|
||||||
public readonly string[] Lines;
|
public readonly string[] Lines = lines;
|
||||||
public DescAttribute(params string[] lines) { Lines = lines; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,19 +37,7 @@ namespace OpenRA.Graphics
|
|||||||
Func<float> getScale, Func<IModel> getVoxel, Func<WRot> getRotation);
|
Func<float> getScale, Func<IModel> getVoxel, Func<WRot> getRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly struct ModelRenderData
|
public readonly record struct ModelRenderData(int Start, int Count, Sheet Sheet);
|
||||||
{
|
|
||||||
public readonly int Start;
|
|
||||||
public readonly int Count;
|
|
||||||
public readonly Sheet Sheet;
|
|
||||||
|
|
||||||
public ModelRenderData(int start, int count, Sheet sheet)
|
|
||||||
{
|
|
||||||
Start = start;
|
|
||||||
Count = count;
|
|
||||||
Sheet = sheet;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IModelCacheInfo : ITraitInfoInterface { }
|
public interface IModelCacheInfo : ITraitInfoInterface { }
|
||||||
|
|
||||||
|
|||||||
@@ -179,12 +179,6 @@ namespace OpenRA
|
|||||||
TriangleList,
|
TriangleList,
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly struct Range<T>
|
|
||||||
{
|
|
||||||
public readonly T Start, End;
|
|
||||||
public Range(T start, T end) { Start = start; End = end; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum WindowMode
|
public enum WindowMode
|
||||||
{
|
{
|
||||||
Windowed,
|
Windowed,
|
||||||
|
|||||||
@@ -14,29 +14,10 @@ using System.Runtime.InteropServices;
|
|||||||
namespace OpenRA.Graphics
|
namespace OpenRA.Graphics
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public readonly struct RenderPostProcessPassVertex
|
public readonly record struct RenderPostProcessPassVertex(float X, float Y);
|
||||||
{
|
|
||||||
public readonly float X, Y;
|
|
||||||
|
|
||||||
public RenderPostProcessPassVertex(float x, float y)
|
|
||||||
{
|
|
||||||
X = x; Y = y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public readonly struct RenderPostProcessPassTexturedVertex
|
public readonly record struct RenderPostProcessPassTexturedVertex(float X, float Y, float S, float T);
|
||||||
{
|
|
||||||
// 3d position
|
|
||||||
public readonly float X, Y;
|
|
||||||
public readonly float S, T;
|
|
||||||
|
|
||||||
public RenderPostProcessPassTexturedVertex(float x, float y, float s, float t)
|
|
||||||
{
|
|
||||||
X = x; Y = y;
|
|
||||||
S = s; T = t;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class RenderPostProcessPassShaderBindings : ShaderBindings
|
public sealed class RenderPostProcessPassShaderBindings : ShaderBindings
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,21 +23,7 @@ namespace OpenRA.Graphics
|
|||||||
UInt = 0x1405 // GL_UNSIGNED_INT
|
UInt = 0x1405 // GL_UNSIGNED_INT
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly struct ShaderVertexAttribute
|
public readonly record struct ShaderVertexAttribute(string Name, ShaderVertexAttributeType Type, int Components, int Offset);
|
||||||
{
|
|
||||||
public readonly string Name;
|
|
||||||
public readonly ShaderVertexAttributeType Type;
|
|
||||||
public readonly int Components;
|
|
||||||
public readonly int Offset;
|
|
||||||
|
|
||||||
public ShaderVertexAttribute(string name, ShaderVertexAttributeType type, int components, int offset)
|
|
||||||
{
|
|
||||||
Name = name;
|
|
||||||
Type = type;
|
|
||||||
Components = components;
|
|
||||||
Offset = offset;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract class ShaderBindings : IShaderBindings
|
public abstract class ShaderBindings : IShaderBindings
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,25 +23,7 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum MouseInputEvent { Down, Move, Up, Scroll }
|
public enum MouseInputEvent { Down, Move, Up, Scroll }
|
||||||
public struct MouseInput
|
public record struct MouseInput(MouseInputEvent Event, MouseButton Button, int2 Location, int2 Delta, Modifiers Modifiers, int MultiTapCount);
|
||||||
{
|
|
||||||
public MouseInputEvent Event;
|
|
||||||
public MouseButton Button;
|
|
||||||
public int2 Location;
|
|
||||||
public int2 Delta;
|
|
||||||
public Modifiers Modifiers;
|
|
||||||
public int MultiTapCount;
|
|
||||||
|
|
||||||
public MouseInput(MouseInputEvent ev, MouseButton button, int2 location, int2 delta, Modifiers mods, int multiTapCount)
|
|
||||||
{
|
|
||||||
Event = ev;
|
|
||||||
Button = button;
|
|
||||||
Location = location;
|
|
||||||
Delta = delta;
|
|
||||||
Modifiers = mods;
|
|
||||||
MultiTapCount = multiTapCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum MouseButton
|
public enum MouseButton
|
||||||
|
|||||||
@@ -216,10 +216,8 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LocationInit : ValueActorInit<CPos>, ISingleInstanceInit
|
public class LocationInit(CPos value) : ValueActorInit<CPos>(value), ISingleInstanceInit
|
||||||
{
|
{
|
||||||
public LocationInit(CPos value)
|
|
||||||
: base(value) { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OwnerInit : ActorInit, ISingleInstanceInit
|
public class OwnerInit : ActorInit, ISingleInstanceInit
|
||||||
|
|||||||
@@ -11,16 +11,10 @@
|
|||||||
|
|
||||||
namespace OpenRA
|
namespace OpenRA
|
||||||
{
|
{
|
||||||
public readonly struct TerrainTile
|
public readonly struct TerrainTile(ushort type, byte index)
|
||||||
{
|
{
|
||||||
public readonly ushort Type;
|
public readonly ushort Type = type;
|
||||||
public readonly byte Index;
|
public readonly byte Index = index;
|
||||||
|
|
||||||
public TerrainTile(ushort type, byte index)
|
|
||||||
{
|
|
||||||
Type = type;
|
|
||||||
Index = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int GetHashCode() { return Type.GetHashCode() ^ Index.GetHashCode(); }
|
public override int GetHashCode() { return Type.GetHashCode() ^ Index.GetHashCode(); }
|
||||||
|
|
||||||
@@ -42,16 +36,10 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly struct ResourceTile
|
public readonly struct ResourceTile(byte type, byte index)
|
||||||
{
|
{
|
||||||
public readonly byte Type;
|
public readonly byte Type = type;
|
||||||
public readonly byte Index;
|
public readonly byte Index = index;
|
||||||
|
|
||||||
public ResourceTile(byte type, byte index)
|
|
||||||
{
|
|
||||||
Type = type;
|
|
||||||
Index = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int GetHashCode() { return Type.GetHashCode() ^ Index.GetHashCode(); }
|
public override int GetHashCode() { return Type.GetHashCode() ^ Index.GetHashCode(); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,16 +59,10 @@ namespace OpenRA
|
|||||||
|
|
||||||
public sealed class MiniYamlNode
|
public sealed class MiniYamlNode
|
||||||
{
|
{
|
||||||
public readonly struct SourceLocation
|
public readonly struct SourceLocation(string name, int line)
|
||||||
{
|
{
|
||||||
public readonly string Name;
|
public readonly string Name = name;
|
||||||
public readonly int Line;
|
public readonly int Line = line;
|
||||||
|
|
||||||
public SourceLocation(string name, int line)
|
|
||||||
{
|
|
||||||
Name = name;
|
|
||||||
Line = line;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString() { return $"{Name}:{Line}"; }
|
public override string ToString() { return $"{Name}:{Line}"; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,19 +54,5 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PlayerBadge
|
public record PlayerBadge(string Label, string Icon, string Icon2x, string Icon3x);
|
||||||
{
|
|
||||||
public readonly string Label;
|
|
||||||
public readonly string Icon;
|
|
||||||
public readonly string Icon2x;
|
|
||||||
public readonly string Icon3x;
|
|
||||||
|
|
||||||
public PlayerBadge(string label, string icon, string icon2x, string icon3x)
|
|
||||||
{
|
|
||||||
Label = label;
|
|
||||||
Icon = icon;
|
|
||||||
Icon2x = icon2x;
|
|
||||||
Icon3x = icon3x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,10 +33,9 @@ namespace OpenRA.Scripting
|
|||||||
|
|
||||||
// For traitinfos that provide actor / player commands
|
// For traitinfos that provide actor / player commands
|
||||||
[AttributeUsage(AttributeTargets.Class)]
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
public sealed class ScriptPropertyGroupAttribute : Attribute
|
public sealed class ScriptPropertyGroupAttribute(string category) : Attribute
|
||||||
{
|
{
|
||||||
public readonly string Category;
|
public readonly string Category = category;
|
||||||
public ScriptPropertyGroupAttribute(string category) { Category = category; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// For property groups that are safe to initialize invoke on destroyed actors
|
// For property groups that are safe to initialize invoke on destroyed actors
|
||||||
@@ -46,28 +45,16 @@ namespace OpenRA.Scripting
|
|||||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)]
|
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)]
|
||||||
public sealed class ScriptActorPropertyActivityAttribute : Attribute { }
|
public sealed class ScriptActorPropertyActivityAttribute : Attribute { }
|
||||||
|
|
||||||
public abstract class ScriptActorProperties
|
public abstract class ScriptActorProperties(ScriptContext context, Actor self)
|
||||||
{
|
{
|
||||||
protected readonly Actor Self;
|
protected readonly Actor Self = self;
|
||||||
protected readonly ScriptContext Context;
|
protected readonly ScriptContext Context = context;
|
||||||
|
|
||||||
protected ScriptActorProperties(ScriptContext context, Actor self)
|
|
||||||
{
|
|
||||||
Self = self;
|
|
||||||
Context = context;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class ScriptPlayerProperties
|
public abstract class ScriptPlayerProperties(ScriptContext context, Player player)
|
||||||
{
|
{
|
||||||
protected readonly Player Player;
|
protected readonly Player Player = player;
|
||||||
protected readonly ScriptContext Context;
|
protected readonly ScriptContext Context = context;
|
||||||
|
|
||||||
protected ScriptPlayerProperties(ScriptContext context, Player player)
|
|
||||||
{
|
|
||||||
Player = player;
|
|
||||||
Context = context;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -124,10 +111,9 @@ namespace OpenRA.Scripting
|
|||||||
}
|
}
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Class)]
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
public sealed class ScriptGlobalAttribute : Attribute
|
public sealed class ScriptGlobalAttribute(string name) : Attribute
|
||||||
{
|
{
|
||||||
public readonly string Name;
|
public readonly string Name = name;
|
||||||
public ScriptGlobalAttribute(string name) { Name = name; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class ScriptContext : IDisposable
|
public sealed class ScriptContext : IDisposable
|
||||||
|
|||||||
@@ -32,17 +32,7 @@ namespace OpenRA
|
|||||||
void SetSoundPosition(ISound sound, WPos position);
|
void SetSoundPosition(ISound sound, WPos position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SoundDevice
|
public record SoundDevice(string Device, string Label);
|
||||||
{
|
|
||||||
public readonly string Device;
|
|
||||||
public readonly string Label;
|
|
||||||
|
|
||||||
public SoundDevice(string device, string label)
|
|
||||||
{
|
|
||||||
Device = device;
|
|
||||||
Label = label;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface ISoundSource : IDisposable { }
|
public interface ISoundSource : IDisposable { }
|
||||||
|
|
||||||
|
|||||||
@@ -30,17 +30,7 @@ namespace OpenRA.Support
|
|||||||
samples.GetOrAdd(item.Key).Add(new BenchmarkPoint(localTick, item.Value.LastValue));
|
samples.GetOrAdd(item.Key).Add(new BenchmarkPoint(localTick, item.Value.LastValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class BenchmarkPoint
|
readonly record struct BenchmarkPoint(int Tick, double Value);
|
||||||
{
|
|
||||||
public int Tick { get; }
|
|
||||||
public double Value { get; }
|
|
||||||
|
|
||||||
public BenchmarkPoint(int tick, double value)
|
|
||||||
{
|
|
||||||
Tick = tick;
|
|
||||||
Value = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Write()
|
public void Write()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,17 +26,7 @@ namespace OpenRA
|
|||||||
public TextWriter Writer;
|
public TextWriter Writer;
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly struct ChannelData
|
readonly record struct ChannelData(string Channel, string Text);
|
||||||
{
|
|
||||||
public readonly string Channel;
|
|
||||||
public readonly string Text;
|
|
||||||
|
|
||||||
public ChannelData(string channel, string text)
|
|
||||||
{
|
|
||||||
Text = text;
|
|
||||||
Channel = channel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Log
|
public static class Log
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,33 +46,21 @@ namespace OpenRA.Traits
|
|||||||
public sealed class WeaponReferenceAttribute : Attribute { }
|
public sealed class WeaponReferenceAttribute : Attribute { }
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Field)]
|
[AttributeUsage(AttributeTargets.Field)]
|
||||||
public sealed class SequenceReferenceAttribute : Attribute
|
public sealed class SequenceReferenceAttribute(
|
||||||
|
string imageReference = null, bool prefix = false, bool allowNullImage = false,
|
||||||
|
LintDictionaryReference dictionaryReference = LintDictionaryReference.None) : Attribute
|
||||||
{
|
{
|
||||||
// The field name in the same trait info that contains the image name.
|
// The field name in the same trait info that contains the image name.
|
||||||
public readonly string ImageReference;
|
public readonly string ImageReference = imageReference;
|
||||||
public readonly bool Prefix;
|
public readonly bool Prefix = prefix;
|
||||||
public readonly bool AllowNullImage;
|
public readonly bool AllowNullImage = allowNullImage;
|
||||||
public readonly LintDictionaryReference DictionaryReference;
|
public readonly LintDictionaryReference DictionaryReference = dictionaryReference;
|
||||||
|
|
||||||
public SequenceReferenceAttribute(string imageReference = null, bool prefix = false, bool allowNullImage = false,
|
|
||||||
LintDictionaryReference dictionaryReference = LintDictionaryReference.None)
|
|
||||||
{
|
|
||||||
ImageReference = imageReference;
|
|
||||||
Prefix = prefix;
|
|
||||||
AllowNullImage = allowNullImage;
|
|
||||||
DictionaryReference = dictionaryReference;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Field)]
|
[AttributeUsage(AttributeTargets.Field)]
|
||||||
public sealed class CursorReferenceAttribute : Attribute
|
public sealed class CursorReferenceAttribute(LintDictionaryReference dictionaryReference = LintDictionaryReference.None) : Attribute
|
||||||
{
|
{
|
||||||
public readonly LintDictionaryReference DictionaryReference;
|
public readonly LintDictionaryReference DictionaryReference = dictionaryReference;
|
||||||
|
|
||||||
public CursorReferenceAttribute(LintDictionaryReference dictionaryReference = LintDictionaryReference.None)
|
|
||||||
{
|
|
||||||
DictionaryReference = dictionaryReference;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
|
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
|
||||||
@@ -82,13 +70,9 @@ namespace OpenRA.Traits
|
|||||||
public sealed class ConsumedConditionReferenceAttribute : Attribute { }
|
public sealed class ConsumedConditionReferenceAttribute : Attribute { }
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Field)]
|
[AttributeUsage(AttributeTargets.Field)]
|
||||||
public sealed class PaletteDefinitionAttribute : Attribute
|
public sealed class PaletteDefinitionAttribute(bool isPlayerPalette = false) : Attribute
|
||||||
{
|
{
|
||||||
public readonly bool IsPlayerPalette;
|
public readonly bool IsPlayerPalette = isPlayerPalette;
|
||||||
public PaletteDefinitionAttribute(bool isPlayerPalette = false)
|
|
||||||
{
|
|
||||||
IsPlayerPalette = isPlayerPalette;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Field)]
|
[AttributeUsage(AttributeTargets.Field)]
|
||||||
@@ -108,12 +92,8 @@ namespace OpenRA.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Class)]
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
public sealed class TraitLocationAttribute : Attribute
|
public sealed class TraitLocationAttribute(SystemActors systemActors) : Attribute
|
||||||
{
|
{
|
||||||
public readonly SystemActors SystemActors;
|
public readonly SystemActors SystemActors = systemActors;
|
||||||
public TraitLocationAttribute(SystemActors systemActors)
|
|
||||||
{
|
|
||||||
SystemActors = systemActors;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,17 +76,7 @@ namespace OpenRA.Traits
|
|||||||
public int RevealedCells { get; private set; }
|
public int RevealedCells { get; private set; }
|
||||||
|
|
||||||
enum ShroudCellType : byte { Shroud, Fog, Visible }
|
enum ShroudCellType : byte { Shroud, Fog, Visible }
|
||||||
sealed class ShroudSource
|
readonly record struct ShroudSource(SourceType Type, PPos[] ProjectedCells);
|
||||||
{
|
|
||||||
public readonly SourceType Type;
|
|
||||||
public readonly PPos[] ProjectedCells;
|
|
||||||
|
|
||||||
public ShroudSource(SourceType type, PPos[] projectedCells)
|
|
||||||
{
|
|
||||||
Type = type;
|
|
||||||
ProjectedCells = projectedCells;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Visible is not a super set of Explored. IsExplored may return false even if IsVisible returns true.
|
// Visible is not a super set of Explored. IsExplored may return false even if IsVisible returns true.
|
||||||
[Flags]
|
[Flags]
|
||||||
|
|||||||
@@ -628,16 +628,7 @@ namespace OpenRA.Traits
|
|||||||
public interface IObservesVariablesInfo : ITraitInfoInterface { }
|
public interface IObservesVariablesInfo : ITraitInfoInterface { }
|
||||||
|
|
||||||
public delegate void VariableObserverNotifier(Actor self, IReadOnlyDictionary<string, int> variables);
|
public delegate void VariableObserverNotifier(Actor self, IReadOnlyDictionary<string, int> variables);
|
||||||
public struct VariableObserver
|
public readonly record struct VariableObserver(VariableObserverNotifier Notifier, IEnumerable<string> Variables);
|
||||||
{
|
|
||||||
public VariableObserverNotifier Notifier;
|
|
||||||
public IEnumerable<string> Variables;
|
|
||||||
public VariableObserver(VariableObserverNotifier notifier, IEnumerable<string> variables)
|
|
||||||
{
|
|
||||||
Notifier = notifier;
|
|
||||||
Variables = variables;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IObservesVariables
|
public interface IObservesVariables
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,12 +18,10 @@ using OpenRA.Primitives;
|
|||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
public readonly struct ActorBoundsPair
|
public readonly struct ActorBoundsPair(Actor actor, Polygon bounds)
|
||||||
{
|
{
|
||||||
public readonly Actor Actor;
|
public readonly Actor Actor = actor;
|
||||||
public readonly Polygon Bounds;
|
public readonly Polygon Bounds = bounds;
|
||||||
|
|
||||||
public ActorBoundsPair(Actor actor, Polygon bounds) { Actor = actor; Bounds = bounds; }
|
|
||||||
|
|
||||||
public override int GetHashCode() { return Actor.GetHashCode() ^ Bounds.GetHashCode(); }
|
public override int GetHashCode() { return Actor.GetHashCode() ^ Bounds.GetHashCode(); }
|
||||||
|
|
||||||
|
|||||||
@@ -182,22 +182,14 @@ namespace OpenRA.Widgets
|
|||||||
protected virtual void Dispose(bool disposing) { }
|
protected virtual void Dispose(bool disposing) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct WidgetBounds
|
public struct WidgetBounds(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
public int X, Y, Width, Height;
|
public int X = x, Y = y, Width = width, Height = height;
|
||||||
public readonly int Left => X;
|
public readonly int Left => X;
|
||||||
public readonly int Right => X + Width;
|
public readonly int Right => X + Width;
|
||||||
public readonly int Top => Y;
|
public readonly int Top => Y;
|
||||||
public readonly int Bottom => Y + Height;
|
public readonly int Bottom => Y + Height;
|
||||||
|
|
||||||
public WidgetBounds(int x, int y, int width, int height)
|
|
||||||
{
|
|
||||||
X = x;
|
|
||||||
Y = y;
|
|
||||||
Width = width;
|
|
||||||
Height = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public readonly Rectangle ToRectangle()
|
public readonly Rectangle ToRectangle()
|
||||||
{
|
{
|
||||||
return new Rectangle(X, Y, Width, Height);
|
return new Rectangle(X, Y, Width, Height);
|
||||||
|
|||||||
@@ -635,12 +635,10 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly struct TraitPair<T> : IEquatable<TraitPair<T>>
|
public readonly struct TraitPair<T>(Actor actor, T trait) : IEquatable<TraitPair<T>>
|
||||||
{
|
{
|
||||||
public readonly Actor Actor;
|
public readonly Actor Actor = actor;
|
||||||
public readonly T Trait;
|
public readonly T Trait = trait;
|
||||||
|
|
||||||
public TraitPair(Actor actor, T trait) { Actor = actor; Trait = trait; }
|
|
||||||
|
|
||||||
public static bool operator ==(TraitPair<T> me, TraitPair<T> other) { return me.Actor == other.Actor && Equals(me.Trait, other.Trait); }
|
public static bool operator ==(TraitPair<T> me, TraitPair<T> other) { return me.Actor == other.Actor && Equals(me.Trait, other.Trait); }
|
||||||
public static bool operator !=(TraitPair<T> me, TraitPair<T> other) { return !(me == other); }
|
public static bool operator !=(TraitPair<T> me, TraitPair<T> other) { return !(me == other); }
|
||||||
|
|||||||
@@ -16,16 +16,7 @@ using System.IO;
|
|||||||
namespace OpenRA.Mods.Cnc.FileFormats
|
namespace OpenRA.Mods.Cnc.FileFormats
|
||||||
{
|
{
|
||||||
public enum NormalType : byte { TiberianSun = 2, RedAlert2 = 4 }
|
public enum NormalType : byte { TiberianSun = 2, RedAlert2 = 4 }
|
||||||
public readonly struct VxlElement
|
public readonly record struct VxlElement(byte Color, byte Normal);
|
||||||
{
|
|
||||||
public readonly byte Color;
|
|
||||||
public readonly byte Normal;
|
|
||||||
public VxlElement(byte color, byte normal)
|
|
||||||
{
|
|
||||||
Color = color;
|
|
||||||
Normal = normal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class VxlLimb
|
public class VxlLimb
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -182,19 +182,11 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
void ITransformActorInitModifier.ModifyTransformActorInit(Actor self, TypeDictionary init) { ModifyActorInit(init); }
|
void ITransformActorInitModifier.ModifyTransformActorInit(Actor self, TypeDictionary init) { ModifyActorInit(init); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ChronoshiftReturnInit : CompositeActorInit, ISingleInstanceInit
|
public class ChronoshiftReturnInit(int ticks, int duration, CPos origin, Actor chronosphere) : CompositeActorInit, ISingleInstanceInit
|
||||||
{
|
{
|
||||||
public readonly int Ticks;
|
public readonly int Ticks = ticks;
|
||||||
public readonly int Duration;
|
public readonly int Duration = duration;
|
||||||
public readonly CPos Origin;
|
public readonly CPos Origin = origin;
|
||||||
public readonly ActorInitActorReference Chronosphere;
|
public readonly ActorInitActorReference Chronosphere = chronosphere;
|
||||||
|
|
||||||
public ChronoshiftReturnInit(int ticks, int duration, CPos origin, Actor chronosphere)
|
|
||||||
{
|
|
||||||
Ticks = ticks;
|
|
||||||
Duration = duration;
|
|
||||||
Origin = origin;
|
|
||||||
Chronosphere = chronosphere;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,38 +17,26 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common
|
namespace OpenRA.Mods.Common
|
||||||
{
|
{
|
||||||
public class FacingInit : ValueActorInit<WAngle>, ISingleInstanceInit
|
public class FacingInit(WAngle value) : ValueActorInit<WAngle>(value), ISingleInstanceInit
|
||||||
{
|
{
|
||||||
public FacingInit(WAngle value)
|
|
||||||
: base(value) { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TerrainOrientationInit : ValueActorInit<WRot>, ISingleInstanceInit, ISuppressInitExport
|
public class TerrainOrientationInit(WRot value) : ValueActorInit<WRot>(value), ISingleInstanceInit, ISuppressInitExport
|
||||||
{
|
{
|
||||||
public TerrainOrientationInit(WRot value)
|
|
||||||
: base(value) { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CreationActivityDelayInit : ValueActorInit<int>, ISingleInstanceInit
|
public class CreationActivityDelayInit(int value) : ValueActorInit<int>(value), ISingleInstanceInit
|
||||||
{
|
{
|
||||||
public CreationActivityDelayInit(int value)
|
|
||||||
: base(value) { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DynamicFacingInit : ValueActorInit<Func<WAngle>>, ISingleInstanceInit
|
public class DynamicFacingInit(Func<WAngle> value) : ValueActorInit<Func<WAngle>>(value), ISingleInstanceInit
|
||||||
{
|
{
|
||||||
public DynamicFacingInit(Func<WAngle> value)
|
|
||||||
: base(value) { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cannot use ValueInit because map.yaml is expected to use the numeric value instead of enum name
|
// Cannot use ValueInit because map.yaml is expected to use the numeric value instead of enum name
|
||||||
public class SubCellInit : ActorInit, ISingleInstanceInit
|
public class SubCellInit(SubCell value) : ActorInit, ISingleInstanceInit
|
||||||
{
|
{
|
||||||
readonly int value;
|
readonly int value = (int)value;
|
||||||
public SubCellInit(SubCell value)
|
|
||||||
{
|
|
||||||
this.value = (int)value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual SubCell Value => (SubCell)value;
|
public virtual SubCell Value => (SubCell)value;
|
||||||
|
|
||||||
@@ -70,23 +58,17 @@ namespace OpenRA.Mods.Common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CenterPositionInit : ValueActorInit<WPos>, ISingleInstanceInit
|
public class CenterPositionInit(WPos value) : ValueActorInit<WPos>(value), ISingleInstanceInit
|
||||||
{
|
{
|
||||||
public CenterPositionInit(WPos value)
|
|
||||||
: base(value) { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allows maps / transformations to specify the faction variant of an actor.
|
// Allows maps / transformations to specify the faction variant of an actor.
|
||||||
public class FactionInit : ValueActorInit<string>, ISingleInstanceInit
|
public class FactionInit(string value) : ValueActorInit<string>(value), ISingleInstanceInit
|
||||||
{
|
{
|
||||||
public FactionInit(string value)
|
|
||||||
: base(value) { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EffectiveOwnerInit : ValueActorInit<Player>
|
public class EffectiveOwnerInit(Player value) : ValueActorInit<Player>(value)
|
||||||
{
|
{
|
||||||
public EffectiveOwnerInit(Player value)
|
|
||||||
: base(value) { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class ActorInitLoader : TypeConverter
|
sealed class ActorInitLoader : TypeConverter
|
||||||
|
|||||||
@@ -16,35 +16,9 @@ using OpenRA.Mods.Common.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.EditorBrushes
|
namespace OpenRA.Mods.Common.EditorBrushes
|
||||||
{
|
{
|
||||||
public readonly struct BlitTile
|
public readonly record struct BlitTile(TerrainTile TerrainTile, ResourceTile ResourceTile, ResourceLayerContents? ResourceLayerContents, byte Height);
|
||||||
{
|
|
||||||
public readonly TerrainTile TerrainTile;
|
|
||||||
public readonly ResourceTile ResourceTile;
|
|
||||||
public readonly ResourceLayerContents? ResourceLayerContents;
|
|
||||||
public readonly byte Height;
|
|
||||||
|
|
||||||
public BlitTile(TerrainTile terrainTile, ResourceTile resourceTile, ResourceLayerContents? resourceLayerContents, byte height)
|
public readonly record struct EditorBlitSource(CellRegion CellRegion, Dictionary<string, EditorActorPreview> Actors, Dictionary<CPos, BlitTile> Tiles);
|
||||||
{
|
|
||||||
TerrainTile = terrainTile;
|
|
||||||
ResourceTile = resourceTile;
|
|
||||||
ResourceLayerContents = resourceLayerContents;
|
|
||||||
Height = height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public readonly struct EditorBlitSource
|
|
||||||
{
|
|
||||||
public readonly CellRegion CellRegion;
|
|
||||||
public readonly Dictionary<string, EditorActorPreview> Actors;
|
|
||||||
public readonly Dictionary<CPos, BlitTile> Tiles;
|
|
||||||
|
|
||||||
public EditorBlitSource(CellRegion cellRegion, Dictionary<string, EditorActorPreview> actors, Dictionary<CPos, BlitTile> tiles)
|
|
||||||
{
|
|
||||||
CellRegion = cellRegion;
|
|
||||||
Actors = actors;
|
|
||||||
Tiles = tiles;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum MapBlitFilters
|
public enum MapBlitFilters
|
||||||
|
|||||||
@@ -109,19 +109,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
public void Dispose() { }
|
public void Dispose() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly struct CellResource
|
readonly record struct CellResource(CPos Cell, ResourceLayerContents OldResourceTile, string NewResourceType);
|
||||||
{
|
|
||||||
public readonly CPos Cell;
|
|
||||||
public readonly ResourceLayerContents OldResourceTile;
|
|
||||||
public readonly string NewResourceType;
|
|
||||||
|
|
||||||
public CellResource(CPos cell, ResourceLayerContents oldResourceTile, string newResourceType)
|
|
||||||
{
|
|
||||||
Cell = cell;
|
|
||||||
OldResourceTile = oldResourceTile;
|
|
||||||
NewResourceType = newResourceType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class AddResourcesEditorAction : IEditorAction
|
sealed class AddResourcesEditorAction : IEditorAction
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -380,17 +380,5 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class UndoTile
|
sealed record UndoTile(CPos Cell, TerrainTile MapTile, byte Height);
|
||||||
{
|
|
||||||
public CPos Cell { get; }
|
|
||||||
public TerrainTile MapTile { get; }
|
|
||||||
public byte Height { get; }
|
|
||||||
|
|
||||||
public UndoTile(CPos cell, TerrainTile mapTile, byte height)
|
|
||||||
{
|
|
||||||
Cell = cell;
|
|
||||||
MapTile = mapTile;
|
|
||||||
Height = height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,68 +178,36 @@ namespace OpenRA.Mods.Common.FileFormats
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly struct CommonHeader
|
readonly struct CommonHeader(Stream stream)
|
||||||
{
|
{
|
||||||
public const long Size = 16;
|
public const long Size = 16;
|
||||||
public readonly uint Version;
|
public readonly uint Version = stream.ReadUInt32();
|
||||||
public readonly uint VolumeInfo;
|
public readonly uint VolumeInfo = stream.ReadUInt32();
|
||||||
public readonly long CabDescriptorOffset;
|
public readonly long CabDescriptorOffset = stream.ReadUInt32();
|
||||||
public readonly uint CabDescriptorSize;
|
public readonly uint CabDescriptorSize = stream.ReadUInt32();
|
||||||
|
|
||||||
public CommonHeader(Stream stream)
|
|
||||||
{
|
|
||||||
Version = stream.ReadUInt32();
|
|
||||||
VolumeInfo = stream.ReadUInt32();
|
|
||||||
CabDescriptorOffset = stream.ReadUInt32();
|
|
||||||
CabDescriptorSize = stream.ReadUInt32();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly struct VolumeHeader
|
readonly struct VolumeHeader(Stream stream)
|
||||||
{
|
{
|
||||||
public readonly uint DataOffset;
|
public readonly uint DataOffset = stream.ReadUInt32();
|
||||||
public readonly uint DataOffsetHigh;
|
public readonly uint DataOffsetHigh = stream.ReadUInt32();
|
||||||
public readonly uint FirstFileIndex;
|
public readonly uint FirstFileIndex = stream.ReadUInt32();
|
||||||
public readonly uint LastFileIndex;
|
public readonly uint LastFileIndex = stream.ReadUInt32();
|
||||||
|
|
||||||
public readonly uint FirstFileOffset;
|
public readonly uint FirstFileOffset = stream.ReadUInt32();
|
||||||
public readonly uint FirstFileOffsetHigh;
|
public readonly uint FirstFileOffsetHigh = stream.ReadUInt32();
|
||||||
public readonly uint FirstFileSizeExpanded;
|
public readonly uint FirstFileSizeExpanded = stream.ReadUInt32();
|
||||||
public readonly uint FirstFileSizeExpandedHigh;
|
public readonly uint FirstFileSizeExpandedHigh = stream.ReadUInt32();
|
||||||
|
|
||||||
public readonly uint FirstFileSizeCompressed;
|
public readonly uint FirstFileSizeCompressed = stream.ReadUInt32();
|
||||||
public readonly uint FirstFileSizeCompressedHigh;
|
public readonly uint FirstFileSizeCompressedHigh = stream.ReadUInt32();
|
||||||
public readonly uint LastFileOffset;
|
public readonly uint LastFileOffset = stream.ReadUInt32();
|
||||||
public readonly uint LastFileOffsetHigh;
|
public readonly uint LastFileOffsetHigh = stream.ReadUInt32();
|
||||||
|
|
||||||
public readonly uint LastFileSizeExpanded;
|
public readonly uint LastFileSizeExpanded = stream.ReadUInt32();
|
||||||
public readonly uint LastFileSizeExpandedHigh;
|
public readonly uint LastFileSizeExpandedHigh = stream.ReadUInt32();
|
||||||
public readonly uint LastFileSizeCompressed;
|
public readonly uint LastFileSizeCompressed = stream.ReadUInt32();
|
||||||
public readonly uint LastFileSizeCompressedHigh;
|
public readonly uint LastFileSizeCompressedHigh = stream.ReadUInt32();
|
||||||
|
|
||||||
public VolumeHeader(Stream stream)
|
|
||||||
{
|
|
||||||
DataOffset = stream.ReadUInt32();
|
|
||||||
DataOffsetHigh = stream.ReadUInt32();
|
|
||||||
|
|
||||||
FirstFileIndex = stream.ReadUInt32();
|
|
||||||
LastFileIndex = stream.ReadUInt32();
|
|
||||||
FirstFileOffset = stream.ReadUInt32();
|
|
||||||
FirstFileOffsetHigh = stream.ReadUInt32();
|
|
||||||
|
|
||||||
FirstFileSizeExpanded = stream.ReadUInt32();
|
|
||||||
FirstFileSizeExpandedHigh = stream.ReadUInt32();
|
|
||||||
FirstFileSizeCompressed = stream.ReadUInt32();
|
|
||||||
FirstFileSizeCompressedHigh = stream.ReadUInt32();
|
|
||||||
|
|
||||||
LastFileOffset = stream.ReadUInt32();
|
|
||||||
LastFileOffsetHigh = stream.ReadUInt32();
|
|
||||||
LastFileSizeExpanded = stream.ReadUInt32();
|
|
||||||
LastFileSizeExpandedHigh = stream.ReadUInt32();
|
|
||||||
|
|
||||||
LastFileSizeCompressed = stream.ReadUInt32();
|
|
||||||
LastFileSizeCompressedHigh = stream.ReadUInt32();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class CabExtracter
|
sealed class CabExtracter
|
||||||
|
|||||||
@@ -22,17 +22,7 @@ namespace OpenRA.Mods.Common.FileSystem
|
|||||||
{
|
{
|
||||||
public sealed class InstallShieldPackage : IReadOnlyPackage
|
public sealed class InstallShieldPackage : IReadOnlyPackage
|
||||||
{
|
{
|
||||||
public readonly struct Entry
|
public readonly record struct Entry(uint Offset, uint Length);
|
||||||
{
|
|
||||||
public readonly uint Offset;
|
|
||||||
public readonly uint Length;
|
|
||||||
|
|
||||||
public Entry(uint offset, uint length)
|
|
||||||
{
|
|
||||||
Offset = offset;
|
|
||||||
Length = length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
public IEnumerable<string> Contents => index.Keys;
|
public IEnumerable<string> Contents => index.Keys;
|
||||||
|
|||||||
@@ -74,17 +74,7 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct SpriteSequenceField<T>
|
public readonly record struct SpriteSequenceField<T>(string Key, T DefaultValue);
|
||||||
{
|
|
||||||
public string Key;
|
|
||||||
public T DefaultValue;
|
|
||||||
|
|
||||||
public SpriteSequenceField(string key, T defaultValue)
|
|
||||||
{
|
|
||||||
Key = key;
|
|
||||||
DefaultValue = defaultValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Desc("Generic sprite sequence implementation, mostly unencumbered with game- or artwork-specific logic.")]
|
[Desc("Generic sprite sequence implementation, mostly unencumbered with game- or artwork-specific logic.")]
|
||||||
public class DefaultSpriteSequence : ISpriteSequence
|
public class DefaultSpriteSequence : ISpriteSequence
|
||||||
|
|||||||
@@ -18,13 +18,9 @@ using OpenRA.Widgets;
|
|||||||
namespace OpenRA.Mods.Common.Lint
|
namespace OpenRA.Mods.Common.Lint
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class)]
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
public sealed class ChromeLogicArgsHotkeys : Attribute
|
public sealed class ChromeLogicArgsHotkeys(params string[] logicArgKeys) : Attribute
|
||||||
{
|
{
|
||||||
public string[] LogicArgKeys;
|
public string[] LogicArgKeys = logicArgKeys;
|
||||||
public ChromeLogicArgsHotkeys(params string[] logicArgKeys)
|
|
||||||
{
|
|
||||||
LogicArgKeys = logicArgKeys;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Method)]
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
|
|||||||
@@ -190,24 +190,15 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected sealed class UnitOrderResult
|
protected sealed class UnitOrderResult(Actor actor, IOrderTargeter order, IIssueOrder trait, string cursor, in Target target)
|
||||||
{
|
{
|
||||||
public readonly Actor Actor;
|
public readonly Actor Actor = actor;
|
||||||
public readonly IOrderTargeter Order;
|
public readonly IOrderTargeter Order = order;
|
||||||
public readonly IIssueOrder Trait;
|
public readonly IIssueOrder Trait = trait;
|
||||||
public readonly string Cursor;
|
public readonly string Cursor = cursor;
|
||||||
public ref readonly Target Target => ref target;
|
public ref readonly Target Target => ref target;
|
||||||
|
|
||||||
readonly Target target;
|
readonly Target target = target;
|
||||||
|
|
||||||
public UnitOrderResult(Actor actor, IOrderTargeter order, IIssueOrder trait, string cursor, in Target target)
|
|
||||||
{
|
|
||||||
Actor = actor;
|
|
||||||
Order = order;
|
|
||||||
Trait = trait;
|
|
||||||
Cursor = cursor;
|
|
||||||
this.target = target;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool ClearSelectionOnLeftClick => true;
|
public virtual bool ClearSelectionOnLeftClick => true;
|
||||||
|
|||||||
@@ -18,15 +18,9 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
/// Used to override the Emmy Lua type generated by the <see cref="ExtractEmmyLuaAPI"/> utility command.
|
/// Used to override the Emmy Lua type generated by the <see cref="ExtractEmmyLuaAPI"/> utility command.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
|
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
|
||||||
public sealed class ScriptEmmyTypeOverrideAttribute : Attribute
|
public sealed class ScriptEmmyTypeOverrideAttribute(string typeDeclaration, string genericTypeDeclaration = null) : Attribute
|
||||||
{
|
{
|
||||||
public readonly string TypeDeclaration;
|
public readonly string TypeDeclaration = typeDeclaration;
|
||||||
public readonly string GenericTypeDeclaration;
|
public readonly string GenericTypeDeclaration = genericTypeDeclaration;
|
||||||
|
|
||||||
public ScriptEmmyTypeOverrideAttribute(string typeDeclaration, string genericTypeDeclaration = null)
|
|
||||||
{
|
|
||||||
TypeDeclaration = typeDeclaration;
|
|
||||||
GenericTypeDeclaration = genericTypeDeclaration;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,19 +19,7 @@ using OpenRA.Support;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Terrain
|
namespace OpenRA.Mods.Common.Terrain
|
||||||
{
|
{
|
||||||
public class TheaterTemplate
|
public record TheaterTemplate(Sprite[] Sprites, int Stride, int Variants);
|
||||||
{
|
|
||||||
public readonly Sprite[] Sprites;
|
|
||||||
public readonly int Stride;
|
|
||||||
public readonly int Variants;
|
|
||||||
|
|
||||||
public TheaterTemplate(Sprite[] sprites, int stride, int variants)
|
|
||||||
{
|
|
||||||
Sprites = sprites;
|
|
||||||
Stride = stride;
|
|
||||||
Variants = variants;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class DefaultTileCache : IDisposable
|
public sealed class DefaultTileCache : IDisposable
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,18 +40,11 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public class ExternalCondition : ITick, INotifyCreated, INotifyOwnerChanged
|
public class ExternalCondition : ITick, INotifyCreated, INotifyOwnerChanged
|
||||||
{
|
{
|
||||||
readonly struct TimedToken
|
readonly struct TimedToken(int token, Actor self, object source, int duration)
|
||||||
{
|
{
|
||||||
public readonly int Expires;
|
public readonly int Expires = self.World.WorldTick + duration;
|
||||||
public readonly int Token;
|
public readonly int Token = token;
|
||||||
public readonly object Source;
|
public readonly object Source = source;
|
||||||
|
|
||||||
public TimedToken(int token, Actor self, object source, int duration)
|
|
||||||
{
|
|
||||||
Token = token;
|
|
||||||
Expires = self.World.WorldTick + duration;
|
|
||||||
Source = source;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly ExternalConditionInfo Info;
|
public readonly ExternalConditionInfo Info;
|
||||||
|
|||||||
@@ -30,20 +30,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public class Demolishable : ConditionalTrait<DemolishableInfo>, IDemolishable, ITick, INotifyOwnerChanged
|
public class Demolishable : ConditionalTrait<DemolishableInfo>, IDemolishable, ITick, INotifyOwnerChanged
|
||||||
{
|
{
|
||||||
sealed class DemolishAction
|
sealed class DemolishAction(Actor saboteur, int delay, int token, BitSet<DamageType> damageTypes)
|
||||||
{
|
{
|
||||||
public readonly Actor Saboteur;
|
public readonly Actor Saboteur = saboteur;
|
||||||
public readonly int Token;
|
public readonly int Token = token;
|
||||||
public int Delay;
|
public int Delay = delay;
|
||||||
public readonly BitSet<DamageType> DamageTypes;
|
public readonly BitSet<DamageType> DamageTypes = damageTypes;
|
||||||
|
|
||||||
public DemolishAction(Actor saboteur, int delay, int token, BitSet<DamageType> damageTypes)
|
|
||||||
{
|
|
||||||
Saboteur = saboteur;
|
|
||||||
Delay = delay;
|
|
||||||
Token = token;
|
|
||||||
DamageTypes = damageTypes;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly List<DemolishAction> actions = [];
|
readonly List<DemolishAction> actions = [];
|
||||||
|
|||||||
@@ -23,15 +23,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public sealed class LocomotorReferenceAttribute : Attribute { }
|
public sealed class LocomotorReferenceAttribute : Attribute { }
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Field)]
|
[AttributeUsage(AttributeTargets.Field)]
|
||||||
public sealed class NotificationReferenceAttribute : Attribute
|
public sealed class NotificationReferenceAttribute(string type = null, string typeFromField = null) : Attribute
|
||||||
{
|
{
|
||||||
public readonly string NotificationTypeFieldName = null;
|
public readonly string NotificationTypeFieldName = typeFromField;
|
||||||
public readonly string NotificationType = null;
|
public readonly string NotificationType = type;
|
||||||
|
|
||||||
public NotificationReferenceAttribute(string type = null, string typeFromField = null)
|
|
||||||
{
|
|
||||||
NotificationType = type;
|
|
||||||
NotificationTypeFieldName = typeFromField;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,14 +40,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
bool isRendering;
|
bool isRendering;
|
||||||
bool created;
|
bool created;
|
||||||
|
|
||||||
sealed class FrozenState
|
sealed class FrozenState(FrozenActor frozenActor)
|
||||||
{
|
{
|
||||||
public readonly FrozenActor FrozenActor;
|
public readonly FrozenActor FrozenActor = frozenActor;
|
||||||
public bool IsVisible;
|
public bool IsVisible;
|
||||||
public FrozenState(FrozenActor frozenActor)
|
|
||||||
{
|
|
||||||
FrozenActor = frozenActor;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public FrozenUnderFog(ActorInitializer init, FrozenUnderFogInfo info)
|
public FrozenUnderFog(ActorInitializer init, FrozenUnderFogInfo info)
|
||||||
|
|||||||
@@ -170,18 +170,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class Arrow
|
sealed record Arrow(Sprite Sprite, double EndAngle, WAngle Direction);
|
||||||
{
|
|
||||||
public Sprite Sprite { get; }
|
|
||||||
public double EndAngle { get; }
|
|
||||||
public WAngle Direction { get; }
|
|
||||||
|
|
||||||
public Arrow(Sprite sprite, double endAngle, WAngle direction)
|
|
||||||
{
|
|
||||||
Sprite = sprite;
|
|
||||||
EndAngle = endAngle;
|
|
||||||
Direction = direction;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,19 +130,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public class Locomotor : IWorldLoaded
|
public class Locomotor : IWorldLoaded
|
||||||
{
|
{
|
||||||
readonly struct CellCache
|
readonly record struct CellCache(LongBitSet<PlayerBitMask> Immovable, CellFlag CellFlag, LongBitSet<PlayerBitMask> Crushable);
|
||||||
{
|
|
||||||
public readonly LongBitSet<PlayerBitMask> Immovable;
|
|
||||||
public readonly LongBitSet<PlayerBitMask> Crushable;
|
|
||||||
public readonly CellFlag CellFlag;
|
|
||||||
|
|
||||||
public CellCache(LongBitSet<PlayerBitMask> immovable, CellFlag cellFlag, LongBitSet<PlayerBitMask> crushable)
|
|
||||||
{
|
|
||||||
Immovable = immovable;
|
|
||||||
Crushable = crushable;
|
|
||||||
CellFlag = cellFlag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public readonly LocomotorInfo Info;
|
public readonly LocomotorInfo Info;
|
||||||
|
|
||||||
|
|||||||
@@ -378,17 +378,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
disposed = true;
|
disposed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly struct MapLine
|
readonly record struct MapLine(float2 Start, float2 End);
|
||||||
{
|
|
||||||
public readonly float2 Start;
|
|
||||||
public readonly float2 End;
|
|
||||||
|
|
||||||
public MapLine(float2 start, float2 end)
|
|
||||||
{
|
|
||||||
Start = start;
|
|
||||||
End = end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IEnumerable<IRenderable> IRenderAnnotations.RenderAnnotations(Actor self, WorldRenderer wr)
|
IEnumerable<IRenderable> IRenderAnnotations.RenderAnnotations(Actor self, WorldRenderer wr)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,17 +17,11 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
public readonly struct ResourceLayerContents
|
public readonly struct ResourceLayerContents(string type, int density)
|
||||||
{
|
{
|
||||||
public static readonly ResourceLayerContents Empty = default;
|
public static readonly ResourceLayerContents Empty = default;
|
||||||
public readonly string Type;
|
public readonly string Type = type;
|
||||||
public readonly int Density;
|
public readonly int Density = density;
|
||||||
|
|
||||||
public ResourceLayerContents(string type, int density)
|
|
||||||
{
|
|
||||||
Type = type;
|
|
||||||
Density = density;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[TraitLocation(SystemActors.World)]
|
[TraitLocation(SystemActors.World)]
|
||||||
|
|||||||
@@ -94,16 +94,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
BottomLeft
|
BottomLeft
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly struct TileInfo
|
readonly struct TileInfo(in float3 screenPosition, byte variant)
|
||||||
{
|
{
|
||||||
public readonly float3 ScreenPosition;
|
public readonly float3 ScreenPosition = screenPosition;
|
||||||
public readonly byte Variant;
|
public readonly byte Variant = variant;
|
||||||
|
|
||||||
public TileInfo(in float3 screenPosition, byte variant)
|
|
||||||
{
|
|
||||||
ScreenPosition = screenPosition;
|
|
||||||
Variant = variant;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly ShroudRendererInfo info;
|
readonly ShroudRendererInfo info;
|
||||||
|
|||||||
@@ -35,22 +35,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public sealed class TerrainLighting : ITerrainLighting
|
public sealed class TerrainLighting : ITerrainLighting
|
||||||
{
|
{
|
||||||
sealed class LightSource
|
sealed class LightSource(WPos pos, CPos cell, WDist range, float intensity, in float3 tint)
|
||||||
{
|
{
|
||||||
public readonly WPos Pos;
|
public readonly WPos Pos = pos;
|
||||||
public readonly CPos Cell;
|
public readonly CPos Cell = cell;
|
||||||
public readonly WDist Range;
|
public readonly WDist Range = range;
|
||||||
public readonly float Intensity;
|
public readonly float Intensity = intensity;
|
||||||
public readonly float3 Tint;
|
public readonly float3 Tint = tint;
|
||||||
|
|
||||||
public LightSource(WPos pos, CPos cell, WDist range, float intensity, in float3 tint)
|
|
||||||
{
|
|
||||||
Pos = pos;
|
|
||||||
Cell = cell;
|
|
||||||
Range = range;
|
|
||||||
Intensity = intensity;
|
|
||||||
Tint = tint;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly TerrainLightingInfo info;
|
readonly TerrainLightingInfo info;
|
||||||
|
|||||||
@@ -28,22 +28,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public class WarheadDebugOverlay : IRenderAnnotations
|
public class WarheadDebugOverlay : IRenderAnnotations
|
||||||
{
|
{
|
||||||
sealed class WHImpact
|
sealed class WHImpact(WPos pos, WDist[] range, int time, Color color)
|
||||||
{
|
{
|
||||||
public readonly WPos CenterPosition;
|
public readonly WPos CenterPosition = pos;
|
||||||
public readonly WDist[] Range;
|
public readonly WDist[] Range = range;
|
||||||
public readonly Color Color;
|
public readonly Color Color = color;
|
||||||
public int Time;
|
public int Time = time;
|
||||||
|
|
||||||
public WDist OuterRange => Range[^1];
|
public WDist OuterRange => Range[^1];
|
||||||
|
|
||||||
public WHImpact(WPos pos, WDist[] range, int time, Color color)
|
|
||||||
{
|
|
||||||
CenterPosition = pos;
|
|
||||||
Range = range;
|
|
||||||
Color = color;
|
|
||||||
Time = time;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly WarheadDebugOverlayInfo info;
|
readonly WarheadDebugOverlayInfo info;
|
||||||
|
|||||||
@@ -200,22 +200,13 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ExtractionCandidate
|
struct ExtractionCandidate(string key, string type, string value, MiniYamlNodeBuilder node)
|
||||||
{
|
{
|
||||||
public string Chrome;
|
public string Chrome = null;
|
||||||
public readonly string Key;
|
public readonly string Key = key;
|
||||||
public readonly string Type;
|
public readonly string Type = type;
|
||||||
public readonly string Value;
|
public readonly string Value = value;
|
||||||
public readonly List<MiniYamlNodeBuilder> Nodes;
|
public readonly List<MiniYamlNodeBuilder> Nodes = [node];
|
||||||
|
|
||||||
public ExtractionCandidate(string key, string type, string value, MiniYamlNodeBuilder node)
|
|
||||||
{
|
|
||||||
Chrome = null;
|
|
||||||
Key = key;
|
|
||||||
Type = type;
|
|
||||||
Value = value;
|
|
||||||
Nodes = [node];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static string ClearContainersAndToLower(string node)
|
static string ClearContainersAndToLower(string node)
|
||||||
|
|||||||
@@ -229,22 +229,13 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ExtractionCandidate
|
struct ExtractionCandidate(string actor, string key, string value, MiniYamlNodeBuilder node)
|
||||||
{
|
{
|
||||||
public string Filename;
|
public string Filename = null;
|
||||||
public readonly string Actor;
|
public readonly string Actor = actor;
|
||||||
public readonly string Key;
|
public readonly string Key = key;
|
||||||
public readonly string Value;
|
public readonly string Value = value;
|
||||||
public readonly List<MiniYamlNodeBuilder> Nodes;
|
public readonly List<MiniYamlNodeBuilder> Nodes = [node];
|
||||||
|
|
||||||
public ExtractionCandidate(string actor, string key, string value, MiniYamlNodeBuilder node)
|
|
||||||
{
|
|
||||||
Filename = null;
|
|
||||||
Actor = actor;
|
|
||||||
Key = key;
|
|
||||||
Value = value;
|
|
||||||
Nodes = [node];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static string ToLowerActor(string actor)
|
static string ToLowerActor(string actor)
|
||||||
|
|||||||
@@ -230,17 +230,5 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LineGraphSeries
|
public record LineGraphSeries(string Key, Color Color, IEnumerable<float> Points);
|
||||||
{
|
|
||||||
public string Key;
|
|
||||||
public Color Color;
|
|
||||||
public IEnumerable<float> Points;
|
|
||||||
|
|
||||||
public LineGraphSeries(string key, Color color, IEnumerable<float> points)
|
|
||||||
{
|
|
||||||
Key = key;
|
|
||||||
Color = color;
|
|
||||||
Points = points;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,21 +24,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
[FluentReference("actorType")]
|
[FluentReference("actorType")]
|
||||||
const string ActorTypeTooltip = "label-actor-type";
|
const string ActorTypeTooltip = "label-actor-type";
|
||||||
|
|
||||||
sealed class ActorSelectorActor
|
sealed record ActorSelectorActor(ActorInfo Actor, string[] Categories, string[] SearchTerms, string Tooltip);
|
||||||
{
|
|
||||||
public readonly ActorInfo Actor;
|
|
||||||
public readonly string[] Categories;
|
|
||||||
public readonly string[] SearchTerms;
|
|
||||||
public readonly string Tooltip;
|
|
||||||
|
|
||||||
public ActorSelectorActor(ActorInfo actor, string[] categories, string[] searchTerms, string tooltip)
|
|
||||||
{
|
|
||||||
Actor = actor;
|
|
||||||
Categories = categories;
|
|
||||||
SearchTerms = searchTerms;
|
|
||||||
Tooltip = tooltip;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly DropDownButtonWidget ownersDropDown;
|
readonly DropDownButtonWidget ownersDropDown;
|
||||||
readonly Ruleset mapRules;
|
readonly Ruleset mapRules;
|
||||||
|
|||||||
@@ -30,19 +30,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
public string UiLabel;
|
public string UiLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class SaveDirectory
|
sealed record SaveDirectory(Folder Folder, string DisplayName, MapClassification Classification);
|
||||||
{
|
|
||||||
public readonly Folder Folder;
|
|
||||||
public readonly string DisplayName;
|
|
||||||
public readonly MapClassification Classification;
|
|
||||||
|
|
||||||
public SaveDirectory(Folder folder, string displayName, MapClassification classification)
|
|
||||||
{
|
|
||||||
Folder = folder;
|
|
||||||
DisplayName = displayName;
|
|
||||||
Classification = classification;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[FluentReference]
|
[FluentReference]
|
||||||
const string SaveMapFailedTitle = "dialog-save-map-failed.title";
|
const string SaveMapFailedTitle = "dialog-save-map-failed.title";
|
||||||
|
|||||||
@@ -42,19 +42,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
[FluentReference]
|
[FluentReference]
|
||||||
const string Slot = "options-lobby-slot.slot";
|
const string Slot = "options-lobby-slot.slot";
|
||||||
|
|
||||||
sealed class SlotDropDownOption
|
sealed record SlotDropDownOption(string Title, string Order, Func<bool> Selected);
|
||||||
{
|
|
||||||
public readonly string Title;
|
|
||||||
public readonly string Order;
|
|
||||||
public readonly Func<bool> Selected;
|
|
||||||
|
|
||||||
public SlotDropDownOption(string title, string order, Func<bool> selected)
|
|
||||||
{
|
|
||||||
Title = title;
|
|
||||||
Order = order;
|
|
||||||
Selected = selected;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ShowSlotDropDown(DropDownButtonWidget dropdown, Session.Slot slot,
|
public static void ShowSlotDropDown(DropDownButtonWidget dropdown, Session.Slot slot,
|
||||||
Session.Client client, OrderManager orderManager, MapPreview map, ModData modData)
|
Session.Client client, OrderManager orderManager, MapPreview map, ModData modData)
|
||||||
@@ -716,17 +704,4 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
widget.IsVisible = () => false;
|
widget.IsVisible = () => false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class ShowPlayerActionDropDownOption
|
|
||||||
{
|
|
||||||
public Action Click { get; set; }
|
|
||||||
public string Title;
|
|
||||||
public Func<bool> Selected = () => false;
|
|
||||||
|
|
||||||
public ShowPlayerActionDropDownOption(string title, Action click)
|
|
||||||
{
|
|
||||||
Click = click;
|
|
||||||
Title = title;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,17 +21,7 @@ namespace OpenRA.Mods.D2k.PackageLoaders
|
|||||||
{
|
{
|
||||||
sealed class D2kSoundResources : IReadOnlyPackage
|
sealed class D2kSoundResources : IReadOnlyPackage
|
||||||
{
|
{
|
||||||
readonly struct Entry
|
readonly record struct Entry(uint Offset, uint Length);
|
||||||
{
|
|
||||||
public readonly uint Offset;
|
|
||||||
public readonly uint Length;
|
|
||||||
|
|
||||||
public Entry(uint offset, uint length)
|
|
||||||
{
|
|
||||||
Offset = offset;
|
|
||||||
Length = length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
public IEnumerable<string> Contents => index.Keys;
|
public IEnumerable<string> Contents => index.Keys;
|
||||||
|
|||||||
Reference in New Issue
Block a user