mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-18 05:59:03 +03:00
ports all changes to the AAC tablet and the AAC tablet itself. also puts it in items loadout. 🆑 - add: Ported the AAC tablet from Delta-V. --------- Co-authored-by: portfiend <109661617+portfiend@users.noreply.github.com> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: Milon <plmilonpl@gmail.com> Co-authored-by: deltanedas <@deltanedas:kde.org> Co-authored-by: Milon <milonpl.git@proton.me> Co-authored-by: keekee38 <iamabanana372456@gmail.com> (cherry picked from commit 5f39fa26f8c0370baae6ee5b33bfaeda451ed4a3)
53 lines
1.7 KiB
C#
53 lines
1.7 KiB
C#
using Content.Server.Abilities.Mime;
|
|
using Content.Server.Chat.Systems;
|
|
using Content.Server.Speech.Components;
|
|
using Content.Shared.Chat;
|
|
using Content.Shared.DeltaV.AACTablet;
|
|
using Content.Shared.IdentityManagement;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Server.DeltaV.AACTablet;
|
|
|
|
public sealed class AACTabletSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly ChatSystem _chat = default!;
|
|
[Dependency] private readonly IGameTiming _timing = default!;
|
|
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
|
[Dependency] private readonly MimePowersSystem _mimePowers = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<AACTabletComponent, AACTabletSendPhraseMessage>(OnSendPhrase);
|
|
}
|
|
|
|
private void OnSendPhrase(Entity<AACTabletComponent> ent, ref AACTabletSendPhraseMessage message)
|
|
{
|
|
if (ent.Comp.NextPhrase > _timing.CurTime)
|
|
return;
|
|
|
|
var senderName = Identity.Entity(message.Actor, EntityManager);
|
|
var speakerName = Loc.GetString("speech-name-relay",
|
|
("speaker", Name(ent)),
|
|
("originalName", senderName));
|
|
|
|
if (!_prototype.TryIndex(message.PhraseId, out var phrase))
|
|
return;
|
|
|
|
if (HasComp<MimePowersComponent>(message.Actor))
|
|
_mimePowers.BreakVow(message.Actor);
|
|
|
|
EnsureComp<VoiceOverrideComponent>(ent).NameOverride = speakerName;
|
|
|
|
_chat.TrySendInGameICMessage(ent,
|
|
Loc.GetString(phrase.Text),
|
|
InGameICChatType.Speak,
|
|
hideChat: false,
|
|
nameOverride: speakerName);
|
|
|
|
var curTime = _timing.CurTime;
|
|
ent.Comp.NextPhrase = curTime + ent.Comp.Cooldown;
|
|
}
|
|
}
|