From 0d33e6182c4fdbad89f1e3a0806040e42f9da40c Mon Sep 17 00:00:00 2001
From: Winkarst <74284083+Winkarst-cpu@users.noreply.github.com>
Date: Wed, 12 Feb 2025 14:21:12 +0300
Subject: [PATCH] Split ``ReplacementAccentPrototype`` and
``ReplacementAccentComponent`` in different files (#35107)
* Split ReplacementAccentPrototype and ReplacementAccentComponent
* Fixes
* Fixes
* inheritdoc
---
Content.Server/Chat/Systems/ChatSystem.cs | 2 +-
.../Components/AddAccentClothingComponent.cs | 3 +-
.../Components/ReplacementAccentComponent.cs | 48 ++++---------------
.../EntitySystems/ReplacementAccentSystem.cs | 1 +
.../Prototypes/ReplacementAccentPrototype.cs | 31 ++++++++++++
5 files changed, 45 insertions(+), 40 deletions(-)
create mode 100644 Content.Server/Speech/Prototypes/ReplacementAccentPrototype.cs
diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs
index d834d8304a..674a82053a 100644
--- a/Content.Server/Chat/Systems/ChatSystem.cs
+++ b/Content.Server/Chat/Systems/ChatSystem.cs
@@ -6,7 +6,7 @@ using Content.Server.Administration.Managers;
using Content.Server.Chat.Managers;
using Content.Server.GameTicking;
using Content.Server.Players.RateLimiting;
-using Content.Server.Speech.Components;
+using Content.Server.Speech.Prototypes;
using Content.Server.Speech.EntitySystems;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
diff --git a/Content.Server/Speech/Components/AddAccentClothingComponent.cs b/Content.Server/Speech/Components/AddAccentClothingComponent.cs
index 9d93b55368..335b436f7c 100644
--- a/Content.Server/Speech/Components/AddAccentClothingComponent.cs
+++ b/Content.Server/Speech/Components/AddAccentClothingComponent.cs
@@ -1,4 +1,5 @@
-using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
+using Content.Server.Speech.Prototypes;
+using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Speech.Components;
diff --git a/Content.Server/Speech/Components/ReplacementAccentComponent.cs b/Content.Server/Speech/Components/ReplacementAccentComponent.cs
index 037da72029..2a5a700a5e 100644
--- a/Content.Server/Speech/Components/ReplacementAccentComponent.cs
+++ b/Content.Server/Speech/Components/ReplacementAccentComponent.cs
@@ -1,43 +1,15 @@
-using Robust.Shared.Prototypes;
+using Content.Server.Speech.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
-namespace Content.Server.Speech.Components
+namespace Content.Server.Speech.Components;
+
+///
+/// Replaces full sentences or words within sentences with new strings.
+///
+[RegisterComponent]
+public sealed partial class ReplacementAccentComponent : Component
{
- [Prototype("accent")]
- public sealed partial class ReplacementAccentPrototype : IPrototype
- {
- [ViewVariables]
- [IdDataField]
- public string ID { get; private set; } = default!;
+ [DataField(customTypeSerializer: typeof(PrototypeIdSerializer), required: true)]
+ public string Accent = default!;
- ///
- /// If this array is non-null, the full text of anything said will be randomly replaced with one of these words.
- ///
- [DataField("fullReplacements")]
- public string[]? FullReplacements;
-
- ///
- /// If this dictionary is non-null and is null, any keys surrounded by spaces
- /// (words) will be replaced by the value, attempting to intelligently keep capitalization.
- ///
- [DataField("wordReplacements")]
- public Dictionary? WordReplacements;
-
- ///
- /// Allows you to substitute words, not always, but with some chance
- ///
- [DataField]
- public float ReplacementChance = 1f;
- }
-
- ///
- /// Replaces full sentences or words within sentences with new strings.
- ///
- [RegisterComponent]
- public sealed partial class ReplacementAccentComponent : Component
- {
- [DataField("accent", customTypeSerializer: typeof(PrototypeIdSerializer), required: true)]
- public string Accent = default!;
-
- }
}
diff --git a/Content.Server/Speech/EntitySystems/ReplacementAccentSystem.cs b/Content.Server/Speech/EntitySystems/ReplacementAccentSystem.cs
index d81d913a36..656a72b3f9 100644
--- a/Content.Server/Speech/EntitySystems/ReplacementAccentSystem.cs
+++ b/Content.Server/Speech/EntitySystems/ReplacementAccentSystem.cs
@@ -1,6 +1,7 @@
using System.Linq;
using System.Text.RegularExpressions;
using Content.Server.Speech.Components;
+using Content.Server.Speech.Prototypes;
using JetBrains.Annotations;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
diff --git a/Content.Server/Speech/Prototypes/ReplacementAccentPrototype.cs b/Content.Server/Speech/Prototypes/ReplacementAccentPrototype.cs
new file mode 100644
index 0000000000..cde4baeb2f
--- /dev/null
+++ b/Content.Server/Speech/Prototypes/ReplacementAccentPrototype.cs
@@ -0,0 +1,31 @@
+using Robust.Shared.Prototypes;
+
+namespace Content.Server.Speech.Prototypes;
+
+[Prototype("accent")]
+public sealed partial class ReplacementAccentPrototype : IPrototype
+{
+ ///
+ [ViewVariables]
+ [IdDataField]
+ public string ID { get; private set; } = default!;
+
+ ///
+ /// If this array is non-null, the full text of anything said will be randomly replaced with one of these words.
+ ///
+ [DataField]
+ public string[]? FullReplacements;
+
+ ///
+ /// If this dictionary is non-null and is null, any keys surrounded by spaces
+ /// (words) will be replaced by the value, attempting to intelligently keep capitalization.
+ ///
+ [DataField]
+ public Dictionary? WordReplacements;
+
+ ///
+ /// Allows you to substitute words, not always, but with some chance
+ ///
+ [DataField]
+ public float ReplacementChance = 1f;
+}