Weldable cleanup (#19809)

This commit is contained in:
metalgearsloth
2023-09-05 00:07:01 +10:00
committed by GitHub
parent 88454b046a
commit db1ff07821
24 changed files with 159 additions and 210 deletions

View File

@@ -6,15 +6,18 @@ using Content.Shared.Lock;
using Content.Shared.Movement.Events;
using Content.Shared.Popups;
using Content.Shared.Resist;
using Content.Shared.Tools.Components;
using Content.Shared.Tools.Systems;
namespace Content.Server.Resist;
public sealed class ResistLockerSystem : EntitySystem
{
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly LockSystem _lockSystem = default!;
[Dependency] private readonly EntityStorageSystem _entityStorage = default!;
[Dependency] private readonly LockSystem _lockSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly WeldableSystem _weldable = default!;
public override void Initialize()
{
@@ -31,7 +34,7 @@ public sealed class ResistLockerSystem : EntitySystem
if (!TryComp(uid, out EntityStorageComponent? storageComponent))
return;
if (TryComp<LockComponent>(uid, out var lockComponent) && lockComponent.Locked || storageComponent.IsWeldedShut)
if (TryComp<LockComponent>(uid, out var lockComponent) && lockComponent.Locked || _weldable.IsWelded(uid))
{
AttemptResist(args.Entity, uid, storageComponent, component);
}
@@ -69,10 +72,11 @@ public sealed class ResistLockerSystem : EntitySystem
component.IsResisting = false;
if (TryComp<EntityStorageComponent>(uid, out var storageComponent))
if (HasComp<EntityStorageComponent>(uid))
{
if (storageComponent.IsWeldedShut)
storageComponent.IsWeldedShut = false;
WeldableComponent? weldable = null;
if (_weldable.IsWelded(uid, weldable))
_weldable.SetWeldedState(uid, false, weldable);
if (TryComp<LockComponent>(args.Args.Target.Value, out var lockComponent))
_lockSystem.Unlock(uid, args.Args.User, lockComponent);