Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -23,4 +24,16 @@ public sealed partial class VentHordeRuleComponent : Component
/// </summary>
[DataField]
public EntityUid? ChosenVent;

/// <summary>
/// starcup: Sound that will be used by <see cref="VentHordeSpawnerComponent"/> after the chosen vent is selected
/// </summary>
[DataField]
public SoundSpecifier? PassiveSound;

/// <summary>
/// starcup: Sound that will play when entities are spawned by the <see cref="VentHordeSpawnerComponent"/>
/// </summary>
[DataField]
public SoundSpecifier? EndSound;
}
2 changes: 1 addition & 1 deletion Content.Server/StationEvents/Events/VentHordeRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
13 changes: 12 additions & 1 deletion Content.Server/VentHorde/Systems/VentHordeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -62,7 +63,9 @@ private void OnSpawnerAnchored(Entity<VentHordeSpawnerComponent> entity, ref Anc
/// <param name="spawns">List of entities to spawn.</param>
/// <param name="spawnDelay">Time after which to spawn the entities.</param>
/// <param name="append">If an already active spawner is selected, will add entities to its list. Otherwise, will fail.</param>
public void StartHordeSpawn(EntityUid uid, List<EntProtoId> spawns, TimeSpan spawnDelay, bool append = true)
/// starcup: <param name="passiveSound">Will override the default sound in VentHordeSpawnerComponent if provided.</param>
/// starcup: <param name="endSound">Will override the default sound in VentHordSpawnerComponent if provided.</param>
public void StartHordeSpawn(EntityUid uid, List<EntProtoId> spawns, TimeSpan spawnDelay, bool append = true, SoundSpecifier? passiveSound = null, SoundSpecifier? endSound = null)
{
if (TryComp<VentHordeSpawnerComponent>(uid, out var hordeSpawner))
{
Expand All @@ -76,6 +79,14 @@ public void StartHordeSpawn(EntityUid uid, List<EntProtoId> spawns, TimeSpan spa

hordeSpawner = EnsureComp<VentHordeSpawnerComponent>(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;
Expand Down
Loading