Skip to content

Commit

Permalink
added announcement about greenshift. Also added event preset for admins.
Browse files Browse the repository at this point in the history
  • Loading branch information
pxc1984 committed Jun 7, 2024
1 parent 5137a7f commit 596b6f8
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Content.Server.StationEvents.Events;
using Robust.Shared.Audio;
using System.Threading;

namespace Content.Server.StationEvents.Components;

[RegisterComponent]
public sealed partial class AnnounceRuleComponent : Component
{
[DataField]
public bool EnableAnnouncement;

[DataField]
public SoundSpecifier? AnnounceAudio;

[DataField("roundStartAnnouncementDelay")]
public int RoundStartAnnouncementDelay = 60; // 1 minute from roundstart by default

[DataField("announcementText")]
public string? AnnouncementText;

public CancellationToken TimerCancel = new();
}
38 changes: 38 additions & 0 deletions Content.Server/_Sunrise/StationEvents/Events/AnnounceRule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System.Threading;
using Content.Server.Chat.Systems;
using Content.Shared.GameTicking.Components;
using Content.Server.StationEvents.Components;
using Robust.Shared.Player;
using Timer = Robust.Shared.Timing.Timer;

namespace Content.Server.StationEvents.Events;

public sealed class AnnounceRule : StationEventSystem<AnnounceRuleComponent>
{
[Dependency] private readonly EventManagerSystem _event = default!;
[Dependency] private readonly ChatSystem _chat = default!;

protected override void Started(EntityUid uid, AnnounceRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
{
base.Started(uid, component, gameRule, args);
Timer.Spawn(component.RoundStartAnnouncementDelay * 1000, () => DispatchAnnouncement(uid, component, gameRule, args), component.TimerCancel);
}

protected override void Ended(EntityUid uid, AnnounceRuleComponent component, GameRuleComponent gameRule, GameRuleEndedEvent args)
{
base.Ended(uid, component, gameRule, args);
}

private void DispatchAnnouncement(EntityUid uid, AnnounceRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
{
if (component.EnableAnnouncement)
{
if (component.AnnouncementText != null)
_chat.DispatchGlobalAnnouncement(Loc.GetString(component.AnnouncementText), playSound: true, colorOverride: Color.Green);

if (component.AnnounceAudio != null)
Audio.PlayGlobal(component.AnnounceAudio, Filter.Broadcast(), true);
}
component.TimerCancel = new CancellationToken();
}
}
8 changes: 8 additions & 0 deletions Resources/Changelog/ChangelogSunrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,11 @@ Entries:
type: Tweak
id: 21
time: '2024-06-05T16:26:42.210195+00:00'
- author: pacable
changes:
- message: "\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u043E \u043E\u0431\u044A\
\u044F\u0432\u043B\u0435\u043D\u0438\u0435 \u043E \u0433\u0440\u0438\u043D\u0448\
\u0438\u0444\u0442\u0435 \u043D\u0430 \u0441\u0442\u0430\u043D\u0446\u0438\u0438"
type: Add
id: 22
time: '2024-06-07T09:00:36.645770+00:00'
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
event-title = Event
event-description = Game masters are running an event. There are no threats, including random ones.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
station-event-greenshift = Thanks to the tireless efforts of our security and intelligence divisions, there are currently no credible threats to Space Station 14. Have a secure shift!
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
event-title = Ивент
event-description = Гейм-мастеры проводят ивент. Отсутсвуют любые угрозы, включая случайные.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
station-event-greenshift = Благодаря неустанным усилиям наших отделов Службы Безопасности, в настоящее время нет никаких достоверных угроз для космической станции 14. Удачной смены!
10 changes: 10 additions & 0 deletions Resources/Prototypes/GameRules/roundstart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,16 @@
- type: InitialInfectedRole
prototype: InitialInfected

- type: entity
id: GreenshiftAnnouncement
parent: BaseGameRule
noSpawn: true
components:
- type: AnnounceRule # Sunrise
enableAnnouncement: true
announcementText: station-event-greenshift
roundStartAnnouncementDelay: 120

# event schedulers
- type: entity
id: BasicStationEventScheduler
Expand Down
11 changes: 11 additions & 0 deletions Resources/Prototypes/_Sunrise/game_presets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- type: gamePreset
id: Event
alias:
- event
- ivent
- SilentGreenshift
name: event-title
showInVote: false
description: event-description
rules:
- BasicRoundstartVariation
1 change: 1 addition & 0 deletions Resources/Prototypes/game_presets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
description: greenshift-description
rules:
- BasicRoundstartVariation
- GreenshiftAnnouncement

- type: gamePreset
id: Secret
Expand Down

0 comments on commit 596b6f8

Please sign in to comment.