CatStation/Content.Server/StationEvents/Events/FalseAlarmRule.cs
Pieter-Jan Briers 5168b5f3d4
IoC source gen compatibility (#43863)
* IoC source gen compatibility

Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter.

* Missed a spot
2026-05-09 03:29:58 +00:00

28 lines
1,010 B
C#

using System.Linq;
using Content.Server.StationEvents.Components;
using Content.Shared.GameTicking.Components;
using JetBrains.Annotations;
using Robust.Shared.Random;
namespace Content.Server.StationEvents.Events;
[UsedImplicitly]
public sealed partial class FalseAlarmRule : StationEventSystem<FalseAlarmRuleComponent>
{
[Dependency] private EventManagerSystem _event = default!;
protected override void Started(EntityUid uid, FalseAlarmRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
{
if (!TryComp<StationEventComponent>(uid, out var stationEvent))
return;
var allEv = _event.AllEvents().Select(p => p.Value).ToList();
var picked = RobustRandom.Pick(allEv);
stationEvent.StartAnnouncement = picked.StartAnnouncement;
stationEvent.StartAudio = picked.StartAudio;
stationEvent.StartAnnouncementColor = picked.StartAnnouncementColor;
base.Started(uid, component, gameRule, args);
}
}