add a new /pause command
This commit is contained in:
@@ -38,9 +38,9 @@ namespace OpenRA.Mods.RA
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void InvokeCommand(string name, string arg)
|
public void InvokeCommand(string name, string arg)
|
||||||
{
|
{
|
||||||
Game.Debug("Here are the available commands:");
|
Game.Debug("Here are the available commands:");
|
||||||
|
|
||||||
foreach (var key in console.Commands.Keys)
|
foreach (var key in console.Commands.Keys)
|
||||||
{
|
{
|
||||||
var description = "";
|
var description = "";
|
||||||
|
|||||||
39
OpenRA.Mods.RA/Console/PauseCommand.cs
Normal file
39
OpenRA.Mods.RA/Console/PauseCommand.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation. For more information,
|
||||||
|
* see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using OpenRA.Graphics;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA
|
||||||
|
{
|
||||||
|
public class PauseCommandInfo : TraitInfo<PauseCommand> { }
|
||||||
|
|
||||||
|
public class PauseCommand : IChatCommand, IWorldLoaded
|
||||||
|
{
|
||||||
|
World world;
|
||||||
|
|
||||||
|
public PauseCommand() { }
|
||||||
|
|
||||||
|
public void WorldLoaded(World w, WorldRenderer wr)
|
||||||
|
{
|
||||||
|
world = w;
|
||||||
|
var console = world.WorldActor.Trait<ChatCommands>();
|
||||||
|
var help = world.WorldActor.Trait<HelpCommand>();
|
||||||
|
|
||||||
|
console.RegisterCommand("pause", this);
|
||||||
|
help.RegisterHelp("pause", "pause or unpause the game");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InvokeCommand(string name, string arg)
|
||||||
|
{
|
||||||
|
world.IssueOrder(new Order("PauseGame", null, false) { TargetString = world.Paused ? "UnPause" : "Pause" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -526,6 +526,7 @@
|
|||||||
<Compile Include="Console\ChatCommands.cs" />
|
<Compile Include="Console\ChatCommands.cs" />
|
||||||
<Compile Include="Console\DevCommands.cs" />
|
<Compile Include="Console\DevCommands.cs" />
|
||||||
<Compile Include="Console\HelpCommand.cs" />
|
<Compile Include="Console\HelpCommand.cs" />
|
||||||
|
<Compile Include="Console\PauseCommand.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj">
|
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj">
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
World:
|
World:
|
||||||
ChatCommands:
|
ChatCommands:
|
||||||
DevCommands:
|
DevCommands:
|
||||||
|
PauseCommand:
|
||||||
HelpCommand:
|
HelpCommand:
|
||||||
ScreenMap:
|
ScreenMap:
|
||||||
ActorMap:
|
ActorMap:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
World:
|
World:
|
||||||
ChatCommands:
|
ChatCommands:
|
||||||
DevCommands:
|
DevCommands:
|
||||||
|
PauseCommand:
|
||||||
HelpCommand:
|
HelpCommand:
|
||||||
ScreenMap:
|
ScreenMap:
|
||||||
ActorMap:
|
ActorMap:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
World:
|
World:
|
||||||
ChatCommands:
|
ChatCommands:
|
||||||
DevCommands:
|
DevCommands:
|
||||||
|
PauseCommand:
|
||||||
HelpCommand:
|
HelpCommand:
|
||||||
ScreenMap:
|
ScreenMap:
|
||||||
ActorMap:
|
ActorMap:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
World:
|
World:
|
||||||
ChatCommands:
|
ChatCommands:
|
||||||
DevCommands:
|
DevCommands:
|
||||||
|
PauseCommand:
|
||||||
HelpCommand:
|
HelpCommand:
|
||||||
ScreenMap:
|
ScreenMap:
|
||||||
ActorMap:
|
ActorMap:
|
||||||
|
|||||||
Reference in New Issue
Block a user