From 3346cb41d83acbc37061940c1bb7836d3c180176 Mon Sep 17 00:00:00 2001 From: Kayzel <43700376+KayzelW@users.noreply.github.com> Date: Tue, 1 Oct 2024 21:15:05 +0300 Subject: [PATCH] Update AdminLanguageCommand.cs --- .../Language/Commands/AdminLanguageCommand.cs | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/Content.Server/Backmen/Language/Commands/AdminLanguageCommand.cs b/Content.Server/Backmen/Language/Commands/AdminLanguageCommand.cs index fbac5d803c6..0cf844ac08a 100644 --- a/Content.Server/Backmen/Language/Commands/AdminLanguageCommand.cs +++ b/Content.Server/Backmen/Language/Commands/AdminLanguageCommand.cs @@ -20,14 +20,12 @@ public sealed class AdminLanguageCommand : ToolshedCommand public EntityUid AddLanguage( [CommandInvocationContext] IInvocationContext ctx, [PipedArgument] EntityUid input, - [CommandArgument] ValueRef> @ref, - [CommandArgument] bool canSpeak = true, - [CommandArgument] bool canUnderstand = true + [CommandArgument] Prototype prototype, + [CommandArgument] bool? canSpeak = true, + [CommandArgument] bool? canUnderstand = true ) { - var language = @ref.Evaluate(ctx)!; - - if (language == SharedLanguageSystem.UniversalPrototype) + if (prototype.Id == SharedLanguageSystem.UniversalPrototype) { EnsureComp(input); Languages.UpdateEntityLanguages(input); @@ -35,7 +33,7 @@ public EntityUid AddLanguage( else { EnsureComp(input); - Languages.AddLanguage(input, language, canSpeak, canUnderstand); + Languages.AddLanguage(input, prototype.Id, canSpeak ?? true, canUnderstand ?? true); } return input; @@ -45,20 +43,19 @@ public EntityUid AddLanguage( public EntityUid RemoveLanguage( [CommandInvocationContext] IInvocationContext ctx, [PipedArgument] EntityUid input, - [CommandArgument] ValueRef> @ref, - [CommandArgument] bool removeSpeak = true, - [CommandArgument] bool removeUnderstand = true + [CommandArgument] Prototype prototype, + [CommandArgument] bool? removeSpeak = true, + [CommandArgument] bool? removeUnderstand = true ) { - var language = @ref.Evaluate(ctx)!; - if (language == SharedLanguageSystem.UniversalPrototype && HasComp(input)) + if (prototype.Id == SharedLanguageSystem.UniversalPrototype && HasComp(input)) { RemComp(input); EnsureComp(input); } // We execute this branch even in case of universal so that it gets removed if it was added manually to the LanguageSpeaker - Languages.RemoveLanguage(input, language, removeSpeak, removeUnderstand); + Languages.RemoveLanguage(input, prototype.Id, removeSpeak ?? true, removeUnderstand ?? true); return input; }