Fires now play a sound effect. (#6138)

This commit is contained in:
Vera Aguilera Puerto
2022-01-13 15:18:17 +01:00
committed by GitHub
parent 0990389a20
commit daef343c2c
8 changed files with 76 additions and 21 deletions

View File

@@ -9,25 +9,31 @@ using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Physics;
using Robust.Shared.Player;
using Robust.Shared.ViewVariables;
namespace Content.Server.Atmos.EntitySystems
{
public partial class AtmosphereSystem
{
private const int SpaceWindSoundCooldownCycles = 75;
private int _spaceWindSoundCooldown = 0;
[ViewVariables(VVAccess.ReadWrite)]
public string? SpaceWindSound { get; private set; } = "/Audio/Effects/space_wind.ogg";
private void HighPressureMovements(GridAtmosphereComponent gridAtmosphere, TileAtmosphere tile)
{
// TODO ATMOS finish this
if(tile.PressureDifference > 15)
// Don't play the space wind sound on tiles that are on fire...
if(tile.PressureDifference > 15 && !tile.Hotspot.Valid)
{
if(_spaceWindSoundCooldown == 0)
if(_spaceWindSoundCooldown == 0 && !string.IsNullOrEmpty(SpaceWindSound))
{
var coordinates = tile.GridIndices.ToEntityCoordinates(tile.GridIndex, _mapManager);
if(!string.IsNullOrEmpty(SpaceWindSound))
SoundSystem.Play(Filter.Pvs(coordinates), SpaceWindSound, coordinates,
AudioHelpers.WithVariation(0.125f).WithVolume(MathHelper.Clamp(tile.PressureDifference / 10, 10, 100)));
SoundSystem.Play(Filter.Pvs(coordinates), SpaceWindSound, coordinates,
AudioHelpers.WithVariation(0.125f).WithVolume(MathHelper.Clamp(tile.PressureDifference / 10, 10, 100)));
}
}
@@ -51,8 +57,7 @@ namespace Content.Server.Atmos.EntitySystems
// TODO ATMOS Do space wind graphics here!
}
_spaceWindSoundCooldown++;
if (_spaceWindSoundCooldown > 75)
if (_spaceWindSoundCooldown++ > SpaceWindSoundCooldownCycles)
_spaceWindSoundCooldown = 0;
}