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

@@ -58,9 +58,6 @@ namespace Content.Server.Singularity.Components
}
}
[ComponentDependency] private readonly PhysicsComponent? _collidableComponent = default;
[ComponentDependency] private readonly PointLightComponent? _pointLightComponent = default;
private Tuple<Direction, ContainmentFieldConnection>? _connection1;
private Tuple<Direction, ContainmentFieldConnection>? _connection2;
@@ -69,7 +66,7 @@ namespace Content.Server.Singularity.Components
public void OnAnchoredChanged()
{
if(_collidableComponent?.BodyType != BodyType.Static)
if(_entMan.TryGetComponent<PhysicsComponent>(Owner, out var physicsComponent) && physicsComponent.BodyType != BodyType.Static)
{
_connection1?.Item2.Dispose();
_connection2?.Item2.Dispose();
@@ -91,7 +88,7 @@ namespace Content.Server.Singularity.Components
private bool TryGenerateFieldConnection([NotNullWhen(true)] ref Tuple<Direction, ContainmentFieldConnection>? propertyFieldTuple)
{
if (propertyFieldTuple != null) return false;
if(_collidableComponent?.BodyType != BodyType.Static) return false;
if(_entMan.TryGetComponent<PhysicsComponent>(Owner, out var physicsComponent) && physicsComponent.BodyType != BodyType.Static) return false;
foreach (var direction in new[] {Direction.North, Direction.East, Direction.South, Direction.West})
{
@@ -166,10 +163,10 @@ namespace Content.Server.Singularity.Components
public void UpdateConnectionLights()
{
if (_pointLightComponent != null)
if (_entMan.TryGetComponent<PointLightComponent>(Owner, out var pointLightComponent))
{
bool hasAnyConnection = (_connection1 != null) || (_connection2 != null);
_pointLightComponent.Enabled = hasAnyConnection;
pointLightComponent.Enabled = hasAnyConnection;
}
}