From 21b22ea2638aa45eda86dfdac14e0a402d005902 Mon Sep 17 00:00:00 2001 From: Oxdeception <30361731+Oxdeception@users.noreply.github.com> Date: Fri, 22 May 2026 20:33:49 -0400 Subject: [PATCH] Add ability to use custom sounds for vent hordes --- .../Components/VentHordeRuleComponent.cs | 15 ++++++++++++++- .../StationEvents/Events/VentHordeRule.cs | 2 +- .../VentHorde/Systems/VentHordeSystem.cs | 13 ++++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/Content.Server/StationEvents/Components/VentHordeRuleComponent.cs b/Content.Server/StationEvents/Components/VentHordeRuleComponent.cs index b4a7b49e6c5..2a37de2dc68 100644 --- a/Content.Server/StationEvents/Components/VentHordeRuleComponent.cs +++ b/Content.Server/StationEvents/Components/VentHordeRuleComponent.cs @@ -1,5 +1,6 @@ -using Content.Server.StationEvents.Events; +using Content.Server.StationEvents.Events; using Content.Shared.EntityTable.EntitySelectors; +using Robust.Shared.Audio; // starcup namespace Content.Server.StationEvents.Components; @@ -23,4 +24,16 @@ public sealed partial class VentHordeRuleComponent : Component /// [DataField] public EntityUid? ChosenVent; + + /// + /// starcup: Sound that will be used by after the chosen vent is selected + /// + [DataField] + public SoundSpecifier? PassiveSound; + + /// + /// starcup: Sound that will play when entities are spawned by the + /// + [DataField] + public SoundSpecifier? EndSound; } diff --git a/Content.Server/StationEvents/Events/VentHordeRule.cs b/Content.Server/StationEvents/Events/VentHordeRule.cs index 230b93c5485..c7b1d468f39 100644 --- a/Content.Server/StationEvents/Events/VentHordeRule.cs +++ b/Content.Server/StationEvents/Events/VentHordeRule.cs @@ -83,7 +83,7 @@ protected override void Started(EntityUid uid, VentHordeRuleComponent component, // And start the spawn at the chosen vent. // The duration is the same as the time until expected gamerule end time, but that is only for convenience. // The spawn can happen early in certain circumstances anyway. - _horde.StartHordeSpawn(component.ChosenVent.Value, spawns.ToList(), duration); + _horde.StartHordeSpawn(component.ChosenVent.Value, spawns.ToList(), duration, passiveSound: component.PassiveSound, endSound: component.EndSound); // starcup: Pass sounds } private EntityUid? ChooseVent() diff --git a/Content.Server/VentHorde/Systems/VentHordeSystem.cs b/Content.Server/VentHorde/Systems/VentHordeSystem.cs index a2834e01459..1b5c542db84 100644 --- a/Content.Server/VentHorde/Systems/VentHordeSystem.cs +++ b/Content.Server/VentHorde/Systems/VentHordeSystem.cs @@ -2,6 +2,7 @@ using Content.Shared.Destructible; using Content.Shared.Jittering; using Content.Shared.Throwing; +using Robust.Shared.Audio; using Robust.Shared.Audio.Systems; using Robust.Shared.Prototypes; using Robust.Shared.Random; @@ -62,7 +63,9 @@ private void OnSpawnerAnchored(Entity entity, ref Anc /// List of entities to spawn. /// Time after which to spawn the entities. /// If an already active spawner is selected, will add entities to its list. Otherwise, will fail. - public void StartHordeSpawn(EntityUid uid, List spawns, TimeSpan spawnDelay, bool append = true) + /// starcup: Will override the default sound in VentHordeSpawnerComponent if provided. + /// starcup: Will override the default sound in VentHordSpawnerComponent if provided. + public void StartHordeSpawn(EntityUid uid, List spawns, TimeSpan spawnDelay, bool append = true, SoundSpecifier? passiveSound = null, SoundSpecifier? endSound = null) { if (TryComp(uid, out var hordeSpawner)) { @@ -76,6 +79,14 @@ public void StartHordeSpawn(EntityUid uid, List spawns, TimeSpan spa hordeSpawner = EnsureComp(uid); + // begin starcup: allow rules to set custom sounds + if (passiveSound is not null) + hordeSpawner.PassiveSound = passiveSound; + + if (endSound is not null) + hordeSpawner.EndSound = endSound; + // end starcup + hordeSpawner.AudioStream = _audio.PlayPvs(hordeSpawner.PassiveSound, uid, hordeSpawner.PassiveSound.Params.WithLoop(true))?.Entity; hordeSpawner.Entities = spawns;