прикол

This commit is contained in:
Remuchi
2024-01-17 19:34:15 +07:00
parent 8b98c68ae2
commit 9ee24b096f
5 changed files with 41 additions and 42 deletions

View File

@@ -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.GameStates;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Content.Server.Actions;
using Content.Shared.Animations;
using static Content.Shared.Animations.EmoteAnimationComponent; 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] private readonly ActionsSystem _action = default!;
[Dependency] public readonly IPrototypeManager _proto = default!; [Dependency] private readonly IPrototypeManager _proto = default!;
/// <summary> /// <summary>
/// We write 'EmoteAction' word before id name for instant action. /// We write 'EmoteAction' word before id name for instant action.
/// Example: EmoteActionJump, EmoteActionFlip and etc. /// Example: EmoteActionJump, EmoteActionFlip and etc.
/// </summary> /// </summary>
private const string INSTANT_IDENTIFIER = "EmoteAction"; private const string InstantIdentifier = "EmoteAction";
public override void Initialize() public override void Initialize()
{ {
SubscribeLocalEvent<EmoteAnimationComponent, ComponentGetState>(OnGetState); SubscribeLocalEvent<EmoteAnimationComponent, ComponentGetState>(OnGetState);
@@ -37,8 +37,8 @@ public class EmoteAnimationSystem : EntitySystem
{ {
foreach (var item in _proto.EnumeratePrototypes<EntityPrototype>()) foreach (var item in _proto.EnumeratePrototypes<EntityPrototype>())
{ {
if (item.ID.Length <= INSTANT_IDENTIFIER.Length || if (item.ID.Length <= InstantIdentifier.Length ||
item.ID[..INSTANT_IDENTIFIER.Length] != INSTANT_IDENTIFIER) item.ID[..InstantIdentifier.Length] != InstantIdentifier)
continue; continue;
EntityUid? action = null; EntityUid? action = null;
@@ -66,6 +66,7 @@ public class EmoteAnimationSystem : EntitySystem
private void OnEmoteAction(EntityUid uid, EmoteAnimationComponent component, EmoteActionEvent args) private void OnEmoteAction(EntityUid uid, EmoteAnimationComponent component, EmoteActionEvent args)
{ {
PlayEmoteAnimation(uid, component, args.Emote); PlayEmoteAnimation(uid, component, args.Emote);
args.Handled = true;
} }
public void PlayEmoteAnimation(EntityUid uid, EmoteAnimationComponent component, string emoteId) public void PlayEmoteAnimation(EntityUid uid, EmoteAnimationComponent component, string emoteId)

View File

@@ -13,7 +13,6 @@ public sealed class EmitSoundStatSystem : EntitySystem
[Dependency] private readonly TagSystem _tag = default!; [Dependency] private readonly TagSystem _tag = default!;
[Dependency] private readonly IConfigurationManager _config = default!; [Dependency] private readonly IConfigurationManager _config = default!;
Dictionary<SoundSources, int> soundsEmitted = new(); Dictionary<SoundSources, int> soundsEmitted = new();
// This Enum must match the exact tag you're searching for. // 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!) // and should have a parameter of "times" (e.g. Horns were honked a total of {$times} times!)
private enum SoundSources private enum SoundSources
{ {
BikeHorn, BikeHorn
Plushie
} }
public override void Initialize() public override void Initialize()
@@ -52,18 +50,15 @@ public sealed class EmitSoundStatSystem : EntitySystem
if (source == null) if (source == null)
return; return;
if (soundsEmitted.ContainsKey(source.Value)) if (!soundsEmitted.TryAdd(source.Value, 1))
{ {
soundsEmitted[source.Value]++; soundsEmitted[source.Value]++;
return;
} }
soundsEmitted.Add(source.Value, 1);
} }
private void OnRoundEnd(RoundEndTextAppendEvent ev) private void OnRoundEnd(RoundEndTextAppendEvent ev)
{ {
var minCount = _config.GetCVar<int>(WhiteCVars.EmitSoundThreshold); var minCount = _config.GetCVar(WhiteCVars.EmitSoundThreshold);
var line = string.Empty; var line = string.Empty;
var entry = false; var entry = false;
@@ -85,11 +80,11 @@ public sealed class EmitSoundStatSystem : EntitySystem
ev.AddLine("[color=springGreen]" + line + "[/color]"); 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.DebugS("eorstats", "Unknown messageId: {0}", preLocalString);
Logger.Debug("Make sure the string is following the correct format, and matches the enum! (eorstats-emitsound-<enum>)"); Logger.Debug("Make sure the string is following the correct format, and matches the enum! (eorstats-emitsound-<enum>)");

View File

@@ -1,11 +1,9 @@
using Content.Server.Chat.Systems; using Content.Server.Chat.Systems;
using Content.Server.Ghost.Components;
using Content.Shared.Ghost;
using Content.Shared.Humanoid; using Content.Shared.Humanoid;
using Content.Shared.Mobs; using Content.Shared.Mobs;
using Robust.Server.GameObjects;
using Robust.Shared.Audio; using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems; using Robust.Shared.Audio.Systems;
using Robust.Shared.Player;
using Robust.Shared.Random; using Robust.Shared.Random;
namespace Content.Server.White.Other; 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)); 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) private void StopPlayingStream(EntityUid uid)
@@ -79,19 +76,27 @@ public sealed class OnDeath : EntitySystem
} }
private string SelectRandomDeathGaspMessage() private string SelectRandomDeathGaspMessage()
=> DeathGaspMessages[_random.Next(DeathGaspMessages.Length)]; {
return DeathGaspMessages[_random.Next(DeathGaspMessages.Length)];
}
private string LocalizeDeathGaspMessage(string message) private string LocalizeDeathGaspMessage(string message)
=> Loc.GetString(message); {
return Loc.GetString(message);
}
private void SendDeathGaspMessage(EntityUid uid, string 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) 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) private void OnDetach(EntityUid uid, HumanoidAppearanceComponent component, PlayerDetachedEvent args)
=> StopPlayingStream(args.Entity); {
StopPlayingStream(args.Entity);
}
} }

View File

@@ -1,12 +1,13 @@
using Content.Shared.Actions.ActionTypes; using Robust.Shared.GameStates;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
using Component = Robust.Shared.GameObjects.Component; using Component = Robust.Shared.GameObjects.Component;
namespace Content.Shared.White.MeatyOre; namespace Content.Shared.White.MeatyOre;
[Serializable, NetSerializable] [Serializable, NetSerializable]
public sealed class MeatyOreShopRequestEvent : EntityEventArgs {} public sealed class MeatyOreShopRequestEvent : EntityEventArgs
{
}
[NetworkedComponent, RegisterComponent] [NetworkedComponent, RegisterComponent]
public sealed partial class IgnorBUIInteractionRangeComponent : Component public sealed partial class IgnorBUIInteractionRangeComponent : Component

View File

@@ -32,9 +32,6 @@
Cloth: 100 Cloth: 100
- type: StaticPrice - type: StaticPrice
price: 5 price: 5
- type: Tag
tags:
- Plushie
- type: entity - type: entity
parent: BasePlushie parent: BasePlushie
@@ -872,7 +869,7 @@
params: params:
variation: 0.65 variation: 0.65
volume: -10 volume: -10
- type: entity - type: entity
parent: BaseItem parent: BaseItem
id: PonderingOrb id: PonderingOrb
@@ -1213,4 +1210,4 @@
path: /Audio/Voice/Human/malescream_3.ogg path: /Audio/Voice/Human/malescream_3.ogg
- type: MeleeWeapon - type: MeleeWeapon
soundHit: soundHit:
path: /Audio/Voice/Human/malescream_4.ogg path: /Audio/Voice/Human/malescream_4.ogg