From cd155b21c9a8d441f22af3d72d285e6d59679605 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Fri, 4 Nov 2011 20:10:28 +1300 Subject: [PATCH] tidy up some bizarre namespacing --- OpenRA.Mods.RA/Buildings/BibLayer.cs | 1 - OpenRA.Mods.RA/Buildings/Building.cs | 2 +- OpenRA.Mods.RA/Buildings/RepairableBuilding.cs | 6 ++++-- OpenRA.Mods.RA/Buildings/RequiresPower.cs | 1 + OpenRA.Mods.RA/Buildings/ShakeOnDeath.cs | 4 +--- .../Buildings/SoundOnDamageTransition.cs | 9 ++------- OpenRA.Mods.RA/Buildings/Wall.cs | 1 - OpenRA.Mods.RA/OpenRA.Mods.RA.csproj | 7 ++----- .../{Buildings => Player}/TechTree.cs | 18 +++++------------- OpenRA.Mods.RA/TraitsInterfaces.cs | 12 ++++++++++++ 10 files changed, 28 insertions(+), 33 deletions(-) rename OpenRA.Mods.RA/{Buildings => Player}/TechTree.cs (91%) diff --git a/OpenRA.Mods.RA/Buildings/BibLayer.cs b/OpenRA.Mods.RA/Buildings/BibLayer.cs index d5b3859a19..6d3f015738 100755 --- a/OpenRA.Mods.RA/Buildings/BibLayer.cs +++ b/OpenRA.Mods.RA/Buildings/BibLayer.cs @@ -10,7 +10,6 @@ using System; using System.Collections.Generic; -using System.Drawing; using System.Linq; using OpenRA.FileFormats; using OpenRA.Graphics; diff --git a/OpenRA.Mods.RA/Buildings/Building.cs b/OpenRA.Mods.RA/Buildings/Building.cs index 46bcae9291..b45d0820c5 100755 --- a/OpenRA.Mods.RA/Buildings/Building.cs +++ b/OpenRA.Mods.RA/Buildings/Building.cs @@ -11,8 +11,8 @@ using System; using System.Collections.Generic; using System.Linq; -using OpenRA.Traits; using OpenRA.FileFormats; +using OpenRA.Traits; namespace OpenRA.Mods.RA.Buildings { diff --git a/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs b/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs index 2ad78658aa..3cfe8fb0d4 100755 --- a/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs +++ b/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs @@ -19,16 +19,17 @@ namespace OpenRA.Mods.RA.Buildings public readonly int RepairPercent = 20; public readonly int RepairInterval = 24; public readonly int RepairStep = 7; + public object Create(ActorInitializer init) { return new RepairableBuilding(init.self, this); } } public class RepairableBuilding : ITick, ISync { - [Sync] - public Player Repairer = null; + [Sync] public Player Repairer = null; Health Health; RepairableBuildingInfo Info; + public RepairableBuilding(Actor self, RepairableBuildingInfo info) { Health = self.Trait(); @@ -57,6 +58,7 @@ namespace OpenRA.Mods.RA.Buildings } int remainingTicks; + public void Tick(Actor self) { if (Repairer == null) return; diff --git a/OpenRA.Mods.RA/Buildings/RequiresPower.cs b/OpenRA.Mods.RA/Buildings/RequiresPower.cs index 10151e9899..586abf4f98 100755 --- a/OpenRA.Mods.RA/Buildings/RequiresPower.cs +++ b/OpenRA.Mods.RA/Buildings/RequiresPower.cs @@ -20,6 +20,7 @@ namespace OpenRA.Mods.RA.Buildings class RequiresPower : IDisable, INotifyCapture { PowerManager power; + public RequiresPower( Actor self ) { power = self.Owner.PlayerActor.Trait(); diff --git a/OpenRA.Mods.RA/Buildings/ShakeOnDeath.cs b/OpenRA.Mods.RA/Buildings/ShakeOnDeath.cs index e7a39839b8..7d036d0949 100644 --- a/OpenRA.Mods.RA/Buildings/ShakeOnDeath.cs +++ b/OpenRA.Mods.RA/Buildings/ShakeOnDeath.cs @@ -8,9 +8,6 @@ */ #endregion -using System; -using System.Collections.Generic; -using System.Linq; using OpenRA.Traits; namespace OpenRA.Mods.RA.Buildings @@ -24,6 +21,7 @@ namespace OpenRA.Mods.RA.Buildings public class ShakeOnDeath : INotifyKilled { readonly ShakeOnDeathInfo Info; + public ShakeOnDeath(ShakeOnDeathInfo info) { this.Info = info; diff --git a/OpenRA.Mods.RA/Buildings/SoundOnDamageTransition.cs b/OpenRA.Mods.RA/Buildings/SoundOnDamageTransition.cs index 7ca74a2237..e9e3762538 100644 --- a/OpenRA.Mods.RA/Buildings/SoundOnDamageTransition.cs +++ b/OpenRA.Mods.RA/Buildings/SoundOnDamageTransition.cs @@ -8,15 +8,9 @@ */ #endregion -using System; -using System.Collections.Generic; -using System.Linq; -using OpenRA.Graphics; -using OpenRA.Mods.RA.Buildings; -using OpenRA.Mods.RA.Effects; using OpenRA.Traits; -namespace OpenRA.Mods.RA.Render +namespace OpenRA.Mods.RA.Buildings { public class SoundOnDamageTransitionInfo : ITraitInfo { @@ -29,6 +23,7 @@ namespace OpenRA.Mods.RA.Render public class SoundOnDamageTransition : INotifyDamageStateChanged { readonly SoundOnDamageTransitionInfo Info; + public SoundOnDamageTransition( SoundOnDamageTransitionInfo info ) { Info = info; diff --git a/OpenRA.Mods.RA/Buildings/Wall.cs b/OpenRA.Mods.RA/Buildings/Wall.cs index f27e23e3ba..727aa0bd59 100755 --- a/OpenRA.Mods.RA/Buildings/Wall.cs +++ b/OpenRA.Mods.RA/Buildings/Wall.cs @@ -8,7 +8,6 @@ */ #endregion -using System.Collections.Generic; using System.Linq; using OpenRA.Traits; diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index d314a5e9d8..e673e94365 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -140,7 +140,6 @@ - @@ -251,6 +250,7 @@ + @@ -332,6 +332,7 @@ + @@ -364,7 +365,6 @@ - @@ -391,7 +391,4 @@ copy "$(TargetPath)" "$(SolutionDir)mods/ra/" cd "$(SolutionDir)" - - - diff --git a/OpenRA.Mods.RA/Buildings/TechTree.cs b/OpenRA.Mods.RA/Player/TechTree.cs similarity index 91% rename from OpenRA.Mods.RA/Buildings/TechTree.cs rename to OpenRA.Mods.RA/Player/TechTree.cs index d4624a7a0b..92f897b90a 100755 --- a/OpenRA.Mods.RA/Buildings/TechTree.cs +++ b/OpenRA.Mods.RA/Player/TechTree.cs @@ -13,7 +13,7 @@ using System.Linq; using OpenRA.FileFormats; using OpenRA.Traits; -namespace OpenRA.Mods.RA.Buildings +namespace OpenRA.Mods.RA { public class TechTreeInfo : ITraitInfo { @@ -24,6 +24,7 @@ namespace OpenRA.Mods.RA.Buildings { readonly List watchers = new List(); readonly Player player; + public TechTree(ActorInitializer init) { player = init.self.Owner; @@ -106,26 +107,17 @@ namespace OpenRA.Mods.RA.Buildings } } - public interface ITechTreeElement - { - void PrerequisitesAvailable(string key); - void PrerequisitesUnavailable(string key); - } - - public interface ITechTreePrerequisite - { - IEnumerable ProvidesPrerequisites {get;} - } - public class ProvidesCustomPrerequisiteInfo : ITraitInfo { - public string Prerequisite; + public readonly string Prerequisite; + public object Create(ActorInitializer init) { return new ProvidesCustomPrerequisite(this);} } public class ProvidesCustomPrerequisite : ITechTreePrerequisite { ProvidesCustomPrerequisiteInfo Info; + public IEnumerable ProvidesPrerequisites { get { yield return Info.Prerequisite; } } public ProvidesCustomPrerequisite(ProvidesCustomPrerequisiteInfo info) diff --git a/OpenRA.Mods.RA/TraitsInterfaces.cs b/OpenRA.Mods.RA/TraitsInterfaces.cs index 000e6832a5..db261188e6 100755 --- a/OpenRA.Mods.RA/TraitsInterfaces.cs +++ b/OpenRA.Mods.RA/TraitsInterfaces.cs @@ -8,6 +8,7 @@ */ #endregion +using System.Collections.Generic; using OpenRA.Mods.RA.Activities; namespace OpenRA.Mods.RA @@ -25,4 +26,15 @@ namespace OpenRA.Mods.RA { void OnDock(Actor self, Actor harv, DeliverResources dockOrder); } + + public interface ITechTreeElement + { + void PrerequisitesAvailable(string key); + void PrerequisitesUnavailable(string key); + } + + public interface ITechTreePrerequisite + { + IEnumerable ProvidesPrerequisites {get;} + } }