Skip to content

Commit

Permalink
Special sounds pack (SerbiaStrong-220#629)
Browse files Browse the repository at this point in the history
* Решил добавит спец звуки для роли. Теперь надо это как-то закодить.

* Доработана возможность запуска доп звука

* Попытка переписать спец звуки на предметы

* Добавлена возможность прописывать специальные звуки на предметы.
Добавлена проверка, что при надетом предмете у вас проигрываются специальные звуки.
Кошачьи ушки при надевании теперь позволяют вам издавать звуки Фелинида.

* Правки с комментариями

* Добавлена эмоция ппри надетой шапке ГП

* Поправлены файлы шапки ГП

* ещё правки атрибута

* ...

* Поправил названия файлов, добавлен смех санты в шапке санты

* Решил назвать паки не по своим начальным представлениям, а нейтрально (по их сути), чтобы к ним можно было обращаться от других предметов и не возникало вопросов

* Доделал специальные смехи для всех костюмов синдиката, противогаза синдиката, синдикекса
Перелопатил название
Перевел SpecialEmoteSounds в dictionary, чтобы можно было иметь звуки с нескольких предметов.

* Правки

* Добавил лицензию

* Микро правки по структуре

* Немного подправил звуки и длинну аудио
  • Loading branch information
SkaldetSkaeg authored Jan 6, 2024
1 parent 63535de commit f014486
Show file tree
Hide file tree
Showing 25 changed files with 281 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Content.Server/Speech/Components/VocalComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,11 @@ public sealed partial class VocalComponent : Component
/// </summary>
[ViewVariables]
public EmoteSoundsPrototype? EmoteSounds = null;

// SS220 Chat-Special-Emote start
//Special sounds for entity
//Made it dictionaty so that user could load several packs of emotions from several items
//Null if no valid prototype were loaded
public Dictionary<EntityUid, EmoteSoundsPrototype>? SpecialEmoteSounds = null;
// SS220 Chat-Special-Emote end
}
66 changes: 66 additions & 0 deletions Content.Server/Speech/EntitySystems/VocalSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Robust.Shared.Audio.Systems;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Content.Shared.SS220.Speech;// SS220 Chat-Special-Emote

namespace Content.Server.Speech.EntitySystems;

Expand All @@ -18,6 +19,7 @@ public sealed class VocalSystem : EntitySystem
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly ActionsSystem _actions = default!;
[Dependency] private readonly IEntityManager _entities = default!;// SS220 Chat-Special-Emote

public override void Initialize()
{
Expand All @@ -28,6 +30,8 @@ public override void Initialize()
SubscribeLocalEvent<VocalComponent, SexChangedEvent>(OnSexChanged);
SubscribeLocalEvent<VocalComponent, EmoteEvent>(OnEmote);
SubscribeLocalEvent<VocalComponent, ScreamActionEvent>(OnScreamAction);
SubscribeLocalEvent<VocalComponent, HasSpecialSoundsEvent>(HasSpecialSounds);// SS220 Chat-Special-Emote
SubscribeLocalEvent<VocalComponent, UnloadSpecialSoundsEvent>(UnloadSpecialSounds);// SS220 Chat-Special-Emote
}

private void OnMapInit(EntityUid uid, VocalComponent component, MapInitEvent args)
Expand Down Expand Up @@ -63,6 +67,14 @@ private void OnEmote(EntityUid uid, VocalComponent component, ref EmoteEvent arg
return;
}

// SS220 Chat-Special-Emote begin
//Will play special emote if it exists
if(CheckSpecialSounds(uid, component, args.Emote))
{
args.Handled = true;
return;
}
// SS220 Chat-Special-Emote end
// just play regular sound based on emote proto
args.Handled = _chat.TryPlayEmoteSound(uid, component.EmoteSounds, args.Emote);
}
Expand Down Expand Up @@ -98,4 +110,58 @@ private void LoadSounds(EntityUid uid, VocalComponent component, Sex? sex = null
return;
_proto.TryIndex(protoId, out component.EmoteSounds);
}

