RCS0056 - roslynator_max_line_length = 160
This commit is contained in:
committed by
Matthias Mailänder
parent
9d5d2ab493
commit
0649f3dc32
@@ -982,7 +982,7 @@ dotnet_analyzer_diagnostic.category-roslynator.severity = none
|
||||
|
||||
# A line is too long.
|
||||
dotnet_diagnostic.RCS0056.severity = warning
|
||||
roslynator_max_line_length = 180 #140
|
||||
roslynator_max_line_length = 160 #140
|
||||
#roslynator_tab_length = 4
|
||||
|
||||
# Remove redundant 'sealed' modifier.
|
||||
|
||||
@@ -17,7 +17,8 @@ using OpenRA.Scripting;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
public readonly struct CVec : IScriptBindable, ILuaAdditionBinding, ILuaSubtractionBinding, ILuaUnaryMinusBinding, ILuaEqualityBinding, ILuaTableBinding, IEquatable<CVec>
|
||||
public readonly struct CVec : IScriptBindable,
|
||||
ILuaAdditionBinding, ILuaSubtractionBinding, ILuaUnaryMinusBinding, ILuaEqualityBinding, ILuaTableBinding, IEquatable<CVec>
|
||||
{
|
||||
public readonly int X, Y;
|
||||
|
||||
|
||||
@@ -324,7 +324,8 @@ namespace OpenRA.FileSystem
|
||||
if (name == ".")
|
||||
continue;
|
||||
|
||||
resolved = Directory.GetFileSystemEntries(resolved).FirstOrDefault(e => e.Equals(Path.Combine(resolved, name), StringComparison.InvariantCultureIgnoreCase));
|
||||
resolved = Directory.GetFileSystemEntries(resolved)
|
||||
.FirstOrDefault(e => e.Equals(Path.Combine(resolved, name), StringComparison.InvariantCultureIgnoreCase));
|
||||
|
||||
if (resolved == null)
|
||||
return null;
|
||||
|
||||
@@ -228,7 +228,11 @@ namespace OpenRA.Graphics
|
||||
(PanelSides.Bottom | PanelSides.Right, new Rectangle(pr[0] + pr[2] + pr[4], pr[1] + pr[3] + pr[5], pr[6], pr[7]))
|
||||
};
|
||||
|
||||
sprites = sides.Select(x => ps.HasSide(x.PanelSides) ? new Sprite(sheetDensity.Sheet, sheetDensity.Density * x.Bounds, TextureChannel.RGBA, 1f / sheetDensity.Density) : null)
|
||||
sprites = sides
|
||||
.Select(x =>
|
||||
ps.HasSide(x.PanelSides)
|
||||
? new Sprite(sheetDensity.Sheet, sheetDensity.Density * x.Bounds, TextureChannel.RGBA, 1f / sheetDensity.Density)
|
||||
: null)
|
||||
.ToArray();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -25,7 +25,8 @@ namespace OpenRA
|
||||
|
||||
public interface IPlatform
|
||||
{
|
||||
IPlatformWindow CreateWindow(Size size, WindowMode windowMode, float scaleModifier, int vertexBatchSize, int indexBatchSize, int videoDisplay, GLProfile profile);
|
||||
IPlatformWindow CreateWindow(
|
||||
Size size, WindowMode windowMode, float scaleModifier, int vertexBatchSize, int indexBatchSize, int videoDisplay, GLProfile profile);
|
||||
ISoundEngine CreateSound(string device);
|
||||
IFont CreateFont(byte[] data);
|
||||
}
|
||||
|
||||
@@ -142,7 +142,9 @@ namespace OpenRA.Graphics
|
||||
p = int2.Zero;
|
||||
}
|
||||
|
||||
var rect = new Sprite(Current, new Rectangle(p.X + margin, p.Y + margin, imageSize.Width, imageSize.Height), zRamp, spriteOffset, CurrentChannel, BlendMode.Alpha, scale);
|
||||
var rect = new Sprite(
|
||||
Current, new Rectangle(p.X + margin, p.Y + margin, imageSize.Width, imageSize.Height),
|
||||
zRamp, spriteOffset, CurrentChannel, BlendMode.Alpha, scale);
|
||||
p += new int2(imageSize.Width + margin, 0);
|
||||
|
||||
return rect;
|
||||
|
||||
@@ -24,7 +24,9 @@ namespace OpenRA.Graphics
|
||||
readonly ISpriteLoader[] loaders;
|
||||
readonly IReadOnlyFileSystem fileSystem;
|
||||
|
||||
readonly Dictionary<int, (int[] Frames, MiniYamlNode.SourceLocation Location, Func<ISpriteFrame, ISpriteFrame> AdjustFrame, bool Premultiplied)> spriteReservations = new();
|
||||
readonly Dictionary<
|
||||
int,
|
||||
(int[] Frames, MiniYamlNode.SourceLocation Location, Func<ISpriteFrame, ISpriteFrame> AdjustFrame, bool Premultiplied)> spriteReservations = new();
|
||||
readonly Dictionary<string, List<int>> reservationsByFilename = new();
|
||||
|
||||
readonly Dictionary<int, Sprite[]> resolvedSprites = new();
|
||||
@@ -33,7 +35,8 @@ namespace OpenRA.Graphics
|
||||
|
||||
int nextReservationToken = 1;
|
||||
|
||||
public SpriteCache(IReadOnlyFileSystem fileSystem, ISpriteLoader[] loaders, int bgraSheetSize, int indexedSheetSize, int bgraSheetMargin = 1, int indexedSheetMargin = 1)
|
||||
public SpriteCache(
|
||||
IReadOnlyFileSystem fileSystem, ISpriteLoader[] loaders, int bgraSheetSize, int indexedSheetSize, int bgraSheetMargin = 1, int indexedSheetMargin = 1)
|
||||
{
|
||||
SheetBuilders = new Dictionary<SheetType, SheetBuilder>
|
||||
{
|
||||
|
||||
@@ -21,7 +21,8 @@ namespace OpenRA.Graphics
|
||||
readonly float alpha;
|
||||
readonly float rotation = 0f;
|
||||
|
||||
public UISpriteRenderable(Sprite sprite, WPos effectiveWorldPos, int2 screenPos, int zOffset, PaletteReference palette, float scale = 1f, float alpha = 1f, float rotation = 0f)
|
||||
public UISpriteRenderable(Sprite sprite, WPos effectiveWorldPos, int2 screenPos, int zOffset, PaletteReference palette,
|
||||
float scale = 1f, float alpha = 1f, float rotation = 0f)
|
||||
{
|
||||
this.sprite = sprite;
|
||||
Pos = effectiveWorldPos;
|
||||
@@ -47,7 +48,8 @@ namespace OpenRA.Graphics
|
||||
public PaletteReference Palette { get; }
|
||||
public int ZOffset { get; }
|
||||
|
||||
public IPalettedRenderable WithPalette(PaletteReference newPalette) { return new UISpriteRenderable(sprite, Pos, screenPos, ZOffset, newPalette, scale, alpha, rotation); }
|
||||
public IPalettedRenderable WithPalette(PaletteReference newPalette) =>
|
||||
new UISpriteRenderable(sprite, Pos, screenPos, ZOffset, newPalette, scale, alpha, rotation);
|
||||
public IRenderable WithZOffset(int newOffset) { return this; }
|
||||
public IRenderable OffsetBy(in WVec vec) { return this; }
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
@@ -215,7 +215,9 @@ namespace OpenRA.Graphics
|
||||
MinZoom = CalculateMinimumZoom(range.X, range.Y) * viewportSizes.DefaultScale;
|
||||
}
|
||||
|
||||
MaxZoom = Math.Min(MinZoom * viewportSizes.MaxZoomScale, Game.Renderer.NativeResolution.Height * viewportSizes.DefaultScale / viewportSizes.MaxZoomWindowHeight);
|
||||
MaxZoom = Math.Min(
|
||||
MinZoom * viewportSizes.MaxZoomScale,
|
||||
Game.Renderer.NativeResolution.Height * viewportSizes.DefaultScale / viewportSizes.MaxZoomWindowHeight);
|
||||
|
||||
if (unlockMinZoom)
|
||||
{
|
||||
|
||||
@@ -140,7 +140,8 @@ namespace OpenRA
|
||||
LoadMapInternal(map, package, classification, mapGrid, oldMap, null);
|
||||
}
|
||||
|
||||
void LoadMapInternal(string map, IReadOnlyPackage package, MapClassification classification, MapGrid mapGrid, string oldMap, IEnumerable<List<MiniYamlNode>> modDataRules)
|
||||
void LoadMapInternal(string map, IReadOnlyPackage package, MapClassification classification, MapGrid mapGrid, string oldMap,
|
||||
IEnumerable<List<MiniYamlNode>> modDataRules)
|
||||
{
|
||||
IReadOnlyPackage mapPackage = null;
|
||||
try
|
||||
@@ -226,7 +227,8 @@ namespace OpenRA
|
||||
yield return mapPackage;
|
||||
}
|
||||
|
||||
public void QueryRemoteMapDetails(string repositoryUrl, IEnumerable<string> uids, Action<MapPreview> mapDetailsReceived = null, Action<MapPreview> mapQueryFailed = null)
|
||||
public void QueryRemoteMapDetails(string repositoryUrl, IEnumerable<string> uids,
|
||||
Action<MapPreview> mapDetailsReceived = null, Action<MapPreview> mapQueryFailed = null)
|
||||
{
|
||||
var queryUids = uids.Distinct()
|
||||
.Where(uid => uid != null)
|
||||
|
||||
@@ -148,8 +148,14 @@ namespace OpenRA
|
||||
sources = sources.Append(RuleDefinitions.Nodes.Where(IsLoadableRuleDefinition).ToList());
|
||||
|
||||
var yamlNodes = MiniYaml.Merge(sources);
|
||||
WorldActorInfo = new ActorInfo(modData.ObjectCreator, "world", yamlNodes.First(n => string.Equals(n.Key, "world", StringComparison.InvariantCultureIgnoreCase)).Value);
|
||||
PlayerActorInfo = new ActorInfo(modData.ObjectCreator, "player", yamlNodes.First(n => string.Equals(n.Key, "player", StringComparison.InvariantCultureIgnoreCase)).Value);
|
||||
WorldActorInfo = new ActorInfo(
|
||||
modData.ObjectCreator,
|
||||
"world",
|
||||
yamlNodes.First(n => string.Equals(n.Key, "world", StringComparison.InvariantCultureIgnoreCase)).Value);
|
||||
PlayerActorInfo = new ActorInfo(
|
||||
modData.ObjectCreator,
|
||||
"player",
|
||||
yamlNodes.First(n => string.Equals(n.Key, "player", StringComparison.InvariantCultureIgnoreCase)).Value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,7 +444,8 @@ namespace OpenRA
|
||||
existingNodes.Add(overrideNode.WithValue(value));
|
||||
}
|
||||
|
||||
static List<MiniYamlNode> ResolveInherits(MiniYaml node, Dictionary<string, MiniYaml> tree, ImmutableDictionary<string, MiniYamlNode.SourceLocation> inherited)
|
||||
static List<MiniYamlNode> ResolveInherits(
|
||||
MiniYaml node, Dictionary<string, MiniYaml> tree, ImmutableDictionary<string, MiniYamlNode.SourceLocation> inherited)
|
||||
{
|
||||
var resolved = new List<MiniYamlNode>(node.Nodes.Length);
|
||||
var resolvedKeys = new HashSet<string>(node.Nodes.Length);
|
||||
|
||||
@@ -271,7 +271,15 @@ namespace OpenRA
|
||||
|
||||
public static Order FromGroupedOrder(Order grouped, Actor subject)
|
||||
{
|
||||
return new Order(grouped.OrderString, subject, grouped.Target, grouped.TargetString, grouped.Queued, grouped.ExtraActors, grouped.ExtraLocation, grouped.ExtraData);
|
||||
return new Order(
|
||||
grouped.OrderString,
|
||||
subject,
|
||||
grouped.Target,
|
||||
grouped.TargetString,
|
||||
grouped.Queued,
|
||||
grouped.ExtraActors,
|
||||
grouped.ExtraLocation,
|
||||
grouped.ExtraData);
|
||||
}
|
||||
|
||||
public static Order Command(string text)
|
||||
|
||||
@@ -203,7 +203,8 @@ namespace OpenRA
|
||||
|
||||
default:
|
||||
{
|
||||
modernUserSupportPath = legacyUserSupportPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), ".openra") + Path.DirectorySeparatorChar;
|
||||
modernUserSupportPath = legacyUserSupportPath =
|
||||
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), ".openra") + Path.DirectorySeparatorChar;
|
||||
systemSupportPath = "/var/games/openra/";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,8 @@ namespace OpenRA
|
||||
}
|
||||
}
|
||||
|
||||
public static FactionInfo ResolveFaction(string factionName, IEnumerable<FactionInfo> factionInfos, MersenneTwister playerRandom, bool requireSelectable = true)
|
||||
public static FactionInfo ResolveFaction(
|
||||
string factionName, IEnumerable<FactionInfo> factionInfos, MersenneTwister playerRandom, bool requireSelectable = true)
|
||||
{
|
||||
var selectableFactions = factionInfos
|
||||
.Where(f => !requireSelectable || f.Selectable)
|
||||
|
||||
@@ -66,7 +66,9 @@ namespace OpenRA.Primitives
|
||||
|
||||
public bool IntersectsWith(Rectangle rect)
|
||||
{
|
||||
var intersectsBoundingRect = BoundingRect.Left < rect.Right && BoundingRect.Right > rect.Left && BoundingRect.Top < rect.Bottom && BoundingRect.Bottom > rect.Top;
|
||||
var intersectsBoundingRect =
|
||||
BoundingRect.Left < rect.Right && BoundingRect.Right > rect.Left &&
|
||||
BoundingRect.Top < rect.Bottom && BoundingRect.Bottom > rect.Top;
|
||||
if (isRectangle)
|
||||
return intersectsBoundingRect;
|
||||
|
||||
@@ -75,11 +77,13 @@ namespace OpenRA.Primitives
|
||||
return false;
|
||||
|
||||
// Easy case 2: Rect and bounding box intersect in a cross shape
|
||||
if ((rect.Left <= BoundingRect.Left && rect.Right >= BoundingRect.Right) || (rect.Top <= BoundingRect.Top && rect.Bottom >= BoundingRect.Bottom))
|
||||
if ((rect.Left <= BoundingRect.Left && rect.Right >= BoundingRect.Right) ||
|
||||
(rect.Top <= BoundingRect.Top && rect.Bottom >= BoundingRect.Bottom))
|
||||
return true;
|
||||
|
||||
// Easy case 3: Corner of rect is inside the polygon
|
||||
if (Vertices.PolygonContains(rect.TopLeft) || Vertices.PolygonContains(rect.TopRight) || Vertices.PolygonContains(rect.BottomLeft) || Vertices.PolygonContains(rect.BottomRight))
|
||||
if (Vertices.PolygonContains(rect.TopLeft) || Vertices.PolygonContains(rect.TopRight) ||
|
||||
Vertices.PolygonContains(rect.BottomLeft) || Vertices.PolygonContains(rect.BottomRight))
|
||||
return true;
|
||||
|
||||
// Easy case 4: Polygon vertex is inside rect
|
||||
|
||||
@@ -289,7 +289,10 @@ namespace OpenRA
|
||||
screenBuffer.Bind();
|
||||
|
||||
var scale = Window.EffectiveWindowScale;
|
||||
var bufferScale = new float3((int)(screenSprite.Bounds.Width / scale) / worldSprite.Size.X, (int)(-screenSprite.Bounds.Height / scale) / worldSprite.Size.Y, 1f);
|
||||
var bufferScale = new float3(
|
||||
(int)(screenSprite.Bounds.Width / scale) / worldSprite.Size.X,
|
||||
(int)(-screenSprite.Bounds.Height / scale) / worldSprite.Size.Y,
|
||||
1f);
|
||||
|
||||
SpriteRenderer.SetAntialiasingPixelsPerTexel(Window.SurfaceSize.Height * 1f / worldSprite.Bounds.Height);
|
||||
RgbaSpriteRenderer.DrawSprite(worldSprite, float3.Zero, bufferScale);
|
||||
|
||||
@@ -15,8 +15,10 @@ namespace OpenRA.Scripting
|
||||
{
|
||||
readonly Player player;
|
||||
|
||||
protected override string DuplicateKeyError(string memberName) { return $"Player '{player.PlayerName}' defines the command '{memberName}' on multiple traits"; }
|
||||
protected override string MemberNotFoundError(string memberName) { return $"Player '{player.PlayerName}' does not define a property '{memberName}'"; }
|
||||
protected override string DuplicateKeyError(string memberName) =>
|
||||
$"Player '{player.PlayerName}' defines the command '{memberName}' on multiple traits";
|
||||
protected override string MemberNotFoundError(string memberName) =>
|
||||
$"Player '{player.PlayerName}' does not define a property '{memberName}'";
|
||||
|
||||
public ScriptPlayerInterface(ScriptContext context, Player player)
|
||||
: base(context)
|
||||
|
||||
@@ -629,8 +629,8 @@ namespace OpenRA.Support
|
||||
if (lastToken.RightOperand == token.LeftOperand)
|
||||
{
|
||||
if (lastToken.RightOperand)
|
||||
throw new InvalidDataException(
|
||||
$"Missing value or sub-expression or there is an extra operator `{lastToken.Symbol}` at index {lastToken.Index} or `{token.Symbol}` at index {token.Index}");
|
||||
throw new InvalidDataException("Missing value or sub-expression or there is an extra operator " +
|
||||
$"`{lastToken.Symbol}` at index {lastToken.Index} or `{token.Symbol}` at index {token.Index}");
|
||||
throw new InvalidDataException($"Missing binary operation before `{token.Symbol}` at index {token.Index}");
|
||||
}
|
||||
}
|
||||
@@ -937,7 +937,9 @@ namespace OpenRA.Support
|
||||
}
|
||||
|
||||
default:
|
||||
throw new InvalidProgramException($"ConditionExpression.Compiler.Compile() is missing an expression builder for TokenType.{Enum<TokenType>.GetValues()[(int)t.Type]}");
|
||||
throw new InvalidProgramException(
|
||||
"ConditionExpression.Compiler.Compile() is missing an expression builder for " +
|
||||
$"TokenType.{Enum<TokenType>.GetValues()[(int)t.Type]}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -222,23 +222,31 @@ namespace OpenRA
|
||||
public LuaValue Add(LuaRuntime runtime, LuaValue left, LuaValue right)
|
||||
{
|
||||
if (!left.TryGetClrValue(out WAngle a))
|
||||
throw new LuaException($"Attempted to call WAngle.Add(WAngle, WAngle) with invalid arguments ({left.WrappedClrType().Name}, {right.WrappedClrType().Name})");
|
||||
throw new LuaException(
|
||||
"Attempted to call WAngle.Add(WAngle, WAngle) with invalid arguments " +
|
||||
$"({left.WrappedClrType().Name}, {right.WrappedClrType().Name})");
|
||||
|
||||
if (right.TryGetClrValue(out WAngle b))
|
||||
return new LuaCustomClrObject(a + b);
|
||||
|
||||
throw new LuaException($"Attempted to call WAngle.Add(WAngle, WAngle) with invalid arguments ({left.WrappedClrType().Name}, {right.WrappedClrType().Name})");
|
||||
throw new LuaException(
|
||||
"Attempted to call WAngle.Add(WAngle, WAngle) with invalid arguments " +
|
||||
$"({left.WrappedClrType().Name}, {right.WrappedClrType().Name})");
|
||||
}
|
||||
|
||||
public LuaValue Subtract(LuaRuntime runtime, LuaValue left, LuaValue right)
|
||||
{
|
||||
if (!left.TryGetClrValue(out WAngle a))
|
||||
throw new LuaException($"Attempted to call WAngle.Subtract(WAngle, WAngle) with invalid arguments ({left.WrappedClrType().Name}, {right.WrappedClrType().Name})");
|
||||
throw new LuaException(
|
||||
"Attempted to call WAngle.Subtract(WAngle, WAngle) with invalid arguments " +
|
||||
$"({left.WrappedClrType().Name}, {right.WrappedClrType().Name})");
|
||||
|
||||
if (right.TryGetClrValue(out WAngle b))
|
||||
return new LuaCustomClrObject(a - b);
|
||||
|
||||
throw new LuaException($"Attempted to call WAngle.Subtract(WAngle, WAngle) with invalid arguments ({left.WrappedClrType().Name}, {right.WrappedClrType().Name})");
|
||||
throw new LuaException(
|
||||
"Attempted to call WAngle.Subtract(WAngle, WAngle) with invalid arguments " +
|
||||
$"({left.WrappedClrType().Name}, {right.WrappedClrType().Name})");
|
||||
}
|
||||
|
||||
public LuaValue Equals(LuaRuntime runtime, LuaValue left, LuaValue right)
|
||||
|
||||
@@ -17,7 +17,8 @@ using OpenRA.Support;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
public readonly struct WVec : IScriptBindable, ILuaAdditionBinding, ILuaSubtractionBinding, ILuaUnaryMinusBinding, ILuaEqualityBinding, ILuaTableBinding, IEquatable<WVec>
|
||||
public readonly struct WVec : IScriptBindable,
|
||||
ILuaAdditionBinding, ILuaSubtractionBinding, ILuaUnaryMinusBinding, ILuaEqualityBinding, ILuaTableBinding, IEquatable<WVec>
|
||||
{
|
||||
public readonly int X, Y, Z;
|
||||
|
||||
|
||||
@@ -20,7 +20,8 @@ namespace OpenRA.Mods.Cnc.Graphics
|
||||
public ClassicSpriteSequenceLoader(ModData modData)
|
||||
: base(modData) { }
|
||||
|
||||
public override ISpriteSequence CreateSequence(ModData modData, string tileset, SpriteCache cache, string image, string sequence, MiniYaml data, MiniYaml defaults)
|
||||
public override ISpriteSequence CreateSequence(
|
||||
ModData modData, string tileset, SpriteCache cache, string image, string sequence, MiniYaml data, MiniYaml defaults)
|
||||
{
|
||||
return new ClassicSpriteSequence(cache, this, image, sequence, data, defaults);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@ namespace OpenRA.Mods.Cnc.Graphics
|
||||
public ClassicTilesetSpecificSpriteSequenceLoader(ModData modData)
|
||||
: base(modData) { }
|
||||
|
||||
public override ISpriteSequence CreateSequence(ModData modData, string tileset, SpriteCache cache, string image, string sequence, MiniYaml data, MiniYaml defaults)
|
||||
public override ISpriteSequence CreateSequence(
|
||||
ModData modData, string tileset, SpriteCache cache, string image, string sequence, MiniYaml data, MiniYaml defaults)
|
||||
{
|
||||
return new ClassicTilesetSpecificSpriteSequence(cache, this, image, sequence, data, defaults);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,11 @@ namespace OpenRA.Mods.Cnc.Graphics
|
||||
readonly WVec cachedLength;
|
||||
IEnumerable<IFinalizedRenderable> cache;
|
||||
|
||||
public TeslaZapRenderable(WPos pos, int zOffset, in WVec length, string image, string brightSequence, int brightZaps, string dimSequence, int dimZaps, string palette)
|
||||
public TeslaZapRenderable(
|
||||
WPos pos, int zOffset, in WVec length, string image,
|
||||
string brightSequence, int brightZaps,
|
||||
string dimSequence, int dimZaps,
|
||||
string palette)
|
||||
{
|
||||
Pos = pos;
|
||||
ZOffset = zOffset;
|
||||
@@ -68,8 +72,10 @@ namespace OpenRA.Mods.Cnc.Graphics
|
||||
return new TeslaZapRenderable(Pos, ZOffset, length, image, brightSequence, brightZaps, dimSequence, dimZaps, palette);
|
||||
}
|
||||
|
||||
public IRenderable WithZOffset(int newOffset) { return new TeslaZapRenderable(Pos, ZOffset, length, image, brightSequence, brightZaps, dimSequence, dimZaps, palette); }
|
||||
public IRenderable OffsetBy(in WVec vec) { return new TeslaZapRenderable(Pos + vec, ZOffset, length, image, brightSequence, brightZaps, dimSequence, dimZaps, palette); }
|
||||
public IRenderable WithZOffset(int newOffset) =>
|
||||
new TeslaZapRenderable(Pos, ZOffset, length, image, brightSequence, brightZaps, dimSequence, dimZaps, palette);
|
||||
public IRenderable OffsetBy(in WVec vec) =>
|
||||
new TeslaZapRenderable(Pos + vec, ZOffset, length, image, brightSequence, brightZaps, dimSequence, dimZaps, palette);
|
||||
public IRenderable AsDecoration() { return this; }
|
||||
|
||||
public IFinalizedRenderable PrepareRender(WorldRenderer wr) { return this; }
|
||||
|
||||
@@ -25,7 +25,9 @@ namespace OpenRA.Mods.Cnc.Installer
|
||||
public void RunActionOnSource(MiniYaml actionYaml, string path, ModData modData, List<string> extracted, Action<string> updateMessage)
|
||||
{
|
||||
// Yaml path may be specified relative to a named directory (e.g. ^SupportDir) or the detected source path
|
||||
var sourcePath = actionYaml.Value.StartsWith('^') ? Platform.ResolvePath(actionYaml.Value) : FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value));
|
||||
var sourcePath = actionYaml.Value.StartsWith('^')
|
||||
? Platform.ResolvePath(actionYaml.Value)
|
||||
: FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value));
|
||||
|
||||
using (var source = File.OpenRead(sourcePath))
|
||||
{
|
||||
|
||||
@@ -78,7 +78,8 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
|
||||
void INotifyAttack.PreparingAttack(Actor self, in Target target, Armament a, Barrel barrel) { }
|
||||
|
||||
public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
public override Activity GetAttackActivity(
|
||||
Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
{
|
||||
return new ChargeAttack(this, newTarget, forceAttack, targetLineColor);
|
||||
}
|
||||
|
||||
@@ -102,7 +102,9 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return new TargetTypeOrderTargeter(new BitSet<TargetableType>("DetonateAttack"), "DetonateAttack", 5, info.AttackCursor, true, false) { ForceAttack = false };
|
||||
yield return
|
||||
new TargetTypeOrderTargeter(new BitSet<TargetableType>("DetonateAttack"), "DetonateAttack", 5, info.AttackCursor, true, false)
|
||||
{ ForceAttack = false };
|
||||
|
||||
if (!initiated)
|
||||
yield return new DeployOrderTargeter("Detonate", 5, () => info.DeployCursor);
|
||||
|
||||
@@ -19,7 +19,8 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Cnc.Traits.Render
|
||||
{
|
||||
public class WithVoxelBarrelInfo : ConditionalTraitInfo, IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>, Requires<ArmamentInfo>, Requires<TurretedInfo>
|
||||
public class WithVoxelBarrelInfo : ConditionalTraitInfo,
|
||||
IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>, Requires<ArmamentInfo>, Requires<TurretedInfo>
|
||||
{
|
||||
[Desc("Voxel sequence name to use")]
|
||||
public readonly string Sequence = "barrel";
|
||||
|
||||
@@ -19,7 +19,8 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Cnc.Traits.Render
|
||||
{
|
||||
public class WithVoxelWalkerBodyInfo : PausableConditionalTraitInfo, IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>, Requires<IMoveInfo>, Requires<IFacingInfo>
|
||||
public class WithVoxelWalkerBodyInfo : PausableConditionalTraitInfo,
|
||||
IRenderActorPreviewVoxelsInfo, Requires<RenderVoxelsInfo>, Requires<IMoveInfo>, Requires<IFacingInfo>
|
||||
{
|
||||
public readonly string Sequence = "idle";
|
||||
|
||||
|
||||
@@ -209,7 +209,8 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
var tiles = power.CellsMatching(xy, footprint, dimensions);
|
||||
var palette = wr.Palette(((ChronoshiftPowerInfo)power.Info).TargetOverlayPalette);
|
||||
foreach (var t in tiles)
|
||||
yield return new SpriteRenderable(tile, wr.World.Map.CenterOfCell(t), WVec.Zero, -511, palette, 1f, alpha, float3.Ones, TintModifiers.IgnoreWorldTint, true);
|
||||
yield return new SpriteRenderable(
|
||||
tile, wr.World.Map.CenterOfCell(t), WVec.Zero, -511, palette, 1f, alpha, float3.Ones, TintModifiers.IgnoreWorldTint, true);
|
||||
}
|
||||
|
||||
protected override string GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi)
|
||||
@@ -310,7 +311,8 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
var isValid = manager.Self.Owner.Shroud.IsExplored(t + delta);
|
||||
var tile = isValid ? validTile : invalidTile;
|
||||
var alpha = isValid ? validAlpha : invalidAlpha;
|
||||
yield return new SpriteRenderable(tile, wr.World.Map.CenterOfCell(t + delta), WVec.Zero, -511, palette, 1f, alpha, float3.Ones, TintModifiers.IgnoreWorldTint, true);
|
||||
yield return new SpriteRenderable(
|
||||
tile, wr.World.Map.CenterOfCell(t + delta), WVec.Zero, -511, palette, 1f, alpha, float3.Ones, TintModifiers.IgnoreWorldTint, true);
|
||||
}
|
||||
|
||||
// Unit previews
|
||||
@@ -323,7 +325,8 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
unit.Trait<Chronoshiftable>().CanChronoshiftTo(unit, targetCell);
|
||||
var tile = canEnter ? validTile : invalidTile;
|
||||
var alpha = canEnter ? validAlpha : invalidAlpha;
|
||||
yield return new SpriteRenderable(tile, wr.World.Map.CenterOfCell(targetCell), WVec.Zero, -511, palette, 1f, alpha, float3.Ones, TintModifiers.IgnoreWorldTint, true);
|
||||
yield return new SpriteRenderable(
|
||||
tile, wr.World.Map.CenterOfCell(targetCell), WVec.Zero, -511, palette, 1f, alpha, float3.Ones, TintModifiers.IgnoreWorldTint, true);
|
||||
}
|
||||
|
||||
var offset = world.Map.CenterOfCell(xy) - world.Map.CenterOfCell(sourceLocation);
|
||||
@@ -353,7 +356,8 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
|
||||
// Source tiles
|
||||
foreach (var t in power.CellsMatching(sourceLocation, footprint, dimensions))
|
||||
yield return new SpriteRenderable(sourceTile, wr.World.Map.CenterOfCell(t), WVec.Zero, -511, palette, 1f, sourceAlpha, float3.Ones, TintModifiers.IgnoreWorldTint, true);
|
||||
yield return new SpriteRenderable(
|
||||
sourceTile, wr.World.Map.CenterOfCell(t), WVec.Zero, -511, palette, 1f, sourceAlpha, float3.Ones, TintModifiers.IgnoreWorldTint, true);
|
||||
}
|
||||
|
||||
bool IsValidTarget(CPos xy)
|
||||
|
||||
@@ -47,7 +47,8 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
bool IOccupySpaceInfo.SharesCell => false;
|
||||
|
||||
// Used to determine if actor can spawn
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell,
|
||||
SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
{
|
||||
return world.Map.Contains(cell);
|
||||
}
|
||||
|
||||
@@ -447,7 +447,8 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual bool TryHandleOverlayToActorInner(CPos cell, byte[] overlayPack, CellLayer<int> overlayIndex, byte overlayType, out ActorReference actorReference)
|
||||
protected virtual bool TryHandleOverlayToActorInner(
|
||||
CPos cell, byte[] overlayPack, CellLayer<int> overlayIndex, byte overlayType, out ActorReference actorReference)
|
||||
{
|
||||
actorReference = null;
|
||||
if (!OverlayToActor.TryGetValue(overlayType, out var actorType))
|
||||
|
||||
@@ -267,7 +267,8 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
|
||||
|
||||
#region Method overrides
|
||||
|
||||
protected override bool TryHandleOverlayToActorInner(CPos cell, byte[] overlayPack, CellLayer<int> overlayIndex, byte overlayType, out ActorReference actorReference)
|
||||
protected override bool TryHandleOverlayToActorInner(
|
||||
CPos cell, byte[] overlayPack, CellLayer<int> overlayIndex, byte overlayType, out ActorReference actorReference)
|
||||
{
|
||||
actorReference = null;
|
||||
if (!OverlayToActor.TryGetValue(overlayType, out var actorType))
|
||||
|
||||
@@ -516,9 +516,13 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
sealed class MoveFirstHalf : MovePart
|
||||
{
|
||||
public MoveFirstHalf(Move move, WPos from, WPos to, WAngle fromFacing, WAngle toFacing,
|
||||
public MoveFirstHalf(
|
||||
Move move, WPos from, WPos to, WAngle fromFacing, WAngle toFacing,
|
||||
WRot? fromTerrainOrientation, WRot? toTerrainOrientation, int terrainOrientationMargin, int carryoverProgress, bool shouldArc, bool movingOnGroundLayer)
|
||||
: base(move, from, to, fromFacing, toFacing, fromTerrainOrientation, toTerrainOrientation, terrainOrientationMargin, carryoverProgress, shouldArc, movingOnGroundLayer) { }
|
||||
: base(
|
||||
move, from, to, fromFacing, toFacing,
|
||||
fromTerrainOrientation, toTerrainOrientation, terrainOrientationMargin, carryoverProgress, shouldArc, movingOnGroundLayer)
|
||||
{ }
|
||||
|
||||
bool IsTurn(Actor self, Mobile mobile, CPos nextCell, Map map)
|
||||
{
|
||||
@@ -599,9 +603,13 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
sealed class MoveSecondHalf : MovePart
|
||||
{
|
||||
public MoveSecondHalf(Move move, WPos from, WPos to, WAngle fromFacing, WAngle toFacing,
|
||||
public MoveSecondHalf(
|
||||
Move move, WPos from, WPos to, WAngle fromFacing, WAngle toFacing,
|
||||
WRot? fromTerrainOrientation, WRot? toTerrainOrientation, int terrainOrientationMargin, int carryoverProgress, bool shouldArc, bool movingOnGroundLayer)
|
||||
: base(move, from, to, fromFacing, toFacing, fromTerrainOrientation, toTerrainOrientation, terrainOrientationMargin, carryoverProgress, shouldArc, movingOnGroundLayer) { }
|
||||
: base(
|
||||
move, from, to, fromFacing, toFacing,
|
||||
fromTerrainOrientation, toTerrainOrientation, terrainOrientationMargin, carryoverProgress, shouldArc, movingOnGroundLayer)
|
||||
{ }
|
||||
|
||||
protected override MovePart OnComplete(Actor self, Mobile mobile, Move parent)
|
||||
{
|
||||
|
||||
@@ -253,7 +253,14 @@ namespace OpenRA.Mods.Common.FileFormats
|
||||
WriteSample(DecodeNibble((short)((bytecode >> 4) & 0x0F), bpred[0], ref chanIdelta[0], ref s1[0], ref s2[0]), data);
|
||||
|
||||
// Decode the second nibble, for stereo this will be the right channel
|
||||
WriteSample(DecodeNibble((short)(bytecode & 0x0F), bpred[channelNumber], ref chanIdelta[channelNumber], ref s1[channelNumber], ref s2[channelNumber]), data);
|
||||
WriteSample(
|
||||
DecodeNibble(
|
||||
(short)(bytecode & 0x0F),
|
||||
bpred[channelNumber],
|
||||
ref chanIdelta[channelNumber],
|
||||
ref s1[channelNumber],
|
||||
ref s2[channelNumber]),
|
||||
data);
|
||||
}
|
||||
|
||||
return ++currentBlock >= numBlocks;
|
||||
|
||||
@@ -36,7 +36,8 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
IndexedSheetSize = FieldLoader.GetValue<int>("IndexedSheetSize", yaml.Value);
|
||||
}
|
||||
|
||||
public virtual ISpriteSequence CreateSequence(ModData modData, string tileset, SpriteCache cache, string image, string sequence, MiniYaml data, MiniYaml defaults)
|
||||
public virtual ISpriteSequence CreateSequence(
|
||||
ModData modData, string tileset, SpriteCache cache, string image, string sequence, MiniYaml data, MiniYaml defaults)
|
||||
{
|
||||
return new DefaultSpriteSequence(cache, this, image, sequence, data, defaults);
|
||||
}
|
||||
@@ -44,7 +45,8 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
int ISpriteSequenceLoader.BgraSheetSize => BgraSheetSize;
|
||||
int ISpriteSequenceLoader.IndexedSheetSize => IndexedSheetSize;
|
||||
|
||||
IReadOnlyDictionary<string, ISpriteSequence> ISpriteSequenceLoader.ParseSequences(ModData modData, string tileset, SpriteCache cache, MiniYamlNode imageNode)
|
||||
IReadOnlyDictionary<string, ISpriteSequence> ISpriteSequenceLoader.ParseSequences(
|
||||
ModData modData, string tileset, SpriteCache cache, MiniYamlNode imageNode)
|
||||
{
|
||||
var sequences = new Dictionary<string, ISpriteSequence>();
|
||||
var node = imageNode.Value.NodeWithKeyOrDefault("Defaults");
|
||||
@@ -135,7 +137,9 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
[Desc("The number of facings that are provided by sprite frames. Use negative values to rotate counter-clockwise.")]
|
||||
protected static readonly SpriteSequenceField<int> Facings = new(nameof(Facings), 1);
|
||||
|
||||
[Desc("The total number of facings for the sequence. If >Facings, the closest facing sprite will be rotated to match. Use negative values to rotate counter-clockwise.")]
|
||||
[Desc("The total number of facings for the sequence. " +
|
||||
"If >Facings, the closest facing sprite will be rotated to match. " +
|
||||
"Use negative values to rotate counter-clockwise.")]
|
||||
protected static readonly SpriteSequenceField<int?> InterpolatedFacings = new(nameof(InterpolatedFacings), null);
|
||||
|
||||
[Desc("Time (in milliseconds at default game speed) to wait until playing the next frame in the animation.")]
|
||||
@@ -302,7 +306,8 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
return Rectangle.FromLTRB(left, top, right, bottom);
|
||||
}
|
||||
|
||||
protected static List<int> CalculateFrameIndices(int start, int? length, int stride, int facings, int[] frames, bool transpose, bool reverseFacings, int shadowStart)
|
||||
protected static List<int> CalculateFrameIndices(
|
||||
int start, int? length, int stride, int facings, int[] frames, bool transpose, bool reverseFacings, int shadowStart)
|
||||
{
|
||||
// Request all frames
|
||||
if (length == null)
|
||||
@@ -411,10 +416,17 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
// Facings must be an integer factor of 1024 (i.e. 1024 / facings is an integer) to allow the frames to be
|
||||
// mapped uniformly over the full rotation range. This implies that it is a power of 2.
|
||||
if (facings == 0 || facings > 1024 || !Exts.IsPowerOf2(facings))
|
||||
throw new YamlException($"{facingsLocation}: {Facings.Key} must be within the (positive or negative) range of 1 to 1024, and a power of 2.");
|
||||
throw new YamlException(
|
||||
$"{facingsLocation}: {Facings.Key} must be within the (positive or negative) range of 1 to 1024, and a power of 2.");
|
||||
|
||||
if (interpolatedFacings != null && (interpolatedFacings < 2 || interpolatedFacings <= facings || interpolatedFacings > 1024 || !Exts.IsPowerOf2(interpolatedFacings.Value)))
|
||||
throw new YamlException($"{interpolatedFacingsLocation}: {InterpolatedFacings.Key} must be greater than {Facings.Key}, within the range of 2 to 1024, and a power of 2.");
|
||||
if (interpolatedFacings != null &&
|
||||
(interpolatedFacings < 2 ||
|
||||
interpolatedFacings <= facings ||
|
||||
interpolatedFacings > 1024 ||
|
||||
!Exts.IsPowerOf2(interpolatedFacings.Value)))
|
||||
throw new YamlException(
|
||||
$"{interpolatedFacingsLocation}: {InterpolatedFacings.Key} must be greater than {Facings.Key}, " +
|
||||
"within the range of 2 to 1024, and a power of 2.");
|
||||
|
||||
if (length != null && length <= 0)
|
||||
throw new YamlException($"{lengthLocation}: {Length.Key} must be positive.");
|
||||
|
||||
@@ -20,7 +20,8 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
public TilesetSpecificSpriteSequenceLoader(ModData modData)
|
||||
: base(modData) { }
|
||||
|
||||
public override ISpriteSequence CreateSequence(ModData modData, string tileSet, SpriteCache cache, string image, string sequence, MiniYaml data, MiniYaml defaults)
|
||||
public override ISpriteSequence CreateSequence(
|
||||
ModData modData, string tileSet, SpriteCache cache, string image, string sequence, MiniYaml data, MiniYaml defaults)
|
||||
{
|
||||
return new TilesetSpecificSpriteSequence(cache, this, image, sequence, data, defaults);
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ namespace OpenRA.Mods.Common.Installer
|
||||
InstallFromSourceLogic.CopyingFilename,
|
||||
Translation.Arguments("filename", displayFilename)));
|
||||
else
|
||||
onProgress = b => updateMessage(
|
||||
TranslationProvider.GetString(InstallFromSourceLogic.CopyingFilenameProgress,
|
||||
onProgress = b => updateMessage(TranslationProvider.GetString(
|
||||
InstallFromSourceLogic.CopyingFilenameProgress,
|
||||
Translation.Arguments("filename", displayFilename, "progress", 100 * b / length)));
|
||||
|
||||
InstallerUtils.CopyStream(source, target, length, onProgress);
|
||||
|
||||
@@ -23,7 +23,9 @@ namespace OpenRA.Mods.Common.Installer
|
||||
public void RunActionOnSource(MiniYaml actionYaml, string path, ModData modData, List<string> extracted, Action<string> updateMessage)
|
||||
{
|
||||
// Yaml path may be specified relative to a named directory (e.g. ^SupportDir) or the detected source path
|
||||
var sourcePath = actionYaml.Value.StartsWith('^') ? Platform.ResolvePath(actionYaml.Value) : FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value));
|
||||
var sourcePath = actionYaml.Value.StartsWith('^')
|
||||
? Platform.ResolvePath(actionYaml.Value)
|
||||
: FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value));
|
||||
|
||||
using (var source = File.OpenRead(sourcePath))
|
||||
{
|
||||
|
||||
@@ -23,7 +23,9 @@ namespace OpenRA.Mods.Common.Installer
|
||||
public void RunActionOnSource(MiniYaml actionYaml, string path, ModData modData, List<string> extracted, Action<string> updateMessage)
|
||||
{
|
||||
// Yaml path may be specified relative to a named directory (e.g. ^SupportDir) or the detected source path
|
||||
var sourcePath = actionYaml.Value.StartsWith('^') ? Platform.ResolvePath(actionYaml.Value) : FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value));
|
||||
var sourcePath = actionYaml.Value.StartsWith('^')
|
||||
? Platform.ResolvePath(actionYaml.Value)
|
||||
: FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value));
|
||||
|
||||
var volumeNode = actionYaml.NodeWithKeyOrDefault("Volumes");
|
||||
if (volumeNode == null)
|
||||
|
||||
@@ -23,7 +23,9 @@ namespace OpenRA.Mods.Common.Installer
|
||||
public void RunActionOnSource(MiniYaml actionYaml, string path, ModData modData, List<string> extracted, Action<string> updateMessage)
|
||||
{
|
||||
// Yaml path may be specified relative to a named directory (e.g. ^SupportDir) or the detected source path
|
||||
var sourcePath = actionYaml.Value.StartsWith('^') ? Platform.ResolvePath(actionYaml.Value) : FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value));
|
||||
var sourcePath = actionYaml.Value.StartsWith('^')
|
||||
? Platform.ResolvePath(actionYaml.Value)
|
||||
: FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value));
|
||||
|
||||
using (var source = File.OpenRead(sourcePath))
|
||||
{
|
||||
|
||||
@@ -22,7 +22,9 @@ namespace OpenRA.Mods.Common.Installer
|
||||
public void RunActionOnSource(MiniYaml actionYaml, string path, ModData modData, List<string> extracted, Action<string> updateMessage)
|
||||
{
|
||||
// Yaml path may be specified relative to a named directory (e.g. ^SupportDir) or the detected source path
|
||||
var sourcePath = actionYaml.Value.StartsWith('^') ? Platform.ResolvePath(actionYaml.Value) : FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value));
|
||||
var sourcePath = actionYaml.Value.StartsWith('^')
|
||||
? Platform.ResolvePath(actionYaml.Value)
|
||||
: FS.ResolveCaseInsensitivePath(Path.Combine(path, actionYaml.Value));
|
||||
|
||||
using (var source = File.OpenRead(sourcePath))
|
||||
{
|
||||
|
||||
@@ -49,7 +49,9 @@ namespace OpenRA.Mods.Common.Installer
|
||||
using (var targetStream = File.OpenWrite(targetPath))
|
||||
sourceStream.CopyTo(targetStream);
|
||||
|
||||
updateMessage(TranslationProvider.GetString(InstallFromSourceLogic.ExtractingProgress, Translation.Arguments("filename", displayFilename, "progress", 100)));
|
||||
updateMessage(TranslationProvider.GetString(
|
||||
InstallFromSourceLogic.ExtractingProgress,
|
||||
Translation.Arguments("filename", displayFilename, "progress", 100)));
|
||||
|
||||
extracted.Add(targetPath);
|
||||
}
|
||||
|
||||
@@ -85,16 +85,29 @@ namespace OpenRA.Mods.Common.Installer
|
||||
}
|
||||
|
||||
case PlatformType.OSX:
|
||||
candidatePaths.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Application Support", "Steam"));
|
||||
candidatePaths.Add(Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
|
||||
"Library",
|
||||
"Application Support",
|
||||
"Steam"));
|
||||
|
||||
break;
|
||||
|
||||
case PlatformType.Linux:
|
||||
// Direct distro install
|
||||
candidatePaths.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".steam", "root"));
|
||||
candidatePaths.Add(Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
|
||||
".steam",
|
||||
"root"));
|
||||
|
||||
// Flatpak installed via Flathub
|
||||
candidatePaths.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".var", "app", "com.valvesoftware.Steam", ".steam", "root"));
|
||||
candidatePaths.Add(Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
|
||||
".var",
|
||||
"app",
|
||||
"com.valvesoftware.Steam",
|
||||
".steam",
|
||||
"root"));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -64,8 +64,15 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
}
|
||||
|
||||
static void CheckInner(ModData modData, string[] namedKeys, (string Widget, string Field)[] checkWidgetFields, Dictionary<string, List<string>> customLintMethods,
|
||||
IEnumerable<MiniYamlNode> nodes, string filename, MiniYamlNode parent, Action<string> emitError)
|
||||
static void CheckInner(
|
||||
ModData modData,
|
||||
string[] namedKeys,
|
||||
(string Widget, string Field)[] checkWidgetFields,
|
||||
Dictionary<string, List<string>> customLintMethods,
|
||||
IEnumerable<MiniYamlNode> nodes,
|
||||
string filename,
|
||||
MiniYamlNode parent,
|
||||
Action<string> emitError)
|
||||
{
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
|
||||
@@ -42,7 +42,9 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (count == 0)
|
||||
emitError($"Actor type `{actorInfo.Key}` does not define a default visibility type.");
|
||||
else if (count > 1)
|
||||
emitError($"Actor type `{actorInfo.Key}` defines multiple default visibility types: {string.Join(", ", visibilityTypes.Select(vis => vis.GetType().Name))}.");
|
||||
emitError(
|
||||
$"Actor type `{actorInfo.Key}` defines multiple default visibility types: " +
|
||||
$"{string.Join(", ", visibilityTypes.Select(vis => vis.GetType().Name))}.");
|
||||
else
|
||||
{
|
||||
var vis = actorInfo.Value.TraitInfoOrDefault<HiddenUnderShroudInfo>();
|
||||
@@ -50,9 +52,13 @@ namespace OpenRA.Mods.Common.Lint
|
||||
{
|
||||
var ios = actorInfo.Value.TraitInfoOrDefault<IOccupySpaceInfo>();
|
||||
if (ios == null)
|
||||
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType().Name}` but has no IOccupySpace traits.");
|
||||
emitError(
|
||||
$"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType().Name}` " +
|
||||
"but has no IOccupySpace traits.");
|
||||
else if (ios.OccupiedCells(actorInfo.Value, CPos.Zero).Count == 0)
|
||||
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType().Name}` but does not have any footprint cells.");
|
||||
emitError(
|
||||
$"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType().Name}` " +
|
||||
"but does not have any footprint cells.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,8 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, emitWarning, map.Players, map.Visibility, map.WorldActorInfo, map.SpawnPoints);
|
||||
}
|
||||
|
||||
static void Run(Action<string> emitError, Action<string> emitWarning, MapPlayers players, MapVisibility visibility, ActorInfo worldActorInfo, CPos[] spawnPoints)
|
||||
static void Run(Action<string> emitError, Action<string> emitWarning,
|
||||
MapPlayers players, MapVisibility visibility, ActorInfo worldActorInfo, CPos[] spawnPoints)
|
||||
{
|
||||
if (players.Players.Count > 64)
|
||||
emitError("Defining more than 64 players is not allowed.");
|
||||
|
||||
@@ -97,10 +97,13 @@ namespace OpenRA.Mods.Common.Lint
|
||||
// TODO: Remove prefixed sequence references and instead use explicit lists of lintable references.
|
||||
if (!sequences.Sequences(i).Any(s => s.StartsWith(sequence, StringComparison.Ordinal)))
|
||||
emitWarning(
|
||||
$"Actor type `{actorInfo.Value.Name}` trait `{traitName}` field `{field.Name}` defines a prefix `{sequence}` that does not match any sequences on image `{i}`.");
|
||||
$"Actor type `{actorInfo.Value.Name}` trait `{traitName}` field `{field.Name}` " +
|
||||
$"defines a prefix `{sequence}` that does not match any sequences on image `{i}`.");
|
||||
}
|
||||
else if (!sequences.HasSequence(i, sequence))
|
||||
emitError($"Actor type `{actorInfo.Value.Name}` trait `{traitName}` field `{field.Name}` references an undefined sequence `{sequence}` on image `{i}`.");
|
||||
emitError(
|
||||
$"Actor type `{actorInfo.Value.Name}` trait `{traitName}` field `{field.Name}` " +
|
||||
$"references an undefined sequence `{sequence}` on image `{i}`.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,10 +148,14 @@ namespace OpenRA.Mods.Common.Lint
|
||||
{
|
||||
// TODO: Remove prefixed sequence references and instead use explicit lists of lintable references.
|
||||
if (!sequences.Sequences(image).Any(s => s.StartsWith(sequence, StringComparison.Ordinal)))
|
||||
emitWarning($"Weapon type `{weaponInfo.Key}` projectile field `{field.Name}` defines a prefix `{sequence}` that does not match any sequences on image `{image}`.");
|
||||
emitWarning(
|
||||
$"Weapon type `{weaponInfo.Key}` projectile field `{field.Name}` " +
|
||||
$"defines a prefix `{sequence}` that does not match any sequences on image `{image}`.");
|
||||
}
|
||||
else if (!sequences.HasSequence(image, sequence))
|
||||
emitError($"Weapon type `{weaponInfo.Key}` projectile field `{field.Name}` references an undefined sequence `{sequence}` on image `{image}`.");
|
||||
emitError(
|
||||
$"Weapon type `{weaponInfo.Key}` projectile field `{field.Name}` " +
|
||||
$"references an undefined sequence `{sequence}` on image `{image}`.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +209,9 @@ namespace OpenRA.Mods.Common.Lint
|
||||
{
|
||||
var userInterface = typeof(UserInterfaceGlobal).GetCustomAttribute<ScriptGlobalAttribute>().Name;
|
||||
const string Translate = nameof(UserInterfaceGlobal.Translate);
|
||||
emitWarning($"{context} calls {userInterface}.{Translate} with key `{key}` and translate args passed as `{variable}`. Inline the args at the callsite for lint analysis.");
|
||||
emitWarning(
|
||||
$"{context} calls {userInterface}.{Translate} with key `{key}` and translate args passed as `{variable}`." +
|
||||
"Inline the args at the callsite for lint analysis.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,9 @@ namespace OpenRA.Mods.Common.Lint
|
||||
"BooleanExpression", "IntegerExpression"
|
||||
};
|
||||
|
||||
throw new InvalidOperationException($"Bad type for reference on `{ruleInfo.GetType().Name}.{fieldInfo.Name}`. Supported types: {supportedTypes.JoinWith(", ")}.");
|
||||
throw new InvalidOperationException(
|
||||
$"Bad type for reference on `{ruleInfo.GetType().Name}.{fieldInfo.Name}`. " +
|
||||
$"Supported types: {supportedTypes.JoinWith(", ")}.");
|
||||
}
|
||||
|
||||
public static IEnumerable<string> GetPropertyValues(object ruleInfo, PropertyInfo propertyInfo,
|
||||
@@ -108,7 +110,9 @@ namespace OpenRA.Mods.Common.Lint
|
||||
"BooleanExpression", "IntegerExpression"
|
||||
};
|
||||
|
||||
throw new InvalidOperationException($"Bad type for reference on `{ruleInfo.GetType().Name}.{propertyInfo.Name}`. Supported types: {supportedTypes.JoinWith(", ")}.");
|
||||
throw new InvalidOperationException(
|
||||
$"Bad type for reference on `{ruleInfo.GetType().Name}.{propertyInfo.Name}`." +
|
||||
$"Supported types: {supportedTypes.JoinWith(", ")}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +294,12 @@ namespace OpenRA.Mods.Common.Orders
|
||||
{
|
||||
var isCloseEnough = buildingInfo.IsCloseEnoughToBase(world, world.LocalPlayer, actorInfo, topLeft);
|
||||
foreach (var t in buildingInfo.Tiles(topLeft))
|
||||
footprint.Add(t, MakeCellType(isCloseEnough && world.IsCellBuildable(t, actorInfo, buildingInfo) && (resourceLayer == null || resourceLayer.GetResource(t).Type == null)));
|
||||
footprint.Add(
|
||||
t,
|
||||
MakeCellType(
|
||||
isCloseEnough &&
|
||||
world.IsCellBuildable(t, actorInfo, buildingInfo) &&
|
||||
(resourceLayer == null || resourceLayer.GetResource(t).Type == null)));
|
||||
}
|
||||
|
||||
return preview?.Render(wr, topLeft, footprint) ?? Enumerable.Empty<IRenderable>();
|
||||
|
||||
@@ -99,7 +99,10 @@ namespace OpenRA.Mods.Common.Orders
|
||||
public virtual bool InputOverridesSelection(World world, int2 xy, MouseInput mi)
|
||||
{
|
||||
var actor = world.ScreenMap.ActorsAtMouse(xy)
|
||||
.Where(a => !a.Actor.IsDead && a.Actor.Info.HasTraitInfo<ISelectableInfo>() && (a.Actor.Owner.IsAlliedWith(world.RenderPlayer) || !world.FogObscures(a.Actor)))
|
||||
.Where(a =>
|
||||
!a.Actor.IsDead &&
|
||||
a.Actor.Info.HasTraitInfo<ISelectableInfo>() &&
|
||||
(a.Actor.Owner.IsAlliedWith(world.RenderPlayer) || !world.FogObscures(a.Actor)))
|
||||
.WithHighestSelectionPriority(xy, mi.Modifiers);
|
||||
|
||||
if (actor == null)
|
||||
|
||||
@@ -75,7 +75,8 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
target = Target.FromPos(args.PassiveTarget);
|
||||
|
||||
// Check for blocking actors
|
||||
if (info.Blockable && BlocksProjectiles.AnyBlockingActorsBetween(world, args.SourceActor.Owner, args.Source, target.CenterPosition, info.Width, out var blockedPos))
|
||||
if (info.Blockable && BlocksProjectiles.AnyBlockingActorsBetween(
|
||||
world, args.SourceActor.Owner, args.Source, target.CenterPosition, info.Width, out var blockedPos))
|
||||
target = Target.FromPos(blockedPos);
|
||||
|
||||
var warheadArgs = new WarheadArgs(args)
|
||||
|
||||
@@ -45,7 +45,9 @@ namespace OpenRA.Mods.Common.Scripting.Global
|
||||
using (kv.Value)
|
||||
{
|
||||
if (!kv.Key.TryGetClrValue<string>(out var variable) || !kv.Value.TryGetClrValue<object>(out var value))
|
||||
throw new LuaException($"Translation arguments requires a table of [\"string\"]=value pairs. Received {kv.Key.WrappedClrType().Name},{kv.Value.WrappedClrType().Name}");
|
||||
throw new LuaException(
|
||||
"Translation arguments requires a table of [\"string\"]=value pairs. " +
|
||||
$"Received {kv.Key.WrappedClrType().Name},{kv.Value.WrappedClrType().Name}");
|
||||
|
||||
argumentDictionary.Add(variable, value);
|
||||
}
|
||||
|
||||
@@ -165,33 +165,34 @@ namespace OpenRA.Mods.Common.Server
|
||||
[TranslationReference]
|
||||
const string VoteKickDisabled = "notification-vote-kick-disabled";
|
||||
|
||||
readonly IDictionary<string, Func<S, Connection, Session.Client, string, bool>> commandHandlers = new Dictionary<string, Func<S, Connection, Session.Client, string, bool>>
|
||||
{
|
||||
{ "state", State },
|
||||
{ "startgame", StartGame },
|
||||
{ "slot", Slot },
|
||||
{ "allow_spectators", AllowSpectators },
|
||||
{ "spectate", Specate },
|
||||
{ "slot_close", SlotClose },
|
||||
{ "slot_open", SlotOpen },
|
||||
{ "slot_bot", SlotBot },
|
||||
{ "map", Map },
|
||||
{ "option", Option },
|
||||
{ "reset_options", ResetOptions },
|
||||
{ "assignteams", AssignTeams },
|
||||
{ "kick", Kick },
|
||||
{ "vote_kick", VoteKick },
|
||||
{ "make_admin", MakeAdmin },
|
||||
{ "make_spectator", MakeSpectator },
|
||||
{ "name", Name },
|
||||
{ "faction", Faction },
|
||||
{ "team", Team },
|
||||
{ "handicap", Handicap },
|
||||
{ "spawn", Spawn },
|
||||
{ "clear_spawn", ClearPlayerSpawn },
|
||||
{ "color", PlayerColor },
|
||||
{ "sync_lobby", SyncLobby }
|
||||
};
|
||||
readonly IDictionary<string, Func<S, Connection, Session.Client, string, bool>> commandHandlers =
|
||||
new Dictionary<string, Func<S, Connection, Session.Client, string, bool>>
|
||||
{
|
||||
{ "state", State },
|
||||
{ "startgame", StartGame },
|
||||
{ "slot", Slot },
|
||||
{ "allow_spectators", AllowSpectators },
|
||||
{ "spectate", Specate },
|
||||
{ "slot_close", SlotClose },
|
||||
{ "slot_open", SlotOpen },
|
||||
{ "slot_bot", SlotBot },
|
||||
{ "map", Map },
|
||||
{ "option", Option },
|
||||
{ "reset_options", ResetOptions },
|
||||
{ "assignteams", AssignTeams },
|
||||
{ "kick", Kick },
|
||||
{ "vote_kick", VoteKick },
|
||||
{ "make_admin", MakeAdmin },
|
||||
{ "make_spectator", MakeSpectator },
|
||||
{ "name", Name },
|
||||
{ "faction", Faction },
|
||||
{ "team", Team },
|
||||
{ "handicap", Handicap },
|
||||
{ "spawn", Spawn },
|
||||
{ "clear_spawn", ClearPlayerSpawn },
|
||||
{ "color", PlayerColor },
|
||||
{ "sync_lobby", SyncLobby }
|
||||
};
|
||||
|
||||
static bool ValidateSlotCommand(S server, Connection conn, Session.Client client, string arg, bool requiresHost)
|
||||
{
|
||||
|
||||
@@ -50,7 +50,8 @@ namespace OpenRA.Mods.Common.Terrain
|
||||
|
||||
if (key < 0 || key >= tileInfo.Length)
|
||||
throw new YamlException(
|
||||
$"Tileset `{terrainInfo.Id}` template `{Id}` references frame {key}, but only [0..{tileInfo.Length - 1}] are valid for a {Size.X}x{Size.Y} Size template.");
|
||||
$"Tileset `{terrainInfo.Id}` template `{Id}` references frame {key}, " +
|
||||
$"but only [0..{tileInfo.Length - 1}] are valid for a {Size.X}x{Size.Y} Size template.");
|
||||
|
||||
tileInfo[key] = LoadTileInfo(terrainInfo, node.Value);
|
||||
}
|
||||
|
||||
@@ -190,12 +190,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
yield return new FacingInit(PreviewFacing);
|
||||
}
|
||||
|
||||
public IReadOnlyDictionary<CPos, SubCell> OccupiedCells(ActorInfo info, CPos location, SubCell subCell = SubCell.Any) { return new Dictionary<CPos, SubCell>(); }
|
||||
public IReadOnlyDictionary<CPos, SubCell> OccupiedCells(ActorInfo info, CPos location, SubCell subCell = SubCell.Any) =>
|
||||
new Dictionary<CPos, SubCell>();
|
||||
|
||||
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)
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell,
|
||||
SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
{
|
||||
if (!world.Map.Contains(cell))
|
||||
return false;
|
||||
|
||||
@@ -27,7 +27,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
"Strafe: Perform a fixed-length attack run on the target.")]
|
||||
public readonly AirAttackType AttackType = AirAttackType.Default;
|
||||
|
||||
[Desc("Distance the strafing aircraft makes to a target before turning for another pass. When set to WDist.Zero this defaults to the maximum armament range.")]
|
||||
[Desc(
|
||||
"Distance the strafing aircraft makes to a target before turning for another pass. " +
|
||||
"When set to WDist.Zero this defaults to the maximum armament range.")]
|
||||
public readonly WDist StrafeRunLength = WDist.Zero;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new AttackAircraft(init.Self, this); }
|
||||
@@ -45,7 +47,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
aircraftInfo = self.Info.TraitInfo<AircraftInfo>();
|
||||
}
|
||||
|
||||
public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
public override Activity GetAttackActivity(
|
||||
Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
{
|
||||
return new FlyAttack(self, source, newTarget, forceAttack, targetLineColor);
|
||||
}
|
||||
|
||||
@@ -380,7 +380,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Burst = Weapon.Burst;
|
||||
|
||||
if (Weapon.AfterFireSound != null && Weapon.AfterFireSound.Length > 0)
|
||||
ScheduleDelayedAction(Weapon.AfterFireSoundDelay, Burst, (burst) => Game.Sound.Play(SoundType.World, Weapon.AfterFireSound, self.World, self.CenterPosition));
|
||||
ScheduleDelayedAction(
|
||||
Weapon.AfterFireSoundDelay,
|
||||
Burst,
|
||||
burst => Game.Sound.Play(SoundType.World, Weapon.AfterFireSound, self.World, self.CenterPosition));
|
||||
|
||||
foreach (var nbc in notifyBurstComplete)
|
||||
nbc.FiredBurst(self, target, this);
|
||||
|
||||
@@ -226,7 +226,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return order.OrderString == attackOrderName || order.OrderString == forceAttackOrderName ? Info.Voice : null;
|
||||
}
|
||||
|
||||
public abstract Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null);
|
||||
public abstract Activity GetAttackActivity(
|
||||
Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null);
|
||||
|
||||
public bool HasAnyValidWeapons(in Target t, bool checkForCenterTargetingWeapons = false, bool reloadingIsInvalid = false)
|
||||
{
|
||||
|
||||
@@ -159,7 +159,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
base.Tick(self);
|
||||
}
|
||||
|
||||
public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
public override Activity GetAttackActivity(
|
||||
Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
{
|
||||
// HACK: Manually set force attacking if we persisted an opportunity target that required force attacking
|
||||
if (opportunityTargetIsPersistentTarget && opportunityForceAttack && newTarget == OpportunityTarget)
|
||||
|
||||
@@ -39,7 +39,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return TargetInFiringArc(self, target, Info.FacingTolerance);
|
||||
}
|
||||
|
||||
public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
public override Activity GetAttackActivity(
|
||||
Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
{
|
||||
return new Activities.Attack(self, newTarget, allowMove, forceAttack, targetLineColor);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public AttackOmni(Actor self, AttackOmniInfo info)
|
||||
: base(self, info) { }
|
||||
|
||||
public override Activity GetAttackActivity(Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
public override Activity GetAttackActivity(
|
||||
Actor self, AttackSource source, in Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null)
|
||||
{
|
||||
return new SetTarget(this, newTarget, allowMove, forceAttack, targetLineColor);
|
||||
}
|
||||
|
||||
@@ -100,8 +100,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return;
|
||||
|
||||
playerBuildings = world.ActorsHavingTrait<Building>().Where(a => a.Owner == player).ToArray();
|
||||
var excessPowerBonus = baseBuilder.Info.ExcessPowerIncrement * (playerBuildings.Length / baseBuilder.Info.ExcessPowerIncreaseThreshold.Clamp(1, int.MaxValue));
|
||||
minimumExcessPower = (baseBuilder.Info.MinimumExcessPower + excessPowerBonus).Clamp(baseBuilder.Info.MinimumExcessPower, baseBuilder.Info.MaximumExcessPower);
|
||||
var excessPowerBonus =
|
||||
baseBuilder.Info.ExcessPowerIncrement *
|
||||
(playerBuildings.Length / baseBuilder.Info.ExcessPowerIncreaseThreshold.Clamp(1, int.MaxValue));
|
||||
minimumExcessPower =
|
||||
(baseBuilder.Info.MinimumExcessPower + excessPowerBonus)
|
||||
.Clamp(baseBuilder.Info.MinimumExcessPower, baseBuilder.Info.MaximumExcessPower);
|
||||
|
||||
// PERF: Queue only one actor at a time per category
|
||||
itemQueuedThisTick = false;
|
||||
@@ -344,7 +348,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var buildingVariantInfo = actorInfo.TraitInfoOrDefault<PlaceBuildingVariantsInfo>();
|
||||
var variants = buildingVariantInfo?.Actors ?? Array.Empty<string>();
|
||||
|
||||
var count = playerBuildings.Count(a => a.Info.Name == name || variants.Contains(a.Info.Name)) + (baseBuilder.BuildingsBeingProduced.TryGetValue(name, out var num) ? num : 0);
|
||||
var count = playerBuildings.Count(a =>
|
||||
a.Info.Name == name || variants.Contains(a.Info.Name)) +
|
||||
(baseBuilder.BuildingsBeingProduced.TryGetValue(name, out var num) ? num : 0);
|
||||
|
||||
// Do we want to build this structure?
|
||||
if (count * 100 > frac.Value * playerBuildings.Length)
|
||||
|
||||
@@ -148,7 +148,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
foreach (var minelayer in minelayers)
|
||||
{
|
||||
var cells = pathFinder.FindPathToTargetCell(minelayer.Actor, new[] { minelayer.Actor.Location }, enemy.Location, BlockedByActor.Immovable, laneBias: false);
|
||||
var cells = pathFinder.FindPathToTargetCell(
|
||||
minelayer.Actor, new[] { minelayer.Actor.Location }, enemy.Location, BlockedByActor.Immovable, laneBias: false);
|
||||
if (cells != null && cells.Count != 0)
|
||||
{
|
||||
AIUtils.BotDebug($"{player}: try find a location to lay mine.");
|
||||
@@ -192,7 +193,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
foreach (var minelayer in minelayers)
|
||||
{
|
||||
var cells = pathFinder.FindPathToTargetCell(minelayer.Actor, new[] { minelayer.Actor.Location }, minelayingPosition, BlockedByActor.Immovable, laneBias: false);
|
||||
var cells = pathFinder.FindPathToTargetCell(
|
||||
minelayer.Actor, new[] { minelayer.Actor.Location }, minelayingPosition, BlockedByActor.Immovable, laneBias: false);
|
||||
if (cells != null && cells.Count != 0)
|
||||
{
|
||||
orderedActors.Add(minelayer.Actor);
|
||||
|
||||
@@ -24,10 +24,16 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("What support power does this decision apply to?")]
|
||||
public readonly string OrderName = "AirstrikePowerInfoOrder";
|
||||
|
||||
[Desc("What is the coarse scan radius of this power?", "For finding the general target area, before doing a detail scan", "Should be 10 or more to avoid lag")]
|
||||
[Desc(
|
||||
"What is the coarse scan radius of this power?",
|
||||
"For finding the general target area, before doing a detail scan",
|
||||
"Should be 10 or more to avoid lag")]
|
||||
public readonly int CoarseScanRadius = 20;
|
||||
|
||||
[Desc("What is the fine scan radius of this power?", "For doing a detailed scan in the general target area.", "Minimum is 1")]
|
||||
[Desc(
|
||||
"What is the fine scan radius of this power?",
|
||||
"For doing a detailed scan in the general target area.",
|
||||
"Minimum is 1")]
|
||||
public readonly int FineScanRadius = 2;
|
||||
|
||||
[FieldLoader.LoadUsing(nameof(LoadConsiderations))]
|
||||
|
||||
@@ -111,7 +111,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
waitingPowers[sp] += 10;
|
||||
|
||||
// Note: SelectDirectionalTarget uses uint.MaxValue in ExtraData to indicate that the player did not pick a direction.
|
||||
bot.QueueOrder(new Order(sp.Key, supportPowerManager.Self, Target.FromCell(world, attackLocation.Value), false) { SuppressVisualFeedback = true, ExtraData = uint.MaxValue });
|
||||
bot.QueueOrder(
|
||||
new Order(sp.Key, supportPowerManager.Self, Target.FromCell(world, attackLocation.Value), false)
|
||||
{ SuppressVisualFeedback = true, ExtraData = uint.MaxValue });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// Reason: If this is less than SquadSize, the bot might get stuck between not producing more units due to this,
|
||||
// but also not creating squads since there aren't enough idle units.
|
||||
[Desc("If > 0, only produce units as long as there are less than this amount of units idling inside the base.",
|
||||
"Beware: if it is less than squad size, e.g. the `SquadSize` from `SquadManagerBotModule`, the bot might get stuck as there aren't enough idle units to create squad.")]
|
||||
"Beware: if it is less than squad size, e.g. the `SquadSize` from `SquadManagerBotModule`, " +
|
||||
"the bot might get stuck as there aren't enough idle units to create squad.")]
|
||||
public readonly int IdleBaseUnitsMaximum = -1;
|
||||
|
||||
[Desc("Production queues AI uses for producing units.")]
|
||||
|
||||
@@ -140,7 +140,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (Info.RequiresForceMove && !forceEnter)
|
||||
return false;
|
||||
|
||||
return !IsTraitDisabled && target.TraitsImplementing<DockHost>().Any(host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType)));
|
||||
return !IsTraitDisabled && target.TraitsImplementing<DockHost>().Any(
|
||||
host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType)));
|
||||
}
|
||||
|
||||
/// <summary>Clone of <see cref="DockClientManager.DockingPossible(Actor, TargetModifiers)"/>.</summary>
|
||||
@@ -150,7 +151,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (Info.RequiresForceMove && !forceEnter)
|
||||
return false;
|
||||
|
||||
return !IsTraitDisabled && target.TraitsImplementing<DockHost>().Any(host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType, forceEnter)));
|
||||
return !IsTraitDisabled && target.TraitsImplementing<DockHost>().Any(
|
||||
host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType, forceEnter)));
|
||||
}
|
||||
|
||||
/// <summary>Clone of <see cref="DockClientManager.CanDockAt(Actor, bool, bool)"/>.</summary>
|
||||
@@ -159,7 +161,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!(self.CurrentActivity is Transform || transforms.Any(t => !t.IsTraitDisabled && !t.IsTraitPaused)))
|
||||
return false;
|
||||
|
||||
return !IsTraitDisabled && target.TraitsImplementing<DockHost>().Any(host => dockClients.Any(client => client.CanDockAt(target, host, forceEnter, true)));
|
||||
return !IsTraitDisabled && target.TraitsImplementing<DockHost>().Any(
|
||||
host => dockClients.Any(client => client.CanDockAt(target, host, forceEnter, true)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,7 +411,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
void INotifyKilled.Killed(Actor self, AttackInfo e)
|
||||
{
|
||||
// IsAtGroundLevel contains Map.Contains(self.Location) check.
|
||||
if (Info.EjectOnDeath && self.IsAtGroundLevel() && (!checkTerrainType || Info.UnloadTerrainTypes.Contains(self.World.Map.GetTerrainInfo(self.Location).Type)))
|
||||
if (Info.EjectOnDeath &&
|
||||
self.IsAtGroundLevel() &&
|
||||
(!checkTerrainType || Info.UnloadTerrainTypes.Contains(self.World.Map.GetTerrainInfo(self.Location).Type)))
|
||||
{
|
||||
while (!IsEmpty())
|
||||
{
|
||||
|
||||
@@ -50,7 +50,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Measured in game ticks.")]
|
||||
public readonly int CloakDelay = 30;
|
||||
|
||||
[Desc("Events leading to the actor getting uncloaked. Possible values are: Attack, Move, Unload, Infiltrate, Demolish, Dock, Damage, Heal, SelfHeal and SupportPower.",
|
||||
[Desc(
|
||||
"Events leading to the actor getting uncloaked. " +
|
||||
"Possible values are: Attack, Move, Unload, Infiltrate, Demolish, Dock, Damage, Heal, SelfHeal and SupportPower.",
|
||||
"'Dock' is triggered when docking to a refinery or resupplying.",
|
||||
"'SupportPower' is triggered when using a support power.")]
|
||||
public readonly UncloakType UncloakOn = UncloakType.Attack
|
||||
@@ -108,7 +110,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public override object Create(ActorInitializer init) { return new Cloak(this); }
|
||||
}
|
||||
|
||||
public class Cloak : PausableConditionalTrait<CloakInfo>, IRenderModifier, INotifyDamage, INotifyUnloadCargo, INotifyLoadCargo, INotifyDemolition, INotifyInfiltration,
|
||||
public class Cloak : PausableConditionalTrait<CloakInfo>,
|
||||
IRenderModifier, INotifyDamage, INotifyUnloadCargo, INotifyLoadCargo, INotifyDemolition, INotifyInfiltration,
|
||||
INotifyAttack, ITick, IVisibilityModifier, IRadarColorModifier, INotifyDockClient, INotifySupportPower
|
||||
{
|
||||
readonly float3 cloakedColor;
|
||||
|
||||
@@ -39,7 +39,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
bool IOccupySpaceInfo.SharesCell => false;
|
||||
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell,
|
||||
SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
{
|
||||
// Since crates don't share cells and GetAvailableSubCell only returns SubCell.Full or SubCell.Invalid, we ignore the subCell parameter
|
||||
return GetAvailableSubCell(world, cell, ignoreActor, check) != SubCell.Invalid;
|
||||
|
||||
@@ -45,7 +45,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
this.self = self;
|
||||
this.info = info;
|
||||
if (info.Units.Length == 0)
|
||||
throw new YamlException("A GiveUnitCrateAction does not specify any units to give. This might be because the yaml is referring to 'Unit' rather than 'Units'.");
|
||||
throw new YamlException(
|
||||
"A GiveUnitCrateAction does not specify any units to give. " +
|
||||
"This might be because the yaml is referring to 'Unit' rather than 'Units'.");
|
||||
}
|
||||
|
||||
public bool CanGiveTo(Actor collector)
|
||||
|
||||
@@ -17,7 +17,8 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
[Desc("This actor can grant experience levels equal to it's own current level via entering to other actors with the `" + nameof(AcceptsDeliveredExperience) + "` trait.")]
|
||||
[Desc("This actor can grant experience levels equal to it's own current level " +
|
||||
"via entering to other actors with the `" + nameof(AcceptsDeliveredExperience) + "` trait.")]
|
||||
sealed class DeliversExperienceInfo : TraitInfo, Requires<GainsExperienceInfo>
|
||||
{
|
||||
[Desc("The amount of experience the donating player receives.")]
|
||||
|
||||
@@ -42,7 +42,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public virtual bool CanDockAt(Actor hostActor, IDockHost host, bool forceEnter = false, bool ignoreOccupancy = false)
|
||||
{
|
||||
return (forceEnter || self.Owner.IsAlliedWith(hostActor.Owner)) && IsDockingPossible(host.GetDockType, forceEnter) && host.IsDockingPossible(self, this, ignoreOccupancy);
|
||||
return (forceEnter || self.Owner.IsAlliedWith(hostActor.Owner)) &&
|
||||
IsDockingPossible(host.GetDockType, forceEnter) &&
|
||||
host.IsDockingPossible(self, this, ignoreOccupancy);
|
||||
}
|
||||
|
||||
public virtual void OnDockStarted(Actor self, Actor hostActor, IDockHost host) { }
|
||||
|
||||
@@ -240,26 +240,30 @@ namespace OpenRA.Mods.Common.Traits
|
||||
/// <summary>Does this <paramref name="target"/> contain at least one enabled <see cref="IDockHost"/> with maching <see cref="DockType"/>.</summary>
|
||||
public bool DockingPossible(Actor target)
|
||||
{
|
||||
return !IsTraitDisabled && target.TraitsImplementing<IDockHost>().Any(host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType)));
|
||||
return !IsTraitDisabled && target.TraitsImplementing<IDockHost>().Any(
|
||||
host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType)));
|
||||
}
|
||||
|
||||
/// <summary>Does this <paramref name="target"/> contain at least one enabled <see cref="IDockHost"/> with maching <see cref="DockType"/>.</summary>
|
||||
public bool DockingPossible(Actor target, TargetModifiers modifiers)
|
||||
{
|
||||
var forceEnter = modifiers.HasModifier(TargetModifiers.ForceMove);
|
||||
return !IsTraitDisabled && target.TraitsImplementing<IDockHost>().Any(host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType, forceEnter)));
|
||||
return !IsTraitDisabled && target.TraitsImplementing<IDockHost>().Any(
|
||||
host => dockClients.Any(client => client.IsDockingPossible(host.GetDockType, forceEnter)));
|
||||
}
|
||||
|
||||
/// <summary>Can we dock to this <paramref name="host"/>.</summary>
|
||||
public bool CanDockAt(Actor hostActor, IDockHost host, bool forceEnter = false, bool ignoreOccupancy = false)
|
||||
{
|
||||
return !IsTraitDisabled && dockClients.Any(client => client.CanDockAt(hostActor, host, forceEnter, ignoreOccupancy));
|
||||
return !IsTraitDisabled && dockClients.Any(
|
||||
client => client.CanDockAt(hostActor, host, forceEnter, ignoreOccupancy));
|
||||
}
|
||||
|
||||
/// <summary>Can we dock to this <paramref name="target"/>.</summary>
|
||||
public bool CanDockAt(Actor target, bool forceEnter = false, bool ignoreOccupancy = false)
|
||||
{
|
||||
return !IsTraitDisabled && target.TraitsImplementing<IDockHost>().Any(host => dockClients.Any(client => client.CanDockAt(target, host, forceEnter, ignoreOccupancy)));
|
||||
return !IsTraitDisabled && target.TraitsImplementing<IDockHost>().Any(
|
||||
host => dockClients.Any(client => client.CanDockAt(target, host, forceEnter, ignoreOccupancy)));
|
||||
}
|
||||
|
||||
/// <summary>Find the closest viable <see cref="IDockHost"/>.</summary>
|
||||
@@ -268,7 +272,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var clients = type.IsEmpty ? dockClients : AvailableDockClients(type);
|
||||
return self.World.ActorsWithTrait<IDockHost>()
|
||||
.Where(host => host.Trait != ignore && clients.Any(client => client.CanDockAt(host.Actor, host.Trait, forceEnter, ignoreOccupancy)))
|
||||
.Where(host =>
|
||||
host.Trait != ignore &&
|
||||
clients.Any(client => client.CanDockAt(host.Actor, host.Trait, forceEnter, ignoreOccupancy)))
|
||||
.ClosestDock(self, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +133,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
OnDockCompleted(self, dockedClientActor, dockedClient);
|
||||
}
|
||||
|
||||
public virtual bool QueueMoveActivity(Activity moveToDockActivity, Actor self, Actor clientActor, DockClientManager client, MoveCooldownHelper moveCooldownHelper)
|
||||
public virtual bool QueueMoveActivity(
|
||||
Activity moveToDockActivity, Actor self, Actor clientActor, DockClientManager client, MoveCooldownHelper moveCooldownHelper)
|
||||
{
|
||||
var move = clientActor.Trait<IMove>();
|
||||
|
||||
|
||||
@@ -72,7 +72,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
var displayedBounty = GetDisplayedBountyValue(self);
|
||||
if (Info.ShowBounty && self.IsInWorld && displayedBounty != 0 && e.Attacker.Owner.IsAlliedWith(self.World.RenderPlayer))
|
||||
e.Attacker.World.AddFrameEndTask(w => w.Add(new FloatingText(self.CenterPosition, e.Attacker.OwnerColor(), FloatingText.FormatCashTick(displayedBounty), 30)));
|
||||
e.Attacker.World.AddFrameEndTask(
|
||||
w => w.Add(new FloatingText(self.CenterPosition, e.Attacker.OwnerColor(), FloatingText.FormatCashTick(displayedBounty), 30)));
|
||||
|
||||
e.Attacker.Owner.PlayerActor.Trait<PlayerResources>().ChangeCash(GetBountyValue(self));
|
||||
}
|
||||
|
||||
@@ -47,7 +47,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
bool IOccupySpaceInfo.SharesCell => false;
|
||||
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell,
|
||||
SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
{
|
||||
// IPositionable*Info*.CanEnterCell is only ever used for things like exiting production facilities,
|
||||
// all places relevant for husks check IPositionable.CanEnterCell instead, so we can safely set this to true.
|
||||
|
||||
@@ -127,7 +127,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
/// <summary>
|
||||
/// Note: If the target <paramref name="cell"/> has any free subcell, the value of <paramref name="subCell"/> is ignored.
|
||||
/// </summary>
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
public bool CanEnterCell(World world, Actor self, CPos cell,
|
||||
SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
|
||||
{
|
||||
// PERF: Avoid repeated trait queries on the hot path
|
||||
locomotor ??= world.WorldActor.TraitsImplementing<Locomotor>()
|
||||
|
||||
@@ -26,7 +26,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public override object Create(ActorInitializer init) { return new FrozenUnderFog(init, this); }
|
||||
}
|
||||
|
||||
public class FrozenUnderFog : ICreatesFrozenActors, IRenderModifier, IDefaultVisibility, ITickRender, ISync, INotifyCreated, INotifyOwnerChanged, INotifyActorDisposing
|
||||
public class FrozenUnderFog : ICreatesFrozenActors, IRenderModifier, IDefaultVisibility,
|
||||
ITickRender, ISync, INotifyCreated, INotifyOwnerChanged, INotifyActorDisposing
|
||||
{
|
||||
[Sync]
|
||||
public int VisibilityHash;
|
||||
|
||||
@@ -63,7 +63,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
ImmutablePalette pal;
|
||||
|
||||
if (info.PlayerIndex.TryGetValue(playerName, out var remap))
|
||||
pal = new ImmutablePalette(basePalette, new IndexedColorRemap(basePalette, info.RemapIndex.Length == 0 ? Enumerable.Range(0, 256).ToArray() : info.RemapIndex, remap));
|
||||
pal = new ImmutablePalette(
|
||||
basePalette,
|
||||
new IndexedColorRemap(basePalette, info.RemapIndex.Length == 0 ? Enumerable.Range(0, 256).ToArray() : info.RemapIndex, remap));
|
||||
else
|
||||
pal = new ImmutablePalette(basePalette);
|
||||
|
||||
|
||||
@@ -61,7 +61,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public override object Create(ActorInitializer init) { return new Passenger(this); }
|
||||
}
|
||||
|
||||
public class Passenger : IIssueOrder, IResolveOrder, IOrderVoice, INotifyRemovedFromWorld, INotifyEnteredCargo, INotifyExitedCargo, INotifyKilled, IObservesVariables
|
||||
public class Passenger : IIssueOrder, IResolveOrder, IOrderVoice,
|
||||
INotifyRemovedFromWorld, INotifyEnteredCargo, INotifyExitedCargo, INotifyKilled, IObservesVariables
|
||||
{
|
||||
public readonly PassengerInfo Info;
|
||||
public Actor Transport;
|
||||
|
||||
@@ -66,7 +66,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(MapPreview map)
|
||||
{
|
||||
yield return new LobbyBooleanOption(map, "cheats", CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked);
|
||||
yield return new LobbyBooleanOption(map, "cheats",
|
||||
CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked);
|
||||
}
|
||||
|
||||
public override object Create(ActorInitializer init) { return new DeveloperMode(this); }
|
||||
|
||||
@@ -28,7 +28,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Human-readable name this bot uses.")]
|
||||
public readonly string Name = "Unnamed Bot";
|
||||
|
||||
[Desc("Minimum portion of pending orders to issue each tick (e.g. 5 issues at least 1/5th of all pending orders). Excess orders remain queued for subsequent ticks.")]
|
||||
[Desc("Minimum portion of pending orders to issue each tick (e.g. 5 issues at least 1/5th of all pending orders). " +
|
||||
"Excess orders remain queued for subsequent ticks.")]
|
||||
public readonly int MinOrderQuotientPerTick = 5;
|
||||
|
||||
string IBotInfo.Type => Type;
|
||||
|
||||
@@ -66,7 +66,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var startingCash = SelectableCash.ToDictionary(c => c.ToStringInvariant(), c => "$" + c.ToString(NumberFormatInfo.CurrentInfo));
|
||||
|
||||
if (startingCash.Count > 0)
|
||||
yield return new LobbyOption(map, "startingcash", DefaultCashDropdownLabel, DefaultCashDropdownDescription, DefaultCashDropdownVisible, DefaultCashDropdownDisplayOrder,
|
||||
yield return new LobbyOption(map, "startingcash",
|
||||
DefaultCashDropdownLabel, DefaultCashDropdownDescription, DefaultCashDropdownVisible, DefaultCashDropdownDisplayOrder,
|
||||
startingCash, DefaultCash.ToStringInvariant(), DefaultCashDropdownLocked);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var pci = rules.Actors[SystemActors.Player].TraitInfoOrDefault<ProximityCaptorInfo>();
|
||||
if (pci == null)
|
||||
throw new YamlException(nameof(ProximityCapturableBase) + " requires the `" + nameof(Player) + "` actor to have the " + nameof(ProximityCaptor) + " trait.");
|
||||
throw new YamlException(
|
||||
nameof(ProximityCapturableBase) + " requires the `" + nameof(Player) + "` actor to have the " + nameof(ProximityCaptor) + " trait.");
|
||||
}
|
||||
|
||||
public abstract override object Create(ActorInitializer init);
|
||||
|
||||
@@ -182,7 +182,10 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
var palette = wr.Palette(info.Palette);
|
||||
var alpha = shadow.CurrentSequence.GetAlpha(shadow.CurrentFrame);
|
||||
var tintModifiers = shadow.CurrentSequence.IgnoreWorldTint ? TintModifiers.ReplaceColor | TintModifiers.IgnoreWorldTint : TintModifiers.ReplaceColor;
|
||||
return new IRenderable[] { new SpriteRenderable(shadow.Image, pos, info.ShadowOffset, info.ShadowZOffset, palette, 1, shadowAlpha * alpha, shadowColor, tintModifiers, true) };
|
||||
return new IRenderable[]
|
||||
{
|
||||
new SpriteRenderable(shadow.Image, pos, info.ShadowOffset, info.ShadowZOffset, palette, 1, shadowAlpha * alpha, shadowColor, tintModifiers, true)
|
||||
};
|
||||
}
|
||||
|
||||
IEnumerable<Rectangle> IRender.ScreenBounds(Actor self, WorldRenderer wr)
|
||||
|
||||
@@ -18,7 +18,8 @@ using OpenRA.Traits;
|
||||
namespace OpenRA.Mods.Common.Traits.Render
|
||||
{
|
||||
[Desc("Renders a decorative animation on units and buildings. Overlay switching controlled by " + nameof(PauseOnCondition) + ".")]
|
||||
public class WithSwitchableOverlayInfo : PausableConditionalTraitInfo, IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>, Requires<BodyOrientationInfo>
|
||||
public class WithSwitchableOverlayInfo : PausableConditionalTraitInfo,
|
||||
IRenderActorPreviewSpritesInfo, Requires<RenderSpritesInfo>, Requires<BodyOrientationInfo>
|
||||
{
|
||||
[Desc("Image used for this decoration. Defaults to the actor's type.")]
|
||||
public readonly string Image = null;
|
||||
@@ -123,7 +124,11 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
var facing = self.TraitOrDefault<IFacing>();
|
||||
|
||||
var image = info.Image ?? rs.GetImage(self);
|
||||
overlay = new Animation(self.World, image, facing == null ? () => WAngle.Zero : (body == null ? () => facing.Facing : () => body.QuantizeFacing(facing.Facing)), () => false)
|
||||
overlay = new Animation(
|
||||
self.World,
|
||||
image,
|
||||
facing == null ? () => WAngle.Zero : (body == null ? () => facing.Facing : () => body.QuantizeFacing(facing.Facing)),
|
||||
() => false)
|
||||
{
|
||||
IsDecoration = info.IsDecoration
|
||||
};
|
||||
|
||||
@@ -111,7 +111,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
else
|
||||
return;
|
||||
|
||||
self.QueueActivity(order.Queued, new RepairBridge(self, order.Target, info.EnterBehaviour, info.RepairNotification, info.RepairTextNotification, info.TargetLineColor));
|
||||
self.QueueActivity(
|
||||
order.Queued,
|
||||
new RepairBridge(self, order.Target, info.EnterBehaviour, info.RepairNotification, info.RepairTextNotification, info.TargetLineColor));
|
||||
self.ShowTargetLines();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(MapPreview map)
|
||||
{
|
||||
yield return new LobbyBooleanOption(map, "crates", CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked);
|
||||
yield return new LobbyBooleanOption(map, "crates",
|
||||
CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked);
|
||||
}
|
||||
|
||||
public override object Create(ActorInitializer init) { return new CrateSpawner(init.Self, this); }
|
||||
|
||||
@@ -206,7 +206,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return terrainInfos[index].Speed;
|
||||
}
|
||||
|
||||
public short MovementCostToEnterCell(Actor actor, CPos destNode, BlockedByActor check, Actor ignoreActor, bool ignoreSelf = false, SubCell subCell = SubCell.FullCell)
|
||||
public short MovementCostToEnterCell(
|
||||
Actor actor, CPos destNode, BlockedByActor check, Actor ignoreActor, bool ignoreSelf = false, SubCell subCell = SubCell.FullCell)
|
||||
{
|
||||
var cellCost = MovementCostForCell(destNode);
|
||||
|
||||
@@ -217,7 +218,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return cellCost;
|
||||
}
|
||||
|
||||
public short MovementCostToEnterCell(Actor actor, CPos srcNode, CPos destNode, BlockedByActor check, Actor ignoreActor, bool ignoreSelf = false)
|
||||
public short MovementCostToEnterCell(
|
||||
Actor actor, CPos srcNode, CPos destNode, BlockedByActor check, Actor ignoreActor, bool ignoreSelf = false)
|
||||
{
|
||||
var cellCost = MovementCostForCell(destNode, srcNode);
|
||||
|
||||
|
||||
@@ -40,7 +40,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(MapPreview map)
|
||||
{
|
||||
yield return new LobbyBooleanOption(map, "creeps", CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked);
|
||||
yield return new LobbyBooleanOption(map, "creeps",
|
||||
CheckboxLabel, CheckboxDescription, CheckboxVisible, CheckboxDisplayOrder, CheckboxEnabled, CheckboxLocked);
|
||||
}
|
||||
|
||||
public override object Create(ActorInitializer init) { return new MapCreeps(this); }
|
||||
|
||||
@@ -81,14 +81,16 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(MapPreview map)
|
||||
{
|
||||
yield return new LobbyBooleanOption(map, "shortgame", ShortGameCheckboxLabel, ShortGameCheckboxDescription,
|
||||
yield return new LobbyBooleanOption(map, "shortgame",
|
||||
ShortGameCheckboxLabel, ShortGameCheckboxDescription,
|
||||
ShortGameCheckboxVisible, ShortGameCheckboxDisplayOrder, ShortGameCheckboxEnabled, ShortGameCheckboxLocked);
|
||||
|
||||
var techLevels = map.PlayerActorInfo.TraitInfos<ProvidesTechPrerequisiteInfo>()
|
||||
.ToDictionary(t => t.Id, t => map.GetLocalisedString(t.Name));
|
||||
|
||||
if (techLevels.Count > 0)
|
||||
yield return new LobbyOption(map, "techlevel", TechLevelDropdownLabel, TechLevelDropdownDescription, TechLevelDropdownVisible, TechLevelDropdownDisplayOrder,
|
||||
yield return new LobbyOption(map, "techlevel",
|
||||
TechLevelDropdownLabel, TechLevelDropdownDescription, TechLevelDropdownVisible, TechLevelDropdownDisplayOrder,
|
||||
techLevels, TechLevel, TechLevelDropdownLocked);
|
||||
|
||||
var gameSpeeds = Game.ModData.Manifest.Get<GameSpeeds>();
|
||||
|
||||
@@ -95,7 +95,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
case TargetType.Terrain:
|
||||
{
|
||||
world.AddFrameEndTask(w => w.Add(new SpriteAnnotation(target.CenterPosition, world, info.TerrainFlashImage, info.TerrainFlashSequence, info.TerrainFlashPalette)));
|
||||
world.AddFrameEndTask(w => w.Add(new SpriteAnnotation(
|
||||
target.CenterPosition, world, info.TerrainFlashImage, info.TerrainFlashSequence, info.TerrainFlashPalette)));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@ using OpenRA.Traits;
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
[TraitLocation(SystemActors.World)]
|
||||
[Desc("Spawn base actor at the spawnpoint and support units in an annulus around the base actor. Both are defined at MPStartUnits. Attach this to the world actor.")]
|
||||
[Desc("Spawn base actor at the spawnpoint and support units in an annulus around the base actor. " +
|
||||
"Both are defined at MPStartUnits. Attach this to the world actor.")]
|
||||
public class SpawnStartingUnitsInfo : TraitInfo, Requires<StartingUnitsInfo>, NotBefore<LocomotorInfo>, ILobbyOptions
|
||||
{
|
||||
public readonly string StartingUnitsClass = "none";
|
||||
|
||||
@@ -377,7 +377,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Color[] PresetColors { get; }
|
||||
Color RandomPresetColor(MersenneTwister random, IReadOnlyCollection<Color> terrainColors, IReadOnlyCollection<Color> playerColors);
|
||||
Color RandomValidColor(MersenneTwister random, IReadOnlyCollection<Color> terrainColors, IReadOnlyCollection<Color> playerColors);
|
||||
Color MakeValid(Color color, MersenneTwister random, IReadOnlyCollection<Color> terrainColors, IReadOnlyCollection<Color> playerColors, Action<string> onError = null);
|
||||
Color MakeValid(
|
||||
Color color, MersenneTwister random, IReadOnlyCollection<Color> terrainColors, IReadOnlyCollection<Color> playerColors, Action<string> onError = null);
|
||||
void ShowColorDropDown(DropDownButtonWidget dropdownButton, Color initialColor, string initialFaction, WorldRenderer worldRenderer, Action<Color> onExit);
|
||||
}
|
||||
|
||||
@@ -876,7 +877,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public interface IPositionableInfo : IOccupySpaceInfo
|
||||
{
|
||||
bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All);
|
||||
bool CanEnterCell(World world, Actor self, CPos cell,
|
||||
SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All);
|
||||
}
|
||||
|
||||
public interface IPositionable : IOccupySpace
|
||||
@@ -885,7 +887,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
bool IsLeavingCell(CPos location, SubCell subCell = SubCell.Any);
|
||||
bool CanEnterCell(CPos location, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All);
|
||||
SubCell GetValidSubCell(SubCell preferred = SubCell.Any);
|
||||
SubCell GetAvailableSubCell(CPos location, SubCell preferredSubCell = SubCell.Any, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All);
|
||||
SubCell GetAvailableSubCell(CPos location,
|
||||
SubCell preferredSubCell = SubCell.Any, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All);
|
||||
void SetPosition(Actor self, CPos cell, SubCell subCell = SubCell.Any);
|
||||
void SetPosition(Actor self, WPos pos);
|
||||
void SetCenterPosition(Actor self, WPos pos);
|
||||
|
||||
@@ -17,7 +17,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public override string Name => "Adds the old default value for AttackFrontal's FacingTolerance.";
|
||||
|
||||
public override string Description => "The tolerance for the attack angle was defined twice on AttackFrontal. This override has to be defined in the rules now.";
|
||||
public override string Description =>
|
||||
"The tolerance for the attack angle was defined twice on AttackFrontal. " +
|
||||
"This override has to be defined in the rules now.";
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNodeBuilder actorNode)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public override string Name => "HarvesterResourceMultiplier and RefineryResourceMultiplier replaced with ResourceValueMultiplier.";
|
||||
|
||||
public override string Description => "The HarvesterResourceMultiplier trait has been removed, and the RefineryResourceMultiplier trait renamed to ResourceValueMultiplier.";
|
||||
public override string Description =>
|
||||
"The HarvesterResourceMultiplier trait has been removed, " +
|
||||
"and the RefineryResourceMultiplier trait renamed to ResourceValueMultiplier.";
|
||||
|
||||
bool notified;
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNodeBuilder actorNode)
|
||||
|
||||
@@ -17,7 +17,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public override string Name => "Removes PlayerExperience property from Infiltrates.";
|
||||
|
||||
public override string Description => "Infiltrates property PlayerExperience was removed, it was replaced by adding PlayerExperience to all InfiltrateFor* Traits.";
|
||||
public override string Description =>
|
||||
"Infiltrates property PlayerExperience was removed, " +
|
||||
"it was replaced by adding PlayerExperience to all InfiltrateFor* Traits.";
|
||||
|
||||
readonly List<string> locations = new();
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user