Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Third update of special sounds #749

Merged
merged 22 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions Content.Server/SS220/Speech/SpecialSoundsSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
using Content.Shared.SS220.Speech;
using Content.Shared.Verbs;
using Content.Server.Popups;

namespace Content.Server.SS220.Speech;

public sealed class SpecialSoundsSystem : EntitySystem
{

[Dependency] private readonly PopupSystem _popupSystem = default!;
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<SpecialSoundsComponent, GetVerbsEvent<Verb>>(OnVerb);
}

private void OnVerb(EntityUid uid, SpecialSoundsComponent component, GetVerbsEvent<Verb> args)
{
// standard interaction checks
if (!args.CanAccess || !args.CanInteract || args.Hands == null)
return;

args.Verbs.UnionWith(new[]
{
CreateVerb(uid, component, args.User, SpecialSoundMode.SpecialSoundOff),
CreateVerb(uid, component, args.User, SpecialSoundMode.SpecialSoundOn),
});
}

private Verb CreateVerb(EntityUid uid, SpecialSoundsComponent component, EntityUid userUid, SpecialSoundMode mode)
{
return new Verb()
{
Text = GetModeName(mode),
Disabled = component.Mode == mode,
Priority = -(int) mode, // sort them in descending order
Category = VerbCategory.SetSoundMode,
Act = () => SetSoundMode(uid, mode, userUid, component)
};
}
private string GetModeName(SpecialSoundMode mode)
{
string name;
switch (mode)
{
case SpecialSoundMode.SpecialSoundOff:
name = "verb-categories-special-sounds-mode-off";
break;
case SpecialSoundMode.SpecialSoundOn:
name = "verb-categories-special-sounds-mode-on";
break;
default:
return "";
}

return Loc.GetString(name);
}
public void SetSoundMode(EntityUid uid, SpecialSoundMode mode, EntityUid? userUid = null,
SpecialSoundsComponent? component = null)
{
if (!Resolve(uid, ref component))
return;

component.Mode = mode;

if (userUid != null)
{
var msg = Loc.GetString("special-sounds-mode-state", ("mode", GetModeName(mode)));
_popupSystem.PopupEntity(msg, uid, userUid.Value);

switch (mode)
{
case SpecialSoundMode.SpecialSoundOff:
RaiseLocalEvent((EntityUid) userUid, new UnloadSpecialSoundsEvent(uid));
break;
case SpecialSoundMode.SpecialSoundOn:
RaiseLocalEvent((EntityUid) userUid, new InitSpecialSoundsEvent(uid));
break;
default:
return;
}
}
}
}
4 changes: 2 additions & 2 deletions Content.Server/Speech/EntitySystems/VocalSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ 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, InitSpecialSoundsEvent>(InitSpecialSounds);// SS220 Chat-Special-Emote
SubscribeLocalEvent<VocalComponent, UnloadSpecialSoundsEvent>(UnloadSpecialSounds);// SS220 Chat-Special-Emote
}

Expand Down Expand Up @@ -142,7 +142,7 @@ private void LoadSpecialSounds(EntityUid uid, VocalComponent component, EntityUi

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

Expand Down
6 changes: 3 additions & 3 deletions Content.Shared/Inventory/InventorySystem.Equip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private void OnEntRemoved(EntityUid uid, InventoryComponent component, EntRemove
RaiseLocalEvent(args.Entity, gotUnequippedEvent, true);

// SS220 Chat-Special-Emote begin
if (_entManager.TryGetComponent<SpecialSoundsComponent>(args.Entity, out var soundcomp))
if (_entManager.TryGetComponent<SpecialSoundsComponent>(args.Entity, out var soundcomp) && (soundcomp.Mode == SpecialSoundMode.SpecialSoundOn))
{
RaiseLocalEvent(uid, new UnloadSpecialSoundsEvent(args.Entity));
}
Expand All @@ -75,9 +75,9 @@ private void OnEntInserted(EntityUid uid, InventoryComponent component, EntInser
RaiseLocalEvent(args.Entity, gotEquippedEvent, true);

// SS220 Chat-Special-Emote begin
if (_entManager.TryGetComponent<SpecialSoundsComponent>(args.Entity, out var soundcomp))
if (_entManager.TryGetComponent<SpecialSoundsComponent>(args.Entity, out var soundcomp) && (soundcomp.Mode == SpecialSoundMode.SpecialSoundOn))
{
RaiseLocalEvent(uid, new HasSpecialSoundsEvent(args.Entity));
RaiseLocalEvent(uid, new InitSpecialSoundsEvent(args.Entity));
}
// SS220 Chat-Special-Emote end
}
Expand Down
27 changes: 22 additions & 5 deletions Content.Shared/SS220/Speech/SpecialSoundsComponent.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt

using Robust.Shared.Serialization;
namespace Content.Shared.SS220.Speech;

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

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

[ByRefEvent]
public readonly record struct UnloadSpecialSoundsEvent();

/// <summary>
/// Current sensor mode. Can be switched by user verbs.
/// </summary>
[DataField("mode")]
public SpecialSoundMode Mode = SpecialSoundMode.SpecialSoundOn;
}

public sealed class HasSpecialSoundsEvent : EntityEventArgs
public sealed class InitSpecialSoundsEvent : EntityEventArgs
{
public EntityUid Item;

public HasSpecialSoundsEvent(EntityUid item)
public InitSpecialSoundsEvent(EntityUid item)
{
Item = item;
}
Expand All @@ -31,3 +40,11 @@ public UnloadSpecialSoundsEvent(EntityUid item)
Item = item;
}
}