// SS220 Chat-Special-Emote begin
private bool CheckSpecialSounds(EntityUid uid, VocalComponent component, EmotePrototype emote)
{
if (component.SpecialEmoteSounds == null)
return false;

foreach (var specEmote in component.SpecialEmoteSounds)
if (_chat.TryPlayEmoteSound(uid, specEmote.Value, emote))
return true;

return false;
}
private void LoadSpecialSounds(EntityUid uid, VocalComponent component, EntityUid itemUid, VocalComponent itemComponent, Sex? sex = null)
{
if (itemComponent.Sounds == null)
return;

if (component.SpecialEmoteSounds == null)
component.SpecialEmoteSounds = new();

sex ??= CompOrNull<HumanoidAppearanceComponent>(uid)?.Sex ?? Sex.Unsexed;

if (!itemComponent.Sounds.TryGetValue(sex.Value, out var protoId))
return;

if (!_proto.TryIndex(protoId, out itemComponent.EmoteSounds))
return;

component.SpecialEmoteSounds.Add(itemUid, itemComponent.EmoteSounds);
}
private void HasSpecialSounds(EntityUid uid, VocalComponent component, HasSpecialSoundsEvent args)
{
_entities.TryGetComponent<VocalComponent>(args.Item, out var itemComponent);

if (itemComponent == null)
return;

if (component.SpecialEmoteSounds != null && component.SpecialEmoteSounds.ContainsKey(args.Item))
return;

LoadSpecialSounds(uid, component, args.Item, itemComponent);
}
private void UnloadSpecialSounds(EntityUid uid, VocalComponent component, UnloadSpecialSoundsEvent args)
{
if (component.SpecialEmoteSounds == null)
return;

component.SpecialEmoteSounds.Remove(args.Item);

if (component.SpecialEmoteSounds.Count < 1)
component.SpecialEmoteSounds = null;
}
// SS220 Chat-Special-Emote end
}
16 changes: 16 additions & 0 deletions Content.Shared/Inventory/InventorySystem.Equip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Robust.Shared.Containers;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Content.Shared.SS220.Speech;// SS220 Chat-Special-Emote

namespace Content.Shared.Inventory;

Expand All @@ -27,6 +28,7 @@ public abstract partial class InventorySystem
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly IEntityManager _entManager = default!;// SS220 Chat-Special-Emote

[ValidatePrototypeId<ItemSizePrototype>]
private const string PocketableItemSize = "Small";
Expand All @@ -50,6 +52,13 @@ private void OnEntRemoved(EntityUid uid, InventoryComponent component, EntRemove

var gotUnequippedEvent = new GotUnequippedEvent(uid, args.Entity, slotDef);
RaiseLocalEvent(args.Entity, gotUnequippedEvent, true);

// SS220 Chat-Special-Emote begin
if (_entManager.TryGetComponent<SpecialSoundsComponent>(args.Entity, out var soundcomp))
{
RaiseLocalEvent(uid, new UnloadSpecialSoundsEvent(args.Entity));
}
// SS220 Chat-Special-Emote end
}

private void OnEntInserted(EntityUid uid, InventoryComponent component, EntInsertedIntoContainerMessage args)
Expand All @@ -62,6 +71,13 @@ private void OnEntInserted(EntityUid uid, InventoryComponent component, EntInser

var gotEquippedEvent = new GotEquippedEvent(uid, args.Entity, slotDef);
RaiseLocalEvent(args.Entity, gotEquippedEvent, true);

// SS220 Chat-Special-Emote begin
if (_entManager.TryGetComponent<SpecialSoundsComponent>(args.Entity, out var soundcomp))
{
RaiseLocalEvent(uid, new HasSpecialSoundsEvent(args.Entity));
}
// SS220 Chat-Special-Emote end
}

/// <summary>
Expand Down
33 changes: 33 additions & 0 deletions Content.Shared/SS220/Speech/SpecialSoundsComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt

namespace Content.Shared.SS220.Speech;

/// <summary>
/// Marks, that this item has the VocalComponent
/// </summary>

