]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Ratvarian Language and CogChamp (#15639)
authorkeronshb <54602815+keronshb@users.noreply.github.com>
Sat, 29 Apr 2023 08:34:19 +0000 (04:34 -0400)
committerGitHub <noreply@github.com>
Sat, 29 Apr 2023 08:34:19 +0000 (18:34 +1000)
17 files changed:
Content.Client/Speech/EntitySystems/RatvarianLanguageSystem.cs [new file with mode: 0644]
Content.Server/Speech/EntitySystems/RatvarianLanguageSystem.cs [new file with mode: 0644]
Content.Shared/Drunk/DrunkSystem.cs
Content.Shared/Speech/Components/RatvarianLanguageComponent.cs [new file with mode: 0644]
Content.Shared/Speech/EntitySystems/SharedRatvarianLanguageSystem.cs [new file with mode: 0644]
Resources/Audio/Magic/Cults/ClockCult/attributions.yml [new file with mode: 0644]
Resources/Audio/Magic/Cults/ClockCult/steam_whoosh.ogg [new file with mode: 0644]
Resources/Locale/en-US/flavors/flavor-profiles.ftl
Resources/Locale/en-US/reagents/meta/consumable/drink/alcohol.ftl
Resources/Prototypes/Entities/Mobs/Species/base.yml
Resources/Prototypes/Entities/Objects/Consumable/Drinks/drinks.yml
Resources/Prototypes/Flavors/flavors.yml
Resources/Prototypes/Reagents/Consumable/Drink/alcohol.yml
Resources/Prototypes/Recipes/Reactions/drinks.yml
Resources/Prototypes/status_effects.yml
Resources/Textures/Objects/Consumable/Drinks/cogchamp.rsi/icon.png [new file with mode: 0644]
Resources/Textures/Objects/Consumable/Drinks/cogchamp.rsi/meta.json [new file with mode: 0644]

diff --git a/Content.Client/Speech/EntitySystems/RatvarianLanguageSystem.cs b/Content.Client/Speech/EntitySystems/RatvarianLanguageSystem.cs
new file mode 100644 (file)
index 0000000..f24194a
--- /dev/null
@@ -0,0 +1,8 @@
+using Content.Shared.Speech.EntitySystems;
+
+namespace Content.Client.Speech.EntitySystems;
+
+public sealed class RatvarianLanguageSystem : SharedRatvarianLanguageSystem
+{
+
+}
diff --git a/Content.Server/Speech/EntitySystems/RatvarianLanguageSystem.cs b/Content.Server/Speech/EntitySystems/RatvarianLanguageSystem.cs
new file mode 100644 (file)
index 0000000..84d9220
--- /dev/null
@@ -0,0 +1,115 @@
+using System.Text;
+using System.Text.RegularExpressions;
+using Content.Shared.Speech.Components;
+using Content.Shared.Speech.EntitySystems;
+using Content.Shared.StatusEffect;
+
+namespace Content.Server.Speech.EntitySystems;
+
+public sealed class RatvarianLanguageSystem : SharedRatvarianLanguageSystem
+{
+    [Dependency] private readonly StatusEffectsSystem _statusEffects = default!;
+    private const string RatvarianKey = "RatvarianLanguage";
+
+    // This is the word of Ratvar and those who speak it shall abide by His rules:
+    /*
+     * Any time the word "of" occurs, it's linked to the previous word by a hyphen: "I am-of Ratvar"
+     * Any time "th", followed by any two letters occurs, you add a grave (`) between those two letters: "Thi`s"
+     * In the same vein, any time "ti" followed by one letter occurs, you add a grave (`) between "i" and the letter: "Ti`me"
+     * Wherever "te" or "et" appear and there is another letter next to the "e", add a hyphen between "e" and the letter: "M-etal/Greate-r"
+     * Where "gua" appears, add a hyphen between "gu" and "a": "Gu-ard"
+     * Where the word "and" appears it's linked to all surrounding words by hyphens: "Sword-and-shield"
+     * Where the word "to" appears, it's linked to the following word by a hyphen: "to-use"
+     * Where the word "my" appears, it's linked to the following word by a hyphen: "my-light"
+     * Any Ratvarian proper noun is not translated: Ratvar, Nezbere, Sevtug, Nzcrentr and Inath-neq
+        * This only applies if they're being used as a proper noun: armorer/Nezbere
+     */
+
+    private static Regex THPattern = new Regex(@"th\w\B", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+    private static Regex ETPattern = new Regex(@"\Bet", RegexOptions.Compiled);
+    private static Regex TEPattern = new Regex(@"te\B",RegexOptions.Compiled);
+    private static Regex OFPattern = new Regex(@"(\s)(of)");
+    private static Regex TIPattern = new Regex(@"ti\B", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+    private static Regex GUAPattern = new Regex(@"(gu)(a)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+    private static Regex ANDPattern = new Regex(@"\b(\s)(and)(\s)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+    private static Regex TOMYPattern = new Regex(@"(to|my)\s", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+    private static Regex ProperNouns = new Regex(@"(ratvar)|(nezbere)|(sevtuq)|(nzcrentr)|(inath-neq)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+
+    public override void Initialize()
+    {
+        // Activate before other modifications so translation works properly
+        SubscribeLocalEvent<RatvarianLanguageComponent, AccentGetEvent>(OnAccent, before: new[] {typeof(SharedSlurredSystem), typeof(SharedStutteringSystem)});
+    }
+
+    public override void DoRatvarian(EntityUid uid, TimeSpan time, bool refresh, StatusEffectsComponent? status = null)
+    {
+        if (!Resolve(uid, ref status, false))
+            return;
+
+        _statusEffects.TryAddStatusEffect<RatvarianLanguageComponent>(uid, RatvarianKey, time, refresh, status);
+    }
+
+    private void OnAccent(EntityUid uid, RatvarianLanguageComponent component, AccentGetEvent args)
+    {
+        args.Message = Translate(args.Message);
+    }
+
+    private string Translate(string message)
+    {
+        var ruleTranslation = message;
+        var finalMessage = new StringBuilder();
+        var newWord = new StringBuilder();
+
+        ruleTranslation = THPattern.Replace(ruleTranslation, "$&`");
+        ruleTranslation = TEPattern.Replace(ruleTranslation, "$&-");
+        ruleTranslation = ETPattern.Replace(ruleTranslation, "-$&");
+        ruleTranslation = OFPattern.Replace(ruleTranslation, "-$2");
+        ruleTranslation = TIPattern.Replace(ruleTranslation, "$&`");
+        ruleTranslation = GUAPattern.Replace(ruleTranslation, "$1-$2");
+        ruleTranslation = ANDPattern.Replace(ruleTranslation, "-$2-");
+        ruleTranslation = TOMYPattern.Replace(ruleTranslation, "$1-");
+
+        var temp = ruleTranslation.Split(' ');
+
+        foreach (var word in temp)
+        {
+            newWord.Clear();
+
+            if (ProperNouns.IsMatch(word))
+                newWord.Append(word);
+
+            else
+            {
+                for (int i = 0; i < word.Length; i++)
+                {
+                    var letter = word[i];
+
+                    if (letter >= 97 && letter <= 122)
+                    {
+                        var letterRot = letter + 13;
+
+                        if (letterRot > 122)
+                            letterRot -= 26;
+
+                        newWord.Append((char) letterRot);
+                    }
+                    else if (letter >= 65 && letter <= 90)
+                    {
+                        var letterRot = letter + 13;
+
+                        if (letterRot > 90)
+                            letterRot -= 26;
+
+                        newWord.Append((char) letterRot);
+                    }
+                    else
+                    {
+                        newWord.Append(word[i]);
+                    }
+                }
+            }
+            finalMessage.Append(newWord + " ");
+        }
+        return finalMessage.ToString().Trim();
+    }
+}
index 4fb91f721353ebe0e9046e38ad17f40930483026..3085e78485947d117ffb81158c14f41c6edeb069 100644 (file)
@@ -18,7 +18,9 @@ public abstract class SharedDrunkSystem : EntitySystem
             return;
 
         if (applySlur)
+        {
             _slurredSystem.DoSlur(uid, TimeSpan.FromSeconds(boozePower), status);
+        }
 
         if (TryComp<LightweightDrunkComponent>(uid, out var trait))
             boozePower *= trait.BoozeStrengthMultiplier;
diff --git a/Content.Shared/Speech/Components/RatvarianLanguageComponent.cs b/Content.Shared/Speech/Components/RatvarianLanguageComponent.cs
new file mode 100644 (file)
index 0000000..161abd7
--- /dev/null
@@ -0,0 +1,8 @@
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.Speech.Components;
+[RegisterComponent, NetworkedComponent]
+public sealed class RatvarianLanguageComponent : Component
+{
+
+}
diff --git a/Content.Shared/Speech/EntitySystems/SharedRatvarianLanguageSystem.cs b/Content.Shared/Speech/EntitySystems/SharedRatvarianLanguageSystem.cs
new file mode 100644 (file)
index 0000000..9564bfd
--- /dev/null
@@ -0,0 +1,10 @@
+using Content.Shared.StatusEffect;
+
+namespace Content.Shared.Speech.EntitySystems;
+
+public abstract class SharedRatvarianLanguageSystem : EntitySystem
+{
+    public virtual void DoRatvarian(EntityUid uid, TimeSpan time, bool refresh, StatusEffectsComponent? status = null)
+    {
+    }
+}
diff --git a/Resources/Audio/Magic/Cults/ClockCult/attributions.yml b/Resources/Audio/Magic/Cults/ClockCult/attributions.yml
new file mode 100644 (file)
index 0000000..dae32f0
--- /dev/null
@@ -0,0 +1,4 @@
+- files: ["steam_woosh.ogg"]
+  license: "CC-BY-SA-3.0"
+  copyright: "Taken from Citadel Station"
+  source: "https://github.com/Citadel-Station-13/Citadel-Station-13/commit/e575bd66854786eb9455eae6954d976cf13c66ea"
\ No newline at end of file
diff --git a/Resources/Audio/Magic/Cults/ClockCult/steam_whoosh.ogg b/Resources/Audio/Magic/Cults/ClockCult/steam_whoosh.ogg
new file mode 100644 (file)
index 0000000..21c7975
Binary files /dev/null and b/Resources/Audio/Magic/Cults/ClockCult/steam_whoosh.ogg differ
index 15ef40d3786266cf2b195e19a0b96a9524446cc7..fa2467cfbf2b7e2b388dcfe53aa55f8ad655ac37 100644 (file)
@@ -165,6 +165,7 @@ flavor-complex-atomic-cola = like hoarding bottle caps
 flavor-complex-cuba-libre = like spiked cola
 flavor-complex-gin-tonic = like spiked lemon-lime soda
 flavor-complex-screwdriver = like spiked orange juice
+flavor-complex-cogchamp = like brass
 
 ### This is exactly what pilk tastes like. I'm not even joking. I might've been a little drunk though
 flavor-complex-pilk = like sweet milk
index 13ec0ef3bec33450dc0c15855306010fc3668938..9b6029234cc68f7d5177c89ed0fded40136f3121 100644 (file)
@@ -205,6 +205,9 @@ reagent-desc-sbiten = A spicy Vodka! Might be a little hot for the little guys!
 reagent-name-screwdriver-cocktail = screwdriver
 reagent-desc-screwdriver-cocktail = Vodka, mixed with plain ol' orange juice. The result is surprisingly delicious.
 
+reagent-name-cogchamp = cogchamp
+reagent-desc-cogchamp = Not even Ratvar's Four Generals could withstand this! Qevax Jryy!
+
 reagent-name-silencer = silencer
 reagent-desc-silencer = A drink from Mime Heaven.
 
index 5f080adb30a4d0659a0f28e42584cef908f5b69f..7ed149364244b7113aee7e1e2156d13073d19688 100644 (file)
@@ -77,6 +77,7 @@
       - Electrocution
       - Drunk
       - SlurredSpeech
+      - RatvarianLanguage
       - PressureImmunity
       - Muted
       - ForcedSleep
index 1e355ec798760b4b89ede162dcc5edd83c45e56a..e8e62f3cced7bec382a9f63c1612a7509ae22b17 100644 (file)
   - type: Sprite
     sprite: Objects/Consumable/Drinks/screwdriverglass.rsi
 
+- type: entity
+  parent: DrinkGlassBase
+  id: DrinkCogChampBase
+  name: cogchamp glass
+  description: This mix of Cognac, Screwdriver and Welding Fuel will have you seeing His light surely!
+  components:
+    - type: SolutionContainerManager
+      solutions:
+        drink:
+          maxVol: 30
+          reagents:
+            - ReagentId: CogChamp
+              Quantity: 30
+    - type: Drink
+    - type: Sprite
+      sprite: Objects/Consumable/Drinks/cogchamp.rsi
+
 - type: entity
   parent: DrinkGlassBase
   id: DrinkSuiDreamGlass
index c820b9f01ad2372d70e42c2a1a170cfea3b4a969..2ce6ed177965412ba2e80578c74beda1f5d98299 100644 (file)
   flavorType: Complex
   description: flavor-complex-cola
 
+- type: flavor
+  id: cogchamp
+  flavorType: Complex
+  description: flavor-complex-cogchamp
+
 - type: flavor
   id: vodka
   flavorType: Complex
index 9998353d6bef493f1df8f93ed661e01be114dc21..f2b1cdd317ce4c1fa59f446af23e3345dfd76648 100644 (file)
         reagent: Ethanol
         amount: 0.15
 
+- type: reagent
+  id: CogChamp
+  name: reagent-name-cogchamp
+  parent: BaseAlcohol
+  desc: reagent-desc-cogchamp
+  physicalDesc: reagent-physical-desc-ground-brass
+  flavor: cogchamp
+  color: "#B5A642"
+  metamorphicSprite:
+    sprite: Objects/Consumable/Drinks/cogchamp.rsi
+    state: icon
+  metabolisms:
+    Drink:
+      effects:
+        - !type:GenericStatusEffect
+          key: RatvarianLanguage
+          component: RatvarianLanguage
+        - !type:SatiateThirst
+          factor: 2
+        - !type:AdjustReagent
+          reagent: Ethanol
+          amount: 0.15
+
 - type: reagent
   id: Silencer
   name: reagent-name-silencer
index 80c0ffdcaff0e1b17a3428b0941af784711168af..40380ff8caca4de7135d540393fc420c13997e23 100644 (file)
   products:
     B52: 3
 
+- type: reaction
+  id: CogChamp
+  reactants:
+    Cognac:
+      amount: 1
+    ScrewdriverCocktail:
+      amount: 1
+    WeldingFuel:
+      amount: 1
+  products:
+    CogChamp: 3
+  sound:
+    path: /Audio/Magic/Cults/ClockCult/steam_whoosh.ogg
+    
 - type: reaction
   id: Barefoot
   reactants:
index b149243ed36836acf32ce9ce484a07a40392f276..b909baa0ebd3de15906e27f5f7ca071386898e6f 100644 (file)
@@ -53,3 +53,6 @@
 
 - type: statusEffect
   id: Pacified #cannot attack
+
+- type: statusEffect
+  id: RatvarianLanguage #Praise him
diff --git a/Resources/Textures/Objects/Consumable/Drinks/cogchamp.rsi/icon.png b/Resources/Textures/Objects/Consumable/Drinks/cogchamp.rsi/icon.png
new file mode 100644 (file)
index 0000000..687e9b3
Binary files /dev/null and b/Resources/Textures/Objects/Consumable/Drinks/cogchamp.rsi/icon.png differ
diff --git a/Resources/Textures/Objects/Consumable/Drinks/cogchamp.rsi/meta.json b/Resources/Textures/Objects/Consumable/Drinks/cogchamp.rsi/meta.json
new file mode 100644 (file)
index 0000000..dce4fff
--- /dev/null
@@ -0,0 +1,22 @@
+{
+  "version": 1,
+  "size": {
+    "x": 32,
+    "y": 32
+  },
+    "license": "CC-BY-SA-3.0",
+    "copyright": "Made by keronshb for Citadel Station at: https://github.com/Citadel-Station-13/Citadel-Station-13/commit/c790478a3d6e8a2846e658c3dc6c5164737e4b42",
+  "states": [
+    {
+      "name": "icon",
+      "delays": [
+        [
+          0.6,
+          0.3,
+          0.3,
+          0.3
+        ]
+      ]
+    }
+  ]
+}