Ambience enhancements. (#7073)

This commit is contained in:
Moony
2022-03-12 16:20:31 -06:00
committed by GitHub
parent 6d2c5868a3
commit f5c92caef4
29 changed files with 290 additions and 68 deletions

View File

@@ -16,7 +16,7 @@ namespace Content.Shared.Audio
[DataField("enabled")]
public bool Enabled { get; set; } = true;
[DataField("sound")]
[DataField("sound", required: true)]
public SoundSpecifier Sound = default!;
/// <summary>

View File

@@ -31,13 +31,13 @@ namespace Content.Shared.CCVar
/// How long we'll wait until re-sampling nearby objects for ambience.
/// </summary>
public static readonly CVarDef<float> AmbientCooldown =
CVarDef.Create("ambience.cooldown", 0.5f, CVar.REPLICATED | CVar.SERVER);
CVarDef.Create("ambience.cooldown", 0.1f, CVar.REPLICATED | CVar.SERVER);
public static readonly CVarDef<float> AmbientRange =
CVarDef.Create("ambience.range", 5f, CVar.REPLICATED | CVar.SERVER);
public static readonly CVarDef<int> MaxAmbientSources =
CVarDef.Create("ambience.max_sounds", 6, CVar.REPLICATED | CVar.SERVER);
CVarDef.Create("ambience.max_sounds", 64, CVar.REPLICATED | CVar.SERVER);
/*
* Status

View File

@@ -1,3 +1,4 @@
using Content.Shared.Audio;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Content.Shared.Maps;
@@ -16,6 +17,7 @@ namespace Content.Shared.SubFloor
[Dependency] protected readonly IMapManager MapManager = default!;
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
[Dependency] private readonly TrayScannerSystem _trayScannerSystem = default!;
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
public override void Initialize()
{
@@ -181,6 +183,10 @@ namespace Content.Shared.SubFloor
appearance.SetData(SubFloorVisuals.Covered, hideComp.IsUnderCover);
appearance.SetData(SubFloorVisuals.ScannerRevealed, hideComp.RevealedBy.Count != 0);
if (hideComp.BlockAmbience && hideComp.IsUnderCover)
_ambientSoundSystem.SetAmbience(uid, false);
else if (hideComp.BlockAmbience && !hideComp.IsUnderCover)
_ambientSoundSystem.SetAmbience(uid, true);
}
}

View File

@@ -29,6 +29,15 @@ namespace Content.Shared.SubFloor
[DataField("blockInteractions")]
public bool BlockInteractions { get; set; } = true;
/// <summary>
/// Whether this entity's ambience should be disabled when underneath the floor.
/// </summary>
/// <remarks>
/// Useful for cables and piping, gives maint it's distinct noise.
/// </remarks>
[DataField("blockAmbience")]
public bool BlockAmbience { get; set; } = true;
/// <summary>
/// When revealed using some scanning tool, what transparency should be used to draw this item?
/// </summary>