Merge pull request #6945 from Phrohdoh/madtank-fix
MadTank deployed teleportation fix.
This commit is contained in:
@@ -16,6 +16,8 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA.Activities
|
namespace OpenRA.Mods.RA.Activities
|
||||||
{
|
{
|
||||||
|
public interface IPreventsTeleport { bool PreventsTeleport(Actor self); }
|
||||||
|
|
||||||
public class Teleport : Activity
|
public class Teleport : Activity
|
||||||
{
|
{
|
||||||
Actor chronosphere;
|
Actor chronosphere;
|
||||||
@@ -46,6 +48,10 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
if (pc != null && !pc.CanTeleport)
|
if (pc != null && !pc.CanTeleport)
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|
||||||
|
foreach (var condition in self.TraitsImplementing<IPreventsTeleport>())
|
||||||
|
if (condition.PreventsTeleport(self))
|
||||||
|
return NextActivity;
|
||||||
|
|
||||||
var bestCell = ChooseBestDestinationCell(self, destination);
|
var bestCell = ChooseBestDestinationCell(self, destination);
|
||||||
if (bestCell == null)
|
if (bestCell == null)
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public object Create(ActorInitializer init) { return new MadTank(init.self, this); }
|
public object Create(ActorInitializer init) { return new MadTank(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class MadTank : IIssueOrder, IResolveOrder, IOrderVoice, ITick
|
class MadTank : IIssueOrder, IResolveOrder, IOrderVoice, ITick, IPreventsTeleport
|
||||||
{
|
{
|
||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
readonly MadTankInfo info;
|
readonly MadTankInfo info;
|
||||||
@@ -131,6 +131,8 @@ namespace OpenRA.Mods.RA
|
|||||||
driverMobile.Nudge(driver, driver, true);
|
driverMobile.Nudge(driver, driver, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool PreventsTeleport(Actor self) { return deployed; }
|
||||||
|
|
||||||
void StartDetonationSequence()
|
void StartDetonationSequence()
|
||||||
{
|
{
|
||||||
if (deployed)
|
if (deployed)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using System.Collections.Generic;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
|
using OpenRA.Mods.RA.Activities;
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
@@ -59,7 +60,8 @@ namespace OpenRA.Mods.RA
|
|||||||
foreach (var t in tiles)
|
foreach (var t in tiles)
|
||||||
units.AddRange(self.World.ActorMap.GetUnitsAt(t));
|
units.AddRange(self.World.ActorMap.GetUnitsAt(t));
|
||||||
|
|
||||||
return units.Distinct().Where(a => a.HasTrait<Chronoshiftable>());
|
return units.Distinct().Where(a => a.HasTrait<Chronoshiftable>() &&
|
||||||
|
!a.TraitsImplementing<IPreventsTeleport>().Any(condition => condition.PreventsTeleport(a)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SimilarTerrain(CPos xy, CPos sourceLocation)
|
public bool SimilarTerrain(CPos xy, CPos sourceLocation)
|
||||||
|
|||||||
Reference in New Issue
Block a user