Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 56 additions & 1 deletion Content.Server/Speech/EntitySystems/LizardAccentSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@

using System.Text.RegularExpressions;
using Content.Server.Speech.Components;
using Robust.Shared.Random;
using Content.Shared.Speech;

#pragma warning disable RA0026

namespace Content.Server.Speech.EntitySystems;

public sealed class LizardAccentSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!; // Arcane: Localization

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Замените маркер одиночной fork-правки.

Строка добавляет зависимость в upstream-файле вне _Arcane, но помечена как // Arcane: Localization. Эта строка не относится к локализационному блоку. Используйте // Arcane-Edit.

Based on learnings: для одиночных fork-правок вне _Arcane используется маркер // Arcane-Edit.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Content.Server/Speech/EntitySystems/LizardAccentSystem.cs` at line 18,
Replace the `// Arcane: Localization` marker on the `_random` dependency
declaration in `LizardAccentSystem` with `// Arcane-Edit`, preserving the
dependency and all other code unchanged.

Source: Learnings


private static readonly Regex RegexLowerS = new("s+");
private static readonly Regex RegexUpperS = new("S+");
private static readonly Regex RegexInternalX = new(@"(\w)x");
Expand Down Expand Up @@ -35,6 +40,56 @@ private void OnAccent(EntityUid uid, LizardAccentComponent component, AccentGetE
// eckS
message = RegexUpperEndX.Replace(message, "ECKS$1");

// Arcane-Start: Localization
// c => ссс
message = Regex.Replace(
message,
"с+",
_random.Pick(new List<string>() { "сс", "ссс" })
);
// С => CCC
message = Regex.Replace(
message,
"С+",
_random.Pick(new List<string>() { "СС", "ССС" })
);
// з => ссс
message = Regex.Replace(
message,
"з+",
_random.Pick(new List<string>() { "сс", "ссс" })
);
// З => CCC
message = Regex.Replace(
message,
"З+",
_random.Pick(new List<string>() { "СС", "ССС" })
);
// ш => шшш
message = Regex.Replace(
message,
"ш+",
_random.Pick(new List<string>() { "шш", "шшш" })
);
// Ш => ШШШ
message = Regex.Replace(
message,
"Ш+",
_random.Pick(new List<string>() { "ШШ", "ШШШ" })
);
// ч => щщщ
message = Regex.Replace(
message,
"ч+",
_random.Pick(new List<string>() { "щщ", "щщщ" })
);
// Ч => ЩЩЩ
message = Regex.Replace(
message,
"Ч+",
_random.Pick(new List<string>() { "ЩЩ", "ЩЩЩ" })
);
// Arcane-End
args.Message = message;
}
}
}
2 changes: 1 addition & 1 deletion Content.Server/Speech/EntitySystems/StutteringSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public sealed class StutteringSystem : SharedStutteringSystem
[Dependency] private readonly IRobustRandom _random = default!;

// Regex of characters to stutter.
private static readonly Regex Stutter = new(@"[b-df-hj-np-tv-wxyz]",
private static readonly Regex Stutter = new(@"[b-df-hj-np-tv-wxyz-б-вд-к-лмн-прст]", // Arcane-Edit
RegexOptions.Compiled | RegexOptions.IgnoreCase);

public override void Initialize()
Expand Down
Loading