diff --git a/Content.Server/Language/Commands/AdminLanguageCommand.cs b/Content.Server/Language/Commands/AdminLanguageCommand.cs index 2e7a0b193a1..12899747f70 100644 --- a/Content.Server/Language/Commands/AdminLanguageCommand.cs +++ b/Content.Server/Language/Commands/AdminLanguageCommand.cs @@ -20,13 +20,11 @@ public sealed class AdminLanguageCommand : ToolshedCommand public EntityUid AddLanguage( [CommandInvocationContext] IInvocationContext ctx, [PipedArgument] EntityUid input, - [CommandArgument] ValueRef> @ref, + [CommandArgument] ProtoId language, [CommandArgument] bool canSpeak = true, [CommandArgument] bool canUnderstand = true ) { - var language = @ref.Evaluate(ctx)!; - if (language == SharedLanguageSystem.UniversalPrototype) { EnsureComp(input); @@ -45,12 +43,11 @@ public EntityUid AddLanguage( public EntityUid RemoveLanguage( [CommandInvocationContext] IInvocationContext ctx, [PipedArgument] EntityUid input, - [CommandArgument] ValueRef> @ref, + [CommandArgument] ProtoId language, [CommandArgument] bool removeSpeak = true, [CommandArgument] bool removeUnderstand = true ) { - var language = @ref.Evaluate(ctx)!; if (language == SharedLanguageSystem.UniversalPrototype && HasComp(input)) { RemComp(input); diff --git a/Content.Server/Language/Commands/AdminTranslatorCommand.cs b/Content.Server/Language/Commands/AdminTranslatorCommand.cs index fc8ee02e386..d7cdef0a0c2 100644 --- a/Content.Server/Language/Commands/AdminTranslatorCommand.cs +++ b/Content.Server/Language/Commands/AdminTranslatorCommand.cs @@ -26,12 +26,11 @@ public sealed class AdminTranslatorCommand : ToolshedCommand public EntityUid AddLanguage( [CommandInvocationContext] IInvocationContext ctx, [PipedArgument] EntityUid input, - [CommandArgument] ValueRef> @ref, + [CommandArgument] ProtoId language, [CommandArgument] bool addSpeak = true, [CommandArgument] bool addUnderstand = true ) { - var language = @ref.Evaluate(ctx)!; // noob trap - needs a universallanguagespeakercomponent if (language == SharedLanguageSystem.UniversalPrototype) throw new ArgumentException(Loc.GetString("command-language-error-this-will-not-work")); @@ -53,12 +52,11 @@ public EntityUid AddLanguage( public EntityUid RemoveLanguage( [CommandInvocationContext] IInvocationContext ctx, [PipedArgument] EntityUid input, - [CommandArgument] ValueRef> @ref, + [CommandArgument] ProtoId language, [CommandArgument] bool removeSpeak = true, [CommandArgument] bool removeUnderstand = true ) { - var language = @ref.Evaluate(ctx)!; if (!TryGetTranslatorComp(input, out var translator)) throw new ArgumentException(Loc.GetString("command-language-error-not-a-translator", ("entity", input))); @@ -76,9 +74,8 @@ public EntityUid RemoveLanguage( public EntityUid AddRequiredLanguage( [CommandInvocationContext] IInvocationContext ctx, [PipedArgument] EntityUid input, - [CommandArgument] ValueRef> @ref) + [CommandArgument] ProtoId language) { - var language = @ref.Evaluate(ctx)!; if (!TryGetTranslatorComp(input, out var translator)) throw new ArgumentException(Loc.GetString("command-language-error-not-a-translator", ("entity", input))); @@ -95,9 +92,8 @@ public EntityUid AddRequiredLanguage( public EntityUid RemoveRequiredLanguage( [CommandInvocationContext] IInvocationContext ctx, [PipedArgument] EntityUid input, - [CommandArgument] ValueRef> @ref) + [CommandArgument] ProtoId language) { - var language = @ref.Evaluate(ctx)!; if (!TryGetTranslatorComp(input, out var translator)) throw new ArgumentException(Loc.GetString("command-language-error-not-a-translator", ("entity", input))); diff --git a/Content.Server/Station/Commands/JobsCommand.cs b/Content.Server/Station/Commands/JobsCommand.cs index 1e39140e840..3f26090828b 100644 --- a/Content.Server/Station/Commands/JobsCommand.cs +++ b/Content.Server/Station/Commands/JobsCommand.cs @@ -3,6 +3,7 @@ using Content.Server.Station.Systems; using Content.Shared.Administration; using Content.Shared.Roles; +using Robust.Shared.Prototypes; using Robust.Shared.Toolshed; using Robust.Shared.Toolshed.Syntax; using Robust.Shared.Toolshed.TypeParsers; @@ -26,28 +27,24 @@ public IEnumerable Jobs([PipedArgument] EntityUid station) } [CommandImplementation("jobs")] - public IEnumerable Jobs([PipedArgument] IEnumerable stations) - => stations.SelectMany(Jobs); + public IEnumerable Jobs([PipedArgument] IEnumerable stations) => stations.SelectMany(Jobs); [CommandImplementation("job")] - public JobSlotRef Job([PipedArgument] EntityUid station, Prototype job) + public JobSlotRef Job([PipedArgument] EntityUid station, ProtoId job) { _jobs ??= GetSys(); - return new JobSlotRef(job.Value.ID, station, _jobs, EntityManager); + return new JobSlotRef(job, station, _jobs, EntityManager); } [CommandImplementation("job")] - public IEnumerable Job([PipedArgument] IEnumerable stations, Prototype job) - => stations.Select(x => Job(x, job)); + public IEnumerable Job([PipedArgument] IEnumerable stations, ProtoId job) => stations.Select(x => Job(x, job)); [CommandImplementation("isinfinite")] - public bool IsInfinite([PipedArgument] JobSlotRef job, [CommandInverted] bool inverted) - => job.Infinite() ^ inverted; + public bool IsInfinite([PipedArgument] JobSlotRef job, [CommandInverted] bool inverted) => job.Infinite() ^ inverted; [CommandImplementation("isinfinite")] - public IEnumerable IsInfinite([PipedArgument] IEnumerable jobs, [CommandInverted] bool inverted) - => jobs.Select(x => IsInfinite(x, inverted)); + public IEnumerable IsInfinite([PipedArgument] IEnumerable jobs, [CommandInverted] bool inverted) => jobs.Select(x => IsInfinite(x, inverted)); [CommandImplementation("adjust")] public JobSlotRef Adjust([PipedArgument] JobSlotRef @ref, int by) @@ -58,8 +55,7 @@ public JobSlotRef Adjust([PipedArgument] JobSlotRef @ref, int by) } [CommandImplementation("adjust")] - public IEnumerable Adjust([PipedArgument] IEnumerable @ref, int by) - => @ref.Select(x => Adjust(x, by)); + public IEnumerable Adjust([PipedArgument] IEnumerable @ref, int by) => @ref.Select(x => Adjust(x, by)); [CommandImplementation("set")] @@ -71,20 +67,18 @@ public JobSlotRef Set([PipedArgument] JobSlotRef @ref, int by) } [CommandImplementation("set")] - public IEnumerable Set([PipedArgument] IEnumerable @ref, int by) - => @ref.Select(x => Set(x, by)); + public IEnumerable Set([PipedArgument] IEnumerable @ref, int by) => @ref.Select(x => Set(x, by)); [CommandImplementation("amount")] public uint Amount([PipedArgument] JobSlotRef @ref) { _jobs ??= GetSys(); _jobs.TryGetJobSlot(@ref.Station, @ref.Job, out var slots); - return slots.HasValue ? slots.Value : 0; + return slots ?? 0; } [CommandImplementation("amount")] - public IEnumerable Amount([PipedArgument] IEnumerable @ref) - => @ref.Select(Amount); + public IEnumerable Amount([PipedArgument] IEnumerable @ref) => @ref.Select(Amount); } // Used for Toolshed queries. diff --git a/Content.Server/StationEvents/BasicStationEventSchedulerSystem.cs b/Content.Server/StationEvents/BasicStationEventSchedulerSystem.cs index 95c2b0085bd..7dcb5ac30df 100644 --- a/Content.Server/StationEvents/BasicStationEventSchedulerSystem.cs +++ b/Content.Server/StationEvents/BasicStationEventSchedulerSystem.cs @@ -92,7 +92,7 @@ public sealed class StationEventCommand : ToolshedCommand /// to even exist) so I think it's fine. /// [CommandImplementation("simulate")] - public IEnumerable<(string, float)> Simulate([CommandArgument] int rounds, [CommandArgument] int playerCount, [CommandArgument] float roundEndMean, [CommandArgument] float roundEndStdDev) + public IEnumerable<(string, float)> Simulate(EntityPrototype eventScheduler, int rounds, int playerCount, float roundEndMean, float roundEndStdDev) { _stationEvent ??= GetSys(); _basicScheduler ??= GetSys();