Refactor Mobile.TeleportTo -> IMove.SetPosition
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#endregion
|
||||
|
||||
using OpenRA.Traits;
|
||||
using System.Linq;
|
||||
namespace OpenRA.Mods.RA.Activities
|
||||
{
|
||||
class Leap : IActivity
|
||||
@@ -51,7 +52,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
if (t >= 1f)
|
||||
{
|
||||
self.traits.Get<Mobile>().TeleportTo(self, target.Location);
|
||||
self.traits.WithInterface<IMove>().FirstOrDefault().SetPosition(self, target.Location);
|
||||
target.InflictDamage(self, target.Health, null); // kill it
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Activities
|
||||
@@ -35,8 +36,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
public IActivity Tick(Actor self)
|
||||
{
|
||||
var mobile = self.traits.Get<Mobile>();
|
||||
mobile.TeleportTo(self, destination);
|
||||
self.traits.WithInterface<IMove>().FirstOrDefault().SetPosition(self, destination);
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
w.Add(actor);
|
||||
actor.traits.Get<Mobile>().TeleportTo(actor, self.Location);
|
||||
actor.traits.WithInterface<IMove>().FirstOrDefault().SetPosition(actor, self.Location);
|
||||
actor.CancelActivity();
|
||||
actor.QueueActivity(new Move(exitTile.Value, 0));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user