mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-10 02:41:18 +03:00
* Scope creep my ass * why was this shit not pushed???? * gone... * fix that * review plus buildd * asfsafsafsafsafas * grug * burber * I'll fix this later * shrimply die * also this * it's snerf or snuthin * assaads * round snend * aaaa * fix this shit for real * actually, don't start GameRules until MapInit now that I think aboot it. * forgot u * don't actually need this part nullable * Deffer comp removal * one liner * do that too * chungus * Honestly makes more sense here, plus WHY are we doing all that shit on "GameRuleAdded" rather than GameRuleStarted(?) * deferred removal :V * aaaaaaaaaaaaaaa * whhop * Whoop * better * landmine that I placed for myself then forgot about lmao * cleanup * FUCKING `!` * gotovo * amogus * please don't check by metadata I beg * waawsasfdfsasfa * sfafsasfafsas * fdsaasffsasfa * code * fix * fasasffasfasfsad * chungaas * I may be stupid * gra * graaaaaaaaaaaaaaaaa * comment * gra * clearing is not predicted and would require major refactors, so don't cache on client. * lame shit :P * last holes * nukeopsfsafsasafsfafsa * why was that shit public bruh * bubrbgwahrghfaka * dynamic * revert change that did nothing lmao
120 lines
3.8 KiB
C#
120 lines
3.8 KiB
C#
using System.Diagnostics;
|
|
using System.Linq;
|
|
using Content.Server.Administration;
|
|
using Content.Server.Cargo.Systems;
|
|
using Content.Server.Station.Systems;
|
|
using Content.Shared.Administration;
|
|
using Content.Shared.Station;
|
|
using Content.Shared.Station.Components;
|
|
using Robust.Shared.Toolshed;
|
|
using Robust.Shared.Toolshed.Errors;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Server.Station.Commands;
|
|
|
|
[ToolshedCommand, AdminCommand(AdminFlags.Admin)]
|
|
public sealed class StationsCommand : ToolshedCommand
|
|
{
|
|
private ServerStationSystem? _station;
|
|
private CargoSystem? _cargo;
|
|
|
|
[CommandImplementation("list")]
|
|
public IEnumerable<EntityUid> List()
|
|
{
|
|
_station ??= GetSys<ServerStationSystem>();
|
|
|
|
return _station.GetStationsSet();
|
|
}
|
|
|
|
[CommandImplementation("get")]
|
|
public EntityUid Get(IInvocationContext ctx)
|
|
{
|
|
_station ??= GetSys<ServerStationSystem>();
|
|
|
|
var set = _station.GetStationsSet();
|
|
if (set.Count > 1 || set.Count == 0)
|
|
ctx.ReportError(new OnlyOneStationsError());
|
|
|
|
return set.FirstOrDefault();
|
|
}
|
|
|
|
[CommandImplementation("getowningstation")]
|
|
public IEnumerable<EntityUid?> GetOwningStation([PipedArgument] IEnumerable<EntityUid> input)
|
|
=> input.Select(GetOwningStation);
|
|
|
|
[CommandImplementation("getowningstation")]
|
|
public EntityUid? GetOwningStation([PipedArgument] EntityUid input)
|
|
{
|
|
_station ??= GetSys<ServerStationSystem>();
|
|
|
|
return _station.GetOwningStation(input);
|
|
}
|
|
|
|
[CommandImplementation("largestgrid")]
|
|
public EntityUid? LargestGrid([PipedArgument] EntityUid input)
|
|
{
|
|
_station ??= GetSys<ServerStationSystem>();
|
|
return _station.GetLargestGrid(input);
|
|
}
|
|
|
|
[CommandImplementation("largestgrid")]
|
|
public IEnumerable<EntityUid?> LargestGrid([PipedArgument] IEnumerable<EntityUid> input)
|
|
=> input.Select(LargestGrid);
|
|
|
|
|
|
[CommandImplementation("grids")]
|
|
public IEnumerable<EntityUid> Grids([PipedArgument] EntityUid input)
|
|
=> Comp<StationDataComponent>(input).Grids;
|
|
|
|
[CommandImplementation("grids")]
|
|
public IEnumerable<EntityUid> Grids([PipedArgument] IEnumerable<EntityUid> input)
|
|
=> input.SelectMany(Grids);
|
|
|
|
[CommandImplementation("config")]
|
|
public StationConfig? Config([PipedArgument] EntityUid input)
|
|
=> Comp<StationDataComponent>(input).StationConfig;
|
|
|
|
[CommandImplementation("config")]
|
|
public IEnumerable<StationConfig?> Config([PipedArgument] IEnumerable<EntityUid> input)
|
|
=> input.Select(Config);
|
|
|
|
[CommandImplementation("addgrid")]
|
|
public void AddGrid([PipedArgument] EntityUid input, EntityUid grid)
|
|
{
|
|
_station ??= GetSys<ServerStationSystem>();
|
|
_station.AddGridToStation(input, grid);
|
|
}
|
|
|
|
[CommandImplementation("rmgrid")]
|
|
public void RmGrid([PipedArgument] EntityUid input, EntityUid grid)
|
|
{
|
|
_station ??= GetSys<ServerStationSystem>();
|
|
_station.RemoveGridFromStation(input, grid);
|
|
}
|
|
|
|
[CommandImplementation("rename")]
|
|
public void Rename([PipedArgument] EntityUid input, string name)
|
|
{
|
|
_station ??= GetSys<ServerStationSystem>();
|
|
_station.RenameStation(input, name);
|
|
}
|
|
|
|
[CommandImplementation("rerollBounties")]
|
|
public void RerollBounties([PipedArgument] EntityUid input)
|
|
{
|
|
_cargo ??= GetSys<CargoSystem>();
|
|
_cargo.RerollBountyDatabase(input);
|
|
}
|
|
}
|
|
|
|
public record struct OnlyOneStationsError : IConError
|
|
{
|
|
public FormattedMessage DescribeInner()
|
|
{
|
|
return FormattedMessage.FromMarkupOrThrow("This command doesn't function if there is more than one or no stations, explicitly specify a station with the ent command or similar.");
|
|
}
|
|
|
|
public string? Expression { get; set; }
|
|
public Vector2i? IssueSpan { get; set; }
|
|
public StackTrace? Trace { get; set; }
|
|
}
|