Move INotifyBlockingMove to Common and require explicit implementation

This commit is contained in:
reaperrr
2016-10-20 15:13:13 +02:00
parent df0021eeed
commit b8c04a0887
4 changed files with 6 additions and 5 deletions

View File

@@ -319,8 +319,6 @@ namespace OpenRA.Traits
bool IsBlocking(Actor self, CPos cell); bool IsBlocking(Actor self, CPos cell);
} }
public interface INotifyBlockingMove { void OnNotifyBlockingMove(Actor self, Actor blocking); }
public interface IFacing public interface IFacing
{ {
int TurnSpeed { get; } int TurnSpeed { get; }

View File

@@ -78,6 +78,7 @@ namespace OpenRA.Mods.Common.Traits
readonly Mobile mobile; readonly Mobile mobile;
Dictionary<ResourceTypeInfo, int> contents = new Dictionary<ResourceTypeInfo, int>(); Dictionary<ResourceTypeInfo, int> contents = new Dictionary<ResourceTypeInfo, int>();
bool idleSmart = true; bool idleSmart = true;
int idleDuration;
[Sync] public Actor OwnerLinkedProc = null; [Sync] public Actor OwnerLinkedProc = null;
[Sync] public Actor LastLinkedProc = 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: // I'm blocking someone else from moving to my location:
var act = self.GetCurrentActivity(); var act = self.GetCurrentActivity();
@@ -253,7 +254,6 @@ namespace OpenRA.Mods.Common.Traits
} }
} }
int idleDuration;
public void TickIdle(Actor self) public void TickIdle(Actor self)
{ {
// Should we be intelligent while idle? // Should we be intelligent while idle?

View File

@@ -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 MoveFollow(Actor self, Target target, WDist minRange, WDist maxRange) { return new Follow(self, target, minRange, maxRange); }
public Activity MoveTo(Func<List<CPos>> pathFunc) { return new Move(self, pathFunc); } public Activity MoveTo(Func<List<CPos>> 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)) if (self.IsIdle && self.AppearsFriendlyTo(blocking))
Nudge(self, blocking, true); Nudge(self, blocking, true);

View File

@@ -50,6 +50,9 @@ namespace OpenRA.Mods.Common.Traits
public interface IRenderActorPreviewInfo : ITraitInfo { IEnumerable<IActorPreview> RenderPreview(ActorPreviewInitializer init); } public interface IRenderActorPreviewInfo : ITraitInfo { IEnumerable<IActorPreview> RenderPreview(ActorPreviewInitializer init); }
public interface ICruiseAltitudeInfo : ITraitInfo { WDist GetCruiseAltitude(); } public interface ICruiseAltitudeInfo : ITraitInfo { WDist GetCruiseAltitude(); }
[RequireExplicitImplementation]
public interface INotifyBlockingMove { void OnNotifyBlockingMove(Actor self, Actor blocking); }
public interface IUpgradable public interface IUpgradable
{ {
IEnumerable<string> UpgradeTypes { get; } IEnumerable<string> UpgradeTypes { get; }