Loudspeaker
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
17
Content.Server/_White/HopSpeaker/HopSpeakerComponent.cs
Normal file
17
Content.Server/_White/HopSpeaker/HopSpeakerComponent.cs
Normal 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");
|
||||
}
|
||||
|
||||
39
Content.Server/_White/HopSpeaker/HopSpeakerSystem.cs
Normal file
39
Content.Server/_White/HopSpeaker/HopSpeakerSystem.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
10
Content.Server/_White/HopSpeaker/PapersSpeechComponent.cs
Normal file
10
Content.Server/_White/HopSpeaker/PapersSpeechComponent.cs
Normal 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
|
||||
{
|
||||
|
||||
}
|
||||
BIN
Resources/Audio/White/Effects/dynamicNEXT_.ogg
Normal file
BIN
Resources/Audio/White/Effects/dynamicNEXT_.ogg
Normal file
Binary file not shown.
BIN
Resources/Fonts/BureaucracyPixel/BureaucracyPixel.ttf
Normal file
BIN
Resources/Fonts/BureaucracyPixel/BureaucracyPixel.ttf
Normal file
Binary file not shown.
3
Resources/Locale/ru-RU/_white/hop-speaker.ftl
Normal file
3
Resources/Locale/ru-RU/_white/hop-speaker.ftl
Normal file
@@ -0,0 +1,3 @@
|
||||
hopspeaker-next = СЛЕДУЮЩИЙ!
|
||||
ent-HOPSpeaker = громкоговоритель
|
||||
.desc = Особо экстравагантный способ продвинуть очередь.
|
||||
@@ -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"
|
||||
@@ -61,3 +61,7 @@
|
||||
- type: font
|
||||
id: Emoji
|
||||
path: /Fonts/NotoEmoji.ttf
|
||||
|
||||
- type: font # WD
|
||||
id: BureaucracyPixel
|
||||
path: /Fonts/BureaucracyPixel/BureaucracyPixel.ttf
|
||||
|
||||
@@ -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 |
Reference in New Issue
Block a user