Skip to content

Commit

Permalink
shuttle, comms, and roundstart announcements
Browse files Browse the repository at this point in the history
  • Loading branch information
DEATHB4DEFEAT committed Nov 4, 2023
1 parent 900561d commit 8f4ba76
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 41 deletions.
9 changes: 7 additions & 2 deletions Content.Server/Communications/CommunicationsConsoleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
using Content.Server.Popups;
using Content.Server.RoundEnd;
using Content.Server.Shuttles.Systems;
using Content.Server.SimpleStation14.Announcements.Systems;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
using Content.Shared.Access.Components;
using Content.Shared.Access.Systems;
Expand All @@ -17,6 +19,7 @@
using Content.Shared.Popups;
using Robust.Server.GameObjects;
using Robust.Shared.Configuration;
using Robust.Shared.Player;

namespace Content.Server.Communications
{
Expand All @@ -34,6 +37,7 @@ public sealed class CommunicationsConsoleSystem : EntitySystem
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly AnnouncerSystem _announcer = default!; // Parkstation-RandomAnnouncer

private const int MaxMessageLength = 256;
private const int MaxMessageNewlines = 2;
Expand Down Expand Up @@ -272,14 +276,15 @@ private void OnAnnounceMessage(EntityUid uid, CommunicationsConsoleComponent com
msg += "\n" + Loc.GetString("comms-console-announcement-sent-by") + " " + author;
if (comp.Global)
{
_chatSystem.DispatchGlobalAnnouncement(msg, title, announcementSound: comp.Sound, colorOverride: comp.Color);
_announcer.SendAnnouncement("announce", Filter.Broadcast(), msg, title, comp.Color); // Parkstation-RandomAnnouncer

if (message.Session.AttachedEntity != null)
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"{ToPrettyString(message.Session.AttachedEntity.Value):player} has sent the following global announcement: {msg}");

return;
}
_chatSystem.DispatchStationAnnouncement(uid, msg, title, colorOverride: comp.Color);
if (TryComp<StationDataComponent>(_stationSystem.GetOwningStation(uid), out var stationData)) // Parkstation-RandomAnnouncer
_announcer.SendAnnouncement("announce", _stationSystem.GetInStation(stationData), msg, title, comp.Color);

if (message.Session.AttachedEntity != null)
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"{ToPrettyString(message.Session.AttachedEntity.Value):player} has sent the following station announcement: {msg}");
Expand Down
9 changes: 4 additions & 5 deletions Content.Server/GameTicking/GameTicker.RoundFlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Content.Server.GameTicking.Events;
using Content.Server.Ghost;
using Content.Server.Maps;
using Content.Server.SimpleStation14.Announcements.Systems;
using Content.Shared.Database;
using Content.Shared.GameTicking;
using Content.Shared.Mind;
Expand All @@ -27,6 +28,7 @@ public sealed partial class GameTicker
{
[Dependency] private readonly DiscordWebhook _discord = default!;
[Dependency] private readonly ITaskManager _taskManager = default!;
[Dependency] private readonly AnnouncerSystem _announcer = default!;

private static readonly Counter RoundNumberMetric = Metrics.CreateCounter(
"ss14_round_number",
Expand Down Expand Up @@ -606,11 +608,8 @@ private void AnnounceRound()

var proto = _robustRandom.Pick(options);

if (proto.Message != null)
_chatSystem.DispatchGlobalAnnouncement(Loc.GetString(proto.Message), playSound: true);

if (proto.Sound != null)
SoundSystem.Play(proto.Sound.GetSound(), Filter.Broadcast());
if (proto.Message != null) // Parkstation-RandomAnnouncer
_announcer.SendAnnouncement("welcome", Filter.Broadcast(), Loc.GetString(proto.Message));
}

private async void SendRoundStartedDiscordMessage()
Expand Down
28 changes: 16 additions & 12 deletions Content.Server/RoundEnd/RoundEndSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Content.Server.Chat.Systems;
using Content.Server.GameTicking;
using Content.Server.Shuttles.Systems;
using Content.Server.SimpleStation14.Announcements.Systems;
using Content.Server.Station.Systems;
using Content.Shared.Database;
using Content.Shared.GameTicking;
Expand Down Expand Up @@ -34,6 +35,7 @@ public sealed class RoundEndSystem : EntitySystem
[Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly EmergencyShuttleSystem _shuttle = default!;
[Dependency] private readonly StationSystem _stationSystem = default!;
[Dependency] private readonly AnnouncerSystem _announcer = default!;

public TimeSpan DefaultCooldownDuration { get; set; } = TimeSpan.FromSeconds(30);

Expand Down Expand Up @@ -146,15 +148,15 @@ public void RequestRoundEnd(TimeSpan countdownTime, EntityUid? requester = null,
units = "eta-units-minutes";
}

_chatSystem.DispatchGlobalAnnouncement(Loc.GetString(text,
("time", time),
("units", Loc.GetString(units))),
_announcer.SendAnnouncement("shuttlecalled", // Parkstation-RandomAnnouncers
Filter.Broadcast(),
Loc.GetString(text,
("time", time),
("units", Loc.GetString(units))
),
name,
false,
null,
Color.Gold);

SoundSystem.Play("/Audio/Announcements/shuttlecalled.ogg", Filter.Broadcast());
Color.Gold
);

LastCountdownStart = _gameTiming.CurTime;
ExpectedCountdownEnd = _gameTiming.CurTime + countdownTime;
Expand Down Expand Up @@ -182,10 +184,12 @@ public void CancelRoundEndCountdown(EntityUid? requester = null, bool checkCoold
_adminLogger.Add(LogType.ShuttleRecalled, LogImpact.High, $"Shuttle recalled");
}

_chatSystem.DispatchGlobalAnnouncement(Loc.GetString("round-end-system-shuttle-recalled-announcement"),
Loc.GetString("Station"), false, colorOverride: Color.Gold);

SoundSystem.Play("/Audio/Announcements/shuttlerecalled.ogg", Filter.Broadcast());
_announcer.SendAnnouncement("shuttlerecalled", // Parkstation-RandomAnnouncers
Filter.Broadcast(),
Loc.GetString("round-end-system-shuttle-recalled-announcement"),
Loc.GetString("Station"),
Color.Gold
);

LastCountdownStart = null;
ExpectedCountdownEnd = null;
Expand Down
20 changes: 7 additions & 13 deletions Content.Server/Shuttles/Systems/EmergencyShuttleSystem.Console.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ private void UpdateEmergencyConsole(float frameTime)
if (!ShuttlesLeft && _consoleAccumulator <= 0f)
{
ShuttlesLeft = true;
_chatSystem.DispatchGlobalAnnouncement(Loc.GetString("emergency-shuttle-left", ("transitTime", $"{TransitTime:0}")));
_announcer.SendAnnouncement("shuttleleft", Filter.Broadcast(), Loc.GetString("emergency-shuttle-left", ("transitTime", $"{TransitTime:0}"))); // Parkstation-RandomAnnouncer

Timer.Spawn((int) (TransitTime * 1000) + _bufferTime.Milliseconds, () => _roundEnd.EndRound(), _roundEndCancelToken?.Token ?? default);
}
Expand Down Expand Up @@ -257,7 +257,7 @@ private void OnEmergencyRepealAll(EntityUid uid, EmergencyShuttleConsoleComponen
return;

_logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle early launch REPEAL ALL by {args.Session:user}");
_chatSystem.DispatchGlobalAnnouncement(Loc.GetString("emergency-shuttle-console-auth-revoked", ("remaining", component.AuthorizationsRequired)));
_announcer.SendAnnouncement("shuttleauthrevoked", Filter.Broadcast(), Loc.GetString("emergency-shuttle-console-auth-revoked", ("remaining", component.AuthorizationsRequired))); // Parkstation-RandomAnnouncer
component.AuthorizedEntities.Clear();
UpdateAllEmergencyConsoles();
}
Expand All @@ -280,7 +280,7 @@ private void OnEmergencyRepeal(EntityUid uid, EmergencyShuttleConsoleComponent c

_logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle early launch REPEAL by {args.Session:user}");
var remaining = component.AuthorizationsRequired - component.AuthorizedEntities.Count;
_chatSystem.DispatchGlobalAnnouncement(Loc.GetString("emergency-shuttle-console-auth-revoked", ("remaining", remaining)));
_announcer.SendAnnouncement("shuttleauthrevoked", Filter.Broadcast(), Loc.GetString("emergency-shuttle-console-auth-revoked", ("remaining", remaining))); // Parkstation-RandomAnnouncer
CheckForLaunch(component);
UpdateAllEmergencyConsoles();
}
Expand All @@ -305,12 +305,11 @@ private void OnEmergencyAuthorize(EntityUid uid, EmergencyShuttleConsoleComponen
var remaining = component.AuthorizationsRequired - component.AuthorizedEntities.Count;

if (remaining > 0)
_chatSystem.DispatchGlobalAnnouncement(
_announcer.SendAnnouncement("shuttleauthadded", // Parkstation-RandomAnnouncer
Filter.Broadcast(),
Loc.GetString("emergency-shuttle-console-auth-left", ("remaining", remaining)),
playSound: false, colorOverride: DangerColor);
colorOverride: DangerColor);

if (!CheckForLaunch(component))
_audio.PlayGlobal("/Audio/Misc/notice1.ogg", Filter.Broadcast(), recordReplay: true);

UpdateAllEmergencyConsoles();
}
Expand Down Expand Up @@ -389,12 +388,7 @@ private void AnnounceLaunch()
if (_announced) return;

_announced = true;
_chatSystem.DispatchGlobalAnnouncement(
Loc.GetString("emergency-shuttle-launch-time", ("consoleAccumulator", $"{_consoleAccumulator:0}")),
playSound: false,
colorOverride: DangerColor);

_audio.PlayGlobal("/Audio/Misc/notice1.ogg", Filter.Broadcast(), recordReplay: true);
_announcer.SendAnnouncement("shuttlealmostlaunching", Filter.Broadcast(), Loc.GetString("emergency-shuttle-launch-time", ("consoleAccumulator", $"{_consoleAccumulator:0}"))); // Parkstation-RandomAnnouncer
}

public bool DelayEmergencyRoundEnd()
Expand Down
16 changes: 7 additions & 9 deletions Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Content.Server.Popups;
using Content.Server.RoundEnd;
using Content.Server.Shuttles.Components;
using Content.Server.SimpleStation14.Announcements.Systems;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
using Content.Shared.Access.Systems;
Expand Down Expand Up @@ -54,6 +55,7 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
[Dependency] private readonly ShuttleSystem _shuttle = default!;
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly AnnouncerSystem _announcer = default!;

private ISawmill _sawmill = default!;

Expand Down Expand Up @@ -188,9 +190,7 @@ public void CallEmergencyShuttle(EntityUid stationUid, StationEmergencyShuttleCo
if (targetGrid == null)
{
_logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle {ToPrettyString(stationUid)} unable to dock with station {ToPrettyString(stationUid)}");
_chatSystem.DispatchStationAnnouncement(stationUid, Loc.GetString("emergency-shuttle-good-luck"), playDefaultSound: false);
// TODO: Need filter extensions or something don't blame me.
_audio.PlayGlobal("/Audio/Misc/notice1.ogg", Filter.Broadcast(), true);
_announcer.SendAnnouncement("shuttlegoodluck", Filter.Broadcast(), Loc.GetString("emergency-shuttle-good-luck"), colorOverride: DangerColor);
return;
}

Expand All @@ -201,24 +201,22 @@ public void CallEmergencyShuttle(EntityUid stationUid, StationEmergencyShuttleCo
if (TryComp<TransformComponent>(targetGrid.Value, out var targetXform))
{
var angle = _dock.GetAngle(stationShuttle.EmergencyShuttle.Value, xform, targetGrid.Value, targetXform, xformQuery);
_chatSystem.DispatchStationAnnouncement(stationUid, Loc.GetString("emergency-shuttle-docked", ("time", $"{_consoleAccumulator:0}"), ("direction", angle.GetDir())), playDefaultSound: false);
_announcer.SendAnnouncementMessage("shuttledock", Loc.GetString("emergency-shuttle-docked", ("time", $"{_consoleAccumulator:0}"), ("direction", angle.GetDir()))); // Parkstation-RandomAnnouncer
}

_logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle {ToPrettyString(stationUid)} docked with stations");
// TODO: Need filter extensions or something don't blame me.
_audio.PlayGlobal("/Audio/Announcements/shuttle_dock.ogg", Filter.Broadcast(), true);
_announcer.SendAnnouncementAudio("shuttledock", Filter.Broadcast()); // Parkstation-RandomAnnouncer
}
else
{
if (TryComp<TransformComponent>(targetGrid.Value, out var targetXform))
{
var angle = _dock.GetAngle(stationShuttle.EmergencyShuttle.Value, xform, targetGrid.Value, targetXform, xformQuery);
_chatSystem.DispatchStationAnnouncement(stationUid, Loc.GetString("emergency-shuttle-nearby", ("direction", angle.GetDir())), playDefaultSound: false);
_announcer.SendAnnouncementMessage("shuttlenearby", Loc.GetString("emergency-shuttle-nearby", ("direction", angle.GetDir()))); // Parkstation-RandomAnnouncer
}

_logger.Add(LogType.EmergencyShuttle, LogImpact.High, $"Emergency shuttle {ToPrettyString(stationUid)} unable to find a valid docking port for {ToPrettyString(stationUid)}");
// TODO: Need filter extensions or something don't blame me.
_audio.PlayGlobal("/Audio/Misc/notice1.ogg", Filter.Broadcast(), true);
_announcer.SendAnnouncementAudio("shuttlenearby", Filter.Broadcast()); // Parkstation-RandomAnnouncer
}
}

Expand Down

0 comments on commit 8f4ba76

Please sign in to comment.