Enforce a line length limit.
This commit is contained in:
@@ -577,7 +577,8 @@ namespace OpenRA.Editor
|
||||
|
||||
void AboutToolStripMenuItemClick(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("OpenRA and OpenRA Editor are Free/Libre Open Source Software released under the GNU General Public License version 3. See AUTHORS and COPYING for details.",
|
||||
MessageBox.Show(
|
||||
"OpenRA and OpenRA Editor are Free/Libre Open Source Software released under the GNU General Public License version 3. See AUTHORS and COPYING for details.",
|
||||
"About",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Asterisk);
|
||||
|
||||
@@ -283,7 +283,8 @@ namespace OpenRA.Editor
|
||||
var rawImage = tile[index];
|
||||
for (var x = 0; x < TileSetRenderer.TileSize; x++)
|
||||
for (var y = 0; y < TileSetRenderer.TileSize; y++)
|
||||
p[(j * TileSetRenderer.TileSize + y) * stride + i * TileSetRenderer.TileSize + x] = Palette.GetColor(rawImage[x + TileSetRenderer.TileSize * y]).ToArgb();
|
||||
p[(j * TileSetRenderer.TileSize + y) * stride + i * TileSetRenderer.TileSize + x] =
|
||||
Palette.GetColor(rawImage[x + TileSetRenderer.TileSize * y]).ToArgb();
|
||||
|
||||
if (Map.MapResources.Value[uv].Type != 0)
|
||||
{
|
||||
|
||||
@@ -309,12 +309,16 @@ namespace OpenRA
|
||||
return new HashSet<T>(source);
|
||||
}
|
||||
|
||||
public static Dictionary<TKey, TSource> ToDictionaryWithConflictLog<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, string debugName, Func<TKey, string> logKey, Func<TSource, string> logValue)
|
||||
public static Dictionary<TKey, TSource> ToDictionaryWithConflictLog<TSource, TKey>(
|
||||
this IEnumerable<TSource> source, Func<TSource, TKey> keySelector,
|
||||
string debugName, Func<TKey, string> logKey, Func<TSource, string> logValue)
|
||||
{
|
||||
return ToDictionaryWithConflictLog(source, keySelector, x => x, debugName, logKey, logValue);
|
||||
}
|
||||
|
||||
public static Dictionary<TKey, TElement> ToDictionaryWithConflictLog<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, string debugName, Func<TKey, string> logKey, Func<TElement, string> logValue)
|
||||
public static Dictionary<TKey, TElement> ToDictionaryWithConflictLog<TSource, TKey, TElement>(
|
||||
this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector,
|
||||
string debugName, Func<TKey, string> logKey, Func<TElement, string> logValue)
|
||||
{
|
||||
// Fall back on ToString() if null functions are provided:
|
||||
logKey = logKey ?? (s => s.ToString());
|
||||
@@ -385,7 +389,8 @@ namespace OpenRA
|
||||
{
|
||||
for (var j = 0; j < height; j++)
|
||||
{
|
||||
// Workaround for broken ternary operators in certain versions of mono (3.10 and certain versions of the 3.8 series): https://bugzilla.xamarin.com/show_bug.cgi?id=23319
|
||||
// Workaround for broken ternary operators in certain versions of mono
|
||||
// (3.10 and certain versions of the 3.8 series): https://bugzilla.xamarin.com/show_bug.cgi?id=23319
|
||||
if (i <= ts.GetUpperBound(0) && j <= ts.GetUpperBound(1))
|
||||
result[i, j] = ts[i, j];
|
||||
else
|
||||
|
||||
@@ -38,8 +38,12 @@ namespace OpenRA.FileFormats
|
||||
byte[] cbf;
|
||||
byte[] cbp;
|
||||
byte[] cbfBuffer;
|
||||
byte[] fileBuffer = new byte[256000]; // Buffer for loading file subchunks, the maximum chunk size of a file is not defined
|
||||
int maxCbfzSize = 256000; // and the header definition for the size of the biggest chunks (color data) isn't accurate. But 256k is large enough for all TS videos(< 200k).
|
||||
|
||||
// Buffer for loading file subchunks, the maximum chunk size of a file is not defined
|
||||
// and the header definition for the size of the biggest chunks (color data) isn't accurate.
|
||||
// But 256k is large enough for all TS videos(< 200k).
|
||||
byte[] fileBuffer = new byte[256000];
|
||||
int maxCbfzSize = 256000;
|
||||
int vtprSize = 0;
|
||||
int currentChunkBuffer = 0;
|
||||
int chunkBufferOffset = 0;
|
||||
|
||||
@@ -29,9 +29,15 @@ namespace OpenRA
|
||||
// Used for verifying map availability in the lobby
|
||||
public enum MapRuleStatus { Unknown, Cached, Invalid }
|
||||
|
||||
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter", Justification = "Fields names must match the with the remote API.")]
|
||||
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1304:NonPrivateReadonlyFieldsMustBeginWithUpperCaseLetter", Justification = "Fields names must match the with the remote API.")]
|
||||
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:FieldNamesMustNotContainUnderscore", Justification = "Fields names must match the with the remote API.")]
|
||||
[SuppressMessage("StyleCop.CSharp.NamingRules",
|
||||
"SA1307:AccessibleFieldsMustBeginWithUpperCaseLetter",
|
||||
Justification = "Fields names must match the with the remote API.")]
|
||||
[SuppressMessage("StyleCop.CSharp.NamingRules",
|
||||
"SA1304:NonPrivateReadonlyFieldsMustBeginWithUpperCaseLetter",
|
||||
Justification = "Fields names must match the with the remote API.")]
|
||||
[SuppressMessage("StyleCop.CSharp.NamingRules",
|
||||
"SA1310:FieldNamesMustNotContainUnderscore",
|
||||
Justification = "Fields names must match the with the remote API.")]
|
||||
public class RemoteMapData
|
||||
{
|
||||
public readonly string title;
|
||||
|
||||
@@ -148,7 +148,8 @@ namespace OpenRA
|
||||
|
||||
public class TileSet
|
||||
{
|
||||
static readonly string[] Fields = { "Name", "Id", "SheetSize", "Palette", "PlayerPalette", "Extensions", "WaterPaletteRotationBase", "EditorTemplateOrder", "IgnoreTileSpriteOffsets", "MaximumHeight" };
|
||||
static readonly string[] Fields = { "Name", "Id", "SheetSize", "Palette", "PlayerPalette", "Extensions", "WaterPaletteRotationBase",
|
||||
"EditorTemplateOrder", "IgnoreTileSpriteOffsets", "MaximumHeight" };
|
||||
|
||||
public readonly string Name;
|
||||
public readonly string Id;
|
||||
|
||||
@@ -44,7 +44,8 @@ namespace OpenRA.Network
|
||||
|
||||
if (NatDevice == null || NatDevice.GetType() != typeof(Mono.Nat.Upnp.UpnpNatDevice))
|
||||
{
|
||||
Log.Write("server", "No NAT devices with UPnP enabled found within {0} ms deadline. Disabling automatic port forwarding.".F(Game.Settings.Server.NatDiscoveryTimeout));
|
||||
Log.Write("server",
|
||||
"No NAT devices with UPnP enabled found within {0} ms deadline. Disabling automatic port forwarding.".F(Game.Settings.Server.NatDiscoveryTimeout));
|
||||
Game.Settings.Server.NatDeviceAvailable = false;
|
||||
Game.Settings.Server.AllowPortForward = false;
|
||||
}
|
||||
|
||||
@@ -298,7 +298,8 @@ namespace OpenRA
|
||||
}
|
||||
|
||||
// Returns true if played successfully
|
||||
public static bool PlayPredefined(Ruleset ruleset, Player p, Actor voicedUnit, string type, string definition, string variant, bool relative, WPos pos, float volumeModifier, bool attenuateVolume)
|
||||
public static bool PlayPredefined(Ruleset ruleset, Player p, Actor voicedUnit, string type, string definition, string variant,
|
||||
bool relative, WPos pos, float volumeModifier, bool attenuateVolume)
|
||||
{
|
||||
if (ruleset == null)
|
||||
throw new ArgumentNullException("ruleset");
|
||||
|
||||
@@ -82,8 +82,15 @@ namespace OpenRA.Widgets
|
||||
return ThumbRect.Contains(mi.Location);
|
||||
}
|
||||
|
||||
float ValueFromPx(int x) { return MinimumValue + (MaximumValue - MinimumValue) * (x - 0.5f * RenderBounds.Height) / (RenderBounds.Width - RenderBounds.Height); }
|
||||
protected int PxFromValue(float x) { return (int)(0.5f * RenderBounds.Height + (RenderBounds.Width - RenderBounds.Height) * (x - MinimumValue) / (MaximumValue - MinimumValue)); }
|
||||
float ValueFromPx(int x)
|
||||
{
|
||||
return MinimumValue + (MaximumValue - MinimumValue) * (x - 0.5f * RenderBounds.Height) / (RenderBounds.Width - RenderBounds.Height);
|
||||
}
|
||||
|
||||
protected int PxFromValue(float x)
|
||||
{
|
||||
return (int)(0.5f * RenderBounds.Height + (RenderBounds.Width - RenderBounds.Height) * (x - MinimumValue) / (MaximumValue - MinimumValue));
|
||||
}
|
||||
|
||||
public override Widget Clone() { return new SliderWidget(this); }
|
||||
|
||||
|
||||
@@ -82,7 +82,9 @@ namespace OpenRA.Widgets
|
||||
TextureChannel.Alpha);
|
||||
|
||||
var scale = Math.Min((float)RenderBounds.Width / video.Width, (float)RenderBounds.Height / video.Height * AspectRatio);
|
||||
videoOrigin = new float2(RenderBounds.X + (RenderBounds.Width - scale * video.Width) / 2, RenderBounds.Y + (RenderBounds.Height - scale * video.Height * AspectRatio) / 2);
|
||||
videoOrigin = new float2(
|
||||
RenderBounds.X + (RenderBounds.Width - scale * video.Width) / 2,
|
||||
RenderBounds.Y + (RenderBounds.Height - scale * video.Height * AspectRatio) / 2);
|
||||
|
||||
// Round size to integer pixels. Round up to be consistent with the scale calcuation.
|
||||
videoSize = new float2((int)Math.Ceiling(video.Width * scale), (int)Math.Ceiling(video.Height * AspectRatio * scale));
|
||||
|
||||
@@ -184,7 +184,8 @@ namespace OpenRA.Widgets
|
||||
}
|
||||
else if (o.TargetLocation != CPos.Zero)
|
||||
{
|
||||
world.AddFrameEndTask(w => w.Add(new SpriteEffect(worldRenderer.Position(worldRenderer.Viewport.ViewToWorldPx(mi.Location)), world, "moveflsh", "moveflash")));
|
||||
world.AddFrameEndTask(w => w.Add(
|
||||
new SpriteEffect(worldRenderer.Position(worldRenderer.Viewport.ViewToWorldPx(mi.Location)), world, "moveflsh", "moveflash")));
|
||||
flashed = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,7 +205,8 @@ namespace OpenRA.Mods.Common.AI
|
||||
if (playerPower.ExcessPower < 0 || playerPower.ExcessPower < pis.Sum(pi => pi.Amount))
|
||||
{
|
||||
// Try building a power plant instead
|
||||
var power = GetProducibleBuilding("Power", buildableThings, a => a.Traits.WithInterface<PowerInfo>().Where(i => i.UpgradeMinEnabledLevel < 1).Sum(pi => pi.Amount));
|
||||
var power = GetProducibleBuilding("Power",
|
||||
buildableThings, a => a.Traits.WithInterface<PowerInfo>().Where(i => i.UpgradeMinEnabledLevel < 1).Sum(pi => pi.Amount));
|
||||
if (power != null && power.Traits.WithInterface<PowerInfo>().Where(i => i.UpgradeMinEnabledLevel < 1).Sum(pi => pi.Amount) > 0)
|
||||
{
|
||||
// TODO: Handle the case when of when we actually do need a power plant because we don't have enough but are also suffering from a power outage
|
||||
@@ -220,7 +221,8 @@ namespace OpenRA.Mods.Common.AI
|
||||
}
|
||||
|
||||
// Lets build this
|
||||
HackyAI.BotDebug("{0} decided to build {1}: Desired is {2} ({3} / {4}); current is {5} / {4}", queue.Actor.Owner, name, frac.Value, frac.Value * playerBuildings.Length, playerBuildings.Length, count);
|
||||
HackyAI.BotDebug("{0} decided to build {1}: Desired is {2} ({3} / {4}); current is {5} / {4}",
|
||||
queue.Actor.Owner, name, frac.Value, frac.Value * playerBuildings.Length, playerBuildings.Length, count);
|
||||
return actor;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
protected virtual void Unreserve(Actor self, bool abort) { }
|
||||
protected virtual void OnInside(Actor self) { }
|
||||
|
||||
protected bool TryGetAlternateTargetInCircle(Actor self, WRange radius, Action<Target> update, Func<Actor, bool> primaryFilter, Func<Actor, bool>[] preferenceFilters = null)
|
||||
protected bool TryGetAlternateTargetInCircle(
|
||||
Actor self, WRange radius, Action<Target> update, Func<Actor, bool> primaryFilter, Func<Actor, bool>[] preferenceFilters = null)
|
||||
{
|
||||
var radiusSquared = radius.Range * radius.Range;
|
||||
var diff = new WVec(radius, radius, WRange.Zero);
|
||||
|
||||
@@ -181,10 +181,14 @@ namespace OpenRA.Mods.Common.Activities
|
||||
else
|
||||
{
|
||||
mobile.SetLocation(mobile.FromCell, mobile.FromSubCell, nextCell.Value.First, nextCell.Value.Second);
|
||||
var from = self.World.Map.CenterOfSubCell(mobile.FromCell, mobile.FromSubCell);
|
||||
var to = Util.BetweenCells(self.World, mobile.FromCell, mobile.ToCell) +
|
||||
(self.World.Map.OffsetOfSubCell(mobile.FromSubCell) +
|
||||
self.World.Map.OffsetOfSubCell(mobile.ToSubCell)) / 2;
|
||||
var move = new MoveFirstHalf(
|
||||
this,
|
||||
self.World.Map.CenterOfSubCell(mobile.FromCell, mobile.FromSubCell),
|
||||
Util.BetweenCells(self.World, mobile.FromCell, mobile.ToCell) + (self.World.Map.OffsetOfSubCell(mobile.FromSubCell) + self.World.Map.OffsetOfSubCell(mobile.ToSubCell)) / 2,
|
||||
from,
|
||||
to,
|
||||
mobile.Facing,
|
||||
mobile.Facing,
|
||||
0);
|
||||
|
||||
@@ -28,7 +28,8 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
readonly WVec offset;
|
||||
readonly int zOffset;
|
||||
|
||||
public VoxelPreview(VoxelAnimation[] components, WVec offset, int zOffset, float scale, WAngle lightPitch, WAngle lightYaw, float[] lightAmbientColor, float[] lightDiffuseColor, WAngle cameraPitch,
|
||||
public VoxelPreview(VoxelAnimation[] components, WVec offset, int zOffset, float scale, WAngle lightPitch, WAngle lightYaw,
|
||||
float[] lightAmbientColor, float[] lightDiffuseColor, WAngle cameraPitch,
|
||||
PaletteReference colorPalette, PaletteReference normalsPalette, PaletteReference shadowPalette)
|
||||
{
|
||||
this.components = components;
|
||||
|
||||
@@ -120,7 +120,8 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
|
||||
Action onLoadComplete;
|
||||
Action onCompleteRadar;
|
||||
[Desc("Play a VQA video in the radar window. File name has to include the file extension. Returns true on success, if the movie wasn't found the function returns false and the callback is executed.")]
|
||||
[Desc("Play a VQA video in the radar window. File name has to include the file extension. " +
|
||||
"Returns true on success, if the movie wasn't found the function returns false and the callback is executed.")]
|
||||
public bool PlayMovieInRadar(string movie, LuaFunction playComplete = null)
|
||||
{
|
||||
if (playComplete != null)
|
||||
|
||||
@@ -30,7 +30,8 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
public object Create(ActorInitializer init) { return new ScriptTriggers(init.World); }
|
||||
}
|
||||
|
||||
public sealed class ScriptTriggers : INotifyIdle, INotifyDamage, INotifyKilled, INotifyProduction, INotifyOtherProduction, INotifyObjectivesUpdated, INotifyCapture, INotifyInfiltrated, INotifyAddedToWorld, INotifyRemovedFromWorld, IDisposable
|
||||
public sealed class ScriptTriggers : INotifyIdle, INotifyDamage, INotifyKilled, INotifyProduction, INotifyOtherProduction,
|
||||
INotifyObjectivesUpdated, INotifyCapture, INotifyInfiltrated, INotifyAddedToWorld, INotifyRemovedFromWorld, IDisposable
|
||||
{
|
||||
readonly World world;
|
||||
|
||||
|
||||
@@ -203,7 +203,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public bool IsLeavingCell(CPos location, SubCell subCell = SubCell.Any) { return false; } // TODO: Handle landing
|
||||
public SubCell GetValidSubCell(SubCell preferred) { return SubCell.Invalid; }
|
||||
public SubCell GetAvailableSubCell(CPos a, SubCell preferredSubCell = SubCell.Any, Actor ignoreActor = null, bool checkTransientActors = true) { return SubCell.Invalid; } // Does not use any subcell
|
||||
public SubCell GetAvailableSubCell(CPos a, SubCell preferredSubCell = SubCell.Any, Actor ignoreActor = null, bool checkTransientActors = true)
|
||||
{
|
||||
// Does not use any subcell
|
||||
return SubCell.Invalid;
|
||||
}
|
||||
|
||||
public bool CanEnterCell(CPos cell, Actor ignoreActor = null, bool checkTransientActors = true) { return true; }
|
||||
|
||||
public bool CanEnterTargetNow(Actor self, Target target)
|
||||
|
||||
@@ -129,12 +129,20 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public Activity MoveTo(CPos cell, int nearEnough) { return Util.SequenceActivities(new Fly(self, Target.FromCell(self.World, cell)), new FlyCircle()); }
|
||||
public Activity MoveTo(CPos cell, Actor ignoredActor) { return Util.SequenceActivities(new Fly(self, Target.FromCell(self.World, cell)), new FlyCircle()); }
|
||||
public Activity MoveWithinRange(Target target, WRange range) { return Util.SequenceActivities(new Fly(self, target, WRange.Zero, range), new FlyCircle()); }
|
||||
public Activity MoveWithinRange(Target target, WRange minRange, WRange maxRange) { return Util.SequenceActivities(new Fly(self, target, minRange, maxRange), new FlyCircle()); }
|
||||
public Activity MoveWithinRange(Target target, WRange minRange, WRange maxRange)
|
||||
{
|
||||
return Util.SequenceActivities(new Fly(self, target, minRange, maxRange), new FlyCircle());
|
||||
}
|
||||
|
||||
public Activity MoveFollow(Actor self, Target target, WRange minRange, WRange maxRange) { return new FlyFollow(self, target, minRange, maxRange); }
|
||||
public CPos NearestMoveableCell(CPos cell) { return cell; }
|
||||
|
||||
public Activity MoveIntoWorld(Actor self, CPos cell, SubCell subCell = SubCell.Any) { return new Fly(self, Target.FromCell(self.World, cell)); }
|
||||
public Activity VisualMove(Actor self, WPos fromPos, WPos toPos) { return Util.SequenceActivities(new CallFunc(() => SetVisualPosition(self, fromPos)), new Fly(self, Target.FromPos(toPos))); }
|
||||
public Activity VisualMove(Actor self, WPos fromPos, WPos toPos)
|
||||
{
|
||||
return Util.SequenceActivities(new CallFunc(() => SetVisualPosition(self, fromPos)), new Fly(self, Target.FromPos(toPos)));
|
||||
}
|
||||
|
||||
public Activity MoveToTarget(Actor self, Target target) { return new Fly(self, target, WRange.FromCells(3), WRange.FromCells(5)); }
|
||||
public Activity MoveIntoTarget(Actor self, Target target) { return new Land(target); }
|
||||
}
|
||||
|
||||
@@ -258,7 +258,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return true;
|
||||
}
|
||||
|
||||
public SubCell GetAvailableSubCell(World world, Actor self, CPos cell, SubCell preferredSubCell = SubCell.Any, Actor ignoreActor = null, CellConditions check = CellConditions.All)
|
||||
public SubCell GetAvailableSubCell(
|
||||
World world, Actor self, CPos cell, SubCell preferredSubCell = SubCell.Any, Actor ignoreActor = null, CellConditions check = CellConditions.All)
|
||||
{
|
||||
if (MovementCostForCell(world, cell) == int.MaxValue)
|
||||
return SubCell.Invalid;
|
||||
|
||||
@@ -134,7 +134,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
bool IsHidden(Cache<string, List<Actor>> ownedPrerequisites)
|
||||
{
|
||||
return prerequisites.Any(prereq => prereq.StartsWith("~") && (prereq.Replace("~", "").StartsWith("!") ^ !ownedPrerequisites.ContainsKey(prereq.Replace("~", "").Replace("!", ""))));
|
||||
return prerequisites.Any(prereq => prereq.StartsWith("~") &&
|
||||
(prereq.Replace("~", "").StartsWith("!") ^ !ownedPrerequisites.ContainsKey(prereq.Replace("~", "").Replace("!", ""))));
|
||||
}
|
||||
|
||||
public void Update(Cache<string, List<Actor>> ownedPrerequisites)
|
||||
|
||||
@@ -18,7 +18,10 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
public interface IRenderActorPreviewSpritesInfo { IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p); }
|
||||
public interface IRenderActorPreviewSpritesInfo
|
||||
{
|
||||
IEnumerable<IActorPreview> RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p);
|
||||
}
|
||||
|
||||
public class RenderSpritesInfo : IRenderActorPreviewInfo, ITraitInfo
|
||||
{
|
||||
@@ -60,7 +63,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var facings = 0;
|
||||
var body = init.Actor.Traits.GetOrDefault<BodyOrientationInfo>();
|
||||
if (body != null)
|
||||
facings = body.QuantizedFacings == -1 ? init.Actor.Traits.Get<IQuantizeBodyOrientationInfo>().QuantizedBodyFacings(init.Actor, sequenceProvider, init.Owner.Country.Race) : body.QuantizedFacings;
|
||||
facings = body.QuantizedFacings == -1 ?
|
||||
init.Actor.Traits.Get<IQuantizeBodyOrientationInfo>().QuantizedBodyFacings(init.Actor, sequenceProvider, init.Owner.Country.Race) :
|
||||
body.QuantizedFacings;
|
||||
|
||||
foreach (var spi in init.Actor.Traits.WithInterface<IRenderActorPreviewSpritesInfo>())
|
||||
foreach (var preview in spi.RenderPreviewSprites(init, this, image, facings, palette))
|
||||
|
||||
@@ -42,7 +42,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
var cp = self.CenterPosition;
|
||||
|
||||
if (info.DeathTypes.Contains(e.Warhead.DeathType) || (!info.DeathTypes.Any() && !self.Info.Traits.WithInterface<DeathSoundsInfo>().Any(dsi => dsi.DeathTypes.Contains(e.Warhead.DeathType))))
|
||||
if (info.DeathTypes.Contains(e.Warhead.DeathType) ||
|
||||
(!info.DeathTypes.Any() && !self.Info.Traits.WithInterface<DeathSoundsInfo>().Any(dsi => dsi.DeathTypes.Contains(e.Warhead.DeathType))))
|
||||
Sound.PlayVoiceLocal(info.DeathSound, self, self.Owner.Country.Race, cp, info.VolumeMultiplier);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,8 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
"These scripts run in a sandbox that prevents access to unsafe functions (e.g. OS or file access), " +
|
||||
"and limits the memory and CPU usage of the scripts.");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("You can access this interface by adding the [LuaScript](Traits#luascript) trait to the world actor in your map rules (note, you must replace the spaces in the snippet below with a single tab for each level of indentation):");
|
||||
Console.WriteLine("You can access this interface by adding the [LuaScript](Traits#luascript) trait to the world actor in your map rules " +
|
||||
"(note, you must replace the spaces in the snippet below with a single tab for each level of indentation):");
|
||||
Console.WriteLine("```\nRules:\n\tWorld:\n\t\tLuaScript:\n\t\t\tScripts: myscript.lua\n```");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Map scripts can interact with the game engine in three ways:\n" +
|
||||
|
||||
@@ -793,8 +793,11 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
// Split out the warheads to individual warhead types.
|
||||
if (depth == 0)
|
||||
{
|
||||
var validTargets = node.Value.Nodes.FirstOrDefault(n => n.Key == "ValidTargets"); // Weapon's ValidTargets need to be copied to the warheads, so find it
|
||||
var invalidTargets = node.Value.Nodes.FirstOrDefault(n => n.Key == "InvalidTargets"); // Weapon's InvalidTargets need to be copied to the warheads, so find it
|
||||
// Weapon's ValidTargets need to be copied to the warheads, so find it
|
||||
var validTargets = node.Value.Nodes.FirstOrDefault(n => n.Key == "ValidTargets");
|
||||
|
||||
// Weapon's InvalidTargets need to be copied to the warheads, so find it
|
||||
var invalidTargets = node.Value.Nodes.FirstOrDefault(n => n.Key == "InvalidTargets");
|
||||
|
||||
var warheadCounter = 0;
|
||||
foreach (var curNode in node.Value.Nodes.ToArray())
|
||||
@@ -970,7 +973,8 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
|
||||
var newYaml = new List<MiniYamlNode>();
|
||||
|
||||
var keywords = new List<string> { "Explosion", "ImpactSound", "Delay", "ValidTargets", "InvalidTargets", "ValidImpactTypes", "InvalidImpactTypes" };
|
||||
var keywords = new List<string> { "Explosion", "ImpactSound", "Delay",
|
||||
"ValidTargets", "InvalidTargets", "ValidImpactTypes", "InvalidImpactTypes" };
|
||||
|
||||
foreach (var keyword in keywords)
|
||||
{
|
||||
@@ -991,7 +995,8 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
|
||||
var newYaml = new List<MiniYamlNode>();
|
||||
|
||||
var keywords = new List<string> { "WaterExplosion", "WaterImpactSound", "Delay", "ValidTargets", "InvalidTargets", "ValidImpactTypes", "InvalidImpactTypes" };
|
||||
var keywords = new List<string> { "WaterExplosion", "WaterImpactSound", "Delay",
|
||||
"ValidTargets", "InvalidTargets", "ValidImpactTypes", "InvalidImpactTypes" };
|
||||
|
||||
foreach (var keyword in keywords)
|
||||
{
|
||||
|
||||
@@ -114,7 +114,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
var frameContainer = panel.GetOrNull("FRAME_SELECTOR");
|
||||
if (frameContainer != null)
|
||||
frameContainer.IsVisible = () => (currentSprites != null && currentSprites.Length > 1) || (isVideoLoaded && player != null && player.Video != null && player.Video.Frames > 1);
|
||||
frameContainer.IsVisible = () => (currentSprites != null && currentSprites.Length > 1) ||
|
||||
(isVideoLoaded && player != null && player.Video != null && player.Video.Frames > 1);
|
||||
|
||||
frameSlider = panel.Get<SliderWidget>("FRAME_SLIDER");
|
||||
if (frameSlider != null)
|
||||
|
||||
@@ -26,7 +26,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
powerIcon.GetImageName = () => powerManager.ExcessPower < 0 ? "power-critical" : "power-normal";
|
||||
power.GetColor = () => powerManager.ExcessPower < 0 ? Color.Red : Color.White;
|
||||
power.GetText = () => powerManager.PowerProvided == 1000000 ? "inf" : powerManager.ExcessPower.ToString();
|
||||
power.GetTooltipText = () => "Power Usage: " + powerManager.PowerDrained.ToString() + (powerManager.PowerProvided != 1000000 ? "/" + powerManager.PowerProvided.ToString() : "");
|
||||
power.GetTooltipText = () => "Power Usage: " + powerManager.PowerDrained.ToString() +
|
||||
(powerManager.PowerProvided != 1000000 ? "/" + powerManager.PowerProvided.ToString() : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
tooltipContainer.BeforeRender = () =>
|
||||
{
|
||||
var latencyPrefixSize = latencyPrefix.Bounds.X + latencyPrefixFont.Measure(latencyPrefix.GetText() + " ").X;
|
||||
var width = Math.Max(locationFont.Measure(location.GetText()).X, Math.Max(adminFont.Measure(admin.GetText()).X, Math.Max(addressFont.Measure(ip.GetText()).X, latencyPrefixSize + latencyFont.Measure(latency.GetText()).X)));
|
||||
var locationWidth = locationFont.Measure(location.GetText()).X;
|
||||
var adminWidth = adminFont.Measure(admin.GetText()).X;
|
||||
var addressWidth = addressFont.Measure(ip.GetText()).X;
|
||||
var latencyWidth = latencyPrefixSize + latencyFont.Measure(latency.GetText()).X;
|
||||
var width = Math.Max(locationWidth, Math.Max(adminWidth, Math.Max(addressWidth, latencyWidth)));
|
||||
widget.Bounds.Width = width + 2 * margin;
|
||||
latency.Bounds.Width = widget.Bounds.Width;
|
||||
ip.Bounds.Width = widget.Bounds.Width;
|
||||
|
||||
@@ -408,8 +408,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
return selectedClass != null ? selectedClass : c;
|
||||
};
|
||||
|
||||
startingUnits.IsDisabled = () => Map.Status != MapStatus.Available || !Map.Map.Options.ConfigurableStartingUnits || configurationDisabled();
|
||||
startingUnits.GetText = () => Map.Status != MapStatus.Available || !Map.Map.Options.ConfigurableStartingUnits ? "Not Available" : className(orderManager.LobbyInfo.GlobalSettings.StartingUnitsClass);
|
||||
startingUnits.IsDisabled = () => Map.Status != MapStatus.Available ||
|
||||
!Map.Map.Options.ConfigurableStartingUnits || configurationDisabled();
|
||||
startingUnits.GetText = () => Map.Status != MapStatus.Available ||
|
||||
!Map.Map.Options.ConfigurableStartingUnits ? "Not Available" : className(orderManager.LobbyInfo.GlobalSettings.StartingUnitsClass);
|
||||
startingUnits.OnMouseDown = _ =>
|
||||
{
|
||||
var options = classes.Select(c => new DropDownOption
|
||||
@@ -435,8 +437,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var startingCash = optionsBin.GetOrNull<DropDownButtonWidget>("STARTINGCASH_DROPDOWNBUTTON");
|
||||
if (startingCash != null)
|
||||
{
|
||||
startingCash.IsDisabled = () => Map.Status != MapStatus.Available || Map.Map.Options.StartingCash.HasValue || configurationDisabled();
|
||||
startingCash.GetText = () => Map.Status != MapStatus.Available || Map.Map.Options.StartingCash.HasValue ? "Not Available" : "${0}".F(orderManager.LobbyInfo.GlobalSettings.StartingCash);
|
||||
startingCash.IsDisabled = () => Map.Status != MapStatus.Available ||
|
||||
Map.Map.Options.StartingCash.HasValue || configurationDisabled();
|
||||
startingCash.GetText = () => Map.Status != MapStatus.Available ||
|
||||
Map.Map.Options.StartingCash.HasValue ? "Not Available" : "${0}".F(orderManager.LobbyInfo.GlobalSettings.StartingCash);
|
||||
startingCash.OnMouseDown = _ =>
|
||||
{
|
||||
var options = modRules.Actors["player"].Traits.Get<PlayerResourcesInfo>().SelectableCash.Select(c => new DropDownOption
|
||||
@@ -463,8 +467,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var techTraits = modRules.Actors["player"].Traits.WithInterface<ProvidesTechPrerequisiteInfo>().ToList();
|
||||
techLevel.IsVisible = () => techTraits.Count > 0;
|
||||
optionsBin.GetOrNull<LabelWidget>("TECHLEVEL_DESC").IsVisible = () => techTraits.Count > 0;
|
||||
techLevel.IsDisabled = () => Map.Status != MapStatus.Available || Map.Map.Options.TechLevel != null || configurationDisabled() || techTraits.Count <= 1;
|
||||
techLevel.GetText = () => Map.Status != MapStatus.Available || Map.Map.Options.TechLevel != null ? "Not Available" : "{0}".F(orderManager.LobbyInfo.GlobalSettings.TechLevel);
|
||||
techLevel.IsDisabled = () => Map.Status != MapStatus.Available ||
|
||||
Map.Map.Options.TechLevel != null || configurationDisabled() || techTraits.Count <= 1;
|
||||
techLevel.GetText = () => Map.Status != MapStatus.Available ||
|
||||
Map.Map.Options.TechLevel != null ? "Not Available" : "{0}".F(orderManager.LobbyInfo.GlobalSettings.TechLevel);
|
||||
techLevel.OnMouseDown = _ =>
|
||||
{
|
||||
var options = techTraits.Select(c => new DropDownOption
|
||||
|
||||
@@ -90,7 +90,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var progress = widget.GetOrNull("MAP_PROGRESS");
|
||||
if (progress != null)
|
||||
{
|
||||
progress.IsVisible = () => (lobby.Map.Status != MapStatus.Available || lobby.Map.RuleStatus == MapRuleStatus.Unknown) && lobby.Map.Status != MapStatus.DownloadAvailable;
|
||||
progress.IsVisible = () =>
|
||||
(lobby.Map.Status != MapStatus.Available || lobby.Map.RuleStatus == MapRuleStatus.Unknown) &&
|
||||
lobby.Map.Status != MapStatus.DownloadAvailable;
|
||||
|
||||
var preview = progress.Get<MapPreviewWidget>("MAP_PREVIEW");
|
||||
preview.Preview = () => lobby.Map;
|
||||
|
||||
@@ -114,7 +114,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var maps = Game.ModData.MapCache
|
||||
.Where(m => m.Status == MapStatus.Available && (m.Map.Visibility & filter) != 0)
|
||||
.Where(m => gameMode == null || m.Type == gameMode)
|
||||
.Where(m => mapFilter == null || m.Title.IndexOf(mapFilter, StringComparison.OrdinalIgnoreCase) >= 0 || m.Author.IndexOf(mapFilter, StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
.Where(m => mapFilter == null ||
|
||||
m.Title.IndexOf(mapFilter, StringComparison.OrdinalIgnoreCase) >= 0 ||
|
||||
m.Author.IndexOf(mapFilter, StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
.OrderBy(m => m.PlayerCount)
|
||||
.ThenBy(m => m.Title);
|
||||
|
||||
@@ -126,7 +128,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
// Access the minimap to trigger async generation of the minimap.
|
||||
preview.GetMinimap();
|
||||
|
||||
var item = ScrollItemWidget.Setup(preview.Uid, itemTemplate, () => selectedUid == preview.Uid, () => selectedUid = preview.Uid, () => { Ui.CloseWindow(); onSelect(preview.Uid); });
|
||||
var item = ScrollItemWidget.Setup(preview.Uid, itemTemplate, () => selectedUid == preview.Uid,
|
||||
() => selectedUid = preview.Uid, () => { Ui.CloseWindow(); onSelect(preview.Uid); });
|
||||
item.IsVisible = () => item.RenderBounds.IntersectsWith(scrollpanel.RenderBounds);
|
||||
|
||||
var titleLabel = item.Get<LabelWidget>("TITLE");
|
||||
|
||||
@@ -299,7 +299,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{
|
||||
ddb.IsDisabled = () => string.IsNullOrEmpty(filter.PlayerName);
|
||||
|
||||
var options = replays.SelectMany(r => r.GameInfo.Players.Select(p => p.FactionName).Where(n => !string.IsNullOrEmpty(n))).Distinct(StringComparer.OrdinalIgnoreCase).ToList();
|
||||
var options = replays
|
||||
.SelectMany(r => r.GameInfo.Players.Select(p => p.FactionName).Where(n => !string.IsNullOrEmpty(n)))
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase).ToList();
|
||||
options.Sort(StringComparer.OrdinalIgnoreCase);
|
||||
options.Insert(0, null); // no filter
|
||||
|
||||
|
||||
@@ -17,7 +17,11 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.TS.Traits
|
||||
{
|
||||
public interface IRenderActorPreviewVoxelsInfo { IEnumerable<VoxelAnimation> RenderPreviewVoxels(ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, WRot orientation, int facings, PaletteReference p); }
|
||||
public interface IRenderActorPreviewVoxelsInfo
|
||||
{
|
||||
IEnumerable<VoxelAnimation> RenderPreviewVoxels(
|
||||
ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, WRot orientation, int facings, PaletteReference p);
|
||||
}
|
||||
|
||||
public class RenderVoxelsInfo : ITraitInfo, IRenderActorPreviewInfo, Requires<IBodyOrientationInfo>
|
||||
{
|
||||
@@ -46,7 +50,9 @@ namespace OpenRA.Mods.TS.Traits
|
||||
var body = init.Actor.Traits.Get<BodyOrientationInfo>();
|
||||
var sequenceProvider = init.World.Map.SequenceProvider;
|
||||
var image = Image ?? init.Actor.Name;
|
||||
var facings = body.QuantizedFacings == -1 ? init.Actor.Traits.Get<IQuantizeBodyOrientationInfo>().QuantizedBodyFacings(init.Actor, sequenceProvider, init.Owner.Country.Race) : body.QuantizedFacings;
|
||||
var facings = body.QuantizedFacings == -1 ?
|
||||
init.Actor.Traits.Get<IQuantizeBodyOrientationInfo>().QuantizedBodyFacings(init.Actor, sequenceProvider, init.Owner.Country.Race) :
|
||||
body.QuantizedFacings;
|
||||
var palette = init.WorldRenderer.Palette(Palette ?? PlayerPalette + init.Owner.InternalName);
|
||||
|
||||
var ifacing = init.Actor.Traits.GetOrDefault<IFacingInfo>();
|
||||
|
||||
@@ -394,8 +394,15 @@
|
||||
<BooleanProperty Name="Enabled">False</BooleanProperty>
|
||||
</RuleSettings>
|
||||
</Rule>
|
||||
<Rule Name="CodeLineMustNotBeLongerThan">
|
||||
<RuleSettings>
|
||||
<BooleanProperty Name="Enabled">True</BooleanProperty>
|
||||
</RuleSettings>
|
||||
</Rule>
|
||||
</Rules>
|
||||
<AnalyzerSettings />
|
||||
<AnalyzerSettings>
|
||||
<StringProperty Name="SP2100_Limit">180:4</StringProperty>
|
||||
</AnalyzerSettings>
|
||||
</Analyzer>
|
||||
</Analyzers>
|
||||
</StyleCopSettings>
|
||||
Reference in New Issue
Block a user