Content audio (#20862)
This commit is contained in:
@@ -29,7 +29,8 @@ namespace Content.Server.Kitchen.Components
|
||||
[DataField("ItemBreakSound")]
|
||||
public SoundSpecifier ItemBreakSound = new SoundPathSpecifier("/Audio/Effects/clang.ogg");
|
||||
|
||||
public IPlayingAudioStream? PlayingStream { get; set; }
|
||||
public EntityUid? PlayingStream;
|
||||
|
||||
[DataField("loopingSound")]
|
||||
public SoundSpecifier LoopingSound = new SoundPathSpecifier("/Audio/Machines/microwave_loop.ogg");
|
||||
#endregion
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Content.Server.Kitchen.Components
|
||||
[DataField("juiceSound"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public SoundSpecifier JuiceSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/juicer.ogg");
|
||||
|
||||
public IPlayingAudioStream? AudioStream;
|
||||
public EntityUid? AudioStream;
|
||||
}
|
||||
|
||||
[Access(typeof(ReagentGrinderSystem)), RegisterComponent]
|
||||
|
||||
@@ -16,6 +16,8 @@ using Content.Shared.Nutrition.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Storage;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
using static Content.Shared.Kitchen.Components.KitchenSpikeComponent;
|
||||
@@ -154,7 +156,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
QueueDel(gib);
|
||||
}
|
||||
|
||||
_audio.Play(component.SpikeSound, Filter.Pvs(uid), uid, true);
|
||||
_audio.PlayEntity(component.SpikeSound, Filter.Pvs(uid), uid, true);
|
||||
}
|
||||
|
||||
private bool TryGetPiece(EntityUid uid, EntityUid user, EntityUid used,
|
||||
|
||||
@@ -24,6 +24,7 @@ using Content.Shared.Tag;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
@@ -73,7 +74,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
SetAppearance(uid, MicrowaveVisualState.Cooking, microwaveComponent);
|
||||
|
||||
microwaveComponent.PlayingStream =
|
||||
_audio.PlayPvs(microwaveComponent.LoopingSound, uid, AudioParams.Default.WithLoop(true).WithMaxDistance(5));
|
||||
_audio.PlayPvs(microwaveComponent.LoopingSound, uid, AudioParams.Default.WithLoop(true).WithMaxDistance(5)).Value.Entity;
|
||||
}
|
||||
|
||||
private void OnCookStop(EntityUid uid, ActiveMicrowaveComponent component, ComponentShutdown args)
|
||||
@@ -82,7 +83,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
return;
|
||||
SetAppearance(uid, MicrowaveVisualState.Idle, microwaveComponent);
|
||||
|
||||
microwaveComponent.PlayingStream?.Stop();
|
||||
microwaveComponent.PlayingStream = _audio.Stop(microwaveComponent.PlayingStream);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -16,6 +16,7 @@ using Content.Shared.Stacks;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -64,7 +65,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
if (active.EndTime > _timing.CurTime)
|
||||
continue;
|
||||
|
||||
reagentGrinder.AudioStream?.Stop();
|
||||
reagentGrinder.AudioStream = _audioSystem.Stop(reagentGrinder.AudioStream);
|
||||
RemCompDeferred<ActiveReagentGrinderComponent>(uid);
|
||||
|
||||
var inputContainer = _containerSystem.EnsureContainer<Container>(uid, SharedReagentGrinder.InputContainerId);
|
||||
@@ -284,7 +285,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
active.Program = program;
|
||||
|
||||
reagentGrinder.AudioStream = _audioSystem.PlayPvs(sound, uid,
|
||||
AudioParams.Default.WithPitchScale(1 / reagentGrinder.WorkTimeMultiplier)); //slightly higher pitched
|
||||
AudioParams.Default.WithPitchScale(1 / reagentGrinder.WorkTimeMultiplier)).Value.Entity; //slightly higher pitched
|
||||
_userInterfaceSystem.TrySendUiMessage(uid, ReagentGrinderUiKey.Key,
|
||||
new ReagentGrinderWorkStartedMessage(program));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user