]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Social a-anxiety/st-st-stuttering t-trait. (#20500)
authorVasilis <vasilis@pikachu.systems>
Sat, 21 Oct 2023 20:09:54 +0000 (22:09 +0200)
committerGitHub <noreply@github.com>
Sat, 21 Oct 2023 20:09:54 +0000 (13:09 -0700)
* This was supposed to be a challenge

* Component magik

* Add documentation

Content.Server/Speech/Components/StutteringAccentComponent.cs
Content.Server/Speech/EntitySystems/StutteringSystem.cs
Resources/Locale/en-US/traits/traits.ftl
Resources/Prototypes/Traits/inconveniences.yml

index b283a8354b9f56c74100cf2dab46e1400b5598f2..e82cd9b12b0f24ee85464cb6bcfb2252c7469b5e 100644 (file)
@@ -3,5 +3,32 @@ namespace Content.Server.Speech.Components
     [RegisterComponent]
     public sealed partial class StutteringAccentComponent : Component
     {
+        /// <summary>
+        /// Percentage chance that a stutter will occur if it matches.
+        /// </summary>
+        [DataField("matchRandomProb")]
+        [ViewVariables(VVAccess.ReadWrite)]
+        public float MatchRandomProb = 0.8f;
+
+        /// <summary>
+        /// Percentage chance that a stutter occurs f-f-f-f-four times.
+        /// </summary>
+        [DataField("fourRandomProb")]
+        [ViewVariables(VVAccess.ReadWrite)]
+        public float FourRandomProb = 0.1f;
+
+        /// <summary>
+        /// Percentage chance that a stutter occurs t-t-t-three times.
+        /// </summary>
+        [DataField("threeRandomProb")]
+        [ViewVariables(VVAccess.ReadWrite)]
+        public float ThreeRandomProb = 0.2f;
+
+        /// <summary>
+        /// Percentage chance that a stutter cut off.
+        /// </summary>
+        [DataField("cutRandomProb")]
+        [ViewVariables(VVAccess.ReadWrite)]
+        public float CutRandomProb = 0.05f;
     }
 }
index 8717d57ad0ee7189e3013af59928206d0d75203d..d6e3c0b749a83fe3d1a5578431e4cdab8c921002 100644 (file)
@@ -31,10 +31,10 @@ namespace Content.Server.Speech.EntitySystems
 
         private void OnAccent(EntityUid uid, StutteringAccentComponent component, AccentGetEvent args)
         {
-            args.Message = Accentuate(args.Message);
+            args.Message = Accentuate(args.Message, component);
         }
 
-        public string Accentuate(string message)
+        public string Accentuate(string message, StutteringAccentComponent component)
         {
             var length = message.Length;
 
@@ -45,17 +45,17 @@ namespace Content.Server.Speech.EntitySystems
             for (var i = 0; i < length; i++)
             {
                 newLetter = message[i].ToString();
-                if (Stutter.IsMatch(newLetter) && _random.Prob(0.8f))
+                if (Stutter.IsMatch(newLetter) && _random.Prob(component.MatchRandomProb))
                 {
-                    if (_random.Prob(0.1f))
+                    if (_random.Prob(component.FourRandomProb))
                     {
                         newLetter = $"{newLetter}-{newLetter}-{newLetter}-{newLetter}";
                     }
-                    else if (_random.Prob(0.2f))
+                    else if (_random.Prob(component.ThreeRandomProb))
                     {
                         newLetter = $"{newLetter}-{newLetter}-{newLetter}";
                     }
-                    else if (_random.Prob(0.05f))
+                    else if (_random.Prob(component.CutRandomProb))
                     {
                         newLetter = "";
                     }
index 28c0ecf79446f8e6cdd05fa2e401362ab79ed345..524d249e9284ed433f5d0e0cc41c5d426790a202 100644 (file)
@@ -34,3 +34,6 @@ trait-wheelchair-bound-desc = You cannot move without your wheelchair. Wheelchai
 
 trait-frontal-lisp-name = Frontal Lisp
 trait-frontal-lisp-desc = You thpeak with a lithp
+
+trait-socialanxiety-name = Social Anxiety
+trait-socialanxiety-desc = You are anxious when you speak and stutter.
index ad61b14971a3e892759b1c753505bcfe5b775169..f8e932c9b92b1b46bc982db47a9054ee494089ad 100644 (file)
@@ -5,3 +5,14 @@
   components:
     - type: LightweightDrunk
       boozeStrengthMultiplier: 2
+
+- type: trait
+  id: SocialAnxiety
+  name: trait-socialanxiety-name
+  description: trait-socialanxiety-desc
+  components:
+    - type: StutteringAccent
+      matchRandomProb: 0.2
+      fourRandomProb: 0
+      threeRandomProb: 0.3
+      cutRandomProb: 0