removes componentdependencies (#6160)

This commit is contained in:
Paul Ritter
2022-01-15 03:26:37 +01:00
committed by GitHub
parent 46405ec165
commit 9e1607722d
33 changed files with 257 additions and 274 deletions

View File

@@ -1,5 +1,6 @@
using Content.Server.Doors.Components;
using Content.Server.Power.Components;
using Content.Server.WireHacking;
using Content.Shared.Doors;
using Content.Shared.Popups;
using Robust.Server.GameObjects;
@@ -29,9 +30,9 @@ namespace Content.Server.Doors.Systems
private void OnPowerChanged(EntityUid uid, AirlockComponent component, PowerChangedEvent args)
{
if (component.AppearanceComponent != null)
if (TryComp<AppearanceComponent>(uid, out var appearanceComponent))
{
component.AppearanceComponent.SetData(DoorVisuals.Powered, args.Powered);
appearanceComponent.SetData(DoorVisuals.Powered, args.Powered);
}
// BoltLights also got out
@@ -41,9 +42,9 @@ namespace Content.Server.Doors.Systems
private void OnStateChanged(EntityUid uid, AirlockComponent component, DoorStateChangedEvent args)
{
// Only show the maintenance panel if the airlock is closed
if (component.WiresComponent != null)
if (TryComp<WiresComponent>(uid, out var wiresComponent))
{
component.WiresComponent.IsPanelVisible =
wiresComponent.IsPanelVisible =
component.OpenPanelVisible
|| args.State != SharedDoorComponent.DoorState.Open;
}
@@ -87,10 +88,10 @@ namespace Content.Server.Doors.Systems
private void OnDoorClickShouldActivate(EntityUid uid, AirlockComponent component, DoorClickShouldActivateEvent args)
{
if (component.WiresComponent != null && component.WiresComponent.IsPanelOpen &&
if (TryComp<WiresComponent>(uid, out var wiresComponent) && wiresComponent.IsPanelOpen &&
EntityManager.TryGetComponent(args.Args.User, out ActorComponent? actor))
{
component.WiresComponent.OpenInterface(actor.PlayerSession);
wiresComponent.OpenInterface(actor.PlayerSession);
args.Handled = true;
}
}