diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs index 7faced1c4a9ae0..c9d72a44d86a0e 100644 --- a/Content.Server/Chat/Systems/ChatSystem.cs +++ b/Content.Server/Chat/Systems/ChatSystem.cs @@ -33,6 +33,8 @@ using Robust.Shared.Replays; using Robust.Shared.Utility; using Robust.Shared.Timing; +using Content.Shared.Bed.Sleep; +using Content.Shared.Dataset; namespace Content.Server.Chat.Systems; @@ -59,6 +61,9 @@ public sealed partial class ChatSystem : SharedChatSystem [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly ReplacementAccentSystem _wordreplacement = default!; + [Dependency] private readonly IEntityManager _entities = default!; + [Dependency] private readonly IPrototypeManager _proto = default!; + public const int VoiceRange = 10; // how far voice goes in world units public const int WhisperClearRange = 2; // how far whisper goes while still being understandable, in world units @@ -556,6 +561,8 @@ private void SendEntityEmote( var ent = Identity.Entity(source, EntityManager); string name = FormattedMessage.EscapeText(nameOverride ?? Name(ent)); + CheckForEmoteAbility(source, ref action);//SS220 No_vocal_emotes_when_muzzle + // Emotes use Identity.Name, since it doesn't actually involve your voice at all. var wrappedMessage = Loc.GetString("chat-manager-entity-me-wrap-message", ("entityName", name), @@ -579,6 +586,23 @@ private void SendEntityEmote( _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Emote from {ToPrettyString(source):user}: {action}"); } + //SS220 No_vocal_emotes_when_muzzled start + private void CheckForEmoteAbility(EntityUid uid,ref String action) + { + if (_entities.TryGetComponent(uid, out var sleeping)) + { + action = PickEmote(sleeping.SleepingEmotes);//if you sleep you are doing smth wierd + return; + } + } + + private string PickEmote(string name) + { + var dataset = _proto.Index(name); + return _random.Pick(dataset.Values); + } + //SS220 No_vocal_emotes_when_muzzled end + // ReSharper disable once InconsistentNaming private void SendLOOC(EntityUid source, ICommonSession player, string message, bool hideChat) { diff --git a/Content.Server/SS220/Muzzle/MuzzleSystem.cs b/Content.Server/SS220/Muzzle/MuzzleSystem.cs new file mode 100644 index 00000000000000..7447840309a111 --- /dev/null +++ b/Content.Server/SS220/Muzzle/MuzzleSystem.cs @@ -0,0 +1,12 @@ +// © 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.Muzzle; + +namespace Content.Server.SS220.Muzzle; + +public sealed class MuzzleSystem : SharedMuzzleSystem +{ + public override void Initialize() + { + base.Initialize(); + } +} diff --git a/Content.Server/Speech/EntitySystems/VocalSystem.cs b/Content.Server/Speech/EntitySystems/VocalSystem.cs index 0ae8dd3e0cb1c8..53aa3bac659929 100644 --- a/Content.Server/Speech/EntitySystems/VocalSystem.cs +++ b/Content.Server/Speech/EntitySystems/VocalSystem.cs @@ -9,7 +9,8 @@ using Robust.Shared.Audio.Systems; using Robust.Shared.Prototypes; using Robust.Shared.Random; -using Content.Shared.SS220.Speech;// SS220 Chat-Special-Emote +using Content.Shared.SS220.Speech; +using Content.Shared.SS220.Muzzle; namespace Content.Server.Speech.EntitySystems; @@ -60,10 +61,13 @@ private void OnEmote(EntityUid uid, VocalComponent component, ref EmoteEvent arg { if (args.Handled || !args.Emote.Category.HasFlag(EmoteCategory.Vocal)) return; - + + if (HasComp(uid))// SS220 No_vocal_emotes_when_muzzled + return; + // SS220 Chat-Special-Emote begin //Will play special emote if it exists - if(CheckSpecialSounds(uid, component, args.Emote)) + if (CheckSpecialSounds(uid, component, args.Emote)) { args.Handled = true; return; diff --git a/Content.Shared/Bed/Sleep/SleepingComponent.cs b/Content.Shared/Bed/Sleep/SleepingComponent.cs index cd468440f40d80..df04baaa14ed48 100644 --- a/Content.Shared/Bed/Sleep/SleepingComponent.cs +++ b/Content.Shared/Bed/Sleep/SleepingComponent.cs @@ -28,4 +28,7 @@ public sealed partial class SleepingComponent : Component public TimeSpan CoolDownEnd; [DataField("wakeAction")] public EntityUid? WakeAction; + + //SS220 No vocal emotes when muzzled + [DataField("sleepingEmotes")] public string SleepingEmotes = "SleepingEmotesSS220";//Name of the dataset, that will replace regular emote } diff --git a/Content.Shared/SS220/Muzzle/MuzzleComponent.cs b/Content.Shared/SS220/Muzzle/MuzzleComponent.cs new file mode 100644 index 00000000000000..372530dd61e7f2 --- /dev/null +++ b/Content.Shared/SS220/Muzzle/MuzzleComponent.cs @@ -0,0 +1,14 @@ +// © 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.GameStates; +using Robust.Shared.Prototypes; + +namespace Content.Shared.SS220.Muzzle; + +[RegisterComponent, NetworkedComponent] +[Access(typeof(SharedMuzzleSystem))] +/// +/// Added to clothing entities that should block the wearer's vocals emotions +/// +public sealed partial class MuzzleComponent : Component +{ +} diff --git a/Content.Shared/SS220/Muzzle/MuzzledComponent.cs b/Content.Shared/SS220/Muzzle/MuzzledComponent.cs new file mode 100644 index 00000000000000..a03fcca8d7c43e --- /dev/null +++ b/Content.Shared/SS220/Muzzle/MuzzledComponent.cs @@ -0,0 +1,13 @@ +// © 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.GameStates; +using Robust.Shared.Prototypes; + +namespace Content.Shared.SS220.Muzzle; + +[RegisterComponent, NetworkedComponent] +/// +/// Added to entity that must block the vocal emotions of other entity +/// +public sealed partial class MuzzledComponent : Component +{ +} diff --git a/Content.Shared/SS220/Muzzle/SharedMuzzleSystem.cs b/Content.Shared/SS220/Muzzle/SharedMuzzleSystem.cs new file mode 100644 index 00000000000000..0ddb41ff7b36f7 --- /dev/null +++ b/Content.Shared/SS220/Muzzle/SharedMuzzleSystem.cs @@ -0,0 +1,25 @@ +// © 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.Clothing; + +namespace Content.Shared.SS220.Muzzle; + +public abstract class SharedMuzzleSystem : EntitySystem +{ + [Dependency] private readonly IEntityManager _entityManager = default!; + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnGotEquipped); + SubscribeLocalEvent(OnGotUnequipped); + } + private void OnGotUnequipped(Entity ent, ref ClothingGotUnequippedEvent args) + { + _entityManager.RemoveComponent(args.Wearer); + } + + private void OnGotEquipped(Entity ent, ref ClothingGotEquippedEvent args) + { + _entityManager.AddComponent(args.Wearer); + } +} diff --git a/Resources/Prototypes/Entities/Clothing/Masks/masks.yml b/Resources/Prototypes/Entities/Clothing/Masks/masks.yml index 643f2dc6d41f74..c6160433a774f0 100644 --- a/Resources/Prototypes/Entities/Clothing/Masks/masks.yml +++ b/Resources/Prototypes/Entities/Clothing/Masks/masks.yml @@ -313,6 +313,7 @@ - type: Construction graph: Muzzle node: muzzle + - type: Muzzle #SS220 No vocal emotes when muzzled - type: entity parent: ClothingMaskPullableBase diff --git a/Resources/Prototypes/SS220/Datasets/sleepingEmotes.yml b/Resources/Prototypes/SS220/Datasets/sleepingEmotes.yml new file mode 100644 index 00000000000000..a7c0ca0bc1857c --- /dev/null +++ b/Resources/Prototypes/SS220/Datasets/sleepingEmotes.yml @@ -0,0 +1,11 @@ +#Нужно для генерации эмоций во сне +- type: dataset + id: SleepingEmotesSS220 + values: + - ворчит + - бормочет + - ворочается + - подергивается + - строит физиономии + - активно жестикулирует + - морщится