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
This commit is contained in:
Token 2024-08-17 07:09:25 +05:00 committed by deltanedas
parent 55428db682
commit bc055a7b65
3 changed files with 39 additions and 9 deletions

View 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;

View 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);

View File

@ -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