nar'sie fake (#20299)
* import narsie sprite * narsie_rises audio * rename SmokeDissipateSpawnComponent to SpawnOnDespawnComponent * add AnnounceOnSpawn system * oop * NAR'SIE HAS RISEN * suffix * base prototype, changes * fix * mapinit * downscale * new toys * singuloose * still not fix * honki sprite * add honki spawn animation * revert spawnondespawn change * really revert * use LocId for announceonspawn --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
36
Content.Server/Chat/AnnounceOnSpawnComponent.cs
Normal file
36
Content.Server/Chat/AnnounceOnSpawnComponent.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Content.Server.Chat.Systems;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Server.Chat;
|
||||
|
||||
/// <summary>
|
||||
/// Dispatches an announcement to everyone when the entity is mapinit'd.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(AnnounceOnSpawnSystem))]
|
||||
public sealed partial class AnnounceOnSpawnComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Locale id of the announcement message.
|
||||
/// </summary>
|
||||
[DataField(required: true)]
|
||||
public LocId Message = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Locale id of the announcement's sender, defaults to Central Command.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public LocId? Sender;
|
||||
|
||||
/// <summary>
|
||||
/// Sound override for the announcement.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public SoundSpecifier? Sound;
|
||||
|
||||
/// <summary>
|
||||
/// Color override for the announcement.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public Color? Color;
|
||||
}
|
||||
22
Content.Server/Chat/Systems/AnnounceOnSpawnSystem.cs
Normal file
22
Content.Server/Chat/Systems/AnnounceOnSpawnSystem.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Content.Server.Chat;
|
||||
|
||||
namespace Content.Server.Chat.Systems;
|
||||
|
||||
public sealed class AnnounceOnSpawnSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ChatSystem _chat = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<AnnounceOnSpawnComponent, MapInitEvent>(OnInit);
|
||||
}
|
||||
|
||||
private void OnInit(EntityUid uid, AnnounceOnSpawnComponent comp, MapInitEvent args)
|
||||
{
|
||||
var message = Loc.GetString(comp.Message);
|
||||
var sender = comp.Sender != null ? Loc.GetString(comp.Sender) : "Central Command";
|
||||
_chat.DispatchGlobalAnnouncement(message, sender, playSound: true, comp.Sound, comp.Color);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user