Files
Delta-v/Content.Shared/Audio/Jukebox/SharedJukeboxSystem.cs
T
Tayrtahnandslarticodefast f27bf8b218 Add a basic API to JukeboxSystem (#42896)
* Add a basic API to JukeboxSystem

* Update Content.Shared/Audio/Jukebox/SharedJukeboxSystem.cs

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Remove pointless Dirty

* Move SetSelectedTrack Dirty inside if block

* logMissing: false

* Remove pointless Audio.Stop call

* Poke tests

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2026-06-29 12:44:03 +02:00

20 lines
551 B
C#

using Robust.Shared.Audio.Systems;
namespace Content.Shared.Audio.Jukebox;
public abstract class SharedJukeboxSystem : EntitySystem
{
[Dependency] protected readonly SharedAudioSystem Audio = default!;
/// <summary>
/// Returns whether or not the given jukebox is currently playing a song.
/// </summary>
public bool IsPlaying(Entity<JukeboxComponent?> entity)
{
if (!Resolve(entity, ref entity.Comp))
return false;
return entity.Comp.AudioStream is { } audio && Audio.IsPlaying(audio);
}
}