Combine AdminFrozenSystem in shared. (#39885)

commit
This commit is contained in:
Kyle Tyo 2025-08-25 09:49:27 -04:00 committed by Vanessa
parent 581f58ca04
commit d677e755ca
4 changed files with 12 additions and 27 deletions

View File

@ -1,7 +0,0 @@
using Content.Shared.Administration;
namespace Content.Client.Administration.Systems;
public sealed class AdminFrozenSystem : SharedAdminFrozenSystem
{
}

View File

@ -1,16 +0,0 @@
using Content.Shared.Administration;
namespace Content.Server.Administration.Systems;
public sealed class AdminFrozenSystem : SharedAdminFrozenSystem
{
/// <summary>
/// Freezes and mutes the given entity.
/// </summary>
public void FreezeAndMute(EntityUid uid)
{
var comp = EnsureComp<AdminFrozenComponent>(uid);
comp.Muted = true;
Dirty(uid, comp);
}
}

View File

@ -2,7 +2,7 @@
namespace Content.Shared.Administration;
[RegisterComponent, Access(typeof(SharedAdminFrozenSystem))]
[RegisterComponent, Access(typeof(AdminFrozenSystem))]
[NetworkedComponent, AutoGenerateComponentState]
public sealed partial class AdminFrozenComponent : Component
{

View File

@ -12,15 +12,13 @@ using Content.Shared.Throwing;
namespace Content.Shared.Administration;
// TODO deduplicate with BlockMovementComponent
public abstract class SharedAdminFrozenSystem : EntitySystem
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);
@ -35,6 +33,16 @@ public abstract class SharedAdminFrozenSystem : EntitySystem
SubscribeLocalEvent<AdminFrozenComponent, SpeakAttemptEvent>(OnSpeakAttempt);
}
/// <summary>
/// Freezes and mutes the given entity.
/// </summary>
public void FreezeAndMute(EntityUid uid)
{
var comp = EnsureComp<AdminFrozenComponent>(uid);
comp.Muted = true;
Dirty(uid, comp);
}
private void OnInteractAttempt(Entity<AdminFrozenComponent> ent, ref InteractionAttemptEvent args)
{
args.Cancelled = true;