From 9a7a45a2c5d629ac3bb48e8f6e42ef67637f0bb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=86=D0=B2=D0=B0=D0=BD=20=D0=9E=D0=BD=D1=96=D1=89=D0=B5?= =?UTF-8?q?=D0=BD=D0=BA=D0=BE?= Date: Sun, 29 Dec 2024 20:54:00 +0300 Subject: [PATCH 1/6] - added description for asperts that need it --- Content.Server/_White/UnsafePseudoIoC.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Content.Server/_White/UnsafePseudoIoC.cs b/Content.Server/_White/UnsafePseudoIoC.cs index f0a423f0e4..2c55b065cc 100644 --- a/Content.Server/_White/UnsafePseudoIoC.cs +++ b/Content.Server/_White/UnsafePseudoIoC.cs @@ -9,6 +9,7 @@ public static class UnsafePseudoIoC // Я НАНАВИЖУ IOCMAANGERRESOLVEPOSH public static void Initialize() { ConfigurationManager = IoCManager.Resolve(); + ChatHelper.Initialize(IoCManager.Resolve(), IoCManager.Resolve());// heh IOCMAANGERRESOLVEPOSHEL NAHUI } } From fbae9f1027091a1a77e20e0756a2556df8cdcaaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=86=D0=B2=D0=B0=D0=BD=20=D0=9E=D0=BD=D1=96=D1=89=D0=B5?= =?UTF-8?q?=D0=BD=D0=BA=D0=BE?= Date: Sun, 29 Dec 2024 20:54:34 +0300 Subject: [PATCH 2/6] huh? --- .../AspectsSystem/Aspects/BattledAspect.cs | 2 ++ .../AspectsSystem/Aspects/CatEarsAspect.cs | 2 ++ .../AspectsSystem/Aspects/DancingAspect.cs | 2 ++ .../AspectsSystem/Aspects/DrunkAspect.cs | 5 +++ .../Aspects/FastAndFuriousAspect.cs | 2 ++ .../AspectsSystem/Aspects/ImmersiveAspect.cs | 10 ++---- .../Aspects/RandomAccentAspect.cs | 4 +-- .../Aspects/RandomAppearanceAspect.cs | 2 ++ .../AspectsSystem/Aspects/RandomItemAspect.cs | 2 ++ .../AspectsSystem/Aspects/SkeletonAspect.cs | 4 +++ .../_White/AspectsSystem/Base/ChatHelper.cs | 33 +++++++++++++++++++ Content.Server/_White/UnsafePseudoIoC.cs | 7 ++-- Resources/Locale/ru-RU/_white/aspects.ftl | 9 +++++ 13 files changed, 73 insertions(+), 11 deletions(-) create mode 100644 Content.Server/_White/AspectsSystem/Base/ChatHelper.cs diff --git a/Content.Server/_White/AspectsSystem/Aspects/BattledAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/BattledAspect.cs index 96cf45fbcc..8b0d181cb0 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/BattledAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/BattledAspect.cs @@ -43,6 +43,7 @@ public sealed class BattledAspect : AspectSystem while (query.MoveNext(out var ent, out _)) { GiveItem(ent); + ChatHelper.SendAspectDescription(ent, Loc.GetString("battled-aspect-desc")); } } @@ -61,6 +62,7 @@ public sealed class BattledAspect : AspectSystem var mob = ev.Mob; GiveItem(mob); + ChatHelper.SendAspectDescription(mob, Loc.GetString("battled-aspect-desc")); } } diff --git a/Content.Server/_White/AspectsSystem/Aspects/CatEarsAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/CatEarsAspect.cs index d75e9de395..f6ad27f73c 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/CatEarsAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/CatEarsAspect.cs @@ -66,6 +66,7 @@ public sealed class CatEarsAspect : AspectSystem while (query.MoveNext(out var ent, out var appearance)) { AddMarkings(ent, appearance); + ChatHelper.SendAspectDescription(ent, Loc.GetString("cat-ears-aspect-desc")); } } @@ -81,6 +82,7 @@ public sealed class CatEarsAspect : AspectSystem return; AddMarkings(ev.Mob); + ChatHelper.SendAspectDescription(ev.Mob, Loc.GetString("cat-ears-aspect-desc")); } } diff --git a/Content.Server/_White/AspectsSystem/Aspects/DancingAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/DancingAspect.cs index f04cf6e4e0..7d2ad4e7ac 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/DancingAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/DancingAspect.cs @@ -28,6 +28,7 @@ public sealed class DancingAspect : AspectSystem while (query.MoveNext(out var ent, out _, out _)) { EnsureComp(ent); + ChatHelper.SendAspectDescription(ent, Loc.GetString("dancing-aspect-desc")); } } @@ -45,6 +46,7 @@ public sealed class DancingAspect : AspectSystem var mob = ev.Mob; EnsureComp(mob); + ChatHelper.SendAspectDescription(mob, Loc.GetString("dancing-aspect-desc")); } } } diff --git a/Content.Server/_White/AspectsSystem/Aspects/DrunkAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/DrunkAspect.cs index 30be9f7931..d5d7c551a6 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/DrunkAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/DrunkAspect.cs @@ -27,6 +27,8 @@ public sealed class DrunkAspect : AspectSystem while (query.MoveNext(out var ent, out _)) { _drunkSystem.TryApplyDrunkenness(ent, 50); + + ChatHelper.SendAspectDescription(ent, Loc.GetString("drunk-aspect-desc")); } } @@ -44,6 +46,9 @@ public sealed class DrunkAspect : AspectSystem var mob = ev.Mob; _drunkSystem.TryApplyDrunkenness(mob, 50); + + ChatHelper.SendAspectDescription(mob, Loc.GetString("drunk-aspect-desc")); + } } } diff --git a/Content.Server/_White/AspectsSystem/Aspects/FastAndFuriousAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/FastAndFuriousAspect.cs index 9221bd23a1..979ec0463c 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/FastAndFuriousAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/FastAndFuriousAspect.cs @@ -39,6 +39,7 @@ public sealed class FastAndFuriousAspect : AspectSystem(ent); + ChatHelper.SendAspectDescription(ent, Loc.GetString("fast-and-furious-aspect-desc")); } } @@ -53,6 +54,7 @@ public sealed class FastAndFuriousAspect : AspectSystem FuckUpEye(entity, 0.6f); AddTelescope(entity); - _playerManager.TryGetSessionByEntity(entity, out var session); - if (session != null) - _chatManager.DispatchServerMessage(session, Loc.GetString("immersive-aspect-desc")); + ChatHelper.SendAspectDescription(entity, Loc.GetString("immersive-aspect-desc")); } } @@ -83,9 +81,7 @@ public sealed class ImmersiveAspect : AspectSystem FuckUpEye(ev.Mob, 0.6f); AddTelescope(ev.Mob); - _playerManager.TryGetSessionByEntity(ev.Mob, out var session); - if (session != null) - _chatManager.DispatchServerMessage(session, Loc.GetString("immersive-aspect-desc")); + ChatHelper.SendAspectDescription(ev.Mob, Loc.GetString("immersive-aspect-desc")); } } diff --git a/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs index b443380f4a..5013dafe83 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs @@ -28,6 +28,7 @@ public sealed class RandomAccentAspect : AspectSystem(ent); + ChatHelper.SendAspectDescription(ent, Loc.GetString("random-appearance-aspect-desc")); } } @@ -41,6 +42,7 @@ public sealed class RandomAppearanceAspect : AspectSystem(mob); + ChatHelper.SendAspectDescription(mob, Loc.GetString("random-appearance-aspect-desc")); } } } diff --git a/Content.Server/_White/AspectsSystem/Aspects/RandomItemAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/RandomItemAspect.cs index 2519e2f43d..118c2c68d9 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/RandomItemAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/RandomItemAspect.cs @@ -30,6 +30,7 @@ public sealed class RandomItemAspect : AspectSystem while (query.MoveNext(out var ent, out _)) { GiveItem(ent, component); + ChatHelper.SendAspectDescription(ent, Loc.GetString("random-item-aspect-desc")); } } @@ -48,6 +49,7 @@ public sealed class RandomItemAspect : AspectSystem var mob = ev.Mob; GiveItem(mob, component); + ChatHelper.SendAspectDescription(mob, Loc.GetString("random-item-aspect-desc")); } } diff --git a/Content.Server/_White/AspectsSystem/Aspects/SkeletonAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/SkeletonAspect.cs index 4eb958e997..2b6e0117e0 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/SkeletonAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/SkeletonAspect.cs @@ -42,7 +42,9 @@ public sealed class SkeletonAspect : AspectSystem foreach (var ent in entitiesToPolymorph) { PolymorphEntity(ent.Key, ent.Value); + ChatHelper.SendAspectDescription(ent.Key, Loc.GetString("skeleton-aspect-desc")); } + } private void HandleLateJoin(PlayerSpawnCompleteEvent ev) @@ -57,6 +59,8 @@ public sealed class SkeletonAspect : AspectSystem return; PolymorphEntity(ev.Mob); + + ChatHelper.SendAspectDescription(ev.Mob, Loc.GetString("skeleton-aspect-desc")); } } diff --git a/Content.Server/_White/AspectsSystem/Base/ChatHelper.cs b/Content.Server/_White/AspectsSystem/Base/ChatHelper.cs new file mode 100644 index 0000000000..f736f46ed1 --- /dev/null +++ b/Content.Server/_White/AspectsSystem/Base/ChatHelper.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Content.Server.Chat.Managers; +using Robust.Shared.Player; + +namespace Content.Server._White.AspectsSystem.Base +{ + public static class ChatHelper + { + [Dependency] private static ISharedPlayerManager _playerManager = default!; + [Dependency] private static IChatManager _chatManager = default!; + + + + + public static void Initialize(ISharedPlayerManager playerManager, IChatManager chatManager) + { + _playerManager = playerManager; + _chatManager = chatManager; + } + public static void SendAspectDescription(EntityUid mob, string messageKey) + { + _playerManager.TryGetSessionByEntity(mob, out var session); + if (session != null) + { + _chatManager.DispatchServerMessage(session, Loc.GetString(messageKey)); + } + } + } +} diff --git a/Content.Server/_White/UnsafePseudoIoC.cs b/Content.Server/_White/UnsafePseudoIoC.cs index 2c55b065cc..88ff739246 100644 --- a/Content.Server/_White/UnsafePseudoIoC.cs +++ b/Content.Server/_White/UnsafePseudoIoC.cs @@ -1,4 +1,7 @@ -using Robust.Shared.Configuration; +using Content.Server._White.AspectsSystem.Base; +using Content.Server.Chat.Managers; +using Robust.Shared.Configuration; +using Robust.Shared.Player; namespace Content.Server._White; @@ -9,7 +12,7 @@ public static class UnsafePseudoIoC // Я НАНАВИЖУ IOCMAANGERRESOLVEPOSH public static void Initialize() { ConfigurationManager = IoCManager.Resolve(); - ChatHelper.Initialize(IoCManager.Resolve(), IoCManager.Resolve());// heh IOCMAANGERRESOLVEPOSHEL NAHUI + ChatHelper.Initialize(IoCManager.Resolve(), IoCManager.Resolve());// heh IOCMAANGERRESOLVEPOSHEL NAHUI X2 } } diff --git a/Resources/Locale/ru-RU/_white/aspects.ftl b/Resources/Locale/ru-RU/_white/aspects.ftl index 0b898194f6..7a9dab2c84 100644 --- a/Resources/Locale/ru-RU/_white/aspects.ftl +++ b/Resources/Locale/ru-RU/_white/aspects.ftl @@ -1 +1,10 @@ immersive-aspect-desc = Для осмотра своего окружение, нажмите клавишу присмотреться/прицелиться (по умолчанию - Пробел). +skeleton-aspect-desc = temp1. +battled-aspect-desc = temp2. +cat-ears-aspect-desc = temp3. +dancing-aspect-desc = temp4. +drunk-aspect-desc = temp5. +fast-and-furious-aspect-desc = temp6. +random-accent-aspect-desc = temp7. +random-appearance-aspect-desc = temp8. +random-item-aspect-desc = temp9. \ No newline at end of file From b62f465c4135b4c610d331dea15d4d1caa8b8fa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=86=D0=B2=D0=B0=D0=BD=20=D0=9E=D0=BD=D1=96=D1=89=D0=B5?= =?UTF-8?q?=D0=BD=D0=BA=D0=BE?= Date: Sun, 29 Dec 2024 20:59:01 +0300 Subject: [PATCH 3/6] ups --- .../_White/AspectsSystem/Aspects/RandomAccentAspect.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs index 5013dafe83..28e251952e 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs @@ -44,6 +44,7 @@ public sealed class RandomAccentAspect : AspectSystem Date: Sun, 5 Jan 2025 05:34:44 +0300 Subject: [PATCH 4/6] descriptions --- Resources/Locale/ru-RU/_white/aspects.ftl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Resources/Locale/ru-RU/_white/aspects.ftl b/Resources/Locale/ru-RU/_white/aspects.ftl index 7a9dab2c84..a9ae84c11e 100644 --- a/Resources/Locale/ru-RU/_white/aspects.ftl +++ b/Resources/Locale/ru-RU/_white/aspects.ftl @@ -1,10 +1,10 @@ immersive-aspect-desc = Для осмотра своего окружение, нажмите клавишу присмотреться/прицелиться (по умолчанию - Пробел). -skeleton-aspect-desc = temp1. -battled-aspect-desc = temp2. -cat-ears-aspect-desc = temp3. -dancing-aspect-desc = temp4. -drunk-aspect-desc = temp5. -fast-and-furious-aspect-desc = temp6. -random-accent-aspect-desc = temp7. -random-appearance-aspect-desc = temp8. -random-item-aspect-desc = temp9. \ No newline at end of file +skeleton-aspect-desc = Все персонажи стали скелетами. +battled-aspect-desc = Всем игрокам выдано случайное оружие. +cat-ears-aspect-desc = Котячьи ушки! Уиииии!. +dancing-aspect-desc = Все персонажи находятся в танце. +drunk-aspect-desc = Все персонажи пьяны. +fast-and-furious-aspect-desc = Все персонажи ускоряются. +random-accent-aspect-desc = Все персонажи получили случайный акцент. +random-appearance-aspect-desc = Все персонажи получили случайную внешность. +random-item-aspect-desc = Все персонажи получили случайный предмет. \ No newline at end of file From ce9b8af5605cb2d71585d3c61754a3f02724bbc9 Mon Sep 17 00:00:00 2001 From: BIGZi0348 Date: Sun, 5 Jan 2025 18:37:53 +0300 Subject: [PATCH 5/6] =?UTF-8?q?=D0=A3=D0=B2=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AspectsSystem/Aspects/BattledAspect.cs | 10 +++--- .../AspectsSystem/Aspects/CatEarsAspect.cs | 24 ++++++------- .../AspectsSystem/Aspects/DancingAspect.cs | 5 +-- .../AspectsSystem/Aspects/DrunkAspect.cs | 6 ++-- .../Aspects/FastAndFuriousAspect.cs | 4 +-- .../AspectsSystem/Aspects/ImmersiveAspect.cs | 11 ++---- .../Aspects/RandomAccentAspect.cs | 4 +-- .../Aspects/RandomAppearanceAspect.cs | 6 ++-- .../AspectsSystem/Aspects/RandomItemAspect.cs | 8 ++--- .../AspectsSystem/Aspects/SkeletonAspect.cs | 6 ++-- .../_White/AspectsSystem/Base/ChatHelper.cs | 34 ++++++------------- Content.Server/_White/UnsafePseudoIoC.cs | 1 - Resources/Locale/ru-RU/_white/aspects.ftl | 16 ++++----- 13 files changed, 57 insertions(+), 78 deletions(-) diff --git a/Content.Server/_White/AspectsSystem/Aspects/BattledAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/BattledAspect.cs index 8b0d181cb0..5ceb47b97a 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/BattledAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/BattledAspect.cs @@ -18,6 +18,7 @@ public sealed class BattledAspect : AspectSystem [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; + [Dependency] private readonly ChatHelper _chatHelper = default!; private NonPeacefulRoundItemsPrototype _nonPeacefulRoundItemsPrototype = default!; @@ -32,7 +33,7 @@ public sealed class BattledAspect : AspectSystem { base.Started(uid, component, gameRule, args); - var prototypes = _prototypeManager.EnumeratePrototypes().ToList(); + var prototypes = _prototypeManager.EnumeratePrototypes().ToList(); if (prototypes.Count == 0) ForceEndSelf(uid, gameRule); @@ -43,7 +44,6 @@ public sealed class BattledAspect : AspectSystem while (query.MoveNext(out var ent, out _)) { GiveItem(ent); - ChatHelper.SendAspectDescription(ent, Loc.GetString("battled-aspect-desc")); } } @@ -62,7 +62,7 @@ public sealed class BattledAspect : AspectSystem var mob = ev.Mob; GiveItem(mob); - ChatHelper.SendAspectDescription(mob, Loc.GetString("battled-aspect-desc")); + _chatHelper.SendAspectDescription(mob, Loc.GetString("battled-aspect-desc")); } } @@ -74,10 +74,10 @@ public sealed class BattledAspect : AspectSystem var transform = CompOrNull(player); - if(transform == null) + if (transform == null) return; - if(!HasComp(player)) + if (!HasComp(player)) return; var weaponEntity = EntityManager.SpawnEntity(item, transform.Coordinates); diff --git a/Content.Server/_White/AspectsSystem/Aspects/CatEarsAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/CatEarsAspect.cs index f6ad27f73c..9f366d1b47 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/CatEarsAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/CatEarsAspect.cs @@ -21,6 +21,7 @@ public sealed class CatEarsAspect : AspectSystem [Dependency] private readonly IPrototypeManager _protoMan = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly ChatSystem _chat = default!; + [Dependency] private readonly ChatHelper _chatHelper = default!; private MarkingPrototype _ears = default!; private MarkingPrototype _tail = default!; @@ -66,7 +67,6 @@ public sealed class CatEarsAspect : AspectSystem while (query.MoveNext(out var ent, out var appearance)) { AddMarkings(ent, appearance); - ChatHelper.SendAspectDescription(ent, Loc.GetString("cat-ears-aspect-desc")); } } @@ -82,7 +82,7 @@ public sealed class CatEarsAspect : AspectSystem return; AddMarkings(ev.Mob); - ChatHelper.SendAspectDescription(ev.Mob, Loc.GetString("cat-ears-aspect-desc")); + _chatHelper.SendAspectDescription(ev.Mob, Loc.GetString("cat-ears-aspect-desc")); } } @@ -96,18 +96,18 @@ public sealed class CatEarsAspect : AspectSystem case "Felinid": return; case "Human": - { - if (!appearance.MarkingSet.TryGetCategory(MarkingCategories.HeadTop, out var markings) || - markings.Count == 0) - AddEars(appearance); + { + if (!appearance.MarkingSet.TryGetCategory(MarkingCategories.HeadTop, out var markings) || + markings.Count == 0) + AddEars(appearance); - if (!appearance.MarkingSet.TryGetCategory(MarkingCategories.Tail, out markings) || markings.Count == 0) - AddTail(appearance); + if (!appearance.MarkingSet.TryGetCategory(MarkingCategories.Tail, out markings) || markings.Count == 0) + AddTail(appearance); - Dirty(uid, appearance); - ChangeEmotesVoice(uid, appearance); - return; - } + Dirty(uid, appearance); + ChangeEmotesVoice(uid, appearance); + return; + } default: AddEars(appearance); AddTail(appearance); diff --git a/Content.Server/_White/AspectsSystem/Aspects/DancingAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/DancingAspect.cs index 7d2ad4e7ac..010bff9145 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/DancingAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/DancingAspect.cs @@ -11,6 +11,8 @@ namespace Content.Server._White.AspectsSystem.Aspects; public sealed class DancingAspect : AspectSystem { + [Dependency] private readonly ChatHelper _chatHelper = default!; + public override void Initialize() { base.Initialize(); @@ -28,7 +30,6 @@ public sealed class DancingAspect : AspectSystem while (query.MoveNext(out var ent, out _, out _)) { EnsureComp(ent); - ChatHelper.SendAspectDescription(ent, Loc.GetString("dancing-aspect-desc")); } } @@ -46,7 +47,7 @@ public sealed class DancingAspect : AspectSystem var mob = ev.Mob; EnsureComp(mob); - ChatHelper.SendAspectDescription(mob, Loc.GetString("dancing-aspect-desc")); + _chatHelper.SendAspectDescription(mob, Loc.GetString("dancing-aspect-desc")); } } } diff --git a/Content.Server/_White/AspectsSystem/Aspects/DrunkAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/DrunkAspect.cs index d5d7c551a6..3f684eac74 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/DrunkAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/DrunkAspect.cs @@ -11,6 +11,7 @@ namespace Content.Server._White.AspectsSystem.Aspects; public sealed class DrunkAspect : AspectSystem { [Dependency] private readonly SharedDrunkSystem _drunkSystem = default!; + [Dependency] private readonly ChatHelper _chatHelper = default!; public override void Initialize() { @@ -27,8 +28,6 @@ public sealed class DrunkAspect : AspectSystem while (query.MoveNext(out var ent, out _)) { _drunkSystem.TryApplyDrunkenness(ent, 50); - - ChatHelper.SendAspectDescription(ent, Loc.GetString("drunk-aspect-desc")); } } @@ -47,8 +46,7 @@ public sealed class DrunkAspect : AspectSystem _drunkSystem.TryApplyDrunkenness(mob, 50); - ChatHelper.SendAspectDescription(mob, Loc.GetString("drunk-aspect-desc")); - + _chatHelper.SendAspectDescription(mob, Loc.GetString("drunk-aspect-desc")); } } } diff --git a/Content.Server/_White/AspectsSystem/Aspects/FastAndFuriousAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/FastAndFuriousAspect.cs index 979ec0463c..57f98479bf 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/FastAndFuriousAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/FastAndFuriousAspect.cs @@ -13,6 +13,7 @@ namespace Content.Server._White.AspectsSystem.Aspects; public sealed class FastAndFuriousAspect : AspectSystem { + [Dependency] private readonly ChatHelper _chatHelper = default!; public override void Initialize() { base.Initialize(); @@ -39,7 +40,6 @@ public sealed class FastAndFuriousAspect : AspectSystem(ent); - ChatHelper.SendAspectDescription(ent, Loc.GetString("fast-and-furious-aspect-desc")); } } @@ -54,7 +54,7 @@ public sealed class FastAndFuriousAspect : AspectSystem { - [Dependency] private readonly SharedContentEyeSystem _eye = default!; [Dependency] private readonly SharedTelescopeSystem _telescope = default!; - [Dependency] private readonly IChatManager _chatManager = default!; - [Dependency] private readonly ISharedPlayerManager _playerManager = default!; + [Dependency] private readonly ChatHelper _chatHelper = default!; public override void Initialize() { @@ -48,7 +43,7 @@ public sealed class ImmersiveAspect : AspectSystem FuckUpEye(entity, 0.6f); AddTelescope(entity); - ChatHelper.SendAspectDescription(entity, Loc.GetString("immersive-aspect-desc")); + _chatHelper.SendAspectDescription(entity, Loc.GetString("immersive-aspect-desc")); } } @@ -81,7 +76,7 @@ public sealed class ImmersiveAspect : AspectSystem FuckUpEye(ev.Mob, 0.6f); AddTelescope(ev.Mob); - ChatHelper.SendAspectDescription(ev.Mob, Loc.GetString("immersive-aspect-desc")); + _chatHelper.SendAspectDescription(ev.Mob, Loc.GetString("immersive-aspect-desc")); } } diff --git a/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs index 28e251952e..ab09d3aa27 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs @@ -13,6 +13,7 @@ namespace Content.Server._White.AspectsSystem.Aspects; public sealed class RandomAccentAspect : AspectSystem { [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly ChatHelper _chatHelper = default!; public override void Initialize() { @@ -28,7 +29,6 @@ public sealed class RandomAccentAspect : AspectSystem { + [Dependency] private readonly ChatHelper _chatHelper = default!; public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(HandleLateJoin, after: new [] {typeof(StationRecordsSystem)}); + SubscribeLocalEvent(HandleLateJoin, after: new[] { typeof(StationRecordsSystem) }); } protected override void Started(EntityUid uid, RandomAppearanceAspectComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) @@ -24,7 +25,6 @@ public sealed class RandomAppearanceAspect : AspectSystem(ent); - ChatHelper.SendAspectDescription(ent, Loc.GetString("random-appearance-aspect-desc")); } } @@ -42,7 +42,7 @@ public sealed class RandomAppearanceAspect : AspectSystem(mob); - ChatHelper.SendAspectDescription(mob, Loc.GetString("random-appearance-aspect-desc")); + _chatHelper.SendAspectDescription(mob, Loc.GetString("random-appearance-aspect-desc")); } } } diff --git a/Content.Server/_White/AspectsSystem/Aspects/RandomItemAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/RandomItemAspect.cs index 118c2c68d9..92034df319 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/RandomItemAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/RandomItemAspect.cs @@ -14,6 +14,7 @@ public sealed class RandomItemAspect : AspectSystem { [Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly RandomGiftSystem _giftSystem = default!; + [Dependency] private readonly ChatHelper _chatHelper = default!; public override void Initialize() { @@ -30,7 +31,6 @@ public sealed class RandomItemAspect : AspectSystem while (query.MoveNext(out var ent, out _)) { GiveItem(ent, component); - ChatHelper.SendAspectDescription(ent, Loc.GetString("random-item-aspect-desc")); } } @@ -49,7 +49,7 @@ public sealed class RandomItemAspect : AspectSystem var mob = ev.Mob; GiveItem(mob, component); - ChatHelper.SendAspectDescription(mob, Loc.GetString("random-item-aspect-desc")); + _chatHelper.SendAspectDescription(mob, Loc.GetString("random-item-aspect-desc")); } } @@ -64,10 +64,10 @@ public sealed class RandomItemAspect : AspectSystem var transform = CompOrNull(player); - if(transform == null) + if (transform == null) return; - if(!HasComp(player)) + if (!HasComp(player)) return; var weaponEntity = EntityManager.SpawnEntity(component.Item, transform.Coordinates); diff --git a/Content.Server/_White/AspectsSystem/Aspects/SkeletonAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/SkeletonAspect.cs index 2b6e0117e0..3abea428ef 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/SkeletonAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/SkeletonAspect.cs @@ -13,6 +13,7 @@ namespace Content.Server._White.AspectsSystem.Aspects; public sealed class SkeletonAspect : AspectSystem { + [Dependency] private readonly ChatHelper _chatHelper = default!; // [Dependency] private readonly IPrototypeManager _protoMan = default!; // [Dependency] private readonly PolymorphSystem _polymorph = default!; // [Dependency] private readonly HumanoidAppearanceSystem _humanoidAppearance = default!; @@ -42,9 +43,8 @@ public sealed class SkeletonAspect : AspectSystem foreach (var ent in entitiesToPolymorph) { PolymorphEntity(ent.Key, ent.Value); - ChatHelper.SendAspectDescription(ent.Key, Loc.GetString("skeleton-aspect-desc")); } - + } private void HandleLateJoin(PlayerSpawnCompleteEvent ev) @@ -60,7 +60,7 @@ public sealed class SkeletonAspect : AspectSystem PolymorphEntity(ev.Mob); - ChatHelper.SendAspectDescription(ev.Mob, Loc.GetString("skeleton-aspect-desc")); + _chatHelper.SendAspectDescription(ev.Mob, Loc.GetString("skeleton-aspect-desc")); } } diff --git a/Content.Server/_White/AspectsSystem/Base/ChatHelper.cs b/Content.Server/_White/AspectsSystem/Base/ChatHelper.cs index f736f46ed1..045ff1fff1 100644 --- a/Content.Server/_White/AspectsSystem/Base/ChatHelper.cs +++ b/Content.Server/_White/AspectsSystem/Base/ChatHelper.cs @@ -1,33 +1,19 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Content.Server.Chat.Managers; using Robust.Shared.Player; -namespace Content.Server._White.AspectsSystem.Base +namespace Content.Server._White.AspectsSystem.Base; + +public sealed class ChatHelper : EntitySystem { - public static class ChatHelper + [Dependency] private readonly ISharedPlayerManager _playerManager = default!; + [Dependency] private readonly IChatManager _chatManager = default!; + + public void SendAspectDescription(EntityUid mob, string messageKey) { - [Dependency] private static ISharedPlayerManager _playerManager = default!; - [Dependency] private static IChatManager _chatManager = default!; - - - - - public static void Initialize(ISharedPlayerManager playerManager, IChatManager chatManager) + _playerManager.TryGetSessionByEntity(mob, out var session); + if (session != null) { - _playerManager = playerManager; - _chatManager = chatManager; - } - public static void SendAspectDescription(EntityUid mob, string messageKey) - { - _playerManager.TryGetSessionByEntity(mob, out var session); - if (session != null) - { - _chatManager.DispatchServerMessage(session, Loc.GetString(messageKey)); - } + _chatManager.DispatchServerMessage(session, Loc.GetString(messageKey)); } } } diff --git a/Content.Server/_White/UnsafePseudoIoC.cs b/Content.Server/_White/UnsafePseudoIoC.cs index 88ff739246..e22414eb4a 100644 --- a/Content.Server/_White/UnsafePseudoIoC.cs +++ b/Content.Server/_White/UnsafePseudoIoC.cs @@ -12,7 +12,6 @@ public static class UnsafePseudoIoC // Я НАНАВИЖУ IOCMAANGERRESOLVEPOSH public static void Initialize() { ConfigurationManager = IoCManager.Resolve(); - ChatHelper.Initialize(IoCManager.Resolve(), IoCManager.Resolve());// heh IOCMAANGERRESOLVEPOSHEL NAHUI X2 } } diff --git a/Resources/Locale/ru-RU/_white/aspects.ftl b/Resources/Locale/ru-RU/_white/aspects.ftl index a9ae84c11e..22c9f07c79 100644 --- a/Resources/Locale/ru-RU/_white/aspects.ftl +++ b/Resources/Locale/ru-RU/_white/aspects.ftl @@ -1,10 +1,10 @@ immersive-aspect-desc = Для осмотра своего окружение, нажмите клавишу присмотреться/прицелиться (по умолчанию - Пробел). -skeleton-aspect-desc = Все персонажи стали скелетами. -battled-aspect-desc = Всем игрокам выдано случайное оружие. -cat-ears-aspect-desc = Котячьи ушки! Уиииии!. -dancing-aspect-desc = Все персонажи находятся в танце. -drunk-aspect-desc = Все персонажи пьяны. -fast-and-furious-aspect-desc = Все персонажи ускоряются. -random-accent-aspect-desc = Все персонажи получили случайный акцент. +skeleton-aspect-desc = Из-за обстоятельств на станции - все персонажи стали скелетами. +battled-aspect-desc = Чтобы то ни было ранее, но у вас с собой оказалось случайное оружие. +cat-ears-aspect-desc = Из-за ошибки в системе клонирования на ЦК все члены экипажа стали походить на фелинидов. +dancing-aspect-desc = Федерация Волшебников прокляла всех работников этой станции на танец до смерти. +drunk-aspect-desc = Ваш персонаж слишком хорошо отгулял в своё свободное время. +fast-and-furious-aspect-desc = Из-за обстоятельств на станции - все персонажи передвигаются быстрее обычного. +random-accent-aspect-desc = Из-за обстоятельств на станции - все персонажи получили случайный акцент. random-appearance-aspect-desc = Все персонажи получили случайную внешность. -random-item-aspect-desc = Все персонажи получили случайный предмет. \ No newline at end of file +random-item-aspect-desc = НаноТрейзен выдало всем случайный предмет. From e0987b782c942b9fca8304c02509c9c1e1c35455 Mon Sep 17 00:00:00 2001 From: BIGZi0348 Date: Sun, 5 Jan 2025 19:12:26 +0300 Subject: [PATCH 6/6] =?UTF-8?q?=D0=A3=D1=85=20=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Aspects/FastAndFuriousAspect.cs | 15 ++++-- .../AspectsSystem/Base/AspectComponent.cs | 2 + .../_White/AspectsSystem/Base/AspectSystem.cs | 17 ++++--- .../Prototypes/_White/Aspects/Aspects.yml | 46 +++++++++++-------- 4 files changed, 52 insertions(+), 28 deletions(-) diff --git a/Content.Server/_White/AspectsSystem/Aspects/FastAndFuriousAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/FastAndFuriousAspect.cs index 57f98479bf..6b2d02d10b 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/FastAndFuriousAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/FastAndFuriousAspect.cs @@ -50,11 +50,18 @@ public sealed class FastAndFuriousAspect : AspectSystem(); + while (query.MoveNext(out var ruleEntity, out _, out var gameRule)) + { + if (!GameTicker.IsGameRuleAdded(ruleEntity, gameRule)) + continue; - ModifySpeedIfActive(ev.Mob); - _chatHelper.SendAspectDescription(ev.Mob, Loc.GetString("fast-and-furious-aspect-desc")); + if (!ev.LateJoin) + return; + + ModifySpeedIfActive(ev.Mob); + _chatHelper.SendAspectDescription(ev.Mob, Loc.GetString("fast-and-furious-aspect-desc")); + } } private void ModifySpeedIfActive(EntityUid mob) diff --git a/Content.Server/_White/AspectsSystem/Base/AspectComponent.cs b/Content.Server/_White/AspectsSystem/Base/AspectComponent.cs index 0caf162d08..a26bf964d3 100644 --- a/Content.Server/_White/AspectsSystem/Base/AspectComponent.cs +++ b/Content.Server/_White/AspectsSystem/Base/AspectComponent.cs @@ -12,6 +12,8 @@ public sealed partial class AspectComponent : Component [DataField] public string? Requires; + [DataField] public string? Sender; + [DataField] public float Weight = 1.0f; [DataField] public bool IsForbidden; diff --git a/Content.Server/_White/AspectsSystem/Base/AspectSystem.cs b/Content.Server/_White/AspectsSystem/Base/AspectSystem.cs index af51b40acd..b644e4ca62 100644 --- a/Content.Server/_White/AspectsSystem/Base/AspectSystem.cs +++ b/Content.Server/_White/AspectsSystem/Base/AspectSystem.cs @@ -66,8 +66,10 @@ public abstract class AspectSystem : GameRuleSystem where T : Component if (aspect is { Description: not null, IsHidden: false }) { - _chatSystem.DispatchGlobalAnnouncement(aspect.Description, playSound: false, - colorOverride: Color.Aquamarine); + _chatSystem.DispatchGlobalAnnouncement(aspect.Description, + sender: aspect.Sender ??= "Центральное Командование", + playSound: false, + colorOverride: Color.Aquamarine); } _audio.PlayGlobal(aspect.StartAudio, Filter.Broadcast(), true); @@ -105,14 +107,17 @@ public abstract class AspectSystem : GameRuleSystem where T : Component if (aspect is { Name: not null, IsHidden: false }) { - _chatSystem.DispatchGlobalAnnouncement($"Именем аспекта являлось: {aspect.Name}", playSound: false, - colorOverride: Color.Aquamarine); + + _chatSystem.DispatchGlobalAnnouncement($"Именем аспекта являлось: {aspect.Name}", + sender: aspect.Sender ??= "Центральное Командование", + playSound: false, + colorOverride: Color.Aquamarine); } _audio.PlayGlobal(aspect.EndAudio, Filter.Broadcast(), true); } -#region Helpers + #region Helpers /// /// Forces this aspect to end prematurely. @@ -140,5 +145,5 @@ public abstract class AspectSystem : GameRuleSystem where T : Component return grids.Count > 0; } -#endregion + #endregion } diff --git a/Resources/Prototypes/_White/Aspects/Aspects.yml b/Resources/Prototypes/_White/Aspects/Aspects.yml index 2ad69ca632..722bafbf83 100644 --- a/Resources/Prototypes/_White/Aspects/Aspects.yml +++ b/Resources/Prototypes/_White/Aspects/Aspects.yml @@ -5,7 +5,8 @@ components: - type: Aspect name: Акценты вне контроля - description: Всегда интересно, какой акцент вы услышите следующим + sender: Федерация Космических Волшебников + description: Всегда интересно, какой акцент вы услышите следующим. weight: 3 startAudio: path: /Audio/White/Aspects/accent.ogg @@ -18,7 +19,7 @@ components: - type: Aspect name: Fast and Furious - description: Люди спешат и не важно куда + description: Новейшие разработки в области фильтрации питьевой воды привели к непредвиденным результатам. КПД двигательных систем большинства органических и неорганических существ возрос на 60%! weight: 3 startAudio: path: /Audio/White/Aspects/accent.ogg @@ -58,7 +59,7 @@ components: - type: Aspect name: Drunk - description: На станции стоит явный запах вчерашнего веселья... и кажется оно только начинается + description: На станции стоит явный запах вчерашнего веселья... и кажется оно только начинается. weight: 3 startAudio: path: /Audio/White/Aspects/accent.ogg @@ -71,7 +72,7 @@ components: - type: Aspect name: Cargo Rich - description: Карго работало усердно в прошлую смену, за что они и были награждены премией в размере 100000 кредитов + description: Карго работало усердно в прошлую смену, за что они и были награждены премией в размере 100000 кредитов. weight: 2 startAudio: path: /Audio/White/Aspects/accent.ogg @@ -97,7 +98,7 @@ components: - type: Aspect name: Weak Walls - description: На стенах явно экономили + description: В связи с невыполнением экономических показателей за предыдущий финансовый период - было принято решение на экономии строительных материалов для стен. weight: 2 startAudio: path: /Audio/White/Aspects/accent.ogg @@ -110,7 +111,7 @@ components: - type: Aspect name: No engine - description: Какой-то смышлённый агент синдиката решил украсть все ваши генераторы энергии целиком + description: Какой-то смышлённый агент синдиката решил украсть все ваши генераторы энергии целиком. weight: 2 startAudio: path: /Audio/White/Aspects/accent.ogg @@ -123,7 +124,8 @@ components: - type: Aspect name: Airunlock - description: Кого волнует безопасность? Экипаж свободно может ходить по всем отсекам, ведь все шлюзы теперь для них доступны + sender: Федерация Космических Волшебников + description: Кого волнует безопасность? Экипаж свободно может ходить по всем отсекам, ведь все шлюзы теперь для них доступны. weight: 2 startAudio: path: /Audio/White/Aspects/accent.ogg @@ -137,7 +139,8 @@ components: - type: Aspect name: Bloody - description: В эту смену любая незначительная травма может оказаться летальной + sender: Федерация Космических Волшебников + description: В эту смену любая незначительная травма может оказаться летальной. weight: 2 startAudio: path: /Audio/White/Aspects/accent.ogg @@ -150,6 +153,7 @@ components: - type: Aspect name: Weak + sender: Федерация Космических Волшебников description: Удары стали слабее. Пули мягче. К чему это приведёт? weight: 1 startAudio: @@ -163,7 +167,7 @@ components: - type: Aspect name: Battled - description: Люди очень насторожены и готовы дать отпор в любую секунду + description: Люди очень насторожены и готовы дать отпор в любую секунду. weight: 1 startAudio: path: /Audio/White/Aspects/accent.ogg @@ -189,6 +193,7 @@ components: - type: Aspect name: Presents + sender: Федерация Космических Волшебников description: А вы верите в Деда Мороза? weight: 3 startAudio: @@ -202,6 +207,7 @@ components: - type: Aspect name: Dance + sender: Федерация Космических Волшебников description: Танцуют все! weight: 3 startAudio: @@ -215,7 +221,8 @@ components: - type: Aspect name: Reflect - description: Ваше отражение повсюду + sender: Федерация Космических Волшебников + description: Ваше отражение повсюду. weight: 2 startAudio: path: /Audio/White/Aspects/accent.ogg @@ -228,7 +235,8 @@ components: - type: Aspect name: Slippery - description: Постарайтесь не поскальзываться! + sender: Федерация Космических Волшебников + description: Постарайтесь не подскальзываться! weight: 2 startAudio: path: /Audio/White/Aspects/accent.ogg @@ -241,7 +249,7 @@ components: - type: Aspect name: Extra TC - description: Синдикат выделил 10 дополнительных телекристаллов для предателей + description: Синдикат выделил 10 дополнительных телекристаллов для предателей. requires: Traitors weight: 3 isHidden: true @@ -254,7 +262,8 @@ components: - type: Aspect name: Whisper - description: Из-за боли в горле речь дается вам с трудом + sender: Федерация Космических Волшебников + description: Вы слишком шумные, мы запрещаем вам повышать голос! weight: 3 startAudio: path: /Audio/White/Aspects/accent.ogg @@ -268,6 +277,7 @@ components: - type: Aspect name: Darkness + sender: Федерация Космических Волшебников description: Почему все так темно? weight: 2 startAudio: @@ -281,7 +291,7 @@ components: - type: Aspect name: Stolen Floor - description: Рабочие забыли положить плитку при строительстве станции + description: Рабочие забыли положить плитку при строительстве станции. weight: 3 startAudio: path: /Audio/White/Aspects/accent.ogg @@ -294,7 +304,7 @@ components: - type: Aspect name: Are We In Dungeon - description: В связи с невероятной хрупкостью окон было решено заменить их на стены + description: В связи с невероятной хрупкостью окон было решено заменить их на стены. weight: 3 startAudio: path: /Audio/White/Aspects/accent.ogg @@ -307,7 +317,7 @@ components: - type: Aspect name: Cat Ears And Tail - description: Из-за ошибки в системе клонирования на ЦК все члены экипажа стали походить на фелинидов + description: Из-за ошибки в системе клонирования на ЦК все члены экипажа стали походить на фелинидов. weight: 3 startAudio: path: /Audio/White/Aspects/accent.ogg @@ -333,7 +343,7 @@ components: - type: Aspect name: Random item - description: ЦК выдало каждому члену экипажа определённый предмет + description: ЦК выдало каждому члену экипажа определённый предмет. weight: 3 startAudio: path: /Audio/White/Aspects/accent.ogg @@ -346,7 +356,7 @@ components: - type: Aspect name: Immersive - description: В связи с недавними трагичными событиями экипаж станции погрузился в себя + description: В связи с недавними трагичными событиями экипаж станции погрузился в себя. weight: 3 startAudio: path: /Audio/White/Aspects/accent.ogg