diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index 1d70d801e8..81fea38a21 100755 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -1,4 +1,4 @@ - + Debug @@ -187,7 +187,6 @@ - @@ -263,4 +262,7 @@ --> + + + \ No newline at end of file diff --git a/OpenRA.Game/Traits/Player/PlayerResources.cs b/OpenRA.Game/Traits/Player/PlayerResources.cs index 96db8b2c64..55c1b11c44 100644 --- a/OpenRA.Game/Traits/Player/PlayerResources.cs +++ b/OpenRA.Game/Traits/Player/PlayerResources.cs @@ -48,8 +48,8 @@ namespace OpenRA.Traits int nextSiloAdviceTime = 0; void TickOre(Actor self) { - OreCapacity = self.World.Queries.OwnedBy[Owner].WithTrait() - .Sum(a => a.Actor.Info.Traits.Get().Capacity); + OreCapacity = self.World.Queries.OwnedBy[Owner].WithTrait() + .Sum(a => a.Actor.traits.WithInterface().Sum(b => b.Capacity)); if (Ore > OreCapacity) Ore = OreCapacity; diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index b4b7a67ee7..0bf21dc4f0 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -56,6 +56,7 @@ namespace OpenRA.Traits public interface INotifyEnterCell { void OnEnterCell(Actor self, int2 cell); } public interface IProvideHazard { IEnumerable HazardCells(Actor self); } public interface IAvoidHazard { string Type { get; } } + public interface IStoreOre { int Capacity { get; }} public interface ITerrainTypeModifier { string GetTerrainType(int2 cell); } public interface ITerrainCost { float GetTerrainCost(int2 cell, Actor forActor); } diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index b44edb437b..49fc099ce1 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -1,4 +1,4 @@ - + Debug @@ -201,6 +201,7 @@ + diff --git a/OpenRA.Game/Traits/StoresOre.cs b/OpenRA.Mods.RA/StoresOre.cs similarity index 91% rename from OpenRA.Game/Traits/StoresOre.cs rename to OpenRA.Mods.RA/StoresOre.cs index cc74a9f6fe..19e6ee8f55 100644 --- a/OpenRA.Game/Traits/StoresOre.cs +++ b/OpenRA.Mods.RA/StoresOre.cs @@ -19,8 +19,9 @@ #endregion using System.Collections.Generic; - -namespace OpenRA.Traits +using OpenRA.Traits; + +namespace OpenRA.Mods.RA { class StoresOreInfo : ITraitInfo { @@ -30,7 +31,7 @@ namespace OpenRA.Traits public object Create(ActorInitializer init) { return new StoresOre(init.self, this); } } - class StoresOre : IPips, INotifyCapture, INotifyDamage, IExplodeModifier + class StoresOre : IPips, INotifyCapture, INotifyDamage, IExplodeModifier, IStoreOre { readonly PlayerResources Player; readonly StoresOreInfo Info; @@ -41,6 +42,8 @@ namespace OpenRA.Traits Info = info; } + public int Capacity { get { return Info.Capacity; } } + public void OnCapture(Actor self, Actor captor) { var ore = Stored(self);