From 55ae60535954c23b8578ae1366b86d3df0e61a88 Mon Sep 17 00:00:00 2001 From: Aviu00 <93730715+Aviu00@users.noreply.github.com> Date: Tue, 31 Oct 2023 13:20:21 +0900 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BC=D0=B5=D1=88=D0=BD=D0=BE=D0=B5=20?= =?UTF-8?q?=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=86=D0=B5=20=D1=80=D0=B0=D1=83?= =?UTF-8?q?=D0=BD=D0=B4=D0=B0=20=D1=81=20=D0=B0=D1=81=D0=BF=D0=B5=D0=BA?= =?UTF-8?q?=D1=82=D0=BE=D0=BC=20(#516)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Cats * Fix --- .../AspectsSystem/Aspects/CatEarsAspect.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) 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) {