From 27793111bb7af8f517b47afe90fc1a485f1caf96 Mon Sep 17 00:00:00 2001 From: Token Date: Sat, 17 Aug 2024 07:09:25 +0500 Subject: [PATCH] Plants scream mutation now have more scream variety (#30862) * 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 | 7 ++++-- .../Botany/Systems/PlantHolderSystem.cs | 23 +++++++++++++------ .../Prototypes/SoundCollections/screams.yml | 18 +++++++++++++++ 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/Content.Server/Botany/SeedPrototype.cs b/Content.Server/Botany/SeedPrototype.cs index b2882d8e94..39f06a6436 100644 --- a/Content.Server/Botany/SeedPrototype.cs +++ b/Content.Server/Botany/SeedPrototype.cs @@ -227,9 +227,12 @@ public partial class SeedData [DataField("plantIconState")] public string PlantIconState { get; set; } = "produce"; + /// + /// Screams random sound, could be strict sound SoundPathSpecifier or collection SoundCollectionSpecifier + /// base class is SoundSpecifier + /// [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; diff --git a/Content.Server/Botany/Systems/PlantHolderSystem.cs b/Content.Server/Botany/Systems/PlantHolderSystem.cs index 53cee92a29..255ab00c7a 100644 --- a/Content.Server/Botany/Systems/PlantHolderSystem.cs +++ b/Content.Server/Botany/Systems/PlantHolderSystem.cs @@ -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; } + /// + /// Force do scream on PlantHolder (like plant is screaming) using seed's ScreamSound specifier (collection or soundPath) + /// + /// + 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); diff --git a/Resources/Prototypes/SoundCollections/screams.yml b/Resources/Prototypes/SoundCollections/screams.yml index 46965712b0..8fb39e9dc1 100644 --- a/Resources/Prototypes/SoundCollections/screams.yml +++ b/Resources/Prototypes/SoundCollections/screams.yml @@ -30,3 +30,21 @@ - /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 -- 2.52.0