Fix a collection of whitespace-style issues in Mods.Common.
This commit is contained in:
@@ -13,7 +13,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
//TODO: Add functionality like a customizable Height that is compared to projectile altitude
|
||||
// TODO: Add functionality like a customizable Height that is compared to projectile altitude
|
||||
[Desc("This actor blocks bullets and missiles without 'High' property.")]
|
||||
public class BlocksBulletsInfo : TraitInfo<BlocksBullets> { }
|
||||
public class BlocksBullets : IBlocksBullets { }
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public static class CustomSellValueExts
|
||||
{
|
||||
public static int GetSellValue( this Actor a )
|
||||
public static int GetSellValue(this Actor a)
|
||||
{
|
||||
var csv = a.Info.Traits.GetOrDefault<CustomSellValueInfo>();
|
||||
if (csv != null) return csv.Value;
|
||||
|
||||
@@ -32,5 +32,4 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
position = init.world.Map.CenterOfCell(location);
|
||||
|
||||
if (info.OccupiesSpace)
|
||||
occupied = new [] { Pair.New(TopLeft, SubCell.FullCell) };
|
||||
occupied = new[] { Pair.New(TopLeft, SubCell.FullCell) };
|
||||
else
|
||||
occupied = new Pair<CPos, SubCell>[0];
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class UpgradeOverlay : UpgradableTrait<UpgradeOverlayInfo>, IRenderModifier
|
||||
{
|
||||
public UpgradeOverlay(UpgradeOverlayInfo info)
|
||||
: base (info) { }
|
||||
: base(info) { }
|
||||
|
||||
public IEnumerable<IRenderable> ModifyRender(Actor self, WorldRenderer wr, IEnumerable<IRenderable> r)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class ProvidesTechPrerequisiteInfo : ITraitInfo
|
||||
{
|
||||
public readonly string Name;
|
||||
public readonly string[] Prerequisites = {};
|
||||
public readonly string[] Prerequisites = { };
|
||||
|
||||
public object Create(ActorInitializer init) { return new ProvidesTechPrerequisite(this, init); }
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -202,7 +201,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
return anims.Values.Where(b => b.IsVisible
|
||||
&& b.Animation.Animation.CurrentSequence != null)
|
||||
.Select(a => (a.Animation.Animation.Image.size*info.Scale).ToInt2())
|
||||
.Select(a => (a.Animation.Animation.Image.size * info.Scale).ToInt2())
|
||||
.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
anim, null, () => !buildComplete, 1024));
|
||||
}
|
||||
|
||||
public void BuildingComplete( Actor self )
|
||||
public void BuildingComplete(Actor self)
|
||||
{
|
||||
buildComplete = true;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -17,14 +17,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly string DamagedSound;
|
||||
public readonly string DestroyedSound;
|
||||
|
||||
public object Create(ActorInitializer init) { return new SoundOnDamageTransition(this);}
|
||||
public object Create(ActorInitializer init) { return new SoundOnDamageTransition(this); }
|
||||
}
|
||||
|
||||
public class SoundOnDamageTransition : INotifyDamageStateChanged
|
||||
{
|
||||
readonly SoundOnDamageTransitionInfo Info;
|
||||
|
||||
public SoundOnDamageTransition( SoundOnDamageTransitionInfo info )
|
||||
public SoundOnDamageTransition(SoundOnDamageTransitionInfo info)
|
||||
{
|
||||
Info = info;
|
||||
}
|
||||
|
||||
@@ -21,21 +21,21 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public object Create(ActorInitializer init) { return new LoadWidgetAtGameStart(this); }
|
||||
}
|
||||
|
||||
public class LoadWidgetAtGameStart: IWorldLoaded
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
var spawns = world.Map.GetSpawnPoints().ToList();
|
||||
var taken = world.LobbyInfo.Clients.Where(c => c.SpawnPoint != 0 && c.Slot != null)
|
||||
.Select(c => spawns[c.SpawnPoint-1]).ToList();
|
||||
.Select(c => spawns[c.SpawnPoint - 1]).ToList();
|
||||
var available = spawns.Except(taken).ToList();
|
||||
|
||||
// Set spawn
|
||||
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var client = world.LobbyInfo.ClientInSlot(kv.Key);
|
||||
var spid = (client == null || client.SpawnPoint == 0)
|
||||
? ChooseSpawnPoint(world, available, taken)
|
||||
: spawns[client.SpawnPoint-1];
|
||||
: spawns[client.SpawnPoint - 1];
|
||||
|
||||
Start.Add(player, spid);
|
||||
|
||||
@@ -85,5 +85,4 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return sp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,12 +40,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
void PlayMusic()
|
||||
{
|
||||
var onComplete = info.Loop ? (Action)PlayMusic : () => {};
|
||||
var onComplete = info.Loop ? (Action)PlayMusic : () => { };
|
||||
|
||||
if (Game.Settings.Sound.MapMusic &&
|
||||
world.Map.Rules.Music.ContainsKey(info.Music))
|
||||
Sound.PlayMusicThen(world.Map.Rules.Music[info.Music], onComplete);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,22 +39,24 @@ 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),
|
||||
Color.FromArgb(96,0,0,0),
|
||||
Color.FromArgb(64,0,0,0),
|
||||
Color.FromArgb(32,0,0,0)
|
||||
Color.FromArgb(128, 0, 0, 0),
|
||||
Color.FromArgb(96, 0, 0, 0),
|
||||
Color.FromArgb(64, 0, 0, 0),
|
||||
Color.FromArgb(32, 0, 0, 0)
|
||||
};
|
||||
|
||||
static Color[] Shroud = new[] {
|
||||
static Color[] Shroud = new[]
|
||||
{
|
||||
Color.Transparent, Color.Green,
|
||||
Color.Blue, Color.Yellow,
|
||||
Color.Black,
|
||||
Color.FromArgb(160,0,0,0),
|
||||
Color.FromArgb(128,0,0,0),
|
||||
Color.FromArgb(64,0,0,0)
|
||||
Color.FromArgb(160, 0, 0, 0),
|
||||
Color.FromArgb(128, 0, 0, 0),
|
||||
Color.FromArgb(64, 0, 0, 0)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user