Fix a collection of whitespace-style issues in Mods.Common.
This commit is contained in:
@@ -16,7 +16,6 @@ using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
|
||||
namespace OpenRA.Mods.Common.Effects
|
||||
{
|
||||
[Desc("Not a sprite, but an engine effect.")]
|
||||
|
||||
@@ -59,7 +59,6 @@ namespace OpenRA.Mods.Common.Effects
|
||||
ticks = turn;
|
||||
}
|
||||
|
||||
|
||||
public void Tick(World world)
|
||||
{
|
||||
anim.Tick();
|
||||
|
||||
@@ -33,4 +33,3 @@ namespace OpenRA.Mods.Common.LoadScreens
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
{
|
||||
world = context.World;
|
||||
}
|
||||
|
||||
[Desc("Play an announcer voice listed in notifications.yaml")]
|
||||
public void PlaySpeechNotification(Player player, string notification)
|
||||
{
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
|
||||
// Mute world sounds
|
||||
var oldModifier = Sound.SoundVolumeModifier;
|
||||
|
||||
// TODO: this also modifies vqa audio
|
||||
// Sound.SoundVolumeModifier = 0f;
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Eluant;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using PowerTrait = OpenRA.Mods.Common.Traits.Power;
|
||||
using OpenRA.Scripting;
|
||||
using OpenRA.Traits;
|
||||
using PowerTrait = OpenRA.Mods.Common.Traits.Power;
|
||||
|
||||
namespace OpenRA.Mods.Common.Scripting
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ using OpenRA.Traits;
|
||||
namespace OpenRA.Mods.Common.Scripting
|
||||
{
|
||||
public enum Trigger { OnIdle, OnDamaged, OnKilled, OnProduction, OnOtherProduction, OnPlayerWon, OnPlayerLost,
|
||||
OnObjectiveAdded, OnObjectiveCompleted, OnObjectiveFailed, OnCapture, OnInfiltrated, OnAddedToWorld, OnRemovedFromWorld };
|
||||
OnObjectiveAdded, OnObjectiveCompleted, OnObjectiveFailed, OnCapture, OnInfiltrated, OnAddedToWorld, OnRemovedFromWorld }
|
||||
|
||||
[Desc("Allows map scripts to attach triggers to this actor via the Triggers global.")]
|
||||
public class ScriptTriggersInfo : ITraitInfo
|
||||
|
||||
@@ -33,4 +33,3 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -140,6 +140,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public void Update(Cache<string, List<Actor>> ownedPrerequisites)
|
||||
{
|
||||
var hasReachedLimit = limit > 0 && ownedPrerequisites.ContainsKey(Key) && ownedPrerequisites[Key].Count >= limit;
|
||||
|
||||
// The '!' annotation inverts prerequisites: "I'm buildable if this prerequisite *isn't* met"
|
||||
var nowHasPrerequisites = HasPrerequisites(ownedPrerequisites) && !hasReachedLimit;
|
||||
var nowHidden = IsHidden(ownedPrerequisites);
|
||||
|
||||
@@ -13,8 +13,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Graphics;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
@@ -49,7 +49,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
foreach (var preview in spi.RenderPreviewSprites(init, this, image, facings, palette))
|
||||
yield return preview;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class RenderSprites : IRender, ITick, INotifyOwnerChanged, INotifyEffectiveOwnerChanged
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public void Killed(Actor self, AttackInfo e)
|
||||
{
|
||||
var player = (info.NotifyAll) ? self.World.LocalPlayer : self.Owner;
|
||||
var player = info.NotifyAll ? self.World.LocalPlayer : self.Owner;
|
||||
Sound.PlayNotification(self.World.Map.Rules, player, "Speech", info.Notification, self.Owner.Country.Race);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public void AppliedDamage(Actor self, Actor damaged, AttackInfo e)
|
||||
{
|
||||
if (e.DamageState == DamageState.Dead && damaged != e.Attacker) // don't notify suicides
|
||||
// Don't notify suicides
|
||||
if (e.DamageState == DamageState.Dead && damaged != e.Attacker)
|
||||
{
|
||||
if (self.World.WorldTick - lastAnnounce > info.Interval * 25)
|
||||
Sound.PlayVoice("Kill", self, self.Owner.Country.Race);
|
||||
|
||||
@@ -23,19 +23,19 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public class LoadWidgetAtGameStart : IWorldLoaded
|
||||
{
|
||||
readonly LoadWidgetAtGameStartInfo Info;
|
||||
public LoadWidgetAtGameStart(LoadWidgetAtGameStartInfo Info)
|
||||
readonly LoadWidgetAtGameStartInfo info;
|
||||
public LoadWidgetAtGameStart(LoadWidgetAtGameStartInfo info)
|
||||
{
|
||||
this.Info = Info;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public void WorldLoaded(World world, WorldRenderer wr)
|
||||
{
|
||||
// Clear any existing widget state
|
||||
if (Info.ClearRoot)
|
||||
if (info.ClearRoot)
|
||||
Ui.ResetAll();
|
||||
|
||||
Game.LoadWidget(world, Info.Widget, Ui.Root, new WidgetArgs());
|
||||
Game.LoadWidget(world, info.Widget, Ui.Root, new WidgetArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,4 +86,3 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,4 +48,3 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
wr.AddPalette(info.Name, new ImmutablePalette(Enumerable.Range(0, Palette.Size).Select(i => (uint)c[i % 8].ToArgb())));
|
||||
}
|
||||
|
||||
static Color[] Fog = new[] {
|
||||
static Color[] Fog = new[]
|
||||
{
|
||||
Color.Transparent, Color.Green,
|
||||
Color.Blue, Color.Yellow,
|
||||
Color.FromArgb(128, 0, 0, 0),
|
||||
@@ -48,7 +49,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Color.FromArgb(32, 0, 0, 0)
|
||||
};
|
||||
|
||||
static Color[] Shroud = new[] {
|
||||
static Color[] Shroud = new[]
|
||||
{
|
||||
Color.Transparent, Color.Green,
|
||||
Color.Blue, Color.Yellow,
|
||||
Color.Black,
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
|
||||
@@ -64,6 +64,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
var desc = m.HasAttribute<DescAttribute>() ? m.GetCustomAttributes<DescAttribute>(true).First().Lines.JoinWith("\n") : "";
|
||||
Console.WriteLine("<tr><td align=\"right\" width=\"50%\"><strong>{0}</strong></td><td>{1}</td></tr>".F(m.LuaDocString(), desc));
|
||||
}
|
||||
|
||||
Console.WriteLine("</table>");
|
||||
}
|
||||
|
||||
@@ -108,6 +109,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
|
||||
Console.WriteLine("</td></tr>");
|
||||
}
|
||||
|
||||
Console.WriteLine("</table>");
|
||||
}
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
doc.Append(line + " ");
|
||||
doc.AppendLine("</td></tr>");
|
||||
}
|
||||
|
||||
doc.AppendLine("</table>");
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.FileSystem;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Mods.Common.UtilityCommands
|
||||
{
|
||||
|
||||
@@ -269,7 +269,6 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
for (var j = 0; j < mapSize; j++)
|
||||
for (var i = 0; i < mapSize; i++)
|
||||
map.MapTiles.Value[new CPos(i, j)] = new TerrainTile(types[i, j], ms.ReadUInt8());
|
||||
|
||||
}
|
||||
|
||||
void UnpackRAOverlayData(MemoryStream ms)
|
||||
|
||||
@@ -14,11 +14,11 @@ using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.FileSystem;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.SpriteLoaders;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.UtilityCommands
|
||||
{
|
||||
|
||||
@@ -261,7 +261,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
// make animation is now its own trait
|
||||
if (engineVersion < 20140621)
|
||||
{
|
||||
if (depth == 1 && (node.Key.StartsWith("RenderBuilding")))
|
||||
if (depth == 1 && node.Key.StartsWith("RenderBuilding"))
|
||||
node.Value.Nodes.RemoveAll(n => n.Key == "HasMakeAnimation");
|
||||
|
||||
if (node.Value.Nodes.Any(n => n.Key.StartsWith("RenderBuilding"))
|
||||
@@ -382,7 +382,6 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
node.Value.Nodes.RemoveAll(_ => true);
|
||||
node.Value.Nodes.Add(new MiniYamlNode("PanelName", new MiniYaml("SKIRMISH_STATS")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Veterancy was changed to use the upgrades system
|
||||
@@ -459,6 +458,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
node.Value.Value = string.Join(", ", node.Value.Value.Split(',')
|
||||
.Select(s => ((int)(100 * 100 / float.Parse(s))).ToString()));
|
||||
}
|
||||
|
||||
if (depth == 3 && parentKey == "Upgrades")
|
||||
node.Value.Value = node.Value.Value.Replace("armor", "damage");
|
||||
}
|
||||
@@ -477,7 +477,6 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
// InfDeath was renamed to DeathType
|
||||
if (engineVersion < 20140830)
|
||||
{
|
||||
|
||||
if (depth == 2 && parentKey.StartsWith("DeathSounds") && node.Key == "InfDeaths")
|
||||
node.Key = "DeathTypes";
|
||||
|
||||
@@ -735,6 +734,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
ConvertPxToRange(ref node.Value.Value, 2, 5);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -949,8 +949,8 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
if (temp != null)
|
||||
newYaml.Add(new MiniYamlNode(keyword, temp.Value.Value));
|
||||
}
|
||||
newYaml.Add(new MiniYamlNode("InvalidImpactTypes", "Water"));
|
||||
|
||||
newYaml.Add(new MiniYamlNode("InvalidImpactTypes", "Water"));
|
||||
newNodes.Add(new MiniYamlNode("Warhead@" + warheadCounter.ToString() + "Eff" + oldNodeAtName, "CreateEffect", newYaml));
|
||||
}
|
||||
|
||||
@@ -976,10 +976,12 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
newYaml.Add(new MiniYamlNode(temp.Key, temp.Value.Value));
|
||||
}
|
||||
}
|
||||
|
||||
newYaml.Add(new MiniYamlNode("ValidImpactTypes", "Water"));
|
||||
|
||||
newNodes.Add(new MiniYamlNode("Warhead@" + warheadCounter.ToString() + "Eff" + oldNodeAtName, "CreateEffect", newYaml));
|
||||
}
|
||||
|
||||
node.Value.Nodes.InsertRange(node.Value.Nodes.IndexOf(curNode), newNodes);
|
||||
node.Value.Nodes.Remove(curNode);
|
||||
}
|
||||
@@ -1028,11 +1030,11 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
if (depth == 2 && parentKey == "TerrainType" && node.Key.Split('@').First() == "Type")
|
||||
addNodes.Add(new MiniYamlNode("TargetTypes", node.Value.Value == "Water" ? "Water" : "Ground"));
|
||||
}
|
||||
|
||||
UpgradeTileset(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||
}
|
||||
|
||||
nodes.AddRange(addNodes);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Mods.Common.Effects;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common
|
||||
{
|
||||
@@ -42,16 +42,12 @@ namespace OpenRA.Mods.Common
|
||||
|
||||
if (isAir && !isDirectHit)
|
||||
return ImpactType.Air;
|
||||
|
||||
else if (isWater && !isDirectHit)
|
||||
return ImpactType.Water;
|
||||
|
||||
else if (isAir && isDirectHit)
|
||||
return ImpactType.AirHit;
|
||||
|
||||
else if (isWater && isDirectHit)
|
||||
return ImpactType.WaterHit;
|
||||
|
||||
else if (isDirectHit)
|
||||
return ImpactType.GroundHit;
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
workerAlive = false;
|
||||
break;
|
||||
}
|
||||
|
||||
update = false;
|
||||
|
||||
// Take a local copy of the hue to generate to avoid tearing
|
||||
@@ -184,6 +185,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
SetValueFromPx(mi.Location - RenderOrigin);
|
||||
OnChange();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,19 +49,13 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
Func<bool> doValidate = null;
|
||||
ButtonWidget acceptButton = null, cancelButton = null;
|
||||
|
||||
//
|
||||
// Title
|
||||
//
|
||||
panel.Get<LabelWidget>("PROMPT_TITLE").GetText = () => title;
|
||||
|
||||
//
|
||||
// Prompt
|
||||
//
|
||||
panel.Get<LabelWidget>("PROMPT_TEXT").GetText = () => prompt;
|
||||
|
||||
//
|
||||
// Text input
|
||||
//
|
||||
var input = panel.Get<TextFieldWidget>("INPUT_TEXT");
|
||||
var isValid = false;
|
||||
input.Text = initialText;
|
||||
@@ -86,9 +80,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
input.CursorPosition = input.Text.Length;
|
||||
input.OnTextEdited = () => doValidate();
|
||||
|
||||
//
|
||||
// Buttons
|
||||
//
|
||||
acceptButton = panel.Get<ButtonWidget>("ACCEPT_BUTTON");
|
||||
if (!string.IsNullOrEmpty(acceptText))
|
||||
acceptButton.GetText = () => acceptText;
|
||||
@@ -113,9 +105,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
onCancel();
|
||||
};
|
||||
|
||||
//
|
||||
// Validation
|
||||
//
|
||||
doValidate = () =>
|
||||
{
|
||||
if (inputValidator == null)
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
for (var h = 0; h < 256; h++)
|
||||
*(c + h) = HSLColor.FromHSV(h / 255f, 1, 1).RGB.ToArgb();
|
||||
}
|
||||
|
||||
hueBitmap.UnlockBits(bitmapData);
|
||||
hueSheet.GetTexture().SetData(hueBitmap);
|
||||
}
|
||||
|
||||
@@ -75,4 +75,3 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
||||
|
||||
ModMetadata initialMod = null;
|
||||
ModMetadata.AllMods.TryGetValue(Game.Settings.Game.PreviousMod, out initialMod);
|
||||
SelectMod(initialMod ?? ModMetadata.AllMods["ra"]);
|
||||
|
||||
@@ -333,6 +333,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var productionTemplate = hotkeyList.Get("PRODUCTION_TEMPLATE");
|
||||
hotkeyList.RemoveChildren();
|
||||
|
||||
Func<bool> returnTrue = () => true;
|
||||
Action doNothing = () => { };
|
||||
|
||||
// Game
|
||||
{
|
||||
var hotkeys = new Dictionary<string, string>()
|
||||
@@ -358,7 +361,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{ "TogglePixelDoubleKey", "Toggle pixel doubling" },
|
||||
};
|
||||
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, () => true, () => {});
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, returnTrue, doNothing);
|
||||
header.Get<LabelWidget>("LABEL").GetText = () => "Game Commands";
|
||||
hotkeyList.AddChild(header);
|
||||
|
||||
@@ -374,7 +377,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{ "ObserverWorldView", "Disable Shroud" }
|
||||
};
|
||||
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, () => true, () => {});
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, returnTrue, doNothing);
|
||||
header.Get<LabelWidget>("LABEL").GetText = () => "Observer Commands";
|
||||
hotkeyList.AddChild(header);
|
||||
|
||||
@@ -394,7 +397,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{ "GuardKey", "Guard" }
|
||||
};
|
||||
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, () => true, () => {});
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, returnTrue, doNothing);
|
||||
header.Get<LabelWidget>("LABEL").GetText = () => "Unit Commands";
|
||||
hotkeyList.AddChild(header);
|
||||
|
||||
@@ -408,7 +411,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
for (var i = 1; i <= 24; i++)
|
||||
hotkeys.Add("Production{0:D2}Key".F(i), "Slot {0}".F(i));
|
||||
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, () => true, () => {});
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, returnTrue, doNothing);
|
||||
header.Get<LabelWidget>("LABEL").GetText = () => "Production Commands";
|
||||
hotkeyList.AddChild(header);
|
||||
|
||||
@@ -423,7 +426,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{ "DevReloadChromeKey", "Reload Chrome" }
|
||||
};
|
||||
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, () => true, () => {});
|
||||
var header = ScrollItemWidget.Setup(hotkeyHeader, returnTrue, doNothing);
|
||||
header.Get<LabelWidget>("LABEL").GetText = () => "Developer commands";
|
||||
hotkeyList.AddChild(header);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user