2022-07-10 18:48:41 -07:00
|
|
|
|
using Content.Server.GameTicking.Rules.Configurations;
|
|
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
|
using Robust.Shared.Audio;
|
|
|
|
|
|
using Robust.Shared.Player;
|
2021-01-18 18:14:53 +08:00
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Server.StationEvents.Events
|
2021-01-18 18:14:53 +08:00
|
|
|
|
{
|
|
|
|
|
|
[UsedImplicitly]
|
2022-07-10 18:48:41 -07:00
|
|
|
|
public sealed class FalseAlarm : StationEventSystem
|
2021-01-18 18:14:53 +08:00
|
|
|
|
{
|
2022-07-10 18:48:41 -07:00
|
|
|
|
public override string Prototype => "FalseAlarm";
|
2021-01-18 18:14:53 +08:00
|
|
|
|
|
2022-07-10 18:48:41 -07:00
|
|
|
|
public override void Started()
|
2021-01-18 18:14:53 +08:00
|
|
|
|
{
|
2022-07-10 18:48:41 -07:00
|
|
|
|
base.Started();
|
2021-01-18 18:14:53 +08:00
|
|
|
|
|
2022-07-10 18:48:41 -07:00
|
|
|
|
var ev = GetRandomEventUnweighted(PrototypeManager, RobustRandom);
|
|
|
|
|
|
|
|
|
|
|
|
if (ev.Configuration is not StationEventRuleConfiguration cfg)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if (cfg.StartAnnouncement != null)
|
2021-01-18 18:14:53 +08:00
|
|
|
|
{
|
2022-07-15 12:16:41 +03:00
|
|
|
|
ChatSystem.DispatchGlobalAnnouncement(Loc.GetString(cfg.StartAnnouncement), playSound: false, colorOverride: Color.Gold);
|
2021-01-18 18:14:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-10 18:48:41 -07:00
|
|
|
|
if (cfg.StartAudio != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
SoundSystem.Play(cfg.StartAudio.GetSound(), Filter.Broadcast(), cfg.StartAudio.Params);
|
|
|
|
|
|
}
|
2021-01-18 18:14:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|