Merge branch 'master' into 2020-08-19-firelocks
# Conflicts: # Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs # Content.Shared/Maps/TurfHelpers.cs # SpaceStation14.sln.DotSettings
This commit is contained in:
@@ -17,11 +17,21 @@ namespace Content.Server.Atmos
|
||||
{
|
||||
public string Command => "addatmos";
|
||||
public string Description => "Adds atmos support to a grid.";
|
||||
public string Help => "addatmos <GridId>";
|
||||
public string Help => $"{Command} <GridId>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
{
|
||||
if (args.Length < 1) return;
|
||||
if(!int.TryParse(args[0], out var id)) return;
|
||||
if (args.Length < 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
var gridId = new GridId(id);
|
||||
|
||||
@@ -29,7 +39,7 @@ namespace Content.Server.Atmos
|
||||
|
||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||
{
|
||||
shell.SendText(player, "Invalid grid ID.");
|
||||
shell.SendText(player, $"{gridId} is not a valid grid id.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -41,7 +51,7 @@ namespace Content.Server.Atmos
|
||||
return;
|
||||
}
|
||||
|
||||
if (grid.HasComponent<GridAtmosphereComponent>())
|
||||
if (grid.HasComponent<IGridAtmosphereComponent>())
|
||||
{
|
||||
shell.SendText(player, "Grid already has an atmosphere.");
|
||||
return;
|
||||
@@ -53,6 +63,56 @@ namespace Content.Server.Atmos
|
||||
}
|
||||
}
|
||||
|
||||
public class AddUnsimulatedAtmos : IClientCommand
|
||||
{
|
||||
public string Command => "addunsimulatedatmos";
|
||||
public string Description => "Adds unimulated atmos support to a grid.";
|
||||
public string Help => $"{Command} <GridId>";
|
||||
|
||||
public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args)
|
||||
{
|
||||
if (args.Length < 1)
|
||||
{
|
||||
shell.SendText(player, Help);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var id))
|
||||
{
|
||||
shell.SendText(player, $"{args[0]} is not a valid integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
var gridId = new GridId(id);
|
||||
|
||||
var mapMan = IoCManager.Resolve<IMapManager>();
|
||||
|
||||
if (!gridId.IsValid() || !mapMan.TryGetGrid(gridId, out var gridComp))
|
||||
{
|
||||
shell.SendText(player, $"{gridId} is not a valid grid id.");
|
||||
return;
|
||||
}
|
||||
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (!entMan.TryGetEntity(gridComp.GridEntityId, out var grid))
|
||||
{
|
||||
shell.SendText(player, "Failed to get grid entity.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (grid.HasComponent<IGridAtmosphereComponent>())
|
||||
{
|
||||
shell.SendText(player, "Grid already has an atmosphere.");
|
||||
return;
|
||||
}
|
||||
|
||||
grid.AddComponent<UnsimulatedGridAtmosphereComponent>();
|
||||
|
||||
shell.SendText(player, $"Added unsimulated atmosphere to grid {id}.");
|
||||
}
|
||||
}
|
||||
|
||||
public class ListGases : IClientCommand
|
||||
{
|
||||
public string Command => "listgases";
|
||||
|
||||
@@ -105,6 +105,7 @@ namespace Content.Server.Atmos
|
||||
{
|
||||
if (tile?.Air == null) continue;
|
||||
tile.Air.CopyFromMutable(combined);
|
||||
tile.AtmosCooldown = 0;
|
||||
tile.UpdateVisuals();
|
||||
}
|
||||
|
||||
@@ -131,7 +132,7 @@ namespace Content.Server.Atmos
|
||||
_disposed = true;
|
||||
_gridAtmosphereComponent.RemoveExcitedGroup(this);
|
||||
|
||||
Dismantle();
|
||||
Dismantle(false);
|
||||
|
||||
_gridAtmosphereComponent = null;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Server.GameObjects.Components.Chemistry;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Content.Shared.Interfaces;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
@@ -13,13 +13,11 @@ using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
|
||||
namespace Content.Server.Atmos
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class GasSprayerComponent : Component, IAfterInteract
|
||||
{
|
||||
[Dependency] private readonly IServerNotifyManager _notifyManager = default!;
|
||||
[Dependency] private readonly IServerEntityManager _serverEntityManager = default!;
|
||||
|
||||
//TODO: create a function that can create a gas based on a solution mix
|
||||
@@ -48,7 +46,7 @@ namespace Content.Server.Atmos
|
||||
|
||||
if (tank.Solution.GetReagentQuantity(_fuelType) == 0)
|
||||
{
|
||||
_notifyManager.PopupMessage(Owner, eventArgs.User,
|
||||
Owner.PopupMessage(eventArgs.User,
|
||||
Loc.GetString("{0:theName} is out of {1}!", Owner, _fuelName));
|
||||
}
|
||||
else
|
||||
|
||||
@@ -9,6 +9,7 @@ using Content.Server.Interfaces;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Maps;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -40,6 +41,9 @@ namespace Content.Server.Atmos
|
||||
[ViewVariables]
|
||||
private static GasTileOverlaySystem _gasTileOverlaySystem;
|
||||
|
||||
[ViewVariables]
|
||||
public int AtmosCooldown { get; set; } = 0;
|
||||
|
||||
[ViewVariables]
|
||||
private float _temperature = Atmospherics.T20C;
|
||||
|
||||
@@ -73,9 +77,11 @@ namespace Content.Server.Atmos
|
||||
[ViewVariables]
|
||||
private readonly TileAtmosphere[] _adjacentTiles = new TileAtmosphere[Atmospherics.Directions];
|
||||
|
||||
[ViewVariables]
|
||||
private AtmosDirection _adjacentBits = AtmosDirection.Invalid;
|
||||
|
||||
[ViewVariables, UsedImplicitly]
|
||||
private int AdjacentBitsInt => (int)_adjacentBits;
|
||||
|
||||
[ViewVariables]
|
||||
private TileAtmosInfo _tileAtmosInfo;
|
||||
|
||||
@@ -84,6 +90,9 @@ namespace Content.Server.Atmos
|
||||
|
||||
private AtmosDirection _pressureDirection;
|
||||
|
||||
[ViewVariables, UsedImplicitly]
|
||||
private int PressureDirectionInt => (int)_pressureDirection;
|
||||
|
||||
[ViewVariables]
|
||||
public GridId GridIndex { get; }
|
||||
|
||||
@@ -635,6 +644,15 @@ namespace Content.Server.Atmos
|
||||
|
||||
_currentCycle = fireCount;
|
||||
var adjacentTileLength = 0;
|
||||
|
||||
AtmosCooldown++;
|
||||
for (var i = 0; i < Atmospherics.Directions; i++)
|
||||
{
|
||||
var direction = (AtmosDirection) (1 << i);
|
||||
if(_adjacentBits.HasFlag(direction))
|
||||
adjacentTileLength++;
|
||||
}
|
||||
|
||||
for(var i = 0; i < Atmospherics.Directions; i++)
|
||||
{
|
||||
var direction = (AtmosDirection) (1 << i);
|
||||
@@ -643,7 +661,6 @@ namespace Content.Server.Atmos
|
||||
|
||||
// If the tile is null or has no air, we don't do anything for it.
|
||||
if(enemyTile?.Air == null) continue;
|
||||
adjacentTileLength++;
|
||||
if (fireCount <= enemyTile._currentCycle) continue;
|
||||
enemyTile.Archive(fireCount);
|
||||
|
||||
@@ -703,7 +720,13 @@ namespace Content.Server.Atmos
|
||||
React();
|
||||
UpdateVisuals();
|
||||
|
||||
if((!(Air.Temperature > Atmospherics.MinimumTemperatureStartSuperConduction && ConsiderSuperconductivity(true))) && ExcitedGroup == null)
|
||||
var remove = true;
|
||||
|
||||
if(Air.Temperature > Atmospherics.MinimumTemperatureStartSuperConduction)
|
||||
if (ConsiderSuperconductivity(true))
|
||||
remove = false;
|
||||
|
||||
if((ExcitedGroup == null && remove) || (AtmosCooldown > (Atmospherics.ExcitedGroupsDismantleCycles * 2)))
|
||||
_gridAtmosphereComponent.RemoveActiveTile(this);
|
||||
}
|
||||
|
||||
@@ -1143,9 +1166,11 @@ namespace Content.Server.Atmos
|
||||
if (lastShare > Atmospherics.MinimumAirToSuspend)
|
||||
{
|
||||
ExcitedGroup.ResetCooldowns();
|
||||
AtmosCooldown = 0;
|
||||
} else if (lastShare > Atmospherics.MinimumMolesDeltaToMove)
|
||||
{
|
||||
ExcitedGroup.DismantleCooldown = 0;
|
||||
AtmosCooldown = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user