Freezes map after game ends.
Adds newline. Disables keyboard hotkeys for units after game ends.
This commit is contained in:
@@ -106,6 +106,9 @@ namespace OpenRA.Orders
|
||||
if (self.Owner != self.World.LocalPlayer)
|
||||
return null;
|
||||
|
||||
if (self.World.IsGameOver)
|
||||
return null;
|
||||
|
||||
if (self.Disposed || !target.IsValidFor(self))
|
||||
return null;
|
||||
|
||||
|
||||
@@ -57,6 +57,16 @@ namespace OpenRA
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var a in newSelection)
|
||||
foreach (var sel in a.TraitsImplementing<INotifySelected>())
|
||||
sel.Selected(a);
|
||||
|
||||
foreach (var ns in world.WorldActor.TraitsImplementing<INotifySelection>())
|
||||
ns.SelectionChanged();
|
||||
|
||||
if (world.IsGameOver)
|
||||
return;
|
||||
|
||||
// Play the selection voice from one of the selected actors
|
||||
// TODO: This probably should only be considering the newly selected actors
|
||||
// TODO: Ship this into an INotifySelection trait to remove the engine dependency on Selectable
|
||||
@@ -72,12 +82,6 @@ namespace OpenRA
|
||||
actor.PlayVoice(selectable.Voice);
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (var a in newSelection)
|
||||
foreach (var sel in a.TraitsImplementing<INotifySelected>())
|
||||
sel.Selected(a);
|
||||
foreach (var ns in world.WorldActor.TraitsImplementing<INotifySelection>())
|
||||
ns.SelectionChanged();
|
||||
}
|
||||
|
||||
public IEnumerable<Actor> Actors { get { return actors; } }
|
||||
|
||||
@@ -232,13 +232,13 @@ namespace OpenRA.Widgets
|
||||
|
||||
if (key == Game.Settings.Keys.PauseKey && World.LocalPlayer != null) // Disable pausing for spectators
|
||||
World.SetPauseState(!World.Paused);
|
||||
else if (key == Game.Settings.Keys.SelectAllUnitsKey)
|
||||
else if (key == Game.Settings.Keys.SelectAllUnitsKey && !World.IsGameOver)
|
||||
{
|
||||
// Select actors on the screen which belong to the current player
|
||||
var ownUnitsOnScreen = SelectActorsOnScreen(World, worldRenderer, null, player).SubsetWithHighestSelectionPriority();
|
||||
World.Selection.Combine(World, ownUnitsOnScreen, false, false);
|
||||
}
|
||||
else if (key == Game.Settings.Keys.SelectUnitsByTypeKey)
|
||||
else if (key == Game.Settings.Keys.SelectUnitsByTypeKey && !World.IsGameOver)
|
||||
{
|
||||
// Get all the selected actors' selection classes
|
||||
var selectedClasses = World.Selection.Actors
|
||||
|
||||
@@ -52,12 +52,12 @@ namespace OpenRA
|
||||
public Player LocalPlayer { get; private set; }
|
||||
|
||||
public event Action GameOver = () => { };
|
||||
bool gameOver;
|
||||
public bool IsGameOver { get; private set; }
|
||||
public void EndGame()
|
||||
{
|
||||
if (!gameOver)
|
||||
if (!IsGameOver)
|
||||
{
|
||||
gameOver = true;
|
||||
IsGameOver = true;
|
||||
|
||||
foreach (var t in WorldActor.TraitsImplementing<IGameOver>())
|
||||
t.GameOver(this);
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
return ToSelection();
|
||||
|
||||
// Put all functions that aren't unit-specific before this line!
|
||||
if (!world.Selection.Actors.Any())
|
||||
if (!world.Selection.Actors.Any() || world.IsGameOver)
|
||||
return false;
|
||||
|
||||
if (key == ks.AttackMoveKey)
|
||||
|
||||
Reference in New Issue
Block a user