Remove IAfterInteract (#9715)

* remove gas analyzer iafterinteract

* solution transfer + obsolete

* cuffable

* remove
This commit is contained in:
Kara
2022-07-14 04:45:31 -07:00
committed by GitHub
parent a2d22837c6
commit fab331742a
11 changed files with 163 additions and 241 deletions

View File

@@ -1,11 +1,24 @@
using Content.Server.Atmos.Components;
using Content.Server.Popups;
using Content.Shared.Interaction;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Player;
namespace Content.Server.Atmos.EntitySystems
{
[UsedImplicitly]
public sealed class GasAnalyzerSystem : EntitySystem
{
[Dependency] private readonly PopupSystem _popup = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<GasAnalyzerComponent, AfterInteractEvent>(OnAfterInteract);
}
public override void Update(float frameTime)
{
foreach (var analyzer in EntityManager.EntityQuery<GasAnalyzerComponent>(true))
@@ -13,5 +26,21 @@ namespace Content.Server.Atmos.EntitySystems
analyzer.Update(frameTime);
}
}
private void OnAfterInteract(EntityUid uid, GasAnalyzerComponent component, AfterInteractEvent args)
{
if (!args.CanReach)
{
_popup.PopupEntity(Loc.GetString("gas-analyzer-component-player-cannot-reach-message"), args.User, Filter.Entities(args.User));
return;
}
if (TryComp(args.User, out ActorComponent? actor))
{
component.OpenInterface(actor.PlayerSession, args.ClickLocation);
}
args.Handled = true;
}
}
}