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 SetAtmosTemperatureCommand : IConsoleCommand
|
2020-12-03 03:40:47 +01:00
|
|
|
|
{
|
|
|
|
|
|
public string Command => "setatmostemp";
|
|
|
|
|
|
public string Description => "Sets a grid's temperature (in kelvin).";
|
|
|
|
|
|
public string Help => "Usage: setatmostemp <GridId> <Temperature>";
|
|
|
|
|
|
|
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 < 2) return;
|
|
|
|
|
|
if(!int.TryParse(args[0], out var id)
|
|
|
|
|
|
|| !float.TryParse(args[1], out var temperature)) return;
|
|
|
|
|
|
|
|
|
|
|
|
var gridId = new GridId(id);
|
|
|
|
|
|
|
|
|
|
|
|
var mapMan = IoCManager.Resolve<IMapManager>();
|
|
|
|
|
|
|
|
|
|
|
|
if (temperature < Atmospherics.TCMB)
|
|
|
|
|
|
{
|
2021-02-01 16:49:43 -08:00
|
|
|
|
shell.WriteLine("Invalid temperature.");
|
2020-12-03 03:40:47 +01:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
|
|
|
|
|
{
|
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
|
|
|
|
|
|
|
|
|
|
var tiles = 0;
|
2021-07-19 12:07:37 +02:00
|
|
|
|
foreach (var tile in atmosphereSystem.GetAllTileMixtures(gridId, true))
|
2020-12-03 03:40:47 +01:00
|
|
|
|
{
|
|
|
|
|
|
tiles++;
|
2021-07-19 12:07:37 +02:00
|
|
|
|
tile.Temperature = temperature;
|
2020-12-03 03:40:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-02-01 16:49:43 -08:00
|
|
|
|
shell.WriteLine($"Changed the temperature of {tiles} tiles.");
|
2020-12-03 03:40:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|