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 SetTemperatureCommand : IConsoleCommand
|
2020-12-03 03:40:47 +01:00
|
|
|
|
{
|
|
|
|
|
|
public string Command => "settemp";
|
|
|
|
|
|
public string Description => "Sets a tile's temperature (in kelvin).";
|
|
|
|
|
|
public string Help => "Usage: settemp <X> <Y> <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 < 4) return;
|
|
|
|
|
|
if(!int.TryParse(args[0], out var x)
|
|
|
|
|
|
|| !int.TryParse(args[1], out var y)
|
|
|
|
|
|
|| !int.TryParse(args[2], out var id)
|
|
|
|
|
|
|| !float.TryParse(args[3], out var temperature)) return;
|
|
|
|
|
|
|
|
|
|
|
|
var gridId = new GridId(id);
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
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.Temperature = temperature;
|
2020-12-03 03:40:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|