[RegisterComponent]
public sealed partial class SpecialSoundsComponent : Component
{
[ByRefEvent]
public readonly record struct HasSpecialSoundsEvent();
}

public sealed class HasSpecialSoundsEvent : EntityEventArgs
{
public EntityUid Item;

public HasSpecialSoundsEvent(EntityUid item)
{
Item = item;
}
}

public sealed class UnloadSpecialSoundsEvent : EntityEventArgs
{
public EntityUid Item;
public UnloadSpecialSoundsEvent(EntityUid item)
{
Item = item;
}
}
12 changes: 12 additions & 0 deletions Resources/Audio/SS220/Voice/Boss/attributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- files:
- male_boss_laugh_1.ogg
- male_boss_laugh_2.ogg
license: "CC0-1.0"
copyright: "Modified by SkaldetSkaeg (Github), shortened, cleaned from background sounds, converted to OGG."
source: "https://www.youtube.com/watch?v=mbVdQe9YtyI"

- files:
- male_boss_laugh_3.ogg
license: "CC0-1.0"
copyright: "Modified by SkaldetSkaeg (Github), shortened, cleaned from background sounds, converted to OGG."
source: "https://www.youtube.com/watch?v=KK1ysowj1dA"
Binary file not shown.
Binary file not shown.
Binary file not shown.
17 changes: 17 additions & 0 deletions Resources/Audio/SS220/Voice/Evil/attributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- files:
- male_evil_laugh_1.ogg
license: "CC0-1.0"
copyright: "Modified by SkaldetSkaeg (Github), shortened, cleaned from background sounds, converted to OGG."
source: "https://www.myinstants.com/en/instant/dr-evil-laugh-97644"

- files:
- male_evil_laugh_2.ogg
license: "CC0-1.0"
copyright: "Modified by SkaldetSkaeg (Github), shortened, cleaned from background sounds, converted to OGG."
source: "https://www.youtube.com/watch?v=H4FSeKBH8vc"

- files:
- male_evil_laugh_3.ogg
license: "CC0-1.0"
copyright: "Modified by SkaldetSkaeg (Github), shortened, cleaned from background sounds, converted to OGG."
source: "https://www.youtube.com/watch?v=kk4pf-Hk5hA"
Binary file not shown.
Binary file not shown.
Binary file not shown.
17 changes: 17 additions & 0 deletions Resources/Audio/SS220/Voice/Santa/attributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- files:
- santa_laugh_1.ogg
license: "CC-BY-4.0"
copyright: "Modified by SkaldetSkaeg (Github), shortened, converted to OGG."
source: "https://freesound.org/people/Cloud-10/sounds/536245/"

- files:
- santa_laugh_2.ogg
license: "CC-BY-4.0"
copyright: "Modified by SkaldetSkaeg (Github), shortened, converted to OGG."
source: "https://freesound.org/people/Jaqvaar/sounds/110697/"

- files:
- santa_laugh_3.ogg
license: "CC-BY-4.0"
copyright: "Modified by SkaldetSkaeg (Github), shortened, converted to OGG."
source: "https://freesound.org/people/Jaqvaar/sounds/110696/"
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions Resources/Prototypes/Corvax/Entities/Clothing/Neck/pins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@
clothingVisuals:
neck:
- state: sind-equipped
#ss220 special_sounds start
- type: SpecialSounds
- type: Vocal
sounds:
Male: MaleEvil
#ss220 special_sounds end

- type: entity
parent: ClothingNeckPinBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@
highPressureMultiplier: 0.08
lowPressureMultiplier: 1000


- type: entity
parent: ClothingHeadHardsuitWithLightBase
id: ClothingHeadHelmetHardsuitSyndieCommander
Expand All @@ -418,6 +419,7 @@
Heat: 0.8
Radiation: 0.5


- type: entity
parent: ClothingHeadHardsuitWithLightBase
id: ClothingHeadHelmetHardsuitSyndieElite
Expand Down Expand Up @@ -445,6 +447,7 @@
Heat: 0.8 #ss220-helmetFix
Radiation: 0.5


