From 9ee24b096f035e26e8faa85b001689dc47a5cc2c Mon Sep 17 00:00:00 2001 From: Remuchi Date: Wed, 17 Jan 2024 19:34:15 +0700 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B8=D0=BA=D0=BE=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../White/Animations/EmoteAnimationSystem.cs | 23 ++++++++------- .../EmitSound/EmitSoundStatSystem.cs | 17 ++++------- Content.Server/White/Other/OnDeath.cs | 29 +++++++++++-------- .../White/MeatyOre/SharedMeatyOre.cs | 7 +++-- .../Prototypes/Entities/Objects/Fun/toys.yml | 7 ++--- 5 files changed, 41 insertions(+), 42 deletions(-) diff --git a/Content.Server/White/Animations/EmoteAnimationSystem.cs b/Content.Server/White/Animations/EmoteAnimationSystem.cs index b8683c8b5b..0eadeb1e44 100644 --- a/Content.Server/White/Animations/EmoteAnimationSystem.cs +++ b/Content.Server/White/Animations/EmoteAnimationSystem.cs @@ -1,24 +1,24 @@ -using System.Linq; +using Content.Server.Actions; +using Content.Server.Chat.Systems; +using Content.Shared.Animations; +using Content.Shared.Chat.Prototypes; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; -using Content.Server.Actions; -using Content.Shared.Animations; using static Content.Shared.Animations.EmoteAnimationComponent; -using Content.Server.Chat.Systems; -using Content.Shared.Chat.Prototypes; -namespace Content.Server.Animations; +namespace Content.Server.White.Animations; -public class EmoteAnimationSystem : EntitySystem +public sealed class EmoteAnimationSystem : EntitySystem { [Dependency] private readonly ActionsSystem _action = default!; - [Dependency] public readonly IPrototypeManager _proto = default!; + [Dependency] private readonly IPrototypeManager _proto = default!; /// /// We write 'EmoteAction' word before id name for instant action. /// Example: EmoteActionJump, EmoteActionFlip and etc. /// - private const string INSTANT_IDENTIFIER = "EmoteAction"; + private const string InstantIdentifier = "EmoteAction"; + public override void Initialize() { SubscribeLocalEvent(OnGetState); @@ -37,8 +37,8 @@ public class EmoteAnimationSystem : EntitySystem { foreach (var item in _proto.EnumeratePrototypes()) { - if (item.ID.Length <= INSTANT_IDENTIFIER.Length || - item.ID[..INSTANT_IDENTIFIER.Length] != INSTANT_IDENTIFIER) + if (item.ID.Length <= InstantIdentifier.Length || + item.ID[..InstantIdentifier.Length] != InstantIdentifier) continue; EntityUid? action = null; @@ -66,6 +66,7 @@ public class EmoteAnimationSystem : EntitySystem private void OnEmoteAction(EntityUid uid, EmoteAnimationComponent component, EmoteActionEvent args) { PlayEmoteAnimation(uid, component, args.Emote); + args.Handled = true; } public void PlayEmoteAnimation(EntityUid uid, EmoteAnimationComponent component, string emoteId) diff --git a/Content.Server/White/EndOfRoundStats/EmitSound/EmitSoundStatSystem.cs b/Content.Server/White/EndOfRoundStats/EmitSound/EmitSoundStatSystem.cs index 0b4d11629b..7a3893b0fe 100644 --- a/Content.Server/White/EndOfRoundStats/EmitSound/EmitSoundStatSystem.cs +++ b/Content.Server/White/EndOfRoundStats/EmitSound/EmitSoundStatSystem.cs @@ -13,7 +13,6 @@ public sealed class EmitSoundStatSystem : EntitySystem [Dependency] private readonly TagSystem _tag = default!; [Dependency] private readonly IConfigurationManager _config = default!; - Dictionary soundsEmitted = new(); // This Enum must match the exact tag you're searching for. @@ -22,8 +21,7 @@ public sealed class EmitSoundStatSystem : EntitySystem // and should have a parameter of "times" (e.g. Horns were honked a total of {$times} times!) private enum SoundSources { - BikeHorn, - Plushie + BikeHorn } public override void Initialize() @@ -52,18 +50,15 @@ public sealed class EmitSoundStatSystem : EntitySystem if (source == null) return; - if (soundsEmitted.ContainsKey(source.Value)) + if (!soundsEmitted.TryAdd(source.Value, 1)) { soundsEmitted[source.Value]++; - return; } - - soundsEmitted.Add(source.Value, 1); } private void OnRoundEnd(RoundEndTextAppendEvent ev) { - var minCount = _config.GetCVar(WhiteCVars.EmitSoundThreshold); + var minCount = _config.GetCVar(WhiteCVars.EmitSoundThreshold); var line = string.Empty; var entry = false; @@ -85,11 +80,11 @@ public sealed class EmitSoundStatSystem : EntitySystem ev.AddLine("[color=springGreen]" + line + "[/color]"); } - private bool TryGenerateSoundsEmitted(SoundSources source, int soundsEmitted, [NotNullWhen(true)] out string? line) + private bool TryGenerateSoundsEmitted(SoundSources source, int amountOfsoundsSoundsEmitted, [NotNullWhen(true)] out string? line) { - string preLocalString = "eorstats-emitsound-" + source.ToString(); + var preLocalString = "eorstats-emitsound-" + source; - if (!Loc.TryGetString(preLocalString, out var localString, ("times", soundsEmitted))) + if (!Loc.TryGetString(preLocalString, out var localString, ("times", amountOfsoundsSoundsEmitted))) { Logger.DebugS("eorstats", "Unknown messageId: {0}", preLocalString); Logger.Debug("Make sure the string is following the correct format, and matches the enum! (eorstats-emitsound-)"); diff --git a/Content.Server/White/Other/OnDeath.cs b/Content.Server/White/Other/OnDeath.cs index e79f83869d..107a5b4da6 100644 --- a/Content.Server/White/Other/OnDeath.cs +++ b/Content.Server/White/Other/OnDeath.cs @@ -1,11 +1,9 @@ using Content.Server.Chat.Systems; -using Content.Server.Ghost.Components; -using Content.Shared.Ghost; using Content.Shared.Humanoid; using Content.Shared.Mobs; -using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Audio.Systems; +using Robust.Shared.Player; using Robust.Shared.Random; namespace Content.Server.White.Other; @@ -65,8 +63,7 @@ public sealed class OnDeath : EntitySystem } var newStream = _audio.PlayEntity(HeartSounds, uid, uid, AudioParams.Default.WithLoop(true)); - if (newStream.HasValue) - _playingStreams[uid] = newStream.Value.Entity; + _playingStreams[uid] = newStream.Value.Entity; } private void StopPlayingStream(EntityUid uid) @@ -79,19 +76,27 @@ public sealed class OnDeath : EntitySystem } private string SelectRandomDeathGaspMessage() - => DeathGaspMessages[_random.Next(DeathGaspMessages.Length)]; + { + return DeathGaspMessages[_random.Next(DeathGaspMessages.Length)]; + } private string LocalizeDeathGaspMessage(string message) - => Loc.GetString(message); + { + return Loc.GetString(message); + } private void SendDeathGaspMessage(EntityUid uid, string message) - => _chat.TrySendInGameICMessage(uid, message, InGameICChatType.Emote, ChatTransmitRange.Normal, force: true); + { + _chat.TrySendInGameICMessage(uid, message, InGameICChatType.Emote, ChatTransmitRange.Normal, force: true); + } private void PlayDeathSound(EntityUid uid) - => _audio.PlayEntity(DeathSounds, uid, uid, AudioParams.Default); + { + _audio.PlayEntity(DeathSounds, uid, uid, AudioParams.Default); + } private void OnDetach(EntityUid uid, HumanoidAppearanceComponent component, PlayerDetachedEvent args) - => StopPlayingStream(args.Entity); - - + { + StopPlayingStream(args.Entity); + } } diff --git a/Content.Shared/White/MeatyOre/SharedMeatyOre.cs b/Content.Shared/White/MeatyOre/SharedMeatyOre.cs index d88fb75e2c..70a98962d3 100644 --- a/Content.Shared/White/MeatyOre/SharedMeatyOre.cs +++ b/Content.Shared/White/MeatyOre/SharedMeatyOre.cs @@ -1,12 +1,13 @@ -using Content.Shared.Actions.ActionTypes; -using Robust.Shared.GameStates; +using Robust.Shared.GameStates; using Robust.Shared.Serialization; using Component = Robust.Shared.GameObjects.Component; namespace Content.Shared.White.MeatyOre; [Serializable, NetSerializable] -public sealed class MeatyOreShopRequestEvent : EntityEventArgs {} +public sealed class MeatyOreShopRequestEvent : EntityEventArgs +{ +} [NetworkedComponent, RegisterComponent] public sealed partial class IgnorBUIInteractionRangeComponent : Component diff --git a/Resources/Prototypes/Entities/Objects/Fun/toys.yml b/Resources/Prototypes/Entities/Objects/Fun/toys.yml index 8f6c91b794..0a311e4427 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/toys.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/toys.yml @@ -32,9 +32,6 @@ Cloth: 100 - type: StaticPrice price: 5 - - type: Tag - tags: - - Plushie - type: entity parent: BasePlushie @@ -872,7 +869,7 @@ params: variation: 0.65 volume: -10 - + - type: entity parent: BaseItem id: PonderingOrb @@ -1213,4 +1210,4 @@ path: /Audio/Voice/Human/malescream_3.ogg - type: MeleeWeapon soundHit: - path: /Audio/Voice/Human/malescream_4.ogg \ No newline at end of file + path: /Audio/Voice/Human/malescream_4.ogg