перенос файлов сервера из папки White в _White
This commit is contained in:
23
Content.Server/_White/Other/Speech/VoiceOfGodComponent.cs
Normal file
23
Content.Server/_White/Other/Speech/VoiceOfGodComponent.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
namespace Content.Server._White.Other.Speech;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class VoiceOfGodComponent : Component
|
||||
{
|
||||
[DataField("sound"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public string Sound { get; set; } = "/Audio/White/Voice/voice_of_god.ogg";
|
||||
|
||||
[DataField("soundRange"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public float SoundRange { get; set; } = 8;
|
||||
|
||||
[DataField("volume"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public int Volume { get; set; } = 5;
|
||||
|
||||
[DataField("accent"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool Accent { get; set; } = true;
|
||||
|
||||
[DataField("color"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public string ChatColor { get; set; } = Color.Red.ToHex();
|
||||
|
||||
[DataField("locale"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public string ChatLoc { get; set; } = "chat-manager-entity-say-god-wrap-message";
|
||||
}
|
||||
38
Content.Server/_White/Other/Speech/VoiceOfGodSystem.cs
Normal file
38
Content.Server/_White/Other/Speech/VoiceOfGodSystem.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using Content.Server.Speech;
|
||||
using Robust.Server.Audio;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server._White.Other.Speech;
|
||||
|
||||
public sealed class VoiceOfGodSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly AudioSystem _audio = default!;
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<VoiceOfGodComponent, AccentGetEvent>(OnAccent);
|
||||
}
|
||||
|
||||
private string Accentuate(VoiceOfGodComponent component, string message)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(component.Sound))
|
||||
{
|
||||
_audio.PlayPvs(component.Sound,
|
||||
component.Owner,
|
||||
new AudioParams()
|
||||
{
|
||||
Volume = component.Volume
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return component.Accent ? message.ToUpper() : message;
|
||||
}
|
||||
|
||||
private void OnAccent(EntityUid uid, VoiceOfGodComponent component, AccentGetEvent args)
|
||||
{
|
||||
args.Message = Accentuate(component, args.Message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user