Skip to content

Commit

Permalink
Silent Station Events (#8938)
Browse files Browse the repository at this point in the history
  • Loading branch information
EmoGarbage404 authored Jun 18, 2022
1 parent cbfcdde commit d3926b7
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
4 changes: 4 additions & 0 deletions Content.Server/StationEvents/Events/DiseaseOutbreak.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public sealed class DiseaseOutbreak : StationEvent
public override SoundSpecifier? StartAudio => new SoundPathSpecifier("/Audio/Announcements/outbreak7.ogg");
protected override float EndAfter => 1.0f;

public override bool AnnounceEvent => false;

/// <summary>
/// Finds 2-5 random, alive entities that can host diseases
/// and gives them a randomly selected disease.
Expand Down Expand Up @@ -79,6 +81,8 @@ public override void Startup()
stationsToNotify.Add((EntityUid) station);
}

if (!AnnounceEvent)
return;
foreach (var station in stationsToNotify)
{
chatSystem.DispatchStationAnnouncement(station, Loc.GetString("station-event-disease-outbreak-announcement"),
Expand Down
2 changes: 2 additions & 0 deletions Content.Server/StationEvents/Events/KudzuGrowth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public sealed class KudzuGrowth : StationEvent
// Give crew at least 9 minutes to either have it gone, or to suffer another event. Kudzu is not actually required to be dead for another event to roll.
protected override float EndAfter => 60*4;

public override bool AnnounceEvent => false;

private EntityUid _targetGrid;

private Vector2i _targetTile;
Expand Down
2 changes: 2 additions & 0 deletions Content.Server/StationEvents/Events/MouseMigration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public sealed class MouseMigration : StationEvent

public override int? MaxOccurrences => 1;

public override bool AnnounceEvent => false;

protected override float StartAfter => 30f;

protected override float EndAfter => 60;
Expand Down
13 changes: 9 additions & 4 deletions Content.Server/StationEvents/Events/StationEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ public abstract class StationEvent
/// </summary>
public virtual int? MaxOccurrences { get; } = null;

/// <summary>
/// Whether or not the event is announced when it is run
/// </summary>
public virtual bool AnnounceEvent { get; } = true;

/// <summary>
/// Has the startup time elapsed?
/// </summary>
Expand Down Expand Up @@ -139,13 +144,13 @@ public virtual void Announce()
IoCManager.Resolve<IAdminLogManager>()
.Add(LogType.EventAnnounced, $"Event announce: {Name}");

if (StartAnnouncement != null)
if (AnnounceEvent && StartAnnouncement != null)
{
var chatSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>();
chatSystem.DispatchGlobalStationAnnouncement(StartAnnouncement, playDefaultSound: false, colorOverride: Color.Gold);
}

if (StartAudio != null)
if (AnnounceEvent && StartAudio != null)
{
SoundSystem.Play(StartAudio.GetSound(), Filter.Broadcast(), AudioParams);
}
Expand All @@ -162,13 +167,13 @@ public virtual void Shutdown()
IoCManager.Resolve<IAdminLogManager>()
.Add(LogType.EventStopped, $"Event shutdown: {Name}");

if (EndAnnouncement != null)
if (AnnounceEvent && EndAnnouncement != null)
{
var chatSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>();
chatSystem.DispatchGlobalStationAnnouncement(EndAnnouncement, playDefaultSound: false, colorOverride: Color.Gold);
}

if (EndAudio != null)
if (AnnounceEvent && EndAudio != null)
{
SoundSystem.Play(EndAudio.GetSound(), Filter.Broadcast(), AudioParams);
}
Expand Down
2 changes: 2 additions & 0 deletions Content.Server/StationEvents/Events/VentCritters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public sealed class VentCritters : StationEvent

protected override float EndAfter => 60;

public override bool AnnounceEvent => false;

public override void Startup()
{
base.Startup();
Expand Down
6 changes: 4 additions & 2 deletions Content.Server/StationEvents/Events/ZombieOutbreak.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ public sealed class ZombieOutbreak : StationEvent
public override string Name => "ZombieOutbreak";
public override int EarliestStart => 50;
public override float Weight => WeightLow / 2;

public override SoundSpecifier? StartAudio => new SoundPathSpecifier("/Audio/Announcements/bloblarm.ogg");
protected override float EndAfter => 1.0f;

public override int? MaxOccurrences => 1;
public override bool AnnounceEvent => false;

/// <summary>
/// Finds 1-3 random, dead entities accross the station
Expand Down Expand Up @@ -61,6 +60,9 @@ public override void Startup()
if(station == null) continue;
stationsToNotify.Add((EntityUid) station);
}

if (!AnnounceEvent)
return;
foreach (var station in stationsToNotify)
{
chatSystem.DispatchStationAnnouncement((EntityUid) station, Loc.GetString("station-event-zombie-outbreak-announcement"),
Expand Down

0 comments on commit d3926b7

Please sign in to comment.