From 1d4c5de39adffd2a92bc9df5b862cb715402d04d Mon Sep 17 00:00:00 2001 From: Schrodinger71 Date: Fri, 14 Jun 2024 18:00:23 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=BE=D1=82=20=D1=82=D0=B5=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D1=8C=20=D1=82=D0=BE=D1=87=D0=BD=D0=BE=20=D0=B2=D1=81?= =?UTF-8?q?=D1=91,=20=D0=BE=D1=81=D0=B2=D0=BE=D0=B1=D0=BE=D0=B6=D0=B4?= =?UTF-8?q?=D0=B0=D0=B5=D0=BC=20=D1=80=D0=B5=D1=81=D1=83=D1=80=D1=81=D1=8B?= =?UTF-8?q?=20=D0=B8=20=D0=BD=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88=D0=B0?= =?UTF-8?q?=D1=8F=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoPostingChat/AutoPostingChatSystem.cs | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/Content.Server/ADT/AutoPostingChat/AutoPostingChatSystem.cs b/Content.Server/ADT/AutoPostingChat/AutoPostingChatSystem.cs index 1bbd84889e..ace44a92b1 100644 --- a/Content.Server/ADT/AutoPostingChat/AutoPostingChatSystem.cs +++ b/Content.Server/ADT/AutoPostingChat/AutoPostingChatSystem.cs @@ -41,6 +41,8 @@ private void ComponentRemove(EntityUid uid, AutoPostingChatComponent component, { _speakTimer.Stop(); _emoteTimer.Stop(); + _speakTimer.Dispose(); // освобождаем ресурсы + _emoteTimer.Dispose(); } /// @@ -51,19 +53,17 @@ private void OnMobState(EntityUid uid, AutoPostingChatComponent component, MobSt if (args.NewMobState == MobState.Dead || component == null) { RemComp(uid); - //var damageSpec = new DamageSpecifier(_prototypeManager.Index("Genetic"), 300); - //_damageableSystem.TryChangeDamage(uid, damageSpec); } } private void OnComponentStartup(EntityUid uid, AutoPostingChatComponent component, ComponentStartup args) { - // Проверяем наличие компонента AutoPostingChatComponent на сущности - //if (component == null) - //{ - // Logger.Warning("AutoPostingChatComponent отсутствует на сущности с UID: " + uid); - // return; - //} + // Проверяем наличие компонента AutoPostingChatComponent на сущности + if (component == null) + { + Log.Debug("AutoPostingChatComponent отсутствует на сущности с UID: " + uid); + return; + } _speakTimer.Interval = component.SpeakTimerRead; // 8000 миллисекунд = 8 секунд по умолчанию _speakTimer.Elapsed += (sender, eventArgs) => @@ -71,9 +71,6 @@ private void OnComponentStartup(EntityUid uid, AutoPostingChatComponent componen // Проверяем, что данные в компоненте были обновлены if (component.PostingMessageSpeak != null) { - //if (component.PostingMessageSpeak == "") - // _speakTimer.Stop(); - _chat.TrySendInGameICMessage(uid, component.PostingMessageSpeak, InGameICChatType.Speak, ChatTransmitRange.Normal); } _speakTimer.Interval = component.SpeakTimerRead; @@ -84,8 +81,6 @@ private void OnComponentStartup(EntityUid uid, AutoPostingChatComponent componen // Проверяем, что данные в компоненте были обновлены if (component.PostingMessageEmote != null) { - //if (component.PostingMessageEmote == "") - // _emoteTimer.Stop(); _chat.TrySendInGameICMessage(uid, component.PostingMessageEmote, InGameICChatType.Emote, ChatTransmitRange.Normal); } _emoteTimer.Interval = component.EmoteTimerRead; @@ -94,4 +89,4 @@ private void OnComponentStartup(EntityUid uid, AutoPostingChatComponent componen _speakTimer.Start(); _emoteTimer.Start(); } -} +} \ No newline at end of file