Prevent chronoshifting into shroud
This commit is contained in:
@@ -35,6 +35,9 @@ namespace OpenRa.Game.Orders
|
|||||||
|
|
||||||
public Cursor GetCursor(int2 xy, MouseInput mi)
|
public Cursor GetCursor(int2 xy, MouseInput mi)
|
||||||
{
|
{
|
||||||
|
if (!Game.LocalPlayer.Shroud.IsExplored(xy))
|
||||||
|
return Cursor.MoveBlocked;
|
||||||
|
|
||||||
var movement = self.traits.WithInterface<IMovement>().FirstOrDefault();
|
var movement = self.traits.WithInterface<IMovement>().FirstOrDefault();
|
||||||
return (movement.CanEnterCell(xy)) ? Cursor.Chronoshift : Cursor.MoveBlocked;
|
return (movement.CanEnterCell(xy)) ? Cursor.Chronoshift : Cursor.MoveBlocked;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ namespace OpenRa.Game
|
|||||||
Sprite[,] sprites = new Sprite[128, 128];
|
Sprite[,] sprites = new Sprite[128, 128];
|
||||||
bool dirty;
|
bool dirty;
|
||||||
|
|
||||||
|
public bool IsExplored(int2 xy)
|
||||||
|
{
|
||||||
|
return explored[ xy.X, xy.Y ];
|
||||||
|
}
|
||||||
|
|
||||||
public void Explore(Actor a)
|
public void Explore(Actor a)
|
||||||
{
|
{
|
||||||
foreach (var t in Game.FindTilesInCircle((1f / Game.CellSize * a.CenterLocation).ToInt2(), a.Info.Sight))
|
foreach (var t in Game.FindTilesInCircle((1f / Game.CellSize * a.CenterLocation).ToInt2(), a.Info.Sight))
|
||||||
|
|||||||
@@ -46,6 +46,9 @@ namespace OpenRa.Game.Traits
|
|||||||
var movement = self.traits.WithInterface<IMovement>().FirstOrDefault();
|
var movement = self.traits.WithInterface<IMovement>().FirstOrDefault();
|
||||||
if (order.OrderString == "Chronoshift" && movement.CanEnterCell(order.TargetLocation))
|
if (order.OrderString == "Chronoshift" && movement.CanEnterCell(order.TargetLocation))
|
||||||
{
|
{
|
||||||
|
// Cannot chronoshift into unexplored location
|
||||||
|
if (!Game.LocalPlayer.Shroud.IsExplored(order.TargetLocation))
|
||||||
|
return;
|
||||||
|
|
||||||
// Set up return-to-sender info
|
// Set up return-to-sender info
|
||||||
chronoshiftOrigin = self.Location;
|
chronoshiftOrigin = self.Location;
|
||||||
|
|||||||
Reference in New Issue
Block a user