Chem guidebook (#17123)
* im good at atomizing. welcome to half-finished chem guides. * wagh * e * save work * aa * woweee UI * finishing the last of it * don't actually update the engine :( --------- Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
This commit is contained in:
47
Content.Server/Chemistry/Commands/DumpReagentGuideText.cs
Normal file
47
Content.Server/Chemistry/Commands/DumpReagentGuideText.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Chemistry.Commands;
|
||||
|
||||
[AdminCommand(AdminFlags.Debug)]
|
||||
public sealed class DumpReagentGuideText : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
[Dependency] private readonly IEntitySystemManager _entSys = default!;
|
||||
|
||||
public string Command => "dumpreagentguidetext";
|
||||
public string Description => "Dumps the guidebook text for a reagent to the console";
|
||||
public string Help => "dumpreagentguidetext <reagent>";
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
shell.WriteError("Must have only 1 argument");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_prototype.TryIndex<ReagentPrototype>(args[0], out var reagent))
|
||||
{
|
||||
shell.WriteError($"Invalid prototype: {args[0]}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (reagent.Metabolisms is null)
|
||||
{
|
||||
shell.WriteLine("Nothing to dump.");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var (_, entry) in reagent.Metabolisms)
|
||||
{
|
||||
foreach (var effect in entry.Effects)
|
||||
{
|
||||
shell.WriteLine(effect.GuidebookEffectDescription(_prototype, _entSys) ?? $"[skipped effect of type {effect.GetType()}]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user