@@ -4,6 +4,7 @@ using Content.Server.Administration;
|
||||
using Content.Server.Cargo.Systems;
|
||||
using Content.Server.EUI;
|
||||
using Content.Server.Item;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Materials;
|
||||
@@ -56,6 +57,9 @@ public sealed class StatValuesCommand : IConsoleCommand
|
||||
case "itemsize":
|
||||
message = GetItem();
|
||||
break;
|
||||
case "drawrate":
|
||||
message = GetDrawRateMessage();
|
||||
break;
|
||||
default:
|
||||
shell.WriteError(Loc.GetString("stat-values-invalid", ("arg", args[0])));
|
||||
return;
|
||||
@@ -70,7 +74,7 @@ public sealed class StatValuesCommand : IConsoleCommand
|
||||
{
|
||||
if (args.Length == 1)
|
||||
{
|
||||
return CompletionResult.FromOptions(new[] { "cargosell", "lathesell", "melee" });
|
||||
return CompletionResult.FromOptions(new[] { "cargosell", "lathesell", "melee", "itemsize", "drawrate" });
|
||||
}
|
||||
|
||||
return CompletionResult.Empty;
|
||||
@@ -250,4 +254,44 @@ public sealed class StatValuesCommand : IConsoleCommand
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
private StatValuesEuiMessage GetDrawRateMessage()
|
||||
{
|
||||
var values = new List<string[]>();
|
||||
var powerName = _factory.GetComponentName(typeof(ApcPowerReceiverComponent));
|
||||
|
||||
foreach (var proto in _proto.EnumeratePrototypes<EntityPrototype>())
|
||||
{
|
||||
if (proto.Abstract ||
|
||||
!proto.Components.TryGetValue(powerName,
|
||||
out var powerConsumer))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var comp = (ApcPowerReceiverComponent) powerConsumer.Component;
|
||||
|
||||
if (comp.Load == 0)
|
||||
continue;
|
||||
|
||||
values.Add(new[]
|
||||
{
|
||||
proto.ID,
|
||||
comp.Load.ToString(CultureInfo.InvariantCulture),
|
||||
});
|
||||
}
|
||||
|
||||
var state = new StatValuesEuiMessage
|
||||
{
|
||||
Title = Loc.GetString("stat-drawrate-values"),
|
||||
Headers = new List<string>
|
||||
{
|
||||
Loc.GetString("stat-drawrate-id"),
|
||||
Loc.GetString("stat-drawrate-rate"),
|
||||
},
|
||||
Values = values,
|
||||
};
|
||||
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user