diff --git a/Content.Server/White/AspectsSystem/Aspects/CatEarsAspect.cs b/Content.Server/White/AspectsSystem/Aspects/CatEarsAspect.cs index 2ec670a52c..2d70763cf2 100644 --- a/Content.Server/White/AspectsSystem/Aspects/CatEarsAspect.cs +++ b/Content.Server/White/AspectsSystem/Aspects/CatEarsAspect.cs @@ -1,16 +1,22 @@ +using Content.Server.Chat.Systems; using Content.Server.GameTicking; using Content.Server.GameTicking.Rules.Components; using Content.Server.White.AspectsSystem.Aspects.Components; using Content.Server.White.AspectsSystem.Base; +using Content.Shared.GameTicking; using Content.Shared.Humanoid; using Content.Shared.Humanoid.Markings; +using Content.Shared.Speech; using Robust.Shared.Prototypes; +using Robust.Shared.Random; namespace Content.Server.White.AspectsSystem.Aspects; public sealed class CatEarsAspect : AspectSystem { [Dependency] private readonly IPrototypeManager _protoMan = default!; + [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly ChatSystem _chat = default!; private MarkingPrototype _ears = default!; private MarkingPrototype _tail = default!; @@ -19,11 +25,29 @@ public sealed class CatEarsAspect : AspectSystem { base.Initialize(); SubscribeLocalEvent(HandleLateJoin); + SubscribeLocalEvent(OnRoundEnd); _ears = _protoMan.Index("FelinidEarsBasic"); _tail = _protoMan.Index("FelinidTailBasic"); } + private void OnRoundEnd(RoundEndedEvent ev) + { + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var ruleEntity, out _, out var gameRule)) + { + if (!GameTicker.IsGameRuleAdded(ruleEntity, gameRule)) + continue; + + var entQuery = EntityQueryEnumerator(); + while (entQuery.MoveNext(out var ent, out _, out _)) + { + _chat.TrySendInGameICMessage(ent, _random.Pick(new[] {"Мяу", "Мур", "Ня"}), InGameICChatType.Speak, + ChatTransmitRange.Normal); + } + } + } + protected override void Started(EntityUid uid, CatEarsAspectComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) {