mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-01 08:37:26 +00:00
* doored bell * doored bell * rezept * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using Content.Shared.Interaction;
|
|
using Robust.Shared.Audio.Systems;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Shared._DV.Pager;
|
|
|
|
public abstract class SharedPagerButtonSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly PageSenderSystem _pageSender = default!;
|
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<PagerButtonComponent, ActivateInWorldEvent>(OnActivated);
|
|
}
|
|
|
|
protected virtual string Location(Entity<PagerButtonComponent> ent)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
|
|
protected virtual void AfterActivated(Entity<PagerButtonComponent> ent)
|
|
{
|
|
}
|
|
|
|
private void OnActivated(Entity<PagerButtonComponent> ent, ref ActivateInWorldEvent args)
|
|
{
|
|
if (args.Handled || !args.Complex)
|
|
return;
|
|
|
|
_audio.PlayPredicted(ent.Comp.PressSound, ent, args.User);
|
|
_pageSender.Notify(ent.Owner, Loc.GetString(ent.Comp.PageMessage, ("location", FormattedMessage.RemoveMarkupPermissive(Location(ent)))));
|
|
args.Handled = true;
|
|
|
|
AfterActivated(ent);
|
|
}
|
|
}
|