-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added announcement about greenshift. Also added event preset for admins.
- Loading branch information
Showing
10 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
Content.Server/_Sunrise/StationEvents/Components/AnnounceRuleComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
38
Content.Server/_Sunrise/StationEvents/Events/AnnounceRule.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
Resources/Locale/en-US/ss14-ru/prototypes/game-ticking/preset-event.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
1 change: 1 addition & 0 deletions
1
Resources/Locale/en-US/ss14-ru/prototypes/gamerules/greenshift.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! |
2 changes: 2 additions & 0 deletions
2
Resources/Locale/ru-RU/game-ticking/game-presets/preset-event.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
event-title = Ивент | ||
event-description = Гейм-мастеры проводят ивент. Отсутсвуют любые угрозы, включая случайные. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
station-event-greenshift = Благодаря неустанным усилиям наших отделов Службы Безопасности, в настоящее время нет никаких достоверных угроз для космической станции 14. Удачной смены! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters