mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-02 10:07:15 +02:00
* [Dependency] source generator No more reflection, no more codegen at runtime Also various changes to Roslyn helpers to make this easier to write. Requires all types with dependencies to be partial and not have readonly dependency fields. An analyzer enforces this at warning level, the previous injection strategies have remained in the code *for now* as a fallback. No fallback is available for [field: Dependency] properties, due to a Roslyn bug. Code Fixes exist. We love Roslyn * Apply dependencies generator changes to all code * Release notes * Preprocessor got hands * Handle nullable dependencies These are bad but gotta deal with it. * Apply suggestions from code review Co-authored-by: Moony <moony@hellomouse.net> * Fine, let's not use collection expressions --------- Co-authored-by: Moony <moony@hellomouse.net>
72 lines
2.1 KiB
C#
72 lines
2.1 KiB
C#
using System.Text;
|
|
using Robust.Shared.Configuration;
|
|
using Robust.Shared.Console;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Network;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Robust.Server.Console.Commands
|
|
{
|
|
/*
|
|
// Disabled for now since it doesn't actually work.
|
|
sealed class RestartCommand : LocalizedCommands
|
|
{
|
|
[Dependency] private IBaseServer _server = default!;
|
|
|
|
public override string Command => "restart";
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
_server.Restart();
|
|
}
|
|
}
|
|
*/
|
|
|
|
sealed partial class ShutdownCommand : LocalizedCommands
|
|
{
|
|
[Dependency] private IBaseServer _server = default!;
|
|
|
|
public override string Command => "shutdown";
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
_server.Shutdown(null);
|
|
}
|
|
}
|
|
|
|
sealed partial class NetworkAuditCommand : LocalizedCommands
|
|
{
|
|
[Dependency] private INetManager _netManager = default!;
|
|
|
|
public override string Command => "netaudit";
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
var callbacks = ((NetManager)_netManager).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 partial class ShowTimeCommand : LocalizedCommands
|
|
{
|
|
[Dependency] private IGameTiming _timing = default!;
|
|
|
|
public override string Command => "showtime";
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
shell.WriteLine($"Paused: {_timing.Paused}, CurTick: {_timing.CurTick}, CurTime: {_timing.CurTime}, RealTime: {_timing.RealTime}");
|
|
}
|
|
}
|
|
}
|