* 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>
32 lines
845 B
C#
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);
|
|
}
|
|
}
|
|
}
|