Files
tbd-station-14/Content.Shared/Trigger/Systems/TriggerOnRoundEndSystem.cs
āda ad5fe5678c Trigger on round end (#39545)
* works if it works

* small rewording

---------

Co-authored-by: iaada <iaada@users.noreply.github.com>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2025-08-11 09:44:36 +02:00

32 lines
845 B
C#

using Content.Shared.GameTicking;
using Content.Shared.Trigger.Components.Triggers;
namespace Content.Shared.Trigger.Systems;
/// <summary>
/// System for creating a trigger when the round ends.
/// </summary>
public sealed class TriggerOnRoundEndSystem : EntitySystem
{
[Dependency] private readonly TriggerSystem _trigger = default!;
/// <inheritdoc/>
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RoundEndMessageEvent>(OnRoundEnd);
}
private void OnRoundEnd(RoundEndMessageEvent args)
{
var triggerQuery = EntityQueryEnumerator<TriggerOnRoundEndComponent>();
// trigger everything with the component
while (triggerQuery.MoveNext(out var uid, out var comp))
{
_trigger.Trigger(uid, null, comp.KeyOut);
}
}
}