Move to a cell you cannot enter doesn't make affirmative sound or cancel existing orders
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||||
* This file is part of OpenRA.
|
* This file is part of OpenRA.
|
||||||
@@ -63,6 +63,8 @@ namespace OpenRa
|
|||||||
|
|
||||||
if (voicedActor != null)
|
if (voicedActor != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(voicedActor.traits.GetOrDefault<IMovement>().CanEnterCell(xy.ToInt2()))
|
||||||
Sound.PlayVoice(isAttack ? "Attack" : "Move", voicedActor);
|
Sound.PlayVoice(isAttack ? "Attack" : "Move", voicedActor);
|
||||||
|
|
||||||
if (isMove)
|
if (isMove)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||||
* This file is part of OpenRA.
|
* This file is part of OpenRA.
|
||||||
@@ -65,14 +65,13 @@ namespace OpenRa.Orders
|
|||||||
|
|
||||||
string CursorForOrderString(string s, Actor a, int2 location)
|
string CursorForOrderString(string s, Actor a, int2 location)
|
||||||
{
|
{
|
||||||
var movement = a.traits.GetOrDefault<IMovement>();
|
|
||||||
switch (s)
|
switch (s)
|
||||||
{
|
{
|
||||||
case "Attack": return "attack";
|
case "Attack": return "attack";
|
||||||
case "Heal": return "heal";
|
case "Heal": return "heal";
|
||||||
case "C4": return "c4";
|
case "C4": return "c4";
|
||||||
case "Move":
|
case "Move":
|
||||||
if (movement.CanEnterCell(location))
|
if (a.traits.GetOrDefault<IMovement>().CanEnterCell(location))
|
||||||
return "move";
|
return "move";
|
||||||
else
|
else
|
||||||
return "move-blocked";
|
return "move-blocked";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||||
* This file is part of OpenRA.
|
* This file is part of OpenRA.
|
||||||
@@ -50,8 +50,10 @@ namespace OpenRa.Traits
|
|||||||
if (!mi.Modifiers.HasModifier(Modifiers.Alt)) return null;
|
if (!mi.Modifiers.HasModifier(Modifiers.Alt)) return null;
|
||||||
if (!self.World.IsActorCrushableByActor(underCursor, self)) return null;
|
if (!self.World.IsActorCrushableByActor(underCursor, self)) return null;
|
||||||
}
|
}
|
||||||
|
if (self.traits.GetOrDefault<IMovement>().CanEnterCell(xy))
|
||||||
return new Order("Move", self, xy);
|
return new Order("Move", self, xy);
|
||||||
|
else
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||||
* This file is part of OpenRA.
|
* This file is part of OpenRA.
|
||||||
@@ -45,7 +45,10 @@ namespace OpenRa.Traits
|
|||||||
if (mi.Button == MouseButton.Left) return null;
|
if (mi.Button == MouseButton.Left) return null;
|
||||||
|
|
||||||
if (underCursor == null)
|
if (underCursor == null)
|
||||||
|
{
|
||||||
|
if (self.traits.GetOrDefault<IMovement>().CanEnterCell(xy))
|
||||||
return new Order("Move", self, xy);
|
return new Order("Move", self, xy);
|
||||||
|
}
|
||||||
|
|
||||||
if (HeliCanEnter(underCursor)
|
if (HeliCanEnter(underCursor)
|
||||||
&& underCursor.Owner == self.Owner
|
&& underCursor.Owner == self.Owner
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||||
* This file is part of OpenRA.
|
* This file is part of OpenRA.
|
||||||
@@ -91,11 +91,14 @@ namespace OpenRa.Traits
|
|||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
if (order.OrderString == "Move")
|
if (order.OrderString == "Move")
|
||||||
|
{
|
||||||
|
if (self.traits.GetOrDefault<IMovement>().CanEnterCell(order.TargetLocation))
|
||||||
{
|
{
|
||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
self.QueueActivity(new Activities.Move(order.TargetLocation, 8));
|
self.QueueActivity(new Activities.Move(order.TargetLocation, 8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public IEnumerable<int2> OccupiedCells()
|
public IEnumerable<int2> OccupiedCells()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||||
* This file is part of OpenRA.
|
* This file is part of OpenRA.
|
||||||
@@ -46,8 +46,9 @@ namespace OpenRa.Traits
|
|||||||
{
|
{
|
||||||
if (mi.Button == MouseButton.Left) return null;
|
if (mi.Button == MouseButton.Left) return null;
|
||||||
if (underCursor == null)
|
if (underCursor == null)
|
||||||
|
{
|
||||||
return new Order("Move", self, xy);
|
return new Order("Move", self, xy);
|
||||||
|
}
|
||||||
if (PlaneCanEnter(underCursor)
|
if (PlaneCanEnter(underCursor)
|
||||||
&& underCursor.Owner == self.Owner
|
&& underCursor.Owner == self.Owner
|
||||||
&& !Reservable.IsReserved(underCursor))
|
&& !Reservable.IsReserved(underCursor))
|
||||||
|
|||||||
Reference in New Issue
Block a user