using Content.Server.Administration; using Content.Server.Atmos.EntitySystems; using Content.Shared.Administration; using Content.Shared.Atmos; using Robust.Shared.Console; using Robust.Shared.Map.Components; namespace Content.Server.Atmos.Commands { [AdminCommand(AdminFlags.Debug)] public sealed class SetAtmosTemperatureCommand : IConsoleCommand { [Dependency] private readonly IEntityManager _entManager = default!; public string Command => "setatmostemp"; public string Description => "Sets a grid's temperature (in kelvin)."; public string Help => "Usage: setatmostemp "; public void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length < 2) return; if (!_entManager.TryParseNetEntity(args[0], out var gridId) || !float.TryParse(args[1], out var temperature)) { return; } if (temperature < Atmospherics.TCMB) { shell.WriteLine("Invalid temperature."); return; } if (!gridId.Value.IsValid() || !_entManager.HasComponent(gridId)) { shell.WriteLine("Invalid grid ID."); return; } var atmosphereSystem = _entManager.System(); var tiles = 0; foreach (var tile in atmosphereSystem.GetAllMixtures(gridId.Value, true)) { tiles++; tile.Temperature = temperature; } shell.WriteLine($"Changed the temperature of {tiles} tiles."); } } }