Explosion SFX juicing + higher persistence (#22544)

This commit is contained in:
Kara
2023-12-15 09:57:46 -07:00
committed by GitHub
parent 46b59329b0
commit e4a227ff0d
40 changed files with 151 additions and 22 deletions

View File

@@ -19,11 +19,6 @@ public sealed class ExplosionOverlaySystem : EntitySystem
[Dependency] private readonly IOverlayManager _overlayMan = default!;
[Dependency] private readonly SharedPointLightSystem _lights = default!;
/// <summary>
/// For how many seconds should an explosion stay on-screen once it has finished expanding?
/// </summary>
public float ExplosionPersistence = 0.3f;
public override void Initialize()
{
base.Initialize();

View File

@@ -63,7 +63,7 @@ public sealed partial class ExplosionSystem : EntitySystem
/// </summary>
public const ushort DefaultTileSize = 1;
private AudioParams _audioParams = AudioParams.Default.WithVolume(-3f);
public const int MaxExplosionAudioRange = 30;
/// <summary>
/// The "default" explosion prototype.
@@ -328,15 +328,33 @@ public sealed partial class ExplosionSystem : EntitySystem
var visualEnt = CreateExplosionVisualEntity(epicenter, type.ID, spaceMatrix, spaceData, gridData.Values, iterationIntensity);
// camera shake
CameraShake(iterationIntensity.Count * 2.5f, epicenter, totalIntensity);
CameraShake(iterationIntensity.Count * 4f, epicenter, totalIntensity);
//For whatever bloody reason, sound system requires ENTITY coordinates.
var mapEntityCoords = EntityCoordinates.FromMap(EntityManager, _mapManager.GetMapEntityId(epicenter.MapId), epicenter);
// play sound.
var audioRange = iterationIntensity.Count * 5;
// for the normal audio, we want everyone in pvs range
// + if the bomb is big enough, people outside of it too
// this is capped to 30 because otherwise really huge bombs
// will attempt to play regular audio for people who can't hear it anyway because the epicenter is so far away
var audioRange = Math.Min(iterationIntensity.Count * 2, MaxExplosionAudioRange);
var filter = Filter.Pvs(epicenter).AddInRange(epicenter, audioRange);
_audio.PlayStatic(type.Sound.GetSound(), filter, mapEntityCoords, true, _audioParams);
var sound = iterationIntensity.Count < type.SmallSoundIterationThreshold
? type.SmallSound
: type.Sound;
_audio.PlayStatic(sound, filter, mapEntityCoords, true, sound.Params);
// play far sound
// far sound should play for anyone who wasn't in range of any of the effects of the bomb
var farAudioRange = iterationIntensity.Count * 5;
var farFilter = Filter.Empty().AddInRange(epicenter, farAudioRange).RemoveInRange(epicenter, audioRange);
var farSound = iterationIntensity.Count < type.SmallSoundIterationThreshold
? type.SmallSoundFar
: type.SoundFar;
_audio.PlayGlobal(farSound, farFilter, true, farSound.Params);
return new Explosion(this,
type,

View File

@@ -127,7 +127,7 @@ public sealed partial class AnomalyComponent : Component
/// The sound plays when an anomaly goes supercritical
/// </summary>
[DataField]
public SoundSpecifier? SupercriticalSound = new SoundCollectionSpecifier("explosion");
public SoundSpecifier? SupercriticalSound = new SoundCollectionSpecifier("Explosion");
#endregion
/// <summary>

View File

@@ -349,7 +349,7 @@ namespace Content.Shared.CCVar
CVarDef.Create("discord.ahelp_avatar", string.Empty, CVar.SERVERONLY);
/// <summary>
/// URL of the Discord webhook which will relay all custom votes. If left empty, disables the webhook.
/// URL of the Discord webhook which will relay all custom votes. If left empty, disables the webhook.
/// </summary>
public static readonly CVarDef<string> DiscordVoteWebhook =
CVarDef.Create("discord.vote_webhook", string.Empty, CVar.SERVERONLY);
@@ -846,7 +846,7 @@ namespace Content.Shared.CCVar
/// This determines for how many seconds an explosion should stay visible once it has finished expanding.
/// </summary>
public static readonly CVarDef<float> ExplosionPersistence =
CVarDef.Create("explosion.persistence", 0.3f, CVar.SERVERONLY);
CVarDef.Create("explosion.persistence", 1.0f, CVar.SERVERONLY);
/// <summary>
/// If an explosion covers a larger area than this number, the damaging/processing will always start during

View File

@@ -62,8 +62,26 @@ public sealed partial class ExplosionPrototype : IPrototype
[DataField("fireColor")]
public Color? FireColor;
[DataField("Sound")]
public SoundSpecifier Sound = new SoundCollectionSpecifier("explosion");
/// <summary>
/// If an explosion finishes in less than this many iterations, play a small sound instead.
/// </summary>
/// <remarks>
/// This value is tuned such that a minibomb is considered small, but just about anything larger is normal
/// </remarks>
[DataField("smallSoundIterationThreshold")]
public int SmallSoundIterationThreshold = 6;
[DataField("sound")]
public SoundSpecifier Sound = new SoundCollectionSpecifier("Explosion");
[DataField("smallSound")]
public SoundSpecifier SmallSound = new SoundCollectionSpecifier("ExplosionSmall");
[DataField("soundFar")]
public SoundSpecifier SoundFar = new SoundCollectionSpecifier("ExplosionFar", AudioParams.Default.WithVolume(2f));
[DataField("smallSoundFar")]
public SoundSpecifier SmallSoundFar = new SoundCollectionSpecifier("ExplosionSmallFar", AudioParams.Default.WithVolume(2f));
[DataField("texturePath")]
public ResPath TexturePath = new("/Textures/Effects/fire.rsi");

View File

@@ -71,7 +71,7 @@ public sealed partial class LightBulbComponent : Component
/// </summary>
[DataField("breakSound")]
[ViewVariables(VVAccess.ReadWrite)]
public SoundSpecifier BreakSound = new SoundCollectionSpecifier("GlassBreak");
public SoundSpecifier BreakSound = new SoundCollectionSpecifier("GlassBreak", AudioParams.Default.WithVolume(-6f));
#region Appearance

View File

@@ -171,3 +171,8 @@
copyright: '"jumps from reason.3.Rev.wav" by martian of Freesound.org. Modified by reversing and altering volume.'
license: CC0-1.0
source: https://freesound.org/people/martian/sounds/19261/
- files: ["explosion_small1.ogg", "explosion_small2.ogg", "explosion_small3.ogg", "explosion1.ogg", "explosion2.ogg", "explosion3.ogg", "explosion4.ogg", "explosion5.ogg", "explosion6.ogg", "explosionfar.ogg", "explosionsmallfar.ogg"]
copyright: "vgstation at c5edbfd7179288080f081e2b8ac2496b7e4455db"
license: CC-BY-SA-3.0
source: https://github.com/vgstation-coders/vgstation13/tree/c5edbfd7179288080f081e2b8ac2496b7e4455db/sound/effects

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -149,7 +149,8 @@
damage: 300
behaviors:
- !type:PlaySoundBehavior
sound: /Audio/Effects/metalbreak.ogg
sound:
path: /Audio/Effects/metalbreak.ogg
- !type:EmptyContainersBehaviour
containers:
- borg_brain

View File

@@ -34,6 +34,8 @@
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
params:
volume: -8
- !type:SpawnEntitiesBehavior
spawn:
FoodPlateTrash:
@@ -84,6 +86,8 @@
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
params:
volume: -8
- !type:SpawnEntitiesBehavior
spawn:
FoodPlateSmallTrash:

View File

@@ -48,6 +48,8 @@
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
params:
volume: -8
- !type:SpillBehavior { }
- !type:SpawnEntitiesBehavior
spawn:

View File

@@ -36,6 +36,8 @@
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
params:
volume: -4
- !type:SpawnEntitiesBehavior
spawn:
ShardGlass:
@@ -157,6 +159,8 @@
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
params:
volume: -4
- !type:SpawnEntitiesBehavior
spawn:
ShardGlassReinforced:
@@ -231,6 +235,8 @@
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
params:
volume: -4
- !type:SpawnEntitiesBehavior
spawn:
ShardGlassPlasma:
@@ -357,6 +363,8 @@
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
params:
volume: -4
- !type:SpawnEntitiesBehavior
spawn:
ShardGlassUranium:

View File

@@ -39,6 +39,8 @@
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
params:
volume: -4
- !type:SpawnEntitiesBehavior
spawn:
ShardGlass:

View File

@@ -24,7 +24,7 @@
thresholds:
- trigger:
!type:DamageTrigger
damage: 40
damage: 30
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]
@@ -33,7 +33,10 @@
damage: 20
behaviors:
- !type:PlaySoundBehavior
sound: /Audio/Effects/metalbreak.ogg
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -8
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: DamageOnLand
@@ -353,7 +356,7 @@
- FloorMiningLight
- type: Stack
stackType: FloorTileMiningLight
# Departamental
- type: entity
name: freezer tile

View File

@@ -39,6 +39,8 @@
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
params:
volume: -8
- !type:DoActsBehavior
acts: [ "Breakage" ]
- trigger:
@@ -48,6 +50,8 @@
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
params:
volume: -8
- !type:SpawnEntitiesBehavior
spawn:
ShardGlass:

View File

@@ -79,6 +79,8 @@
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
params:
volume: -4
- !type:SpillBehavior { }
- !type:SpawnEntitiesBehavior
spawn:

View File

@@ -62,6 +62,8 @@
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
params:
volume: -4
- !type:SpillBehavior
solution: beaker
- !type:SpawnEntitiesBehavior

View File

@@ -93,6 +93,8 @@
- !type:PlaySoundBehavior
sound:
collection: GlassBreak
params:
volume: -4
- !type:SpawnEntitiesBehavior
spawn:
PartRodMetal1:

View File

@@ -42,6 +42,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -6
- !type:SpawnEntitiesBehavior
spawn:
PartRodMetal1:
@@ -140,6 +142,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -6
- !type:SpawnEntitiesBehavior
spawn:
SheetSteel1:
@@ -179,6 +183,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -6
- !type:SpawnEntitiesBehavior
spawn:
SheetSteel1:
@@ -215,6 +221,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -6
- !type:SpawnEntitiesBehavior
spawn:
SheetSteel1:
@@ -601,6 +609,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -6
- !type:SpawnEntitiesBehavior
spawn:
SheetSteel1:

View File

@@ -91,6 +91,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -6
- !type:SpawnEntitiesBehavior
spawn:
SheetSteel1:

View File

@@ -34,6 +34,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -8
- !type:SpawnEntitiesBehavior
spawn:
GasPipeBroken:

View File

@@ -56,6 +56,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -6
- !type:SpawnEntitiesBehavior
spawn:
SheetSteel1:

View File

@@ -36,6 +36,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -6
- !type:SpawnEntitiesBehavior
spawn:
SheetSteel1:

View File

@@ -75,6 +75,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -6
- !type:SpawnEntitiesBehavior
spawn:
SheetSteel1:
@@ -148,6 +150,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -6
- !type:SpawnEntitiesBehavior
spawn:
SheetSteel1:
@@ -254,6 +258,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -6
- !type:SpawnEntitiesBehavior
spawn:
SheetSteel1:

View File

@@ -48,6 +48,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -6
- !type:SpawnEntitiesBehavior
spawn:
SheetSteel1:

View File

@@ -103,6 +103,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -4
- type: entity
id: AirAlarmAssembly

View File

@@ -55,6 +55,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -4
placement:
mode: SnapgridCenter

View File

@@ -102,6 +102,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -4
placement:
mode: SnapgridCenter
snap:

View File

@@ -82,6 +82,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -4
- type: GenericVisualizer
visuals:
enum.PowerDeviceVisuals.Powered:

View File

@@ -64,6 +64,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -8
placement:
mode: SnapgridCenter
snap:

View File

@@ -92,6 +92,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -8
- type: entity
id: ApcNetSwitch

View File

@@ -44,6 +44,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -6
- !type:SpawnEntitiesBehavior
spawn:
PartRodMetal1:
@@ -111,6 +113,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -6
- !type:SpawnEntitiesBehavior
spawn:
PartRodMetal1:
@@ -169,6 +173,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -6
- !type:SpawnEntitiesBehavior
spawn:
PartRodMetal1:
@@ -242,6 +248,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -6
- !type:SpawnEntitiesBehavior
spawn:
PartRodMetal1:

View File

@@ -720,8 +720,6 @@
path: /Audio/Effects/metalbreak.ogg
- !type:DoActsBehavior
acts: ["Destruction"]
destroySound:
path: /Audio/Effects/metalbreak.ogg
- type: Construction
graph: Girder
node: diagonalshuttleWall

View File

@@ -32,6 +32,8 @@
- !type:PlaySoundBehavior
sound:
path: /Audio/Effects/metalbreak.ogg
params:
volume: -4
- !type:SpawnEntitiesBehavior
spawn:
SheetSteel1:

View File

@@ -1,5 +1,5 @@
- type: soundCollection
id: explosion
id: Explosion
files:
- /Audio/Effects/explosion1.ogg
- /Audio/Effects/explosion2.ogg
@@ -7,3 +7,20 @@
- /Audio/Effects/explosion4.ogg
- /Audio/Effects/explosion5.ogg
- /Audio/Effects/explosion6.ogg
- type: soundCollection
id: ExplosionSmall
files:
- /Audio/Effects/explosion_small1.ogg
- /Audio/Effects/explosion_small2.ogg
- /Audio/Effects/explosion_small3.ogg
- type: soundCollection
id: ExplosionFar
files:
- /Audio/Effects/explosionfar.ogg
- type: soundCollection
id: ExplosionSmallFar
files:
- /Audio/Effects/explosionsmallfar.ogg