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.Map;
|
|
|
|
|
|
using Robust.Shared.Maths;
|
|
|
|
|
|
|
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 AddGasCommand : IConsoleCommand
|
2020-12-03 03:40:47 +01:00
|
|
|
|
{
|
|
|
|
|
|
public string Command => "addgas";
|
|
|
|
|
|
public string Description => "Adds gas at a certain position.";
|
|
|
|
|
|
public string Help => "addgas <X> <Y> <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 < 5) return;
|
|
|
|
|
|
if(!int.TryParse(args[0], out var x)
|
|
|
|
|
|
|| !int.TryParse(args[1], out var y)
|
|
|
|
|
|
|| !int.TryParse(args[2], out var id)
|
|
|
|
|
|
|| !(AtmosCommandUtils.TryParseGasID(args[3], out var gasId))
|
|
|
|
|
|
|| !float.TryParse(args[4], out var moles)) return;
|
|
|
|
|
|
|
|
|
|
|
|
var gridId = new GridId(id);
|
|
|
|
|
|
|
2021-07-19 12:07:37 +02:00
|
|
|
|
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
2020-12-03 03:40:47 +01:00
|
|
|
|
var indices = new Vector2i(x, y);
|
2021-07-19 12:07:37 +02:00
|
|
|
|
var tile = atmosphereSystem.GetTileMixture(gridId, indices, true);
|
2020-12-03 03:40:47 +01:00
|
|
|
|
|
|
|
|
|
|
if (tile == null)
|
|
|
|
|
|
{
|
2021-07-19 12:07:37 +02:00
|
|
|
|
shell.WriteLine("Invalid coordinates or tile.");
|
2020-12-03 03:40:47 +01:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-07-19 12:07:37 +02:00
|
|
|
|
tile.AdjustMoles(gasId, moles);
|
2020-12-03 03:40:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|