Inserted SoundSpecifier where appropiate

This commit is contained in:
Galactic Chimp
2021-07-31 15:17:16 +02:00
parent 41c30aa28b
commit b2e40d540f
90 changed files with 663 additions and 368 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System;
using Content.Shared.Sound;
using JetBrains.Annotations;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
@@ -39,7 +40,7 @@ namespace Content.Client.Disposal.Visualizers
private string? _stateFlush;
[DataField("flush_sound", required: true)]
private string? _flushSound;
private SoundSpecifier _flushSound = default!;
[DataField("flush_time", required: true)]
private float _flushTime;
@@ -58,9 +59,9 @@ namespace Content.Client.Disposal.Visualizers
var sound = new AnimationTrackPlaySound();
_flushAnimation.AnimationTracks.Add(sound);
if (_flushSound != null)
if (_flushSound.TryGetSound(out var flushSound))
{
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_flushSound, 0));
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(flushSound, 0));
}
}

View File

@@ -1,8 +1,8 @@
using System;
using Content.Client.Wires;
using Content.Client.Wires.Visualizers;
using Content.Shared.Audio;
using Content.Shared.Doors;
using Content.Shared.Sound;
using JetBrains.Annotations;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
@@ -18,13 +18,13 @@ namespace Content.Client.Doors
private const string AnimationKey = "airlock_animation";
[DataField("open_sound", required: true)]
private string _openSound = default!;
private SoundSpecifier _openSound = default!;
[DataField("close_sound", required: true)]
private string _closeSound = default!;
private SoundSpecifier _closeSound = default!;
[DataField("deny_sound", required: true)]
private string _denySound = default!;
private SoundSpecifier _denySound = default!;
[DataField("animation_time")]
private float _delay = 0.8f;
@@ -55,9 +55,9 @@ namespace Content.Client.Doors
var sound = new AnimationTrackPlaySound();
CloseAnimation.AnimationTracks.Add(sound);
if (_closeSound != null)
if (_closeSound.TryGetSound(out var closeSound))
{
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_closeSound, 0));
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(closeSound, 0));
}
}
@@ -81,9 +81,9 @@ namespace Content.Client.Doors
var sound = new AnimationTrackPlaySound();
OpenAnimation.AnimationTracks.Add(sound);
if (_openSound != null)
if (_openSound.TryGetSound(out var openSound))
{
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_openSound, 0));
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(openSound, 0));
}
}
@@ -97,9 +97,9 @@ namespace Content.Client.Doors
var sound = new AnimationTrackPlaySound();
DenyAnimation.AnimationTracks.Add(sound);
if (_denySound != null)
if (_denySound.TryGetSound(out var denySound))
{
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_denySound, 0, () => AudioHelpers.WithVariation(0.05f)));
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(denySound, 0, () => AudioHelpers.WithVariation(0.05f)));
}
}
}

View File

@@ -1,5 +1,6 @@
using System;
using Content.Shared.Light;
using Content.Shared.Sound;
using JetBrains.Annotations;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
@@ -17,7 +18,7 @@ namespace Content.Client.Light.Visualizers
{
[DataField("minBlinkingTime")] private float _minBlinkingTime = 0.5f;
[DataField("maxBlinkingTime")] private float _maxBlinkingTime = 2;
[DataField("blinkingSound")] private string? _blinkingSound;
[DataField("blinkingSound")] private SoundSpecifier _blinkingSound = default!;
private bool _wasBlinking;
@@ -124,13 +125,13 @@ namespace Content.Client.Light.Visualizers
}
};
if (_blinkingSound != null)
if (_blinkingSound.TryGetSound(out var blinkingSound))
{
blinkingAnim.AnimationTracks.Add(new AnimationTrackPlaySound()
{
KeyFrames =
{
new AnimationTrackPlaySound.KeyFrame(_blinkingSound, 0.5f)
new AnimationTrackPlaySound.KeyFrame(blinkingSound, 0.5f)
}
});
}

View File

@@ -1,4 +1,5 @@
using System;
using System;
using Content.Shared.Sound;
using Content.Shared.Trigger;
using JetBrains.Annotations;
using Robust.Client.Animations;
@@ -15,7 +16,7 @@ namespace Content.Client.Trigger
private const string AnimationKey = "priming_animation";
[DataField("countdown_sound", required: true)]
private string? _countdownSound;
private SoundSpecifier _countdownSound = default!;
private Animation PrimingAnimation = default!;
@@ -28,11 +29,11 @@ namespace Content.Client.Trigger
flick.LayerKey = TriggerVisualLayers.Base;
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame("primed", 0f));
if (_countdownSound != null)
if (_countdownSound.TryGetSound(out var countdownSound))
{
var sound = new AnimationTrackPlaySound();
PrimingAnimation.AnimationTracks.Add(sound);
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_countdownSound, 0));
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(countdownSound, 0));
}
}
}