From e160825398165df988a52c47a9522d976b039cf4 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 17 Jan 2010 10:40:51 +1300 Subject: [PATCH] RA special infantry all in mod dll now --- OpenRa.Game/Effects/DelayedAction.cs | 4 +-- OpenRa.Game/Exts.cs | 2 +- OpenRa.Game/Graphics/Animation.cs | 2 +- OpenRa.Game/Graphics/Sequence.cs | 3 +- OpenRa.Game/OpenRa.Game.csproj | 8 ----- OpenRa.Game/Traits/Activities/Move.cs | 2 +- OpenRa.Game/Traits/Activities/Steal.cs | 22 ------------- OpenRa.Game/Traits/Building.cs | 2 +- OpenRa.Game/Traits/Cargo.cs | 10 ++---- OpenRa.Game/Traits/RenderInfantry.cs | 4 +-- OpenRa.Game/Traits/RenderSimple.cs | 5 ++- .../Activities/CaptureBuilding.cs | 4 ++- .../Activities/Demolish.cs | 9 ++--- .../Activities/Infiltrate.cs | 6 ++-- OpenRa.Mods.RA/Activities/Steal.cs | 33 +++++++++++++++++++ .../Traits => OpenRa.Mods.RA}/C4Demolition.cs | 6 ++-- .../EngineerCapture.cs | 4 ++- OpenRa.Mods.RA/OpenRa.Mods.RA.csproj | 9 +++++ .../Traits => OpenRa.Mods.RA}/RenderSpy.cs | 3 +- {OpenRa.Game/Traits => OpenRa.Mods.RA}/Spy.cs | 4 ++- .../Traits => OpenRa.Mods.RA}/Thief.cs | 9 ++--- 21 files changed, 82 insertions(+), 69 deletions(-) rename {OpenRa.Game/Traits => OpenRa.Mods.RA}/Activities/CaptureBuilding.cs (89%) rename {OpenRa.Game/Traits => OpenRa.Mods.RA}/Activities/Demolish.cs (75%) rename {OpenRa.Game/Traits => OpenRa.Mods.RA}/Activities/Infiltrate.cs (82%) create mode 100644 OpenRa.Mods.RA/Activities/Steal.cs rename {OpenRa.Game/Traits => OpenRa.Mods.RA}/C4Demolition.cs (84%) rename {OpenRa.Game/Traits => OpenRa.Mods.RA}/EngineerCapture.cs (89%) rename {OpenRa.Game/Traits => OpenRa.Mods.RA}/RenderSpy.cs (89%) rename {OpenRa.Game/Traits => OpenRa.Mods.RA}/Spy.cs (88%) rename {OpenRa.Game/Traits => OpenRa.Mods.RA}/Thief.cs (82%) diff --git a/OpenRa.Game/Effects/DelayedAction.cs b/OpenRa.Game/Effects/DelayedAction.cs index 97599f4d7a..91ae9bdc2e 100755 --- a/OpenRa.Game/Effects/DelayedAction.cs +++ b/OpenRa.Game/Effects/DelayedAction.cs @@ -1,12 +1,10 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; using OpenRa.Traits; namespace OpenRa.Effects { - class DelayedAction : IEffect + public class DelayedAction : IEffect { Action a; int delay; diff --git a/OpenRa.Game/Exts.cs b/OpenRa.Game/Exts.cs index e96afd4f6e..e29f99802e 100644 --- a/OpenRa.Game/Exts.cs +++ b/OpenRa.Game/Exts.cs @@ -5,7 +5,7 @@ using OpenRa.Traits; namespace OpenRa { - static class Exts + public static class Exts { public static bool HasModifier(this Modifiers k, Modifiers mod) { diff --git a/OpenRa.Game/Graphics/Animation.cs b/OpenRa.Game/Graphics/Animation.cs index deced9f2da..f7c29362ac 100644 --- a/OpenRa.Game/Graphics/Animation.cs +++ b/OpenRa.Game/Graphics/Animation.cs @@ -2,7 +2,7 @@ using System; namespace OpenRa.Graphics { - class Animation + public class Animation { string name; public Sequence CurrentSequence { get; private set; } diff --git a/OpenRa.Game/Graphics/Sequence.cs b/OpenRa.Game/Graphics/Sequence.cs index 0c88a7e354..aabfcc75a1 100644 --- a/OpenRa.Game/Graphics/Sequence.cs +++ b/OpenRa.Game/Graphics/Sequence.cs @@ -1,9 +1,8 @@ using System.Xml; -using Ijw.DirectX; namespace OpenRa.Graphics { - class Sequence + public class Sequence { readonly Sprite[] sprites; readonly int start, length; diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index 2129a0b738..631ce4727d 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -134,8 +134,6 @@ - - @@ -166,7 +164,6 @@ - @@ -216,12 +213,10 @@ - - @@ -236,12 +231,10 @@ - - @@ -268,7 +261,6 @@ - diff --git a/OpenRa.Game/Traits/Activities/Move.cs b/OpenRa.Game/Traits/Activities/Move.cs index 2985ab68bd..2818eedd18 100755 --- a/OpenRa.Game/Traits/Activities/Move.cs +++ b/OpenRa.Game/Traits/Activities/Move.cs @@ -6,7 +6,7 @@ using OpenRa.GameRules; namespace OpenRa.Traits.Activities { - class Move : IActivity + public class Move : IActivity { public IActivity NextActivity { get; set; } diff --git a/OpenRa.Game/Traits/Activities/Steal.cs b/OpenRa.Game/Traits/Activities/Steal.cs index 1e74d74e47..bee55ff22a 100644 --- a/OpenRa.Game/Traits/Activities/Steal.cs +++ b/OpenRa.Game/Traits/Activities/Steal.cs @@ -1,27 +1,5 @@  namespace OpenRa.Traits.Activities { - class Steal : IActivity - { - Actor target; - - public Steal(Actor target) { this.target = target; } - public IActivity NextActivity { get; set; } - - public IActivity Tick(Actor self) - { - if (target == null || target.IsDead) return NextActivity; - if (target.Owner == self.Owner) return NextActivity; - - foreach (var t in target.traits.WithInterface()) - t.OnSteal(target, self); - - Game.world.AddFrameEndTask(w => w.Remove(self)); - - return NextActivity; - } - - public void Cancel(Actor self) { target = null; NextActivity = null; } - } } diff --git a/OpenRa.Game/Traits/Building.cs b/OpenRa.Game/Traits/Building.cs index 018989d155..07a0b00007 100644 --- a/OpenRa.Game/Traits/Building.cs +++ b/OpenRa.Game/Traits/Building.cs @@ -31,7 +31,7 @@ namespace OpenRa.Traits public object Create(Actor self) { return new Building(self); } } - class Building : INotifyDamage, IResolveOrder, ITick + public class Building : INotifyDamage, IResolveOrder, ITick { readonly Actor self; public readonly BuildingInfo Info; diff --git a/OpenRa.Game/Traits/Cargo.cs b/OpenRa.Game/Traits/Cargo.cs index bd4e50be7a..f5caacd5b3 100644 --- a/OpenRa.Game/Traits/Cargo.cs +++ b/OpenRa.Game/Traits/Cargo.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using OpenRa.GameRules; +using System.Collections.Generic; using OpenRa.Traits.Activities; namespace OpenRa.Traits @@ -81,8 +77,8 @@ namespace OpenRa.Traits return PipType.Yellow; if (!a.traits.Contains()) return PipType.Yellow; // noncombat [E6,SPY,THF] - if (a.traits.Contains()) - return PipType.Red; // E7 + + // todo: fix E7 color again. return PipType.Green; } diff --git a/OpenRa.Game/Traits/RenderInfantry.cs b/OpenRa.Game/Traits/RenderInfantry.cs index f26b63aef3..ac186c25d6 100644 --- a/OpenRa.Game/Traits/RenderInfantry.cs +++ b/OpenRa.Game/Traits/RenderInfantry.cs @@ -2,12 +2,12 @@ namespace OpenRa.Traits { - class RenderInfantryInfo : RenderSimpleInfo + public class RenderInfantryInfo : RenderSimpleInfo { public override object Create(Actor self) { return new RenderInfantry(self); } } - class RenderInfantry : RenderSimple, INotifyAttack, INotifyDamage + public class RenderInfantry : RenderSimple, INotifyAttack, INotifyDamage { public RenderInfantry(Actor self) : base(self) diff --git a/OpenRa.Game/Traits/RenderSimple.cs b/OpenRa.Game/Traits/RenderSimple.cs index 895c73ceb9..9023b37db3 100644 --- a/OpenRa.Game/Traits/RenderSimple.cs +++ b/OpenRa.Game/Traits/RenderSimple.cs @@ -1,18 +1,17 @@ using System; using System.Collections.Generic; -using System.Linq; using OpenRa.Graphics; namespace OpenRa.Traits { - abstract class RenderSimpleInfo : ITraitInfo + public abstract class RenderSimpleInfo : ITraitInfo { public readonly string Image = null; public abstract object Create(Actor self); } - abstract class RenderSimple : IRender, ITick + public abstract class RenderSimple : IRender, ITick { public Dictionary anims = new Dictionary(); public Animation anim { get { return anims[""].Animation; } protected set { anims[""].Animation = value; } } diff --git a/OpenRa.Game/Traits/Activities/CaptureBuilding.cs b/OpenRa.Mods.RA/Activities/CaptureBuilding.cs similarity index 89% rename from OpenRa.Game/Traits/Activities/CaptureBuilding.cs rename to OpenRa.Mods.RA/Activities/CaptureBuilding.cs index 99a178be84..362bf33c2f 100644 --- a/OpenRa.Game/Traits/Activities/CaptureBuilding.cs +++ b/OpenRa.Mods.RA/Activities/CaptureBuilding.cs @@ -2,8 +2,10 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using OpenRa.Traits.Activities; +using OpenRa.Traits; -namespace OpenRa.Traits.Activities +namespace OpenRa.Mods.RA.Activities { class CaptureBuilding : IActivity { diff --git a/OpenRa.Game/Traits/Activities/Demolish.cs b/OpenRa.Mods.RA/Activities/Demolish.cs similarity index 75% rename from OpenRa.Game/Traits/Activities/Demolish.cs rename to OpenRa.Mods.RA/Activities/Demolish.cs index ecf8abaaf7..fad7cb0244 100644 --- a/OpenRa.Game/Traits/Activities/Demolish.cs +++ b/OpenRa.Mods.RA/Activities/Demolish.cs @@ -1,10 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using OpenRa.Effects; +using OpenRa.Effects; +using OpenRa.Traits.Activities; -namespace OpenRa.Traits.Activities +namespace OpenRa.Mods.RA.Activities { class Demolish : IActivity { diff --git a/OpenRa.Game/Traits/Activities/Infiltrate.cs b/OpenRa.Mods.RA/Activities/Infiltrate.cs similarity index 82% rename from OpenRa.Game/Traits/Activities/Infiltrate.cs rename to OpenRa.Mods.RA/Activities/Infiltrate.cs index bea8c3f258..2e3b0b3d53 100644 --- a/OpenRa.Game/Traits/Activities/Infiltrate.cs +++ b/OpenRa.Mods.RA/Activities/Infiltrate.cs @@ -1,5 +1,7 @@ - -namespace OpenRa.Traits.Activities +using OpenRa.Traits.Activities; +using OpenRa.Traits; + +namespace OpenRa.Mods.RA.Activities { class Infiltrate : IActivity { diff --git a/OpenRa.Mods.RA/Activities/Steal.cs b/OpenRa.Mods.RA/Activities/Steal.cs new file mode 100644 index 0000000000..7d51b25b35 --- /dev/null +++ b/OpenRa.Mods.RA/Activities/Steal.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using OpenRa.Traits.Activities; +using OpenRa.Traits; + +namespace OpenRa.Mods.RA.Activities +{ + class Steal : IActivity + { + Actor target; + + public Steal(Actor target) { this.target = target; } + + public IActivity NextActivity { get; set; } + + public IActivity Tick(Actor self) + { + if (target == null || target.IsDead) return NextActivity; + if (target.Owner == self.Owner) return NextActivity; + + foreach (var t in target.traits.WithInterface()) + t.OnSteal(target, self); + + Game.world.AddFrameEndTask(w => w.Remove(self)); + + return NextActivity; + } + + public void Cancel(Actor self) { target = null; NextActivity = null; } + } +} diff --git a/OpenRa.Game/Traits/C4Demolition.cs b/OpenRa.Mods.RA/C4Demolition.cs similarity index 84% rename from OpenRa.Game/Traits/C4Demolition.cs rename to OpenRa.Mods.RA/C4Demolition.cs index 44c0bc21e2..402d899207 100644 --- a/OpenRa.Game/Traits/C4Demolition.cs +++ b/OpenRa.Mods.RA/C4Demolition.cs @@ -1,6 +1,8 @@ -using OpenRa.Traits.Activities; +using OpenRa.Mods.RA.Activities; +using OpenRa.Traits; +using OpenRa.Traits.Activities; -namespace OpenRa.Traits +namespace OpenRa.Mods.RA { class C4DemolitionInfo : StatelessTraitInfo { } diff --git a/OpenRa.Game/Traits/EngineerCapture.cs b/OpenRa.Mods.RA/EngineerCapture.cs similarity index 89% rename from OpenRa.Game/Traits/EngineerCapture.cs rename to OpenRa.Mods.RA/EngineerCapture.cs index b02900cbbb..c053c3bb78 100644 --- a/OpenRa.Game/Traits/EngineerCapture.cs +++ b/OpenRa.Mods.RA/EngineerCapture.cs @@ -1,6 +1,8 @@ using OpenRa.Traits.Activities; +using OpenRa.Traits; +using OpenRa.Mods.RA.Activities; -namespace OpenRa.Traits +namespace OpenRa.Mods.RA { class EngineerCaptureInfo : StatelessTraitInfo { } diff --git a/OpenRa.Mods.RA/OpenRa.Mods.RA.csproj b/OpenRa.Mods.RA/OpenRa.Mods.RA.csproj index 0f1cda0826..ff9b901130 100644 --- a/OpenRa.Mods.RA/OpenRa.Mods.RA.csproj +++ b/OpenRa.Mods.RA/OpenRa.Mods.RA.csproj @@ -46,10 +46,19 @@ + + + + + + + + + diff --git a/OpenRa.Game/Traits/RenderSpy.cs b/OpenRa.Mods.RA/RenderSpy.cs similarity index 89% rename from OpenRa.Game/Traits/RenderSpy.cs rename to OpenRa.Mods.RA/RenderSpy.cs index 647084722a..46178b326c 100644 --- a/OpenRa.Game/Traits/RenderSpy.cs +++ b/OpenRa.Mods.RA/RenderSpy.cs @@ -3,8 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; using OpenRa.Graphics; +using OpenRa.Traits; -namespace OpenRa.Traits +namespace OpenRa.Mods.RA { class RenderSpyInfo : RenderInfantryInfo { diff --git a/OpenRa.Game/Traits/Spy.cs b/OpenRa.Mods.RA/Spy.cs similarity index 88% rename from OpenRa.Game/Traits/Spy.cs rename to OpenRa.Mods.RA/Spy.cs index 393481082c..8ebb86a3f2 100644 --- a/OpenRa.Game/Traits/Spy.cs +++ b/OpenRa.Mods.RA/Spy.cs @@ -3,8 +3,10 @@ using System.Collections.Generic; using System.Linq; using System.Text; using OpenRa.Traits.Activities; +using OpenRa.Traits; +using OpenRa.Mods.RA.Activities; -namespace OpenRa.Traits +namespace OpenRa.Mods.RA { class SpyInfo : StatelessTraitInfo { } diff --git a/OpenRa.Game/Traits/Thief.cs b/OpenRa.Mods.RA/Thief.cs similarity index 82% rename from OpenRa.Game/Traits/Thief.cs rename to OpenRa.Mods.RA/Thief.cs index 4d0e60b336..1f3eb5d19e 100644 --- a/OpenRa.Game/Traits/Thief.cs +++ b/OpenRa.Mods.RA/Thief.cs @@ -1,7 +1,8 @@ -using OpenRa.Traits.Activities; -using System.Collections.Generic; -using System.Linq; -namespace OpenRa.Traits +using OpenRa.Mods.RA.Activities; +using OpenRa.Traits; +using OpenRa.Traits.Activities; + +namespace OpenRa.Mods.RA { class ThiefInfo : StatelessTraitInfo { }