Inline TryGetComponent completely, for real

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 14:17:01 +01:00
parent 2ff4ec65d5
commit 69b270017b
425 changed files with 1143 additions and 995 deletions

View File

@@ -4,6 +4,7 @@ using Content.Shared.Security;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using System;
using Robust.Shared.IoC;
namespace Content.Server.Security.Systems
{
@@ -18,7 +19,7 @@ namespace Content.Server.Security.Systems
private void OnStartup(EntityUid uid, DeployableBarrierComponent component, ComponentStartup args)
{
if (!component.Owner.TryGetComponent(out LockComponent? lockComponent))
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner.Uid, out LockComponent? lockComponent))
return;
ToggleBarrierDeploy(component, lockComponent.Locked);
@@ -33,13 +34,13 @@ namespace Content.Server.Security.Systems
{
component.Owner.Transform.Anchored = isDeployed;
if (!component.Owner.TryGetComponent(out AppearanceComponent? appearanceComponent))
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner.Uid, out AppearanceComponent? appearanceComponent))
return;
var state = isDeployed ? DeployableBarrierState.Deployed : DeployableBarrierState.Idle;
appearanceComponent.SetData(DeployableBarrierVisuals.State, state);
if (component.Owner.TryGetComponent(out PointLightComponent? light))
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner.Uid, out PointLightComponent? light))
light.Enabled = isDeployed;
}
}