however, we *do* need to know who nudged us, so we can tell them where to shove it if required.
This commit is contained in:
@@ -161,7 +161,7 @@ namespace OpenRA.Traits.Activities
|
|||||||
|
|
||||||
var nudge = blocker.traits.GetOrDefault<INudge>();
|
var nudge = blocker.traits.GetOrDefault<INudge>();
|
||||||
if (nudge != null)
|
if (nudge != null)
|
||||||
nudge.OnNudge(blocker);
|
nudge.OnNudge(blocker, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
int2? PopPath( Actor self, Mobile mobile )
|
int2? PopPath( Actor self, Mobile mobile )
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Traits
|
|||||||
public virtual object Create(ActorInitializer init) { return new Mobile(init, this); }
|
public virtual object Create(ActorInitializer init) { return new Mobile(init, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Mobile : IIssueOrder, IResolveOrder, IOccupySpace, IMove, IProvideCursor
|
public class Mobile : IIssueOrder, IResolveOrder, IOccupySpace, IMove, IProvideCursor, INudge
|
||||||
{
|
{
|
||||||
public readonly Actor self;
|
public readonly Actor self;
|
||||||
public readonly MobileInfo Info;
|
public readonly MobileInfo Info;
|
||||||
@@ -240,5 +240,14 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
self.World.WorldActor.traits.Get<UnitInfluence>().Remove( self, this );
|
self.World.WorldActor.traits.Get<UnitInfluence>().Remove( self, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnNudge(Actor self, Actor nudger)
|
||||||
|
{
|
||||||
|
if (self.Owner.Stances[nudger.Owner] != Stance.Ally)
|
||||||
|
return; /* don't allow ourselves to be pushed around
|
||||||
|
* by the enemy! */
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public interface IDisable { bool Disabled { get; } }
|
public interface IDisable { bool Disabled { get; } }
|
||||||
public interface IExplodeModifier { bool ShouldExplode(Actor self); }
|
public interface IExplodeModifier { bool ShouldExplode(Actor self); }
|
||||||
public interface INudge { void OnNudge(Actor self); }
|
public interface INudge { void OnNudge(Actor self, Actor nudger); }
|
||||||
|
|
||||||
public interface IOccupySpace
|
public interface IOccupySpace
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user