[Serializable, NetSerializable]
public enum SpecialSoundMode : byte
{
SpecialSoundOff = 0,

SpecialSoundOn = 1
}
4 changes: 4 additions & 0 deletions Content.Shared/Verbs/VerbCategory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,9 @@ public VerbCategory(string text, string? icon, bool iconsOnly = false)

public static readonly VerbCategory DeattachCart = new("verb-categories-deattach-cart", null);
//SS220-Cart-system end

//SS220-SpecialSound-system start
public static readonly VerbCategory SetSoundMode = new("verb-categories-special-sounds", "/Textures/SS220/Interface/VerbIcons/special_emote.svg.192dpi.png");
//SS220-SpecialSound-system end
}
}
7 changes: 7 additions & 0 deletions Resources/Audio/SS220/Voice/Bandit/attributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- files:
- male_bandit_laugh_1.ogg
- male_bandit_laugh_2.ogg
- male_bandit_laugh_3.ogg
license: "CC0-1.0"
copyright: "Modified by SkaldetSkaeg (Github), shortened, cleaned from background sounds, converted to OGG."
source: "https://zvukipro.com/games/2272-zvuki-s-frazami-banditov-iz-igry-stalker-stalker.html"
Binary file not shown.
Binary file not shown.
Binary file not shown.
9 changes: 9 additions & 0 deletions Resources/Audio/SS220/Voice/Evil/attributions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,12 @@
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"

- files:
- female_evil_laugh_1.ogg
- female_evil_laugh_2.ogg
- female_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=JTJh9M54d8k"

Binary file not shown.
Binary file not shown.
Binary file not shown.
10 changes: 10 additions & 0 deletions Resources/Audio/SS220/Voice/Whitemane/attributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- files:
- whitemane_giggle_1.ogg
- whitemane_giggle_2.ogg
- whitemane_laugh_1.ogg
- whitemane_laugh_2.ogg
- whitemane_laugh_3.ogg
- whitemane_laugh_4.ogg
license: "CC-BY-4.0"
copyright: "Modified by SkaldetSkaeg (Github), shortened, converted to OGG."
source: "https://www.youtube.com/watch?v=o3R2KpXHK1w"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions Resources/Locale/ru-RU/ss220/special-sounds.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
verb-categories-special-sounds = Спец. эмоции
verb-categories-special-sounds-mode-on = Вкл
verb-categories-special-sounds-mode-off = Выкл

## Popups
special-sounds-mode-state = Спец. эмоции: {$mode}
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
- type: Vocal
sounds:
Male: MaleEvil
Female: FemaleEvil
Unsexed: MaleEvil
#ss220 special_sounds end

Expand Down
8 changes: 8 additions & 0 deletions Resources/Prototypes/Entities/Clothing/Head/hats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@
- type: Vocal
sounds:
Male: MaleDoctor
Female: FemaleDoctor
Unsexed: MaleDoctor
#ss220 special_sounds end

Expand Down Expand Up @@ -796,6 +797,13 @@
sprite: Clothing/Head/Hats/syndiecap.rsi
- type: Clothing
sprite: Clothing/Head/Hats/syndiecap.rsi
#ss220 special_sounds start
- type: SpecialSounds
- type: Vocal
sounds:
Male: MaleBandit
Unsexed: MaleBandit
#ss220 special_sounds end

- type: entity
parent: ClothingHeadBase
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Entities/Clothing/Masks/masks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
- type: Vocal
sounds:
Male: MaleEvil
Female: FemaleEvil
Unsexed: MaleEvil
#ss220 special_sounds end

Expand Down
16 changes: 16 additions & 0 deletions Resources/Prototypes/Entities/Clothing/Neck/cloaks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@
sprite: Clothing/Neck/Cloaks/rd.rsi
- type: StealTarget
stealGroup: HeadCloak
#ss220 special_sounds start
- type: SpecialSounds
mode: 0
- type: Vocal
sounds:
Male: MaleScientist
Unsexed: MaleScientist
#ss220 special_sounds end

- type: entity
parent: ClothingNeckBase
Expand Down Expand Up @@ -188,6 +196,14 @@
toggleable-clothing: !type:ContainerSlot {}
- type: TypingIndicatorClothing
proto: moth
#ss220 special_sounds start
- type: SpecialSounds
- type: Vocal
sounds:
Male: UnisexMoth
Female: UnisexMoth
Unsexed: UnisexMoth
#ss220 special_sounds end

- type: entity
parent: ClothingNeckBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@
- type: Vocal
sounds:
Male: MaleEvil
Female: FemaleEvil
Unsexed: MaleEvil
#ss220 special_sounds end

Expand Down Expand Up @@ -598,6 +599,7 @@
- type: Vocal
sounds:
Male: MaleEvil
Female: FemaleEvil
Unsexed: MaleEvil
#ss220 special_sounds end

Expand Down Expand Up @@ -638,6 +640,7 @@
- type: Vocal
sounds:
Male: MaleEvil
Female: FemaleEvil
Unsexed: MaleEvil
#ss220 special_sounds end

Expand Down Expand Up @@ -680,6 +683,7 @@
- type: Vocal
sounds:
Male: MaleEvil
Female: FemaleEvil
Unsexed: MaleEvil
#ss220 special_sounds end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
- type: Vocal
sounds:
Male: MaleEvil
Female: FemaleEvil
Unsexed: MaleEvil
#ss220 special_sounds end

Expand Down
28 changes: 28 additions & 0 deletions Resources/Prototypes/SS220/SoundCollections/emotes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@
- /Audio/SS220/Voice/Evil/male_evil_laugh_2.ogg
- /Audio/SS220/Voice/Evil/male_evil_laugh_3.ogg

- type: soundCollection
id: FemaleEvilLaugh
files:
- /Audio/SS220/Voice/Evil/female_evil_laugh_1.ogg
- /Audio/SS220/Voice/Evil/female_evil_laugh_2.ogg
- /Audio/SS220/Voice/Evil/female_evil_laugh_3.ogg

- type: soundCollection
id: MaleScientistChoke
files:
Expand All @@ -106,3 +113,24 @@
- /Audio/SS220/Voice/Doctor/male_doctor_laugh_1.ogg
- /Audio/SS220/Voice/Doctor/male_doctor_laugh_2.ogg
- /Audio/SS220/Voice/Doctor/male_doctor_laugh_3.ogg

- type: soundCollection
id: MaleBanditLaugh
files:
- /Audio/SS220/Voice/Bandit/male_bandit_laugh_1.ogg
- /Audio/SS220/Voice/Bandit/male_bandit_laugh_2.ogg
- /Audio/SS220/Voice/Bandit/male_bandit_laugh_3.ogg

- type: soundCollection
id: FemaleWhitemaneLaugh
files:
- /Audio/SS220/Voice/Whitemane/whitemane_laugh_1.ogg
- /Audio/SS220/Voice/Whitemane/whitemane_laugh_2.ogg
- /Audio/SS220/Voice/Whitemane/whitemane_laugh_3.ogg
- /Audio/SS220/Voice/Whitemane/whitemane_laugh_4.ogg

- type: soundCollection
id: FemaleWhitemaneGiggle
files:
- /Audio/SS220/Voice/Whitemane/whitemane_giggle_1.ogg
- /Audio/SS220/Voice/Whitemane/whitemane_giggle_2.ogg
Loading
Loading