mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
* Console command completions v1.
I think it works™️
* Unify cvar commands
* Handle no-completions-at-all better.
* Don't crash if you tab complete while no completions available.
* Always show hints if available
* Properly null completion hint over the wire
* Unify help command, localize it.
* Clean up + localize cvar command.
* Remove debug logging
* List command unified & localized.
* Remove server completions debug logging
* Remote execute command.
Had to make everything async for this.
* Don't lower case enums or bools
Why
* GC commands converted and localized.
* Fix remote command completions.
Whoops
* Kick command completions
* lsasm unified & localized.
* Revert "Don't lower case enums or bools"
This reverts commit 2f825347c3.
* ToString gc_mode command enums instead of trying to fix Fluent.
Ah well.
* Unify szr_stats
* Unify log commands, completions
* Fix compile
* Improve completion with complex cases (quotes, escapes)
* Code cleanup, comments.
* Fix tab completion with empty arg ruining everything.
* Fix RegisteredCommand completions
* Add more complex completion options system.
* Refactor content directory entries into a proper resource manager API.
* Implement GetEntries for DirLoader
* Make type hint darker.
* Exec command autocomplete, pulled play global sound code out to engine.
86 lines
2.7 KiB
C#
86 lines
2.7 KiB
C#
using System.Text;
|
|
using Robust.Shared.Configuration;
|
|
using Robust.Shared.Console;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Network;
|
|
using Robust.Shared.Serialization;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Robust.Server.Console.Commands
|
|
{
|
|
sealed class RestartCommand : IConsoleCommand
|
|
{
|
|
public string Command => "restart";
|
|
public string Description => "Gracefully restarts the server (not just the round).";
|
|
public string Help => "restart";
|
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
IoCManager.Resolve<IBaseServer>().Restart();
|
|
}
|
|
}
|
|
|
|
sealed class ShutdownCommand : IConsoleCommand
|
|
{
|
|
public string Command => "shutdown";
|
|
public string Description => "Gracefully shuts down the server.";
|
|
public string Help => "shutdown";
|
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
IoCManager.Resolve<IBaseServer>().Shutdown(null);
|
|
}
|
|
}
|
|
|
|
public sealed class SaveConfig : IConsoleCommand
|
|
{
|
|
public string Command => "saveconfig";
|
|
public string Description => "Saves the server configuration to the config file";
|
|
public string Help => "saveconfig";
|
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
IoCManager.Resolve<IConfigurationManager>().SaveToFile();
|
|
}
|
|
}
|
|
|
|
sealed class NetworkAuditCommand : IConsoleCommand
|
|
{
|
|
public string Command => "netaudit";
|
|
public string Description => "Prints into about NetMsg security.";
|
|
public string Help => "netaudit";
|
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
var network = (NetManager) IoCManager.Resolve<INetManager>();
|
|
|
|
var callbacks = network.CallbackAudit;
|
|
|
|
var sb = new StringBuilder();
|
|
|
|
foreach (var kvCallback in callbacks)
|
|
{
|
|
var msgType = kvCallback.Key;
|
|
var call = kvCallback.Value;
|
|
|
|
sb.AppendLine($"Type: {msgType.Name.PadRight(16)} Call:{call.Target}");
|
|
}
|
|
|
|
shell.WriteLine(sb.ToString());
|
|
}
|
|
}
|
|
|
|
sealed class ShowTimeCommand : IConsoleCommand
|
|
{
|
|
public string Command => "showtime";
|
|
public string Description => "Shows the server time.";
|
|
public string Help => "showtime";
|
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
var timing = IoCManager.Resolve<IGameTiming>();
|
|
shell.WriteLine($"Paused: {timing.Paused}, CurTick: {timing.CurTick}, CurTime: {timing.CurTime}, RealTime: {timing.RealTime}");
|
|
}
|
|
}
|
|
}
|