]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
localize skeleton accent (#32166)
authorlzk <124214523+lzk228@users.noreply.github.com>
Sun, 15 Sep 2024 19:49:05 +0000 (21:49 +0200)
committerGitHub <noreply@github.com>
Sun, 15 Sep 2024 19:49:05 +0000 (21:49 +0200)
* localize skeleton accent

* commit number 2

* remove that from this

* this

* babushka

Content.Server/Speech/EntitySystems/SkeletonAccentSystem.cs
Resources/Locale/en-US/accent/skeleton.ftl [new file with mode: 0644]
Resources/Prototypes/Accents/word_replacements.yml

index d143c25fdbab2350e6e67962ca069d7a69ce7784..1b773f1a5ac132d03ac7ee67f7db0ec989e41783 100644 (file)
@@ -7,29 +7,11 @@ namespace Content.Server.Speech.EntitySystems;
 public sealed partial class SkeletonAccentSystem : EntitySystem
 {
     [Dependency] private readonly IRobustRandom _random = default!;
+    [Dependency] private readonly ReplacementAccentSystem _replacement = default!;
 
     [GeneratedRegex(@"(?<!\w)[^aeiou]one", RegexOptions.IgnoreCase, "en-US")]
     private static partial Regex BoneRegex();
 
-    private static readonly Dictionary<string, string> DirectReplacements = new()
-    {
-        { "fuck you", "I've got a BONE to pick with you" },
-        { "fucked", "boned"},
-        { "fuck", "RATTLE RATTLE" },
-        { "fck", "RATTLE RATTLE" },
-        { "shit", "RATTLE RATTLE" }, // Capitalize RATTLE RATTLE regardless of original message case.
-        { "definitely", "make no bones about it" },
-        { "absolutely", "make no bones about it" },
-        { "afraid", "rattled"},
-        { "scared", "rattled"},
-        { "spooked", "rattled"},
-        { "shocked", "rattled"},
-        { "killed", "skeletonized"},
-        { "humorous", "humerus"},
-        { "to be a", "tibia"},
-        { "under", "ulna"}
-    };
-
     public override void Initialize()
     {
         base.Initialize();
@@ -50,11 +32,8 @@ public sealed partial class SkeletonAccentSystem : EntitySystem
         // At the start of words, any non-vowel + "one" becomes "bone", e.g. tone -> bone ; lonely -> bonely; clone -> clone (remains unchanged).
         msg = BoneRegex().Replace(msg, "bone");
 
-        // Direct word/phrase replacements:
-        foreach (var (first, replace) in DirectReplacements)
-        {
-            msg = Regex.Replace(msg, $@"(?<!\w){first}(?!\w)", replace, RegexOptions.IgnoreCase);
-        }
+        // apply word replacements
+        msg = _replacement.ApplyReplacements(msg, "skeleton");
 
         // Suffix:
         if (_random.Prob(component.ackChance))
diff --git a/Resources/Locale/en-US/accent/skeleton.ftl b/Resources/Locale/en-US/accent/skeleton.ftl
new file mode 100644 (file)
index 0000000..9a83967
--- /dev/null
@@ -0,0 +1,32 @@
+accent-skeleton-words-1 = fuck you
+accent-skeleton-words-replace-1 = I've got a BONE to pick with you
+
+accent-skeleton-words-2 = fucked
+accent-skeleton-words-replace-2 = boned
+
+accent-skeleton-words-3 = fuck
+accent-skeleton-words-3-2 = fck
+accent-skeleton-words-3-3 = shit
+accent-skeleton-words-replace-3 = RATTLE RATTLE
+
+accent-skeleton-words-4 = definitely
+accent-skeleton-words-4-2 = absolutely
+accent-skeleton-words-replace-4 = make no bones about it
+
+accent-skeleton-words-5 = afraid
+accent-skeleton-words-5-2 = scared
+accent-skeleton-words-5-3 = spooked
+accent-skeleton-words-5-4 = shocked
+accent-skeleton-words-replace-5 = rattled
+
+accent-skeleton-words-6 = killed
+accent-skeleton-words-replace-6 = skeletonized
+
+accent-skeleton-words-7 = humorous
+accent-skeleton-words-replace-7 = humerus
+
+accent-skeleton-words-8 = to be a
+accent-skeleton-words-replace-8 = tibia
+
+accent-skeleton-words-9 = under
+accent-skeleton-words-replace-9 = ulna
index 067c8016b64ac2b333f006dfe2dde24dd7568fdb..9678cb313e65eb43be5ff7c13f074247d6749432 100644 (file)
     accent-russian-words-4: accent-russian-words-replace-4
     accent-russian-words-5: accent-russian-words-replace-5
     accent-russian-words-6: accent-russian-words-replace-6
+
+- type: accent
+  id: skeleton
+  wordReplacements:
+    accent-skeleton-words-1: accent-skeleton-words-replace-1
+    accent-skeleton-words-2: accent-skeleton-words-replace-2
+    accent-skeleton-words-3: accent-skeleton-words-replace-3
+    accent-skeleton-words-3-2: accent-skeleton-words-replace-3
+    accent-skeleton-words-3-3: accent-skeleton-words-replace-3
+    accent-skeleton-words-4: accent-skeleton-words-replace-4
+    accent-skeleton-words-4-2: accent-skeleton-words-replace-4
+    accent-skeleton-words-5: accent-skeleton-words-replace-5
+    accent-skeleton-words-5-2: accent-skeleton-words-replace-5
+    accent-skeleton-words-5-3: accent-skeleton-words-replace-5
+    accent-skeleton-words-5-4: accent-skeleton-words-replace-5
+    accent-skeleton-words-6: accent-skeleton-words-replace-6
+    accent-skeleton-words-7: accent-skeleton-words-replace-7
+    accent-skeleton-words-8: accent-skeleton-words-replace-8
+    accent-skeleton-words-9: accent-skeleton-words-replace-9