mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-06-09 10:06:34 +02:00
83c2a1be11
* [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>
77 lines
2.5 KiB
C#
77 lines
2.5 KiB
C#
using Robust.Client.Debugging;
|
|
using Robust.Shared.Console;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Localization;
|
|
|
|
namespace Robust.Client.Console.Commands
|
|
{
|
|
public sealed partial class PhysicsOverlayCommands : LocalizedCommands
|
|
{
|
|
[Dependency] private IEntitySystemManager _entitySystems = default!;
|
|
|
|
public override string Command => "physics";
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
if (args.Length != 1)
|
|
{
|
|
shell.WriteError(Loc.GetString("shell-wrong-arguments-number-need-specific", ("properAmount", 1), ("currentAmount", args.Length)));
|
|
return;
|
|
}
|
|
|
|
var system = _entitySystems.GetEntitySystem<DebugPhysicsSystem>();
|
|
|
|
switch (args[0])
|
|
{
|
|
case "aabbs":
|
|
system.Flags ^= PhysicsDebugFlags.AABBs;
|
|
break;
|
|
case "com":
|
|
system.Flags ^= PhysicsDebugFlags.COM;
|
|
break;
|
|
case "contactnormals":
|
|
system.Flags ^= PhysicsDebugFlags.ContactNormals;
|
|
break;
|
|
case "contactpoints":
|
|
system.Flags ^= PhysicsDebugFlags.ContactPoints;
|
|
break;
|
|
case "distance":
|
|
system.Flags ^= PhysicsDebugFlags.Distance;
|
|
break;
|
|
case "joints":
|
|
system.Flags ^= PhysicsDebugFlags.Joints;
|
|
break;
|
|
case "shapeinfo":
|
|
system.Flags ^= PhysicsDebugFlags.ShapeInfo;
|
|
break;
|
|
case "shapes":
|
|
system.Flags ^= PhysicsDebugFlags.Shapes;
|
|
break;
|
|
default:
|
|
shell.WriteError(Loc.GetString("cmd-physics-overlay", ("overlay", args[0])));
|
|
return;
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
|
{
|
|
if (args.Length != 1) return CompletionResult.Empty;
|
|
|
|
return CompletionResult.FromOptions(new[]
|
|
{
|
|
"aabbs",
|
|
"com",
|
|
"contactnormals",
|
|
"contactpoints",
|
|
"distance",
|
|
"joints",
|
|
"shapeinfo",
|
|
"shapes",
|
|
});
|
|
}
|
|
}
|
|
}
|