Merge branch 'master' into replace-sounds-with-sound-specifier
This commit is contained in:
@@ -23,23 +23,20 @@ namespace Content.Server.Atmos.Components
|
||||
[ViewVariables]
|
||||
[ComponentDependency] private readonly FlammableComponent? _flammableComponent = null;
|
||||
|
||||
public void Update(TileAtmosphere tile, float frameDelta, AtmosphereSystem atmosphereSystem)
|
||||
public void Update(GasMixture air, float frameDelta, AtmosphereSystem atmosphereSystem)
|
||||
{
|
||||
if (_temperatureComponent != null)
|
||||
{
|
||||
if (tile.Air != null)
|
||||
{
|
||||
var temperatureDelta = tile.Air.Temperature - _temperatureComponent.CurrentTemperature;
|
||||
var tileHeatCapacity = atmosphereSystem.GetHeatCapacity(tile.Air);
|
||||
var heat = temperatureDelta * (tileHeatCapacity * _temperatureComponent.HeatCapacity / (tileHeatCapacity + _temperatureComponent.HeatCapacity));
|
||||
_temperatureComponent.ReceiveHeat(heat);
|
||||
}
|
||||
var temperatureDelta = air.Temperature - _temperatureComponent.CurrentTemperature;
|
||||
var tileHeatCapacity = atmosphereSystem.GetHeatCapacity(air);
|
||||
var heat = temperatureDelta * (tileHeatCapacity * _temperatureComponent.HeatCapacity / (tileHeatCapacity + _temperatureComponent.HeatCapacity));
|
||||
_temperatureComponent.ReceiveHeat(heat);
|
||||
_temperatureComponent.Update();
|
||||
}
|
||||
|
||||
_barotraumaComponent?.Update(tile.Air?.Pressure ?? 0);
|
||||
_barotraumaComponent?.Update(air.Pressure);
|
||||
|
||||
_flammableComponent?.Update(tile);
|
||||
_flammableComponent?.Update(air);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Doors;
|
||||
using Content.Server.Doors.Components;
|
||||
using Content.Shared.Doors;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
namespace Content.Server.Atmos.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Companion component to ServerDoorComponent that handles firelock-specific behavior -- primarily prying, and not being openable on open-hand click.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(IDoorCheck))]
|
||||
public class FirelockComponent : Component, IDoorCheck
|
||||
{
|
||||
public override string Name => "Firelock";
|
||||
|
||||
[ComponentDependency]
|
||||
private readonly ServerDoorComponent? _doorComponent = null;
|
||||
|
||||
public bool EmergencyPressureStop()
|
||||
{
|
||||
if (_doorComponent != null && _doorComponent.State == SharedDoorComponent.DoorState.Open && _doorComponent.CanCloseGeneric())
|
||||
{
|
||||
_doorComponent.Close();
|
||||
if (Owner.TryGetComponent(out AirtightComponent? airtight))
|
||||
{
|
||||
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IDoorCheck.OpenCheck()
|
||||
{
|
||||
return !IsHoldingFire() && !IsHoldingPressure();
|
||||
}
|
||||
|
||||
bool IDoorCheck.DenyCheck() => false;
|
||||
|
||||
float? IDoorCheck.GetPryTime()
|
||||
{
|
||||
if (IsHoldingFire() || IsHoldingPressure())
|
||||
{
|
||||
return 1.5f;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
bool IDoorCheck.BlockActivate(ActivateEventArgs eventArgs) => true;
|
||||
|
||||
void IDoorCheck.OnStartPry(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
if (_doorComponent == null || _doorComponent.State != SharedDoorComponent.DoorState.Closed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsHoldingPressure())
|
||||
{
|
||||
Owner.PopupMessage(eventArgs.User, Loc.GetString("firelock-component-is-holding-pressure-message"));
|
||||
}
|
||||
else if (IsHoldingFire())
|
||||
{
|
||||
Owner.PopupMessage(eventArgs.User, Loc.GetString("firelock-component-is-holding-fire-message"));
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsHoldingPressure(float threshold = 20)
|
||||
{
|
||||
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||
|
||||
var minMoles = float.MaxValue;
|
||||
var maxMoles = 0f;
|
||||
|
||||
foreach (var adjacent in atmosphereSystem.GetAdjacentTileMixtures(Owner.Transform.Coordinates))
|
||||
{
|
||||
var moles = adjacent.TotalMoles;
|
||||
if (moles < minMoles)
|
||||
minMoles = moles;
|
||||
if (moles > maxMoles)
|
||||
maxMoles = moles;
|
||||
}
|
||||
|
||||
return (maxMoles - minMoles) > threshold;
|
||||
}
|
||||
|
||||
public bool IsHoldingFire()
|
||||
{
|
||||
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||
|
||||
if (!atmosphereSystem.TryGetGridAndTile(Owner.Transform.Coordinates, out var tuple))
|
||||
return false;
|
||||
|
||||
if (atmosphereSystem.GetTileMixture(tuple.Value.Grid, tuple.Value.Tile) == null)
|
||||
return false;
|
||||
|
||||
if (atmosphereSystem.IsHotspotActive(tuple.Value.Grid, tuple.Value.Tile))
|
||||
return true;
|
||||
|
||||
foreach (var adjacent in atmosphereSystem.GetAdjacentTiles(Owner.Transform.Coordinates))
|
||||
{
|
||||
if (atmosphereSystem.IsHotspotActive(tuple.Value.Grid, adjacent))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@ namespace Content.Server.Atmos.Components
|
||||
UpdateAppearance();
|
||||
}
|
||||
|
||||
public void Update(TileAtmosphere tile)
|
||||
public void Update(GasMixture air)
|
||||
{
|
||||
// Slowly dry ourselves off if wet.
|
||||
if (FireStacks < 0)
|
||||
@@ -104,13 +104,13 @@ namespace Content.Server.Atmos.Components
|
||||
}
|
||||
|
||||
// If we're in an oxygenless environment, put the fire out.
|
||||
if (tile.Air?.GetMoles(Gas.Oxygen) < 1f)
|
||||
if (air.GetMoles(Gas.Oxygen) < 1f)
|
||||
{
|
||||
Extinguish();
|
||||
return;
|
||||
}
|
||||
|
||||
EntitySystem.Get<AtmosphereSystem>().HotspotExpose(tile.GridIndex, tile.GridIndices, 700f, 50f, true);
|
||||
EntitySystem.Get<AtmosphereSystem>().HotspotExpose(Owner.Transform.Coordinates, 700f, 50f, true);
|
||||
|
||||
var physics = Owner.GetComponent<IPhysBody>();
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#nullable disable warnings
|
||||
using System;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Body.Respiratory;
|
||||
|
||||
@@ -14,13 +14,14 @@ using Dependency = Robust.Shared.IoC.DependencyAttribute;
|
||||
namespace Content.Server.Atmos.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// This is our SSAir equivalent.
|
||||
/// Internal Atmos class. Use <see cref="AtmosphereSystem"/> to interact with atmos instead.
|
||||
/// </summary>
|
||||
[ComponentReference(typeof(IGridAtmosphereComponent))]
|
||||
[ComponentReference(typeof(IAtmosphereComponent))]
|
||||
[RegisterComponent, Serializable]
|
||||
public class GridAtmosphereComponent : Component, IGridAtmosphereComponent, ISerializationHooks
|
||||
public class GridAtmosphereComponent : Component, IAtmosphereComponent, ISerializationHooks
|
||||
{
|
||||
public override string Name => "GridAtmosphere";
|
||||
|
||||
public virtual bool Simulated => true;
|
||||
|
||||
[ViewVariables]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Content.Server.Atmos.Components
|
||||
{
|
||||
public interface IGridAtmosphereComponent : IComponent
|
||||
public interface IAtmosphereComponent : IComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether this atmosphere is simulated or not.
|
||||
13
Content.Server/Atmos/Components/SpaceAtmosphereComponent.cs
Normal file
13
Content.Server/Atmos/Components/SpaceAtmosphereComponent.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.Atmos.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(IAtmosphereComponent))]
|
||||
public class SpaceAtmosphereComponent : Component, IAtmosphereComponent
|
||||
{
|
||||
public override string Name => "SpaceAtmosphere";
|
||||
|
||||
public bool Simulated => false;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Server.Atmos.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(IGridAtmosphereComponent))]
|
||||
public class SpaceGridAtmosphereComponent : UnsimulatedGridAtmosphereComponent
|
||||
{
|
||||
public override string Name => "SpaceGridAtmosphere";
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,9 @@ using Robust.Shared.Maths;
|
||||
namespace Content.Server.Atmos.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(IGridAtmosphereComponent))]
|
||||
[ComponentReference(typeof(GridAtmosphereComponent))]
|
||||
[ComponentReference(typeof(IAtmosphereComponent))]
|
||||
[Serializable]
|
||||
public class UnsimulatedGridAtmosphereComponent : GridAtmosphereComponent, IGridAtmosphereComponent
|
||||
public class UnsimulatedGridAtmosphereComponent : GridAtmosphereComponent
|
||||
{
|
||||
public override string Name => "UnsimulatedGridAtmosphere";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user