]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Plants scream mutation now have more scream variety (#30862)
authorToken <esil.bektay@yandex.com>
Sat, 17 Aug 2024 02:09:25 +0000 (07:09 +0500)
committerGitHub <noreply@github.com>
Sat, 17 Aug 2024 02:09:25 +0000 (22:09 -0400)
* seed screams now SoundCollectionSpecifier
More types of scream sounds

* plants scream mutation have 10+ scream types

* plant scream reduce scream volume
And scream powerness get's from yml instead of hardcode, so from prototypes could be changed pretty much easilly

* plants review change

Content.Server/Botany/SeedPrototype.cs
Content.Server/Botany/Systems/PlantHolderSystem.cs
Resources/Prototypes/SoundCollections/screams.yml

index b2882d8e944102bd5aa9fd1c2d7feedea9b6624e..39f06a64360224e0bd7767a4f47381c448395193 100644 (file)
@@ -227,9 +227,12 @@ public partial class SeedData
 
     [DataField("plantIconState")] public string PlantIconState { get; set; } = "produce";
 
+    /// <summary>
+    /// Screams random sound, could be strict sound SoundPathSpecifier or collection SoundCollectionSpecifier
+    /// base class is SoundSpecifier
+    /// </summary>
     [DataField("screamSound")]
-    public SoundSpecifier ScreamSound = new SoundPathSpecifier("/Audio/Voice/Human/malescream_1.ogg");
-
+    public SoundSpecifier ScreamSound = new SoundCollectionSpecifier("PlantScreams", AudioParams.Default.WithVolume(-10));
 
     [DataField("screaming")] public bool CanScream;
 
index 53cee92a2987c30f02f84f151b3149941c98fedf..255ab00c7aad8a3a543795938c8a98b97584e8ec 100644 (file)
@@ -313,11 +313,8 @@ public sealed class PlantHolderSystem : EntitySystem
             var displayName = Loc.GetString(component.Seed.DisplayName);
             _popup.PopupCursor(Loc.GetString("plant-holder-component-take-sample-message",
                 ("seedName", displayName)), args.User);
-
-            if (component.Seed != null && component.Seed.CanScream)
-            {
-                _audio.PlayPvs(component.Seed.ScreamSound, uid, AudioParams.Default.WithVolume(-2));
-            }
+            
+            DoScream(entity.Owner, component.Seed);
 
             if (_random.Prob(0.3f))
                 component.Sampled = true;
@@ -748,6 +745,19 @@ public sealed class PlantHolderSystem : EntitySystem
         return true;
     }
 
+    /// <summary>
+    /// Force do scream on PlantHolder (like plant is screaming) using seed's ScreamSound specifier (collection or soundPath)
+    /// </summary>
+    /// <returns></returns>
+    public bool DoScream(EntityUid plantholder, SeedData? seed = null)
+    {
+        if (seed == null || seed.CanScream == false)
+            return false;
+
+        _audio.PlayPvs(seed.ScreamSound, plantholder);
+        return true;
+    }
+
     public void AutoHarvest(EntityUid uid, PlantHolderComponent? component = null)
     {
         if (!Resolve(uid, ref component))
@@ -768,8 +778,7 @@ public sealed class PlantHolderSystem : EntitySystem
         component.Harvest = false;
         component.LastProduce = component.Age;
 
-        if (component.Seed != null && component.Seed.CanScream)
-            _audio.PlayPvs(component.Seed.ScreamSound, uid, AudioParams.Default.WithVolume(-2));
+        DoScream(uid, component.Seed);
 
         if (component.Seed?.HarvestRepeat == HarvestType.NoRepeat)
             RemovePlant(uid, component);
index 46965712b0e5dba40ab47799294b6bc3c92e5a14..8fb39e9dc146acd0cdb9ab3e9eb9a6a8c28e0da6 100644 (file)
     - /Audio/Voice/Cluwne/cluwnelaugh1.ogg
     - /Audio/Voice/Cluwne/cluwnelaugh2.ogg
     - /Audio/Voice/Cluwne/cluwnelaugh3.ogg
+
+- type: soundCollection
+  id: PlantScreams
+  files:
+    # Male.
+    - /Audio/Voice/Human/malescream_1.ogg
+    - /Audio/Voice/Human/malescream_2.ogg
+    - /Audio/Voice/Human/malescream_3.ogg
+    - /Audio/Voice/Human/malescream_4.ogg
+    - /Audio/Voice/Human/malescream_5.ogg
+    - /Audio/Voice/Human/malescream_6.ogg
+
+    # Female.
+    - /Audio/Voice/Human/femalescream_1.ogg
+    - /Audio/Voice/Human/femalescream_2.ogg
+    - /Audio/Voice/Human/femalescream_3.ogg
+    - /Audio/Voice/Human/femalescream_4.ogg
+    - /Audio/Voice/Human/femalescream_5.ogg
\ No newline at end of file