2022-04-10 16:48:11 +12:00
|
|
|
using Content.Shared.ActionBlocker;
|
2022-03-09 19:40:07 +13:00
|
|
|
using Content.Shared.Interaction.Events;
|
2022-02-11 19:01:37 -07:00
|
|
|
using Content.Shared.Item;
|
|
|
|
|
using Content.Shared.Movement;
|
2022-06-24 17:44:30 +10:00
|
|
|
using Content.Shared.Movement.Events;
|
2022-05-16 22:24:52 +10:00
|
|
|
using Content.Shared.Physics.Pull;
|
|
|
|
|
using Content.Shared.Pulling;
|
|
|
|
|
using Content.Shared.Pulling.Components;
|
|
|
|
|
using Content.Shared.Pulling.Events;
|
2022-11-15 19:34:47 +13:00
|
|
|
using Content.Shared.Stunnable;
|
2022-02-11 19:01:37 -07:00
|
|
|
using Content.Shared.Throwing;
|
|
|
|
|
|
|
|
|
|
namespace Content.Shared.Administration;
|
|
|
|
|
|
|
|
|
|
public sealed class AdminFrozenSystem : EntitySystem
|
|
|
|
|
{
|
2022-04-10 16:48:11 +12:00
|
|
|
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
|
2022-05-16 22:24:52 +10:00
|
|
|
[Dependency] private readonly SharedPullingSystem _pulling = default!;
|
2022-04-10 16:48:11 +12:00
|
|
|
|
2022-02-11 19:01:37 -07:00
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
2022-10-21 01:09:52 +11:00
|
|
|
SubscribeLocalEvent<AdminFrozenComponent, UseAttemptEvent>(OnAttempt);
|
|
|
|
|
SubscribeLocalEvent<AdminFrozenComponent, PickupAttemptEvent>(OnAttempt);
|
|
|
|
|
SubscribeLocalEvent<AdminFrozenComponent, ThrowAttemptEvent>(OnAttempt);
|
|
|
|
|
SubscribeLocalEvent<AdminFrozenComponent, InteractionAttemptEvent>(OnAttempt);
|
2022-05-16 22:24:52 +10:00
|
|
|
SubscribeLocalEvent<AdminFrozenComponent, ComponentStartup>(OnStartup);
|
2022-04-10 16:48:11 +12:00
|
|
|
SubscribeLocalEvent<AdminFrozenComponent, ComponentShutdown>(UpdateCanMove);
|
|
|
|
|
SubscribeLocalEvent<AdminFrozenComponent, UpdateCanMoveEvent>(OnUpdateCanMove);
|
2022-05-16 22:24:52 +10:00
|
|
|
SubscribeLocalEvent<AdminFrozenComponent, PullAttemptEvent>(OnPullAttempt);
|
2022-10-21 01:09:52 +11:00
|
|
|
SubscribeLocalEvent<AdminFrozenComponent, AttackAttemptEvent>(OnAttempt);
|
2022-11-15 19:34:47 +13:00
|
|
|
SubscribeLocalEvent<AdminFrozenComponent, ChangeDirectionAttemptEvent>(OnAttempt);
|
2022-10-21 01:09:52 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnAttempt(EntityUid uid, AdminFrozenComponent component, CancellableEntityEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
args.Cancel();
|
2022-05-16 22:24:52 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnPullAttempt(EntityUid uid, AdminFrozenComponent component, PullAttemptEvent args)
|
|
|
|
|
{
|
|
|
|
|
args.Cancelled = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnStartup(EntityUid uid, AdminFrozenComponent component, ComponentStartup args)
|
|
|
|
|
{
|
|
|
|
|
if (TryComp<SharedPullableComponent>(uid, out var pullable))
|
|
|
|
|
{
|
|
|
|
|
_pulling.TryStopPull(pullable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UpdateCanMove(uid, component, args);
|
2022-04-10 16:48:11 +12:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnUpdateCanMove(EntityUid uid, AdminFrozenComponent component, UpdateCanMoveEvent args)
|
|
|
|
|
{
|
|
|
|
|
if (component.LifeStage > ComponentLifeStage.Running)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
args.Cancel();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void UpdateCanMove(EntityUid uid, AdminFrozenComponent component, EntityEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
_blocker.UpdateCanMove(uid);
|
2022-02-11 19:01:37 -07:00
|
|
|
}
|
|
|
|
|
}
|