From b8c04a0887560a66daf5891e7a4606efe38c8c88 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Thu, 20 Oct 2016 15:13:13 +0200 Subject: [PATCH] Move INotifyBlockingMove to Common and require explicit implementation --- OpenRA.Game/Traits/TraitsInterfaces.cs | 2 -- OpenRA.Mods.Common/Traits/Harvester.cs | 4 ++-- OpenRA.Mods.Common/Traits/Mobile.cs | 2 +- OpenRA.Mods.Common/TraitsInterfaces.cs | 3 +++ 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index 6e580d5234..e2e488af7d 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -319,8 +319,6 @@ namespace OpenRA.Traits bool IsBlocking(Actor self, CPos cell); } - public interface INotifyBlockingMove { void OnNotifyBlockingMove(Actor self, Actor blocking); } - public interface IFacing { int TurnSpeed { get; } diff --git a/OpenRA.Mods.Common/Traits/Harvester.cs b/OpenRA.Mods.Common/Traits/Harvester.cs index 1cb9c859e8..5d4ba7be23 100644 --- a/OpenRA.Mods.Common/Traits/Harvester.cs +++ b/OpenRA.Mods.Common/Traits/Harvester.cs @@ -78,6 +78,7 @@ namespace OpenRA.Mods.Common.Traits readonly Mobile mobile; Dictionary contents = new Dictionary(); bool idleSmart = true; + int idleDuration; [Sync] public Actor OwnerLinkedProc = null; [Sync] public Actor LastLinkedProc = null; @@ -233,7 +234,7 @@ namespace OpenRA.Mods.Common.Traits } } - public void OnNotifyBlockingMove(Actor self, Actor blocking) + void INotifyBlockingMove.OnNotifyBlockingMove(Actor self, Actor blocking) { // I'm blocking someone else from moving to my location: var act = self.GetCurrentActivity(); @@ -253,7 +254,6 @@ namespace OpenRA.Mods.Common.Traits } } - int idleDuration; public void TickIdle(Actor self) { // Should we be intelligent while idle? diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index cdd07f2a70..2f3fc2d0d1 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -770,7 +770,7 @@ namespace OpenRA.Mods.Common.Traits public Activity MoveFollow(Actor self, Target target, WDist minRange, WDist maxRange) { return new Follow(self, target, minRange, maxRange); } public Activity MoveTo(Func> pathFunc) { return new Move(self, pathFunc); } - public void OnNotifyBlockingMove(Actor self, Actor blocking) + void INotifyBlockingMove.OnNotifyBlockingMove(Actor self, Actor blocking) { if (self.IsIdle && self.AppearsFriendlyTo(blocking)) Nudge(self, blocking, true); diff --git a/OpenRA.Mods.Common/TraitsInterfaces.cs b/OpenRA.Mods.Common/TraitsInterfaces.cs index bdacbedcaf..b86c6c8cf6 100644 --- a/OpenRA.Mods.Common/TraitsInterfaces.cs +++ b/OpenRA.Mods.Common/TraitsInterfaces.cs @@ -50,6 +50,9 @@ namespace OpenRA.Mods.Common.Traits public interface IRenderActorPreviewInfo : ITraitInfo { IEnumerable RenderPreview(ActorPreviewInitializer init); } public interface ICruiseAltitudeInfo : ITraitInfo { WDist GetCruiseAltitude(); } + [RequireExplicitImplementation] + public interface INotifyBlockingMove { void OnNotifyBlockingMove(Actor self, Actor blocking); } + public interface IUpgradable { IEnumerable UpgradeTypes { get; }