#Cybersun Juggernaut Hardsuit
- type: entity
parent: ClothingHeadHardsuitWithLightBase #SS220-syndifix
Expand Down
13 changes: 13 additions & 0 deletions Resources/Prototypes/Entities/Clothing/Head/hats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@
- Ian # SS220 Shapochki
- HamsterWearable
- WhitelistChameleon
#ss220 special_sounds start
- type: SpecialSounds
- type: Vocal
sounds:
Male: MaleBoss
#ss220 special_sounds end

- type: entity
parent: ClothingHeadBase
Expand Down Expand Up @@ -386,6 +392,13 @@
sprite: Clothing/Head/Hats/santahat.rsi
- type: Clothing
sprite: Clothing/Head/Hats/santahat.rsi
#ss220 special_sounds start
- type: SpecialSounds
- type: Vocal
sounds:
Male: MaleSanta
#ss220 special_sounds end


- type: entity
parent: ClothingHeadBase
Expand Down
11 changes: 10 additions & 1 deletion Resources/Prototypes/Entities/Clothing/Head/misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,16 @@
sprite: Clothing/Head/Hats/catears.rsi
- type: AddAccentClothing
accent: OwOAccent

#ss220 special_sounds start
- type: SpecialSounds
- type: Vocal
wilhelm: "/Audio/Voice/Felinid/cat_wilhelm.ogg"
sounds:
Male: MaleFelinid
Female: FemaleFelinid
Unsexed: MaleFelinid
#ss220 special_sounds end

- type: entity
parent: ClothingHeadBase
id: ClothingHeadHatDogEars
Expand Down
6 changes: 6 additions & 0 deletions Resources/Prototypes/Entities/Clothing/Masks/masks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@
Slash: 0.95
Piercing: 0.95
Heat: 0.95
#ss220 special_sounds start
- type: SpecialSounds
- type: Vocal
sounds:
Male: MaleEvil
#ss220 special_sounds end

- type: entity
parent: ClothingMaskGas
Expand Down
24 changes: 24 additions & 0 deletions Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,12 @@
- type: HeldSpeedModifier
- type: ToggleableClothing
clothingPrototype: ClothingHeadHelmetHardsuitSyndie
#ss220 special_sounds start
- type: SpecialSounds
- type: Vocal
sounds:
Male: MaleEvil
#ss220 special_sounds end

# Syndicate Medic Hardsuit
- type: entity
Expand Down Expand Up @@ -551,6 +557,12 @@
- type: HeldSpeedModifier
- type: ToggleableClothing
clothingPrototype: ClothingHeadHelmetHardsuitSyndieElite
#ss220 special_sounds start
- type: SpecialSounds
- type: Vocal
sounds:
Male: MaleEvil
#ss220 special_sounds end

#Syndicate Commander Hardsuit
- type: entity
Expand Down Expand Up @@ -584,6 +596,12 @@
- type: HeldSpeedModifier
- type: ToggleableClothing
clothingPrototype: ClothingHeadHelmetHardsuitSyndieCommander
#ss220 special_sounds start
- type: SpecialSounds
- type: Vocal
sounds:
Male: MaleEvil
#ss220 special_sounds end

#Cybersun Juggernaut Hardsuit
- type: entity
Expand Down Expand Up @@ -617,6 +635,12 @@
- type: HeldSpeedModifier
- type: ToggleableClothing
clothingPrototype: ClothingHeadHelmetHardsuitCybersun
#ss220 special_sounds start
- type: SpecialSounds
- type: Vocal
sounds:
Male: MaleEvil
#ss220 special_sounds end

#Wizard Hardsuit
- type: entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
tags:
- SuitEVA
- WhitelistChameleon
#ss220 special_sounds start
- type: SpecialSounds
- type: Vocal
sounds:
Male: MaleEvil
#ss220 special_sounds end

#Emergency EVA
- type: entity
Expand Down
Loading

0 comments on commit f014486

Please sign in to comment.