-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
International Space Station Update - New Accent Traits (#1712)
Ports Russian and German languages from Wizden and adds traits for them. Also adds traits for Italian, French and Spanish since they already exist. Not tested because the game didn't want to build locally. # Changelog <!-- You can add an author after the `:cl:` to change the name that appears in the changelog (ex: `:cl: Death`) Leaving it blank will default to your GitHub display name This includes all available types for the changelog --> :cl: - add: Added traits for accents: Russian, German, French, Italian and Spanish --------- Signed-off-by: Peptide90 <78795277+Peptide90@users.noreply.github.com>
- Loading branch information
Showing
8 changed files
with
473 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace Content.Server.Speech.Components; | ||
|
||
[RegisterComponent] | ||
public sealed partial class GermanAccentComponent : Component; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
using System.Text; | ||
using Content.Server.Speech.Components; | ||
using Robust.Shared.Random; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace Content.Server.Speech.EntitySystems; | ||
|
||
public sealed class GermanAccentSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IRobustRandom _random = default!; | ||
[Dependency] private readonly ReplacementAccentSystem _replacement = default!; | ||
|
||
private static readonly Regex RegexTh = new(@"(?<=\s|^)th", RegexOptions.IgnoreCase); | ||
private static readonly Regex RegexThe = new(@"(?<=\s|^)the(?=\s|$)", RegexOptions.IgnoreCase); | ||
|
||
public override void Initialize() | ||
{ | ||
SubscribeLocalEvent<GermanAccentComponent, AccentGetEvent>(OnAccent); | ||
} | ||
|
||
public string Accentuate(string message) | ||
{ | ||
var msg = message; | ||
|
||
// rarely, "the" should become "das" instead of "ze" | ||
// TODO: The ReplacementAccentSystem should have random replacements this built-in. | ||
foreach (Match match in RegexThe.Matches(msg)) | ||
{ | ||
if (_random.Prob(0.3f)) | ||
{ | ||
// just shift T, H and E over to D, A and S to preserve capitalization | ||
msg = msg.Substring(0, match.Index) + | ||
(char)(msg[match.Index] - 16) + | ||
(char)(msg[match.Index + 1] - 7) + | ||
(char)(msg[match.Index + 2] + 14) + | ||
msg.Substring(match.Index + 3); | ||
} | ||
} | ||
|
||
// now, apply word replacements | ||
msg = _replacement.ApplyReplacements(msg, "german"); | ||
|
||
// replace th with zh (for zhis, zhat, etc. the => ze is handled by replacements already) | ||
var msgBuilder = new StringBuilder(msg); | ||
foreach (Match match in RegexTh.Matches(msg)) | ||
{ | ||
// just shift the T over to a Z to preserve capitalization | ||
msgBuilder[match.Index] = (char) (msgBuilder[match.Index] + 6); | ||
} | ||
|
||
// Random Umlaut Time! (The joke outweighs the emotional damage this inflicts on actual Germans) | ||
var umlautCooldown = 0; | ||
for (var i = 0; i < msgBuilder.Length; i++) | ||
{ | ||
if (umlautCooldown == 0) | ||
{ | ||
if (_random.Prob(0.1f)) // 10% of all eligible vowels become umlauts) | ||
{ | ||
msgBuilder[i] = msgBuilder[i] switch | ||
{ | ||
'A' => 'Ä', | ||
'a' => 'ä', | ||
'O' => 'Ö', | ||
'o' => 'ö', | ||
'U' => 'Ü', | ||
'u' => 'ü', | ||
_ => msgBuilder[i] | ||
}; | ||
umlautCooldown = 4; | ||
} | ||
} | ||
else | ||
{ | ||
umlautCooldown--; | ||
} | ||
} | ||
|
||
return msgBuilder.ToString(); | ||
} | ||
|
||
private void OnAccent(Entity<GermanAccentComponent> ent, ref AccentGetEvent args) | ||
{ | ||
args.Message = Accentuate(args.Message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
accent-german-words-1 = yes | ||
accent-german-words-1-2 = yea | ||
accent-german-words-replace-1 = ja | ||
accent-german-words-2 = no | ||
accent-german-words-replace-2 = nein | ||
accent-german-words-3 = the | ||
accent-german-words-replace-3 = ze | ||
accent-german-words-4 = shit | ||
accent-german-words-replace-4 = scheisse | ||
accent-german-words-5 = sausage | ||
accent-german-words-replace-5 = wurst | ||
accent-german-words-6 = sausages | ||
accent-german-words-replace-6 = würste | ||
accent-german-words-7 = man | ||
accent-german-words-replace-7 = mann | ||
accent-german-words-8 = men | ||
accent-german-words-replace-8 = männer | ||
accent-german-words-9 = woman | ||
accent-german-words-9-2 = lady | ||
accent-german-words-replace-9 = frau | ||
accent-german-words-10 = women | ||
accent-german-words-10-2 = ladies | ||
accent-german-words-replace-10 = frauen | ||
accent-german-words-11 = gentleman | ||
accent-german-words-replace-11 = herr | ||
accent-german-words-12 = gentlemen | ||
accent-german-words-replace-12 = herren | ||
accent-german-words-13 = my god | ||
accent-german-words-replace-13 = mein gott | ||
accent-german-words-14 = my | ||
accent-german-words-replace-14 = mein | ||
accent-german-words-15 = here | ||
accent-german-words-replace-15 = hier | ||
accent-german-words-16 = idiot | ||
accent-german-words-replace-16 = dummkopf | ||
accent-german-words-17 = idiots | ||
accent-german-words-replace-17 = dummköpfe | ||
accent-german-words-18 = butterfly | ||
accent-german-words-replace-18 = schmetterling | ||
accent-german-words-19 = machine | ||
accent-german-words-replace-19 = maschine | ||
accent-german-words-20 = machines | ||
accent-german-words-replace-20 = maschinen | ||
accent-german-words-21 = watch out | ||
accent-german-words-replace-21 = achtung | ||
accent-german-words-22 = music | ||
accent-german-words-replace-22 = musik | ||
accent-german-words-23 = captain | ||
accent-german-words-replace-23 = kapitän | ||
accent-german-words-24 = kebab | ||
accent-german-words-replace-24 = döner | ||
accent-german-words-25 = mouse | ||
accent-german-words-replace-25 = maus | ||
accent-german-words-26 = what | ||
accent-german-words-replace-26 = wat | ||
accent-german-words-27 = thank you | ||
accent-german-words-replace-27 = dankeschön | ||
accent-german-words-28 = thanks | ||
accent-german-words-replace-28 = danke | ||
accent-german-words-29 = bless you | ||
accent-german-words-replace-29 = gesundheit | ||
accent-german-words-30 = flamethrower | ||
accent-german-words-replace-30 = flammenwerfer | ||
accent-german-words-31 = ghost | ||
accent-german-words-replace-31 = poltergeist | ||
accent-german-words-32 = weed | ||
accent-german-words-32-2 = cabbage | ||
accent-german-words-replace-32 = kraut | ||
accent-german-words-33 = vodka | ||
accent-german-words-replace-33 = wodka | ||
accent-german-words-34 = backpack | ||
accent-german-words-replace-34 = rucksack | ||
accent-german-words-35 = medicine | ||
accent-german-words-replace-35 = medizin | ||
accent-german-words-36 = accent | ||
accent-german-words-replace-36 = akzent | ||
accent-german-words-37 = anomaly | ||
accent-german-words-replace-37 = anomalie | ||
accent-german-words-38 = artifact | ||
accent-german-words-38-2 = artefact | ||
accent-german-words-replace-38 = artefakt | ||
accent-german-words-39 = dumb | ||
accent-german-words-replace-39 = dumm | ||
accent-german-words-40 = stupid | ||
accent-german-words-replace-40 = doof | ||
accent-german-words-41 = wonderful | ||
accent-german-words-replace-41 = wunderbar | ||
accent-german-words-42 = warning | ||
accent-german-words-replace-42 = warnung | ||
accent-german-words-43 = warnings | ||
accent-german-words-replace-43 = warnungen | ||
accent-german-words-44 = and | ||
accent-german-words-replace-44 = und | ||
accent-german-words-45 = carp | ||
accent-german-words-replace-45 = karpfen | ||
accent-german-words-46 = commander | ||
accent-german-words-replace-46 = kommandant | ||
accent-german-words-47 = beer | ||
accent-german-words-47-2 = beers | ||
accent-german-words-replace-47 = bier | ||
accent-german-words-48 = hi | ||
accent-german-words-replace-48 = hallo | ||
accent-german-words-49 = hello | ||
accent-german-words-replace-49 = guten Tag | ||
accent-german-words-50 = ambulance | ||
accent-german-words-replace-50 = krankenwagen | ||
accent-german-words-51 = goodbye | ||
accent-german-words-replace-51 = auf Wiedersehen | ||
accent-german-words-52 = bye | ||
accent-german-words-replace-52 = tschüss | ||
accent-german-words-53 = bye bye | ||
accent-german-words-53-2 = bye-bye | ||
accent-german-words-replace-53 = tschau | ||
accent-german-words-54 = fantastic | ||
accent-german-words-replace-54 = fantastisch | ||
accent-german-words-55 = changeling | ||
accent-german-words-replace-55 = doppelgänger | ||
accent-german-words-56 = forbidden | ||
accent-german-words-56-2 = prohibited | ||
accent-german-words-56-3 = banned | ||
accent-german-words-replace-56 = verboten | ||
accent-german-words-57 = quick | ||
accent-german-words-57-2 = quickly | ||
accent-german-words-replace-57 = schnell | ||
accent-german-words-58 = hospital | ||
accent-german-words-replace-58 = krankenhaus | ||
accent-german-words-59 = tesla coil | ||
accent-german-words-replace-59 = tesla coil | ||
accent-german-words-60 = tesla coils | ||
accent-german-words-replace-60 = tesla coils | ||
accent-german-words-61 = teslaloose | ||
accent-german-words-61-2 = tesloose | ||
accent-german-words-61-3 = lightning ball | ||
accent-german-words-61-4 = ball lightning | ||
accent-german-words-61-5 = tesla | ||
accent-german-words-replace-61 = kugelblitz | ||
accent-german-words-62 = car | ||
accent-german-words-replace-62 = auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
accent-russian-words-1 = yes | ||
accent-russian-words-replace-1 = da | ||
accent-russian-words-2 = no | ||
accent-russian-words-replace-2 = nyet | ||
accent-russian-words-3 = grandma | ||
accent-russian-words-3-2 = grandmother | ||
accent-russian-words-3-3 = granny | ||
accent-russian-words-replace-3 = babushka | ||
accent-russian-words-4 = friend | ||
accent-russian-words-replace-4 = comrade | ||
accent-russian-words-5 = friends | ||
accent-russian-words-replace-5 = comrades | ||
accent-russian-words-6 = cheers | ||
accent-russian-words-replace-6 = na zdorovje |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.