]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Use chat emotes for disease (#15134)
authorMorb <14136326+Morb0@users.noreply.github.com>
Fri, 7 Apr 2023 23:17:30 +0000 (16:17 -0700)
committerGitHub <noreply@github.com>
Fri, 7 Apr 2023 23:17:30 +0000 (16:17 -0700)
* Use chat emote system for disease

* Use chat emotes in prototypes

* Fix sound path

* Fix prototype ids

* Update Content.Server/Disease/DiseaseSystem.cs

Co-authored-by: Flipp Syder <76629141+vulppine@users.noreply.github.com>
---------

Co-authored-by: Flipp Syder <76629141+vulppine@users.noreply.github.com>
26 files changed:
Content.Server/Disease/DiseaseSystem.cs
Content.Server/Disease/Effects/DiseaseSnough.cs
Content.Server/Traits/Assorted/UncontrollableSnoughComponent.cs
Content.Server/Traits/Assorted/UncontrollableSnoughSystem.cs
Content.Shared/Disease/Events/AttemptSneezeCoughEvent.cs
Resources/Audio/Effects/Diseases/license.txt
Resources/Audio/Voice/Human/female_cough_1.ogg [new file with mode: 0644]
Resources/Audio/Voice/Human/female_cough_2.ogg [new file with mode: 0644]
Resources/Audio/Voice/Human/female_sneeze_1.ogg [moved from Resources/Audio/Effects/Diseases/sneeze1.ogg with 100% similarity]
Resources/Audio/Voice/Human/female_yawn_1.ogg [moved from Resources/Audio/Effects/Diseases/yawn2.ogg with 100% similarity]
Resources/Audio/Voice/Human/license.txt
Resources/Audio/Voice/Human/male_cough_1.ogg [moved from Resources/Audio/Effects/Diseases/cough1.ogg with 100% similarity]
Resources/Audio/Voice/Human/male_cough_2.ogg [moved from Resources/Audio/Effects/Diseases/cough2.ogg with 100% similarity]
Resources/Audio/Voice/Human/male_sneeze_1.ogg [moved from Resources/Audio/Effects/Diseases/sneeze2.ogg with 100% similarity]
Resources/Audio/Voice/Human/male_yawn_1.ogg [moved from Resources/Audio/Effects/Diseases/yawn1.ogg with 100% similarity]
Resources/Audio/Voice/Human/snore1.ogg [moved from Resources/Audio/Effects/Diseases/snore1.ogg with 100% similarity]
Resources/Audio/Voice/Human/snore2.ogg [moved from Resources/Audio/Effects/Diseases/snore2.ogg with 100% similarity]
Resources/Audio/Voice/Human/snore3.ogg [moved from Resources/Audio/Effects/Diseases/snore3.ogg with 100% similarity]
Resources/Locale/en-US/disease/disease.ftl
Resources/Prototypes/Diseases/infectious.yml
Resources/Prototypes/Diseases/noninfectious.yml
Resources/Prototypes/Diseases/zombie.yml
Resources/Prototypes/SoundCollections/disease.yml
Resources/Prototypes/Traits/inconveniences.yml
Resources/Prototypes/Voice/disease_emotes.yml [new file with mode: 0644]
Resources/Prototypes/Voice/speech_emote_sounds.yml

index 93a1cab5a34f590de1d36a7dbcf1e714356b7c71..0366ee2e8a7ef2c8bf4bd86c1c02e94a90145e39 100644 (file)
@@ -32,7 +32,6 @@ namespace Content.Server.Disease
     /// </summary>
     public sealed class DiseaseSystem : EntitySystem
     {
-        [Dependency] private readonly AudioSystem _audioSystem = default!;
         [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
         [Dependency] private readonly ISerializationManager _serializationManager = default!;
         [Dependency] private readonly IRobustRandom _random = default!;
@@ -42,6 +41,7 @@ namespace Content.Server.Disease
         [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
         [Dependency] private readonly InventorySystem _inventorySystem = default!;
         [Dependency] private readonly MobStateSystem _mobStateSystem = default!;
+        [Dependency] private readonly ChatSystem _chatSystem = default!;
         public override void Initialize()
         {
             base.Initialize();
@@ -265,7 +265,7 @@ namespace Content.Server.Disease
         {
             if (TryComp<DiseaseCarrierComponent>(uid, out var carrier))
             {
-                SneezeCough(uid, _random.Pick(carrier.Diseases), string.Empty, null);
+                SneezeCough(uid, _random.Pick(carrier.Diseases), string.Empty);
             }
         }
 
@@ -418,21 +418,17 @@ namespace Content.Server.Disease
         /// and then tries to infect anyone in range
         /// if the snougher is not wearing a mask.
         /// </summary>
-        public bool SneezeCough(EntityUid uid, DiseasePrototype? disease, string snoughMessage, SoundSpecifier? snoughSound, bool airTransmit = true, TransformComponent? xform = null)
+        public bool SneezeCough(EntityUid uid, DiseasePrototype? disease, string emoteId, bool airTransmit = true, TransformComponent? xform = null)
         {
             if (!Resolve(uid, ref xform)) return false;
 
             if (_mobStateSystem.IsDead(uid)) return false;
 
-            var attemptSneezeCoughEvent = new AttemptSneezeCoughEvent(uid, snoughMessage, snoughSound);
+            var attemptSneezeCoughEvent = new AttemptSneezeCoughEvent(uid, emoteId);
             RaiseLocalEvent(uid, ref attemptSneezeCoughEvent);
             if (attemptSneezeCoughEvent.Cancelled) return false;
 
-            if (!string.IsNullOrEmpty(snoughMessage))
-                _popupSystem.PopupEntity(Loc.GetString(snoughMessage, ("person", Identity.Entity(uid, EntityManager))), uid);
-
-            if (snoughSound != null)
-                _audioSystem.PlayPvs(snoughSound, uid);
+            _chatSystem.TryEmoteWithChat(uid, emoteId);
 
             if (disease is not { Infectious: true } || !airTransmit)
                 return true;
index 957836df30dbc71bcba2de96e038afb0748a24f3..8ee12c18bacc48ac52cc1d6532e79c6962164a54 100644 (file)
@@ -1,6 +1,7 @@
+using Content.Shared.Chat.Prototypes;
 using Content.Shared.Disease;
 using JetBrains.Annotations;
-using Robust.Shared.Audio;
+using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
 
 namespace Content.Server.Disease
 {
@@ -12,16 +13,10 @@ namespace Content.Server.Disease
     public sealed class DiseaseSnough : DiseaseEffect
     {
         /// <summary>
-        /// Message to play when snoughing
+        /// Emote to play when snoughing
         /// </summary>
-        [DataField("snoughMessage")]
-        public string SnoughMessage = "disease-sneeze";
-
-        /// <summary>
-        /// Sound to play when snoughing
-        /// </summary>
-        [DataField("snoughSound")]
-        public SoundSpecifier? SnoughSound;
+        [DataField("emote", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EmotePrototype>))]
+        public string EmoteId = String.Empty;
 
         /// <summary>
         /// Whether to spread the disease through the air
@@ -31,7 +26,7 @@ namespace Content.Server.Disease
 
         public override void Effect(DiseaseEffectArgs args)
         {
-            EntitySystem.Get<DiseaseSystem>().SneezeCough(args.DiseasedEntity, args.Disease, SnoughMessage, SnoughSound, AirTransmit);
+            EntitySystem.Get<DiseaseSystem>().SneezeCough(args.DiseasedEntity, args.Disease, EmoteId, AirTransmit);
         }
     }
 }
index bd36c6fa25f3575856fcaa36e477ef3f9fb8ca21..546af9bb51ef9d67e76c0ad0e7da56b02e387033 100644 (file)
@@ -1,4 +1,5 @@
-using Robust.Shared.Audio;
+using Content.Shared.Chat.Prototypes;
+using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
 
 namespace Content.Server.Traits.Assorted;
 
@@ -9,14 +10,10 @@ namespace Content.Server.Traits.Assorted;
 public sealed class UncontrollableSnoughComponent : Component
 {
     /// <summary>
-    /// Message to play when snoughing.
+    /// Emote to play when snoughing
     /// </summary>
-    [DataField("snoughMessage")] public string SnoughMessage = "disease-sneeze";
-
-    /// <summary>
-    /// Sound to play when snoughing.
-    /// </summary>
-    [DataField("snoughSound")] public SoundSpecifier? SnoughSound;
+    [DataField("emote", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EmotePrototype>))]
+    public string EmoteId = String.Empty;
 
     /// <summary>
     /// The random time between incidents, (min, max).
index 5797e219f25131487c4827633a546f9cddec72fe..3c6903099368da97209f99f9f5fdf6aef79c9583 100644 (file)
@@ -27,7 +27,8 @@ public sealed class UncontrollableSnoughSystem : EntitySystem
     {
         base.Update(frameTime);
 
-        foreach (var snough in EntityQuery<UncontrollableSnoughComponent>())
+        var query = EntityQueryEnumerator<UncontrollableSnoughComponent>();
+        while (query.MoveNext(out var ent, out var snough))
         {
             snough.NextIncidentTime -= frameTime;
 
@@ -38,7 +39,7 @@ public sealed class UncontrollableSnoughSystem : EntitySystem
             snough.NextIncidentTime +=
                 _random.NextFloat(snough.TimeBetweenIncidents.X, snough.TimeBetweenIncidents.Y);
 
-            _diseaseSystem.SneezeCough(snough.Owner, null, snough.SnoughMessage, snough.SnoughSound, false);
+            _diseaseSystem.SneezeCough(ent, null, snough.EmoteId, false);
         }
     }
 }
index 6a1d9816bf446f3179f2f5dc53d8885aec967f79..cb2f99220c93512445cc5b6ef4c899e3c79db4f7 100644 (file)
@@ -1,5 +1,3 @@
-using Robust.Shared.Audio;
-
 namespace Content.Shared.Disease.Events;
 
 /// <summary>
@@ -7,4 +5,4 @@ namespace Content.Shared.Disease.Events;
 ///     Set Cancelled to true on event handling to suppress the sneeze
 /// </summary>
 [ByRefEvent]
-public record struct AttemptSneezeCoughEvent(EntityUid uid, string SnoughMessage, SoundSpecifier? SnoughSound, bool Cancelled = false);
+public record struct AttemptSneezeCoughEvent(EntityUid Uid, string? EmoteId, bool Cancelled = false);
index 16aa10dbd9c7752c3a9d1a83b6beeaede5c20789..412660da573ca97f104b14614de92334f206ef12 100644 (file)
@@ -1,11 +1,3 @@
-cough1.ogg taken from freesound (deleted user)
-cough2.ogg taken from https://freesound.org/people/Harris85/sounds/208761/
-sneeze.ogg taken from https://freesound.org/people/sherby168/sounds/540771/
 beepboop.ogg taken from https://freesound.org/people/Fidjo20/sounds/503526/
 monkey1.ogg taken from https://freesound.org/people/TRAVELcandies/sounds/423396/
 monkey2.ogg taken from https://freesound.org/people/Archeos/sounds/325549/
-sneeze2.ogg taken from https://freesound.org/people/InspectorJ/sounds/352177/
-vomiting.ogg taken from https://freesound.org/people/vikuserro/sounds/246308/
-yawn1.ogg taken from https://freesound.org/people/ckvoiceover/sounds/401338/ user ckvoiceover CC-3.0
-yawn2.ogg taken from https://freesound.org/people/Reitanna/sounds/252239/ user reitanna CC-0
-snore1, snore2, snore3.ogg taken from https://freesound.org/people/mattyharm/sounds/432995/ user mattyharm CC-0
diff --git a/Resources/Audio/Voice/Human/female_cough_1.ogg b/Resources/Audio/Voice/Human/female_cough_1.ogg
new file mode 100644 (file)
index 0000000..3509dcb
Binary files /dev/null and b/Resources/Audio/Voice/Human/female_cough_1.ogg differ
diff --git a/Resources/Audio/Voice/Human/female_cough_2.ogg b/Resources/Audio/Voice/Human/female_cough_2.ogg
new file mode 100644 (file)
index 0000000..32b2372
Binary files /dev/null and b/Resources/Audio/Voice/Human/female_cough_2.ogg differ
index 51c969fd0ee29571f8736077a52a7ab9ed3be4f7..d24b2874e49e225c7c66188dcb1decec0b161065 100644 (file)
@@ -14,3 +14,12 @@ manlaugh_1
 manlaugh_2
 wilhelm_scream
 womanlaugh
+female_cough_1.ogg taken from https://freesound.org/people/OwlStorm/sounds/151213/
+female_cough_2.ogg taken from https://freesound.org/people/thatkellytrna/sounds/425777/ and cropped
+male_cough_1.ogg taken from freesound (deleted user)
+male_cough_2.ogg taken from https://freesound.org/people/Harris85/sounds/208761/
+female_sneeze_1.ogg taken from https://freesound.org/people/sherby168/sounds/540771/
+male_sneeze_1.ogg taken from https://freesound.org/people/InspectorJ/sounds/352177/
+male_yawn_1.ogg taken from https://freesound.org/people/ckvoiceover/sounds/401338/ user ckvoiceover CC-3.0
+female_yawn_1.ogg taken from https://freesound.org/people/Reitanna/sounds/252239/ user reitanna CC-0
+snore1, snore2, snore3.ogg taken from https://freesound.org/people/mattyharm/sounds/432995/ user mattyharm CC-0
index 1a2de90acc5e62888e2f1c09831db64eff8a42ad..f738851a7382c1fb234049ee77b62e74bd188769 100644 (file)
@@ -1,12 +1,5 @@
 disease-cured = You feel a bit better.
 disease-sick-generic = You feel sick.
-disease-sneeze = {CAPITALIZE($person)} sneezes.
-disease-cough = {CAPITALIZE($person)} coughs.
-disease-screech = {CAPITALIZE($person)} screeches.
-disease-yawn = {CAPITALIZE($person)} yawns.
-disease-meow = {CAPITALIZE($person)} meows.
-disease-hiss = {CAPITALIZE($person)} hisses.
-disease-beep= {CAPITALIZE($person)} beeps.
 disease-eaten-inside = You feel like you're being eaten from the inside.
 disease-banana-compulsion = You really want to eat some bananas.
 disease-beat-chest-compulsion = {CAPITALIZE(THE($person))} beats {POSS-ADJ($person)} chest.
index 6138549afb8e94ee7e348150616337dbcfe45e48..d6b7a9e0516605996ff2cea15827f4accc0fbf55 100644 (file)
@@ -11,8 +11,7 @@
       probability: 0.025
     - !type:DiseaseSnough
       probability: 0.025
-      snoughSound:
-        collection: Sneezes
+      emote: Sneeze
   cures:
     - !type:DiseaseBedrestCure
       maxLength: 20
@@ -33,9 +32,7 @@
       visualType: Medium
     - !type:DiseaseSnough
       probability: 0.025
-      snoughMessage: disease-cough
-      snoughSound:
-        collection: Coughs
+      emote: Cough
     - !type:DiseaseHealthChange
       probability: 0.015
       damage:
@@ -60,8 +57,7 @@
       probability: 0.025
     - !type:DiseaseSnough
       probability: 0.025
-      snoughSound:
-        collection: Sneezes
+      emote: Sneeze
     - !type:DiseaseHealthChange
       probability: 0.015
       damage:
@@ -82,9 +78,7 @@
       probability: 0.025
     - !type:DiseaseSnough
       probability: 0.025
-      snoughMessage: disease-cough
-      snoughSound:
-        collection: Coughs
+      emote: Cough
     - !type:DiseaseHealthChange
       probability: 0.05
       damage:
       amount: 0.5
     - !type:DiseaseSnough
       probability: 0.02
-      snoughMessage: disease-beep
-      snoughSound:
-        collection: RobotBeeps
+      emote: RobotBeep
   cures:
     - !type:DiseaseJustWaitCure
       maxLength: 900
     # Screeches - spreads disease
     - !type:DiseaseSnough
       probability: 0.01
-      snoughMessage: disease-screech
-      snoughSound:
-        collection: MonkeyScreeches
+      emote: MonkeyScreeches
       stages:
         - 0
     - !type:DiseaseSnough
       probability: 0.02
-      snoughMessage: disease-screech
-      snoughSound:
-        collection: MonkeyScreeches
+      emote: MonkeyScreeches
       stages:
         - 1
     - !type:DiseaseSnough
       probability: 0.04
-      snoughMessage: disease-screech
-      snoughSound:
-        collection: MonkeyScreeches
+      emote: MonkeyScreeches
       stages:
         - 2
     # monkey accent chance when speaking
       type: Add
     - !type:DiseaseSnough
       probability: 0.025
-      snoughMessage: disease-yawn
-      snoughSound:
-        collection: Yawns
+      emote: Yawn
 
 - type: disease
   id: BleedersBite
       probability: 0.025
     - !type:DiseaseSnough
       probability: 0.025
-      snoughMessage: disease-cough
-      snoughSound:
-        collection: Coughs
+      emote: Cough
     - !type:DiseaseHealthChange
       probability: 0.05
       damage:
       amount: 1
     - !type:DiseaseSnough
       probability: 0.01
-      snoughMessage: disease-meow
-      snoughSound:
-        collection: CatMeows
+      emote: CatMeow
     - !type:DiseaseSnough
       probability: 0.01
-      snoughMessage: disease-hiss
-      snoughSound:
-        collection: CatHisses
+      emote: CatHisses
   cures:
     - !type:DiseaseBodyTemperatureCure
       min: 420 ## Reachable with a flamer
       component: ScrambledAccent
     - !type:DiseaseSnough
       probability: 0.01
-      snoughSound:
-        collection: Sneezes
+      emote: Sneeze
     - !type:DiseasePopUp
       probability: 0.02
       message: disease-think
index 91d691fcc59a2cdb85e3067d17858b4bdb385ad0..d66f2ae02de8700059415ac5be9ddcecfdc8b09d 100644 (file)
@@ -31,9 +31,7 @@
       type: Add
     - !type:DiseaseSnough
       probability: 0.025
-      snoughMessage: disease-yawn
-      snoughSound:
-        collection: Yawns
+      emote: Yawn
     - !type:DiseaseHealthChange
       probability: 0.02
       damage:
@@ -60,9 +58,7 @@
       probability: 0.01
     - !type:DiseaseSnough
       probability: 0.10
-      snoughMessage: disease-cough
-      snoughSound:
-        collection: Coughs
+      emote: Cough
     - !type:DiseasePopUp
       probability: 0.03
 
index be6122d7c926808ca900a9d542fa630b9f255d28..018fbc82e241fc7a0f705c76f39df51cfd1233bb 100644 (file)
@@ -15,9 +15,7 @@
       amount: 1
     - !type:DiseaseSnough
       probability: 0.01
-      snoughMessage: disease-cough
-      snoughSound:
-        collection: Coughs
+      emote: Cough
     - !type:DiseaseAddComponent
       comp: ZombifyOnDeath
   cures:
@@ -32,4 +30,4 @@
   cureResist: 1 #no cure. Death is your cure.
   effects:
     - !type:DiseaseAddComponent
-      comp: ZombifyOnDeath
\ No newline at end of file
+      comp: ZombifyOnDeath
index b4299e0c85d7ae25d8fa1c204376f150b879a1d5..a9e6c4694a90b8412f5d6475756726cfb35c8ef1 100644 (file)
@@ -1,14 +1,24 @@
 - type: soundCollection
-  id: Sneezes
+  id: MaleSneezes
   files:
-  - /Audio/Effects/Diseases/sneeze1.ogg
-  - /Audio/Effects/Diseases/sneeze2.ogg
+    - /Audio/Voice/Human/male_sneeze_1.ogg
 
 - type: soundCollection
-  id: Coughs
+  id: FemaleSneezes
   files:
-  - /Audio/Effects/Diseases/cough1.ogg
-  - /Audio/Effects/Diseases/cough2.ogg
+    - /Audio/Voice/Human/female_sneeze_1.ogg
+
+- type: soundCollection
+  id: MaleCoughs
+  files:
+  - /Audio/Voice/Human/male_cough_1.ogg
+  - /Audio/Voice/Human/male_cough_2.ogg
+
+- type: soundCollection
+  id: FemaleCoughs
+  files:
+  - /Audio/Voice/Human/female_cough_1.ogg
+  - /Audio/Voice/Human/female_cough_2.ogg
 
 - type: soundCollection
   id: CatMeows
   - /Audio/Effects/Diseases/beepboop.ogg
 
 - type: soundCollection
-  id: Yawns
+  id: MaleYawn
+  files:
+  - /Audio/Voice/Human/male_yawn_1.ogg
+
+- type: soundCollection
+  id: FemaleYawn
   files:
-  - /Audio/Effects/Diseases/yawn1.ogg
-  - /Audio/Effects/Diseases/yawn2.ogg
+  - /Audio/Voice/Human/female_yawn_1.ogg
 
 - type: soundCollection
   id: Snores
   files:
-  - /Audio/Effects/Diseases/snore1.ogg
-  - /Audio/Effects/Diseases/snore2.ogg
-  - /Audio/Effects/Diseases/snore3.ogg
+  - /Audio/Voice/Human/snore1.ogg
+  - /Audio/Voice/Human/snore2.ogg
+  - /Audio/Voice/Human/snore3.ogg
index 54fbd252ccf4581de7305bf8ae67ef32991c9033..b74dfb2fb00e03b87ab829e08baabd15c65d5df5 100644 (file)
@@ -7,10 +7,7 @@
       - DiseaseCarrier
   components:
     - type: UncontrollableSnough
-      snoughSound:
-        collection: Sneezes
-        params:
-          variation: 0.2
+      emote: Sneeze
       timeBetweenIncidents: 0.3, 300
 
 - type: trait
diff --git a/Resources/Prototypes/Voice/disease_emotes.yml b/Resources/Prototypes/Voice/disease_emotes.yml
new file mode 100644 (file)
index 0000000..af93025
--- /dev/null
@@ -0,0 +1,45 @@
+- type: emote
+  id: Sneeze
+  category: Vocal
+  chatMessages: [sneezes]
+    
+- type: emote
+  id: Cough
+  category: Vocal
+  chatMessages: [coughs]
+  chatTriggers:
+    - cough
+    - coughs
+
+- type: emote
+  id: CatMeow
+  category: Vocal
+  chatMessages: [meows]
+
+- type: emote
+  id: CatHisses
+  category: Vocal
+  chatMessages: [hisses]
+
+- type: emote
+  id: MonkeyScreeches
+  category: Vocal
+  chatMessages: [screeches]
+
+- type: emote
+  id: RobotBeep
+  category: Vocal
+  chatMessages: [beeps]
+
+- type: emote
+  id: Yawn
+  category: Vocal
+  chatMessages: [yawns]
+  chatTriggers:
+    - yawn
+    - yawns
+
+- type: emote
+  id: Snore
+  category: Vocal
+  chatMessages: [snores]
index ea9f50237b10a810936c25227016cdebafd06f07..cb63c7b297e725db03113b361f0aa33da8c59916 100644 (file)
@@ -8,6 +8,22 @@
       collection: MaleScreams
     Laugh:
       collection: MaleLaugh
+    Sneeze:
+      collection: MaleSneezes
+    Cough:
+      collection: MaleCoughs
+    CatMeow:
+      collection: CatMeows
+    CatHisses:
+      collection: CatHisses
+    MonkeyScreeches:
+      collection: MonkeyScreeches
+    RobotBeep:
+      collection: RobotBeeps
+    Yawn:
+      collection: MaleYawn
+    Snore:
+      collection: Snores
 
 - type: emoteSounds
   id: FemaleHuman
       collection: FemaleScreams
     Laugh:
       collection: FemaleLaugh
+    Sneeze:
+      collection: FemaleSneezes
+    Cough:
+      collection: FemaleCoughs
+    CatMeow:
+      collection: CatMeows
+    CatHisses:
+      collection: CatHisses
+    MonkeyScreeches:
+      collection: MonkeyScreeches
+    RobotBeep:
+      collection: RobotBeeps
+    Yawn:
+      collection: FemaleYawn
+    Snore:
+      collection: Snores
 
 - type: emoteSounds
   id: UnisexReptilian