2021-07-17 02:37:09 +02:00
|
|
|
|
using Content.Server.Administration;
|
2021-07-19 12:07:37 +02:00
|
|
|
|
using Content.Server.Atmos.EntitySystems;
|
2020-12-03 03:40:47 +01:00
|
|
|
|
using Content.Shared.Administration;
|
|
|
|
|
|
using Content.Shared.Atmos;
|
2021-02-01 16:49:43 -08:00
|
|
|
|
using Robust.Shared.Console;
|
2021-02-11 01:13:03 -08:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2020-12-03 03:40:47 +01:00
|
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
|
using Robust.Shared.Map;
|
|
|
|
|
|
|
2021-07-25 09:04:58 +02:00
|
|
|
|
namespace Content.Server.Atmos.Commands
|
2020-12-03 03:40:47 +01:00
|
|
|
|
{
|
|
|
|
|
|
[AdminCommand(AdminFlags.Debug)]
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class FillGas : IConsoleCommand
|
2020-12-03 03:40:47 +01:00
|
|
|
|
{
|
|
|
|
|
|
public string Command => "fillgas";
|
|
|
|
|
|
public string Description => "Adds gas to all tiles in a grid.";
|
|
|
|
|
|
public string Help => "fillgas <GridId> <Gas> <moles>";
|
|
|
|
|
|
|
2021-02-01 16:49:43 -08:00
|
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
2020-12-03 03:40:47 +01:00
|
|
|
|
{
|
|
|
|
|
|
if (args.Length < 3) return;
|
|
|
|
|
|
if(!int.TryParse(args[0], out var id)
|
|
|
|
|
|
|| !(AtmosCommandUtils.TryParseGasID(args[1], out var gasId))
|
|
|
|
|
|
|| !float.TryParse(args[2], out var moles)) return;
|
|
|
|
|
|
|
|
|
|
|
|
var gridId = new GridId(id);
|
|
|
|
|
|
|
|
|
|
|
|
var mapMan = IoCManager.Resolve<IMapManager>();
|
|
|
|
|
|
|
2021-07-19 12:07:37 +02:00
|
|
|
|
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out _))
|
2020-12-03 03:40:47 +01:00
|
|
|
|
{
|
2021-02-01 16:49:43 -08:00
|
|
|
|
shell.WriteLine("Invalid grid ID.");
|
2020-12-03 03:40:47 +01:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-07-19 12:07:37 +02:00
|
|
|
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
2020-12-03 03:40:47 +01:00
|
|
|
|
|
2021-07-19 12:07:37 +02:00
|
|
|
|
foreach (var tile in atmosphereSystem.GetAllTileMixtures(gridId, true))
|
2020-12-03 03:40:47 +01:00
|
|
|
|
{
|
2021-07-19 12:07:37 +02:00
|
|
|
|
tile.AdjustMoles(gasId, moles);
|
2020-12-03 03:40:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|