From d043f6690dcbe5a648bb0688230288cacad42b22 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Fri, 29 Jan 2010 19:48:51 +1300 Subject: [PATCH] invuln moved to mod --- OpenRa.Game/OpenRa.Game.csproj | 3 --- OpenRa.Game/Traits/RenderBuilding.cs | 4 ++-- OpenRa.Game/Traits/Selectable.cs | 4 ++-- OpenRa.Game/WorldUtils.cs | 6 ++++++ .../Effects/InvulnEffect.cs | 3 ++- .../Traits => OpenRa.Mods.RA}/IronCurtainPower.cs | 13 +++++-------- .../Traits => OpenRa.Mods.RA}/IronCurtainable.cs | 4 +++- OpenRa.Mods.RA/OpenRa.Mods.RA.csproj | 3 +++ 8 files changed, 23 insertions(+), 17 deletions(-) rename {OpenRa.Game => OpenRa.Mods.RA}/Effects/InvulnEffect.cs (85%) mode change 100755 => 100644 rename {OpenRa.Game/Traits => OpenRa.Mods.RA}/IronCurtainPower.cs (87%) rename {OpenRa.Game/Traits => OpenRa.Mods.RA}/IronCurtainable.cs (84%) diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index b1a4ae7ced..308239c03e 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -81,7 +81,6 @@ - @@ -218,8 +217,6 @@ - - diff --git a/OpenRa.Game/Traits/RenderBuilding.cs b/OpenRa.Game/Traits/RenderBuilding.cs index dea269569c..b47885e261 100644 --- a/OpenRa.Game/Traits/RenderBuilding.cs +++ b/OpenRa.Game/Traits/RenderBuilding.cs @@ -3,12 +3,12 @@ using OpenRa.Effects; namespace OpenRa.Traits { - class RenderBuildingInfo : RenderSimpleInfo + public class RenderBuildingInfo : RenderSimpleInfo { public override object Create(Actor self) { return new RenderBuilding(self); } } - class RenderBuilding : RenderSimple, INotifyDamage, INotifySold + public class RenderBuilding : RenderSimple, INotifyDamage, INotifySold { const int SmallBibStart = 1; const int LargeBibStart = 5; diff --git a/OpenRa.Game/Traits/Selectable.cs b/OpenRa.Game/Traits/Selectable.cs index 494688975b..66a63a4ee8 100755 --- a/OpenRa.Game/Traits/Selectable.cs +++ b/OpenRa.Game/Traits/Selectable.cs @@ -5,12 +5,12 @@ using System.Text; namespace OpenRa.Traits { - class SelectableInfo : StatelessTraitInfo + public class SelectableInfo : StatelessTraitInfo { public readonly int Priority = 10; public readonly int[] Bounds = null; public readonly string Voice = "GenericVoice"; } - class Selectable {} + public class Selectable {} } diff --git a/OpenRa.Game/WorldUtils.cs b/OpenRa.Game/WorldUtils.cs index f66bc8469b..83f126fad1 100755 --- a/OpenRa.Game/WorldUtils.cs +++ b/OpenRa.Game/WorldUtils.cs @@ -52,6 +52,12 @@ namespace OpenRa world.TileSet.GetWalkability(world.Map.MapTiles[a.X, a.Y])) < double.PositiveInfinity; } + public static IEnumerable FindUnitsAtMouse(this World world, int2 mouseLocation) + { + var loc = mouseLocation + Game.viewport.Location; + return FindUnits(world, loc, loc); + } + public static IEnumerable FindUnits(this World world, float2 a, float2 b) { var min = float2.Min(a, b); diff --git a/OpenRa.Game/Effects/InvulnEffect.cs b/OpenRa.Mods.RA/Effects/InvulnEffect.cs old mode 100755 new mode 100644 similarity index 85% rename from OpenRa.Game/Effects/InvulnEffect.cs rename to OpenRa.Mods.RA/Effects/InvulnEffect.cs index e17dfd8382..b6a546adc3 --- a/OpenRa.Game/Effects/InvulnEffect.cs +++ b/OpenRa.Mods.RA/Effects/InvulnEffect.cs @@ -1,8 +1,9 @@ using System.Collections.Generic; using OpenRa.Graphics; using OpenRa.Traits; +using OpenRa.Effects; -namespace OpenRa.Effects +namespace OpenRa.Mods.RA.Effects { class InvulnEffect : IEffect { diff --git a/OpenRa.Game/Traits/IronCurtainPower.cs b/OpenRa.Mods.RA/IronCurtainPower.cs similarity index 87% rename from OpenRa.Game/Traits/IronCurtainPower.cs rename to OpenRa.Mods.RA/IronCurtainPower.cs index d0a727f415..3548e25aa1 100644 --- a/OpenRa.Game/Traits/IronCurtainPower.cs +++ b/OpenRa.Mods.RA/IronCurtainPower.cs @@ -1,10 +1,8 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using System.Text; -using OpenRa.Orders; +using OpenRa.Traits; -namespace OpenRa.Traits +namespace OpenRa.Mods.RA { class IronCurtainPowerInfo : SupportPowerInfo { @@ -61,9 +59,8 @@ namespace OpenRa.Traits { if (mi.Button == MouseButton.Left) { - var loc = mi.Location + Game.viewport.Location; - var underCursor = world.FindUnits(loc, loc) - .Where(a => a.Owner == world.LocalPlayer + var underCursor = world.FindUnitsAtMouse(mi.Location) + .Where(a => a.Owner != null && a.traits.Contains() && a.traits.Contains()).FirstOrDefault(); diff --git a/OpenRa.Game/Traits/IronCurtainable.cs b/OpenRa.Mods.RA/IronCurtainable.cs similarity index 84% rename from OpenRa.Game/Traits/IronCurtainable.cs rename to OpenRa.Mods.RA/IronCurtainable.cs index 3447cb0efb..b60a0f890c 100644 --- a/OpenRa.Game/Traits/IronCurtainable.cs +++ b/OpenRa.Mods.RA/IronCurtainable.cs @@ -1,7 +1,9 @@ using System.Linq; using OpenRa.Effects; +using OpenRa.Traits; +using OpenRa.Mods.RA.Effects; -namespace OpenRa.Traits +namespace OpenRa.Mods.RA { class IronCurtainableInfo : ITraitInfo { diff --git a/OpenRa.Mods.RA/OpenRa.Mods.RA.csproj b/OpenRa.Mods.RA/OpenRa.Mods.RA.csproj index 188136c025..bff7beb4c1 100644 --- a/OpenRa.Mods.RA/OpenRa.Mods.RA.csproj +++ b/OpenRa.Mods.RA/OpenRa.Mods.RA.csproj @@ -53,9 +53,12 @@ + + +