Skip to content

Commit

Permalink
Toolshed refactor (#33598)
Browse files Browse the repository at this point in the history
* Content changes for engine toolshed PR

* add contains command

* more permissive commands
  • Loading branch information
ElectroJr authored Dec 21, 2024
1 parent b011dbb commit 06e2bba
Show file tree
Hide file tree
Showing 19 changed files with 204 additions and 262 deletions.
20 changes: 17 additions & 3 deletions Content.IntegrationTests/Tests/Toolshed/AdminTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Content.Server.Administration.Managers;
using Robust.Shared.Toolshed;

namespace Content.IntegrationTests.Tests.Toolshed;
Expand All @@ -10,10 +11,23 @@ public sealed class AdminTest : ToolshedTest
[Test]
public async Task AllCommandsHavePermissions()
{
var toolMan = Server.ResolveDependency<ToolshedManager>();
var admin = Server.ResolveDependency<IAdminManager>();
var ignored = new HashSet<Assembly>()
{typeof(LocTest).Assembly, typeof(Robust.UnitTesting.Shared.Toolshed.LocTest).Assembly};

await Server.WaitAssertion(() =>
{
Assert.That(InvokeCommand("cmd:list where { acmd:perms isnull }", out var res));
Assert.That((IEnumerable<CommandSpec>) res, Is.Empty, "All commands must have admin permissions set up.");
Assert.Multiple(() =>
{
foreach (var cmd in toolMan.DefaultEnvironment.AllCommands())
{
if (ignored.Contains(cmd.Cmd.GetType().Assembly))
continue;

Assert.That(admin.TryGetCommandFlags(cmd, out _), $"Command does not have admin permissions set up: {cmd.FullName()}");
}
});
});
}
}
23 changes: 20 additions & 3 deletions Content.IntegrationTests/Tests/Toolshed/LocTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using System.Globalization;
using Robust.Shared.IoC;
using System.Reflection;
using Robust.Shared.Localization;
using Robust.Shared.Toolshed;

Expand All @@ -14,10 +14,27 @@ public sealed class LocTest : ToolshedTest
[Test]
public async Task AllCommandsHaveDescriptions()
{
var locMan = Server.ResolveDependency<ILocalizationManager>();
var toolMan = Server.ResolveDependency<ToolshedManager>();
var locStrings = new HashSet<string>();

var ignored = new HashSet<Assembly>()
{typeof(LocTest).Assembly, typeof(Robust.UnitTesting.Shared.Toolshed.LocTest).Assembly};

await Server.WaitAssertion(() =>
{
Assert.That(InvokeCommand("cmd:list where { cmd:descloc loc:tryloc isnull }", out var res));
Assert.That((IEnumerable<CommandSpec>)res!, Is.Empty, "All commands must have localized descriptions.");
Assert.Multiple(() =>
{
foreach (var cmd in toolMan.DefaultEnvironment.AllCommands())
{
if (ignored.Contains(cmd.Cmd.GetType().Assembly))
continue;

var descLoc = cmd.DescLocStr();
Assert.That(locStrings.Add(descLoc), $"Duplicate command description key: {descLoc}");
Assert.That(locMan.TryGetString(descLoc, out _), $"Failed to get command description for command {cmd.FullName()}");
}
});
});
}
}
27 changes: 22 additions & 5 deletions Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ protected T InvokeCommand<T>(string command)
return (T) res!;
}

protected void ParseCommand(string command, Type? inputType = null, Type? expectedType = null, bool once = false)
protected void ParseCommand(string command, Type? inputType = null, Type? expectedType = null)
{
var parser = new ParserContext(command, Toolshed);
var success = CommandRun.TryParse(false, parser, inputType, expectedType, once, out _, out _, out var error);
var success = CommandRun.TryParse(parser, inputType, expectedType, out _);

Check failure on line 80 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

There is no argument given that corresponds to the required parameter 'once' of 'CommandRun.TryParse(bool, ParserContext, Type?, Type?, bool, out CommandRun?, out ValueTask<(CompletionResult?, IConError?)>?, out IConError?)'

Check failure on line 80 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

There is no argument given that corresponds to the required parameter 'once' of 'CommandRun.TryParse(bool, ParserContext, Type?, Type?, bool, out CommandRun?, out ValueTask<(CompletionResult?, IConError?)>?, out IConError?)'

Check failure on line 80 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

There is no argument given that corresponds to the required parameter 'once' of 'CommandRun.TryParse(bool, ParserContext, Type?, Type?, bool, out CommandRun?, out ValueTask<(CompletionResult?, IConError?)>?, out IConError?)'

Check failure on line 80 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

There is no argument given that corresponds to the required parameter 'once' of 'CommandRun.TryParse(bool, ParserContext, Type?, Type?, bool, out CommandRun?, out ValueTask<(CompletionResult?, IConError?)>?, out IConError?)'

Check failure on line 80 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

There is no argument given that corresponds to the required parameter 'once' of 'CommandRun.TryParse(bool, ParserContext, Type?, Type?, bool, out CommandRun?, out ValueTask<(CompletionResult?, IConError?)>?, out IConError?)'

Check failure on line 80 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

There is no argument given that corresponds to the required parameter 'once' of 'CommandRun.TryParse(bool, ParserContext, Type?, Type?, bool, out CommandRun?, out ValueTask<(CompletionResult?, IConError?)>?, out IConError?)'

if (error is not null)
ReportError(error);
if (parser.Error is not null)

Check failure on line 82 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

'ParserContext' does not contain a definition for 'Error' and no accessible extension method 'Error' accepting a first argument of type 'ParserContext' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 82 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

'ParserContext' does not contain a definition for 'Error' and no accessible extension method 'Error' accepting a first argument of type 'ParserContext' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 82 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'ParserContext' does not contain a definition for 'Error' and no accessible extension method 'Error' accepting a first argument of type 'ParserContext' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 82 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'ParserContext' does not contain a definition for 'Error' and no accessible extension method 'Error' accepting a first argument of type 'ParserContext' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 82 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'ParserContext' does not contain a definition for 'Error' and no accessible extension method 'Error' accepting a first argument of type 'ParserContext' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 82 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'ParserContext' does not contain a definition for 'Error' and no accessible extension method 'Error' accepting a first argument of type 'ParserContext' could be found (are you missing a using directive or an assembly reference?)
ReportError(parser.Error);

Check failure on line 83 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

'ParserContext' does not contain a definition for 'Error' and no accessible extension method 'Error' accepting a first argument of type 'ParserContext' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 83 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

'ParserContext' does not contain a definition for 'Error' and no accessible extension method 'Error' accepting a first argument of type 'ParserContext' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 83 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'ParserContext' does not contain a definition for 'Error' and no accessible extension method 'Error' accepting a first argument of type 'ParserContext' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 83 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'ParserContext' does not contain a definition for 'Error' and no accessible extension method 'Error' accepting a first argument of type 'ParserContext' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 83 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'ParserContext' does not contain a definition for 'Error' and no accessible extension method 'Error' accepting a first argument of type 'ParserContext' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 83 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'ParserContext' does not contain a definition for 'Error' and no accessible extension method 'Error' accepting a first argument of type 'ParserContext' could be found (are you missing a using directive or an assembly reference?)

if (error is null)
if (parser.Error is null)

Check failure on line 85 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

'ParserContext' does not contain a definition for 'Error' and no accessible extension method 'Error' accepting a first argument of type 'ParserContext' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 85 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

'ParserContext' does not contain a definition for 'Error' and no accessible extension method 'Error' accepting a first argument of type 'ParserContext' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 85 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'ParserContext' does not contain a definition for 'Error' and no accessible extension method 'Error' accepting a first argument of type 'ParserContext' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 85 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'ParserContext' does not contain a definition for 'Error' and no accessible extension method 'Error' accepting a first argument of type 'ParserContext' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 85 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'ParserContext' does not contain a definition for 'Error' and no accessible extension method 'Error' accepting a first argument of type 'ParserContext' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 85 in Content.IntegrationTests/Tests/Toolshed/ToolshedTest.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'ParserContext' does not contain a definition for 'Error' and no accessible extension method 'Error' accepting a first argument of type 'ParserContext' could be found (are you missing a using directive or an assembly reference?)
Assert.That(success, $"Parse failed despite no error being reported. Parsed {command}");
}

Expand Down Expand Up @@ -153,11 +153,28 @@ public IEnumerable<IConError> GetErrors()
return _errors;
}

public bool HasErrors => _errors.Count > 0;

public void ClearErrors()
{
_errors.Clear();
}

public object? ReadVar(string name)
{
return Variables.GetValueOrDefault(name);
}

public void WriteVar(string name, object? value)
{
Variables[name] = value;
}

public IEnumerable<string> GetVars()
{
return Variables.Keys;
}

public Dictionary<string, object?> Variables { get; } = new();

protected void ExpectError(Type err)
Expand Down
17 changes: 4 additions & 13 deletions Content.Server/Access/AddAccessLogCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ namespace Content.Server.Access;
public sealed class AddAccessLogCommand : ToolshedCommand
{
[CommandImplementation]
public void AddAccessLog(
[CommandInvocationContext] IInvocationContext ctx,
[CommandArgument] EntityUid input,
[CommandArgument] float seconds,
[CommandArgument] ValueRef<string> accessor)
public void AddAccessLog(IInvocationContext ctx, EntityUid input, float seconds, string accessor)
{
var accessReader = EnsureComp<AccessReaderComponent>(input);

Expand All @@ -23,19 +19,14 @@ public void AddAccessLog(
ctx.WriteLine($"WARNING: Surpassing the limit of the log by {accessLogCount - accessReader.AccessLogLimit+1} entries!");

var accessTime = TimeSpan.FromSeconds(seconds);
var accessName = accessor.Evaluate(ctx)!;
accessReader.AccessLog.Enqueue(new AccessRecord(accessTime, accessName));
accessReader.AccessLog.Enqueue(new AccessRecord(accessTime, accessor));
ctx.WriteLine($"Successfully added access log to {input} with this information inside:\n " +
$"Time of access: {accessTime}\n " +
$"Accessed by: {accessName}");
$"Accessed by: {accessor}");
}

[CommandImplementation]
public void AddAccessLogPiped(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] EntityUid input,
[CommandArgument] float seconds,
[CommandArgument] ValueRef<string> accessor)
public void AddAccessLogPiped(IInvocationContext ctx, [PipedArgument] EntityUid input, float seconds, string accessor)
{
AddAccessLog(ctx, input, seconds, accessor);
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Administration/Toolshed/MarkedCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Content.Server.Administration.Toolshed;
public sealed class MarkedCommand : ToolshedCommand
{
[CommandImplementation]
public IEnumerable<EntityUid> Marked([CommandInvocationContext] IInvocationContext ctx)
public IEnumerable<EntityUid> Marked(IInvocationContext ctx)
{
var res = (IEnumerable<EntityUid>?)ctx.ReadVar("marked");
res ??= Array.Empty<EntityUid>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public IEnumerable<EntityUid> Rejuvenate([PipedArgument] IEnumerable<EntityUid>
}

[CommandImplementation]
public void Rejuvenate([CommandInvocationContext] IInvocationContext ctx)
public void Rejuvenate(IInvocationContext ctx)
{
_rejuvenate ??= GetSys<RejuvenateSystem>();
if (ExecutingEntity(ctx) is not { } ent)
Expand Down
34 changes: 12 additions & 22 deletions Content.Server/Administration/Toolshed/SolutionCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Robust.Shared.Toolshed.Syntax;
using Robust.Shared.Toolshed.TypeParsers;
using System.Linq;
using Robust.Shared.Prototypes;

namespace Content.Server.Administration.Toolshed;

Expand All @@ -17,61 +18,50 @@ public sealed class SolutionCommand : ToolshedCommand
private SharedSolutionContainerSystem? _solutionContainer;

[CommandImplementation("get")]
public SolutionRef? Get(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] EntityUid input,
[CommandArgument] ValueRef<string> name
)
public SolutionRef? Get([PipedArgument] EntityUid input, string name)
{
_solutionContainer ??= GetSys<SharedSolutionContainerSystem>();

if (_solutionContainer.TryGetSolution(input, name.Evaluate(ctx)!, out var solution))
if (_solutionContainer.TryGetSolution(input, name, out var solution))
return new SolutionRef(solution.Value);

return null;
}

[CommandImplementation("get")]
public IEnumerable<SolutionRef> Get(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] IEnumerable<EntityUid> input,
[CommandArgument] ValueRef<string> name
)
public IEnumerable<SolutionRef> Get([PipedArgument] IEnumerable<EntityUid> input, string name)
{
return input.Select(x => Get(ctx, x, name)).Where(x => x is not null).Cast<SolutionRef>();
return input.Select(x => Get(x, name)).Where(x => x is not null).Cast<SolutionRef>();
}

[CommandImplementation("adjreagent")]
public SolutionRef AdjReagent(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] SolutionRef input,
[CommandArgument] Prototype<ReagentPrototype> name,
[CommandArgument] ValueRef<FixedPoint2> amountRef
ProtoId<ReagentPrototype> proto,
FixedPoint2 amount
)
{
_solutionContainer ??= GetSys<SharedSolutionContainerSystem>();

var amount = amountRef.Evaluate(ctx);
if (amount > 0)
{
_solutionContainer.TryAddReagent(input.Solution, name.Value.ID, amount, out _);
_solutionContainer.TryAddReagent(input.Solution, proto, amount, out _);
}
else if (amount < 0)
{
_solutionContainer.RemoveReagent(input.Solution, name.Value.ID, -amount);
_solutionContainer.RemoveReagent(input.Solution, proto, -amount);
}

return input;
}

[CommandImplementation("adjreagent")]
public IEnumerable<SolutionRef> AdjReagent(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] IEnumerable<SolutionRef> input,
[CommandArgument] Prototype<ReagentPrototype> name,
[CommandArgument] ValueRef<FixedPoint2> amountRef
ProtoId<ReagentPrototype> name,
FixedPoint2 amount
)
=> input.Select(x => AdjReagent(ctx, x, name, amountRef));
=> input.Select(x => AdjReagent(x, name, amount));
}

public readonly record struct SolutionRef(Entity<SolutionComponent> Solution)
Expand Down
64 changes: 16 additions & 48 deletions Content.Server/Administration/Toolshed/TagCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,82 +36,50 @@ public IEnumerable<EntityUid> With(
}

[CommandImplementation("add")]
public EntityUid Add(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] EntityUid input,
[CommandArgument] ValueRef<string, Prototype<TagPrototype>> @ref
)
public EntityUid Add([PipedArgument] EntityUid input, ProtoId<TagPrototype> tag)
{
_tag ??= GetSys<TagSystem>();
_tag.AddTag(input, @ref.Evaluate(ctx)!);
_tag.AddTag(input, tag);
return input;
}

[CommandImplementation("add")]
public IEnumerable<EntityUid> Add(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] IEnumerable<EntityUid> input,
[CommandArgument] ValueRef<string, Prototype<TagPrototype>> @ref
)
=> input.Select(x => Add(ctx, x, @ref));
public IEnumerable<EntityUid> Add([PipedArgument] IEnumerable<EntityUid> input, ProtoId<TagPrototype> tag)
=> input.Select(x => Add(x, tag));

[CommandImplementation("rm")]
public EntityUid Rm(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] EntityUid input,
[CommandArgument] ValueRef<string, Prototype<TagPrototype>> @ref
)
public EntityUid Rm([PipedArgument] EntityUid input, ProtoId<TagPrototype> tag)
{
_tag ??= GetSys<TagSystem>();
_tag.RemoveTag(input, @ref.Evaluate(ctx)!);
_tag.RemoveTag(input, tag);
return input;
}

[CommandImplementation("rm")]
public IEnumerable<EntityUid> Rm(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] IEnumerable<EntityUid> input,
[CommandArgument] ValueRef<string, Prototype<TagPrototype>> @ref
)
=> input.Select(x => Rm(ctx, x, @ref));
public IEnumerable<EntityUid> Rm([PipedArgument] IEnumerable<EntityUid> input, ProtoId<TagPrototype> tag)
=> input.Select(x => Rm(x, tag));

[CommandImplementation("addmany")]
public EntityUid AddMany(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] EntityUid input,
[CommandArgument] ValueRef<IEnumerable<string>, IEnumerable<string>> @ref
)
public EntityUid AddMany([PipedArgument] EntityUid input, IEnumerable<ProtoId<TagPrototype>> tags)
{
_tag ??= GetSys<TagSystem>();
_tag.AddTags(input, (IEnumerable<ProtoId<TagPrototype>>)@ref.Evaluate(ctx)!);
_tag.AddTags(input, tags);
return input;
}

[CommandImplementation("addmany")]
public IEnumerable<EntityUid> AddMany(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] IEnumerable<EntityUid> input,
[CommandArgument] ValueRef<IEnumerable<string>, IEnumerable<string>> @ref
)
=> input.Select(x => AddMany(ctx, x, @ref));
public IEnumerable<EntityUid> AddMany([PipedArgument] IEnumerable<EntityUid> input, IEnumerable<ProtoId<TagPrototype>> tags)
=> input.Select(x => AddMany(x, tags.ToArray()));

[CommandImplementation("rmmany")]
public EntityUid RmMany(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] EntityUid input,
[CommandArgument] ValueRef<IEnumerable<string>, IEnumerable<string>> @ref
)
public EntityUid RmMany([PipedArgument] EntityUid input, IEnumerable<ProtoId<TagPrototype>> tags)
{
_tag ??= GetSys<TagSystem>();
_tag.RemoveTags(input, (IEnumerable<ProtoId<TagPrototype>>)@ref.Evaluate(ctx)!);
_tag.RemoveTags(input, tags);
return input;
}

[CommandImplementation("rmmany")]
public IEnumerable<EntityUid> RmMany(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] IEnumerable<EntityUid> input,
[CommandArgument] ValueRef<IEnumerable<string>, IEnumerable<string>> @ref
)
=> input.Select(x => RmMany(ctx, x, @ref));
public IEnumerable<EntityUid> RmMany([PipedArgument] IEnumerable<EntityUid> input, IEnumerable<ProtoId<TagPrototype>> tags)
=> input.Select(x => RmMany(x, tags.ToArray()));
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public sealed class DeleteChatMessageCommand : ToolshedCommand
[Dependency] private readonly IEntitySystemManager _manager = default!;

[CommandImplementation("id")]
public void DeleteChatMessage([CommandInvocationContext] IInvocationContext ctx, [CommandArgument] uint messageId)
public void DeleteChatMessage(IInvocationContext ctx, uint messageId)
{
if (!_manager.GetEntitySystem<ChatRepositorySystem>().Delete(messageId))
{
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Chat/V2/Commands/NukeChatMessagesCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public sealed class NukeChatMessagesCommand : ToolshedCommand
[Dependency] private readonly IEntitySystemManager _manager = default!;

[CommandImplementation("usernames")]
public void Command([CommandInvocationContext] IInvocationContext ctx, [CommandArgument] string usernamesCsv)
public void Command(IInvocationContext ctx, string usernamesCsv)
{
var usernames = usernamesCsv.Split(',');

Expand Down
11 changes: 1 addition & 10 deletions Content.Server/Mind/Toolshed/MindCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,10 @@ public sealed class MindCommand : ToolshedCommand
}

[CommandImplementation("control")]
public EntityUid Control(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] EntityUid target,
[CommandArgument] ValueRef<ICommonSession> playerRef)
public EntityUid Control(IInvocationContext ctx, [PipedArgument] EntityUid target, ICommonSession player)
{
_mind ??= GetSys<SharedMindSystem>();

var player = playerRef.Evaluate(ctx);
if (player is null)
{
ctx.ReportError(new NotForServerConsoleError());
return target;
}

if (!_mind.TryGetMind(player, out var mindId, out var mind))
{
Expand Down
Loading

0 comments on commit 06e2bba

Please sign in to comment.