Files
wwdpublic/Content.Shared/Administration/AdminFrozenSystem.cs
SimpleStation14 24f36c1803 Mirror: Pulling Rework V2 (#269)
## Mirror of PR #24936: [Pulling rework
v2](https://github.com/space-wizards/space-station-14/pull/24936) from
<img src="https://avatars.githubusercontent.com/u/10567778?v=4"
alt="space-wizards" width="22"/>
[space-wizards](https://github.com/space-wizards)/[space-station-14](https://github.com/space-wizards/space-station-14)

###### `c584f6444a85cc53edb060230f7e7b2b76cc87bf`

PR opened by <img
src="https://avatars.githubusercontent.com/u/31366439?v=4"
width="16"/><a href="https://github.com/metalgearsloth">
metalgearsloth</a> at 2024-02-04 01:43:17 UTC

---

PR changed 53 files with 796 additions and 1356 deletions.

The PR had the following labels:
- Status: Needs Review


---

<details open="true"><summary><h1>Original Body</h1></summary>

> Health v2 moment
> 
> Fixes https://github.com/space-wizards/space-station-14/issues/24900
> 
> - Fixes container changes.
> - Fixes keybind.
> - Fixes multi-pull.
> - Fixes alerts cleanup for non-predicted pull stops.
> 
> I'm awake now for any issues.


</details>

---------

Co-authored-by: SimpleStation14 <Unknown>
Co-authored-by: Danger Revolution! <142105406+DangerRevolution@users.noreply.github.com>
Co-authored-by: VMSolidus <evilexecutive@gmail.com>
2024-07-09 19:51:27 -04:00

66 lines
2.4 KiB
C#

using Content.Shared.ActionBlocker;
using Content.Shared.Interaction.Events;
using Content.Shared.Item;
using Content.Shared.Movement.Events;
using Content.Shared.Movement.Pulling.Components;
using Content.Shared.Movement.Pulling.Events;
using Content.Shared.Movement.Pulling.Systems;
using Content.Shared.Throwing;
namespace Content.Shared.Administration;
public sealed class AdminFrozenSystem : EntitySystem
{
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
[Dependency] private readonly PullingSystem _pulling = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<AdminFrozenComponent, UseAttemptEvent>(OnAttempt);
SubscribeLocalEvent<AdminFrozenComponent, PickupAttemptEvent>(OnAttempt);
SubscribeLocalEvent<AdminFrozenComponent, ThrowAttemptEvent>(OnAttempt);
SubscribeLocalEvent<AdminFrozenComponent, InteractionAttemptEvent>(OnAttempt);
SubscribeLocalEvent<AdminFrozenComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<AdminFrozenComponent, ComponentShutdown>(UpdateCanMove);
SubscribeLocalEvent<AdminFrozenComponent, UpdateCanMoveEvent>(OnUpdateCanMove);
SubscribeLocalEvent<AdminFrozenComponent, PullAttemptEvent>(OnPullAttempt);
SubscribeLocalEvent<AdminFrozenComponent, AttackAttemptEvent>(OnAttempt);
SubscribeLocalEvent<AdminFrozenComponent, ChangeDirectionAttemptEvent>(OnAttempt);
}
private void OnAttempt(EntityUid uid, AdminFrozenComponent component, CancellableEntityEventArgs args)
{
args.Cancel();
}
private void OnPullAttempt(EntityUid uid, AdminFrozenComponent component, PullAttemptEvent args)
{
args.Cancelled = true;
}
private void OnStartup(EntityUid uid, AdminFrozenComponent component, ComponentStartup args)
{
if (TryComp<PullableComponent>(uid, out var pullable))
{
_pulling.TryStopPull(uid, pullable);
}
UpdateCanMove(uid, component, args);
}
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);
}
}