Event Music & Nuke Countdown Song (#8597)
Co-authored-by: ike709 <ike709@github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Station.Components;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Sound;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Console;
|
||||
@@ -8,10 +11,11 @@ using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Audio;
|
||||
|
||||
public sealed class ServerAdminSoundSystem : SharedAdminSoundSystem
|
||||
public sealed class ServerGlobalSoundSystem : SharedGlobalSoundSystem
|
||||
{
|
||||
[Dependency] private readonly IConsoleHost _conHost = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly StationSystem _stationSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -25,12 +29,43 @@ public sealed class ServerAdminSoundSystem : SharedAdminSoundSystem
|
||||
_conHost.UnregisterCommand("playglobalsound");
|
||||
}
|
||||
|
||||
private void PlayGlobal(Filter playerFilter, string filename, AudioParams? audioParams = null)
|
||||
private void PlayAdminGlobal(Filter playerFilter, string filename, AudioParams? audioParams = null)
|
||||
{
|
||||
var msg = new AdminSoundEvent(filename, audioParams);
|
||||
RaiseNetworkEvent(msg, playerFilter);
|
||||
}
|
||||
|
||||
private Filter GetStationAndPvs(EntityUid source)
|
||||
{
|
||||
var stationFilter = _stationSystem.GetInStation(source);
|
||||
stationFilter.AddPlayersByPvs(source, entityManager: EntityManager);
|
||||
return stationFilter;
|
||||
}
|
||||
|
||||
public void PlayGlobalOnStation(EntityUid source, string filename, AudioParams? audioParams = null)
|
||||
{
|
||||
var msg = new GameGlobalSoundEvent(filename, audioParams);
|
||||
var filter = GetStationAndPvs(source);
|
||||
RaiseNetworkEvent(msg, filter);
|
||||
}
|
||||
|
||||
public void StopStationEventMusic(EntityUid source, StationEventMusicType type)
|
||||
{
|
||||
var msg = new StopStationEventMusic(type);
|
||||
var filter = GetStationAndPvs(source);
|
||||
RaiseNetworkEvent(msg, filter);
|
||||
}
|
||||
|
||||
public void DispatchStationEventMusic(EntityUid source, SoundSpecifier sound, StationEventMusicType type)
|
||||
{
|
||||
var audio = AudioParams.Default.WithVolume(-8);
|
||||
var soundFile = sound.GetSound();
|
||||
var msg = new StationEventMusicEvent(soundFile, type, audio);
|
||||
|
||||
var filter = GetStationAndPvs(source);
|
||||
RaiseNetworkEvent(msg, filter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Command that allows admins to play global sounds.
|
||||
/// </summary>
|
||||
@@ -96,6 +131,6 @@ public sealed class ServerAdminSoundSystem : SharedAdminSoundSystem
|
||||
break;
|
||||
}
|
||||
|
||||
PlayGlobal(filter, args[0], audio);
|
||||
PlayAdminGlobal(filter, args[0], audio);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user