Loudspeaker

This commit is contained in:
BIGZi0348
2024-12-29 16:00:55 +03:00
parent 7d103834d2
commit 1907ecc399
11 changed files with 153 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
using Content.Server.Chat.Systems;
using Content.Server.VoiceMask;
using Content.Shared.Interaction.Components;
using Content.Server._White.HopSpeaker;
namespace Content.Server.Chat;
@@ -14,11 +15,17 @@ public sealed class FunnyFontsChatSystem : EntitySystem
private void OnEntitySpeak(SpeechTransformedEvent ev)
{
if(TryComp(ev.Sender, out VoiceMaskComponent? mask) && mask.Enabled) return;
if (TryComp(ev.Sender, out VoiceMaskComponent? mask) && mask.Enabled) return;
if (TryComp<ClumsyComponent>(ev.Sender, out _))
{
ev.Message = $"[font=\"ComicSansMS\"]{ev.Message}[/font]";
}
// WD EDIT START
if (TryComp<PapersSpeechComponent>(ev.Sender, out _))
{
ev.Message = $"[font=\"BureaucracyPixel\"]{ev.Message}[/font]";
}
// WD EDIT END
}
}

View File

@@ -0,0 +1,17 @@
using Robust.Shared.Audio;
namespace Content.Server._White.HopSpeaker;
[RegisterComponent]
public sealed partial class HopSpeakerComponent : Component
{
[DataField("delay")]
public TimeSpan Delay = TimeSpan.FromSeconds(5);
[ViewVariables(VVAccess.ReadOnly)]
public TimeSpan DelayEnd = TimeSpan.Zero;
[DataField]
public SoundSpecifier Sound = new SoundPathSpecifier("/Audio/White/Effects/dynamicNEXT_.ogg");
}

View File

@@ -0,0 +1,39 @@
using Content.Server.Explosion.EntitySystems;
using Content.Server.Chat.Systems;
using Content.Server.Power.Components;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Player;
using Robust.Shared.Timing;
namespace Content.Server._White.HopSpeaker;
public sealed partial class HopSpeakerSystem : EntitySystem
{
[Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<HopSpeakerComponent, TriggerEvent>(HandleChatOnTrigger);
}
private void HandleChatOnTrigger(EntityUid uid, HopSpeakerComponent component, TriggerEvent args)
{
if (component.DelayEnd > _gameTiming.CurTime)
return;
if (!TryComp<ApcPowerReceiverComponent>(uid, out var receiverComponent) || !receiverComponent.Powered)
return;
_chat.TrySendInGameICMessage(uid, Loc.GetString("hopspeaker-next"), InGameICChatType.Speak,
ChatTransmitRange.Normal);
_audio.PlayEntity(component.Sound, Filter.Local(), uid, false, AudioParams.Default.WithVolume(-2f));
component.DelayEnd = _gameTiming.CurTime + component.Delay;
}
}

View File

@@ -0,0 +1,10 @@
namespace Content.Server._White.HopSpeaker;
/// <summary>
/// Entity with this component will have a pixel font while speaking.
/// </summary>
[RegisterComponent]
public sealed partial class PapersSpeechComponent : Component
{
}

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,3 @@
hopspeaker-next = СЛЕДУЮЩИЙ!
ent-HOPSpeaker = громкоговоритель
.desc = Особо экстравагантный способ продвинуть очередь.

View File

@@ -0,0 +1,58 @@
- type: entity
id: HOPSpeaker
name: loudspeaker
description: An especially extravagant way to move the queue.
placement:
mode: SnapgridCenter
snap:
- Wallmount
components:
- type: HopSpeaker
- type: PapersSpeech
- type: Speech
- type: Transform
anchored: true
- type: WallMount
arc: 360
- type: InteractionOutline
- type: Clickable
- type: Appearance
- type: Sprite
drawdepth: WallMountedItems
sprite: White/Structures/Wallmounts/speaker.rsi
state: speaker
noRot: true
- type: TriggerOnSignal
- type: DeviceNetwork
deviceNetId: Wireless
receiveFrequencyId: BasicDevice
- type: WirelessNetworkConnection
range: 200
- type: DeviceLinkSink
ports:
- Trigger
- type: ApcPowerReceiver
powerLoad: 500
needsPower: true
- type: Electrified
enabled: false
usesApcPower: true
- type: ExtensionCableReceiver
- type: Damageable
damageContainer: StructuralInorganic
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 100
behaviors:
- !type:PlaySoundBehavior
sound:
collection: MetalBreak
- !type:DoActsBehavior
acts: ["Destruction"]
- type: MeleeSound
soundGroups:
Brute:
path:
"/Audio/Weapons/smash.ogg"

View File

@@ -61,3 +61,7 @@
- type: font
id: Emoji
path: /Fonts/NotoEmoji.ttf
- type: font # WD
id: BureaucracyPixel
path: /Fonts/BureaucracyPixel/BureaucracyPixel.ttf

View File

@@ -0,0 +1,14 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Nickel",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "speaker"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B