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

@@ -11,6 +11,7 @@ using Content.Shared.Popups;
using Content.Shared.Pulling.Components;
using Content.Shared.Standing;
using Content.Shared.Stunnable;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
@@ -34,9 +35,6 @@ namespace Content.Server.Buckle.Components
[Dependency] private readonly IEntityManager _entMan = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[ComponentDependency] public readonly AppearanceComponent? Appearance = null;
[ComponentDependency] private readonly MobStateComponent? _mobState = null;
[DataField("size")]
private int _size = 100;
@@ -234,7 +232,8 @@ namespace Content.Server.Buckle.Components
return false;
}
Appearance?.SetData(BuckleVisuals.Buckled, true);
if(_entMan.TryGetComponent<AppearanceComponent>(Owner, out var appearance))
appearance.SetData(BuckleVisuals.Buckled, true);
ReAttach(strap);
@@ -324,10 +323,11 @@ namespace Content.Server.Buckle.Components
xform.Coordinates = oldBuckledXform.Coordinates.Offset(oldBuckledTo.UnbuckleOffset);
}
Appearance?.SetData(BuckleVisuals.Buckled, false);
if(_entMan.TryGetComponent<AppearanceComponent>(Owner, out var appearance))
appearance.SetData(BuckleVisuals.Buckled, false);
if (_entMan.HasComponent<KnockedDownComponent>(Owner)
|| (_mobState?.IsIncapacitated() ?? false))
| _entMan.TryGetComponent<MobStateComponent>(Owner, out var mobState) && mobState.IsIncapacitated())
{
EntitySystem.Get<StandingStateSystem>().Down(Owner);
}
@@ -336,7 +336,7 @@ namespace Content.Server.Buckle.Components
EntitySystem.Get<StandingStateSystem>().Stand(Owner);
}
_mobState?.CurrentState?.EnterState(Owner, _entMan);
mobState?.CurrentState?.EnterState(Owner, _entMan);
UpdateBuckleStatus();
@@ -397,9 +397,9 @@ namespace Content.Server.Buckle.Components
if (BuckledTo != null &&
_entMan.GetComponent<TransformComponent>(BuckledTo.Owner).LocalRotation.GetCardinalDir() == Direction.North &&
BuckledTo.SpriteComponent != null)
_entMan.TryGetComponent<SpriteComponent>(BuckledTo.Owner, out var spriteComponent))
{
drawDepth = BuckledTo.SpriteComponent.DrawDepth - 1;
drawDepth = spriteComponent.DrawDepth - 1;
}
return new BuckleComponentState(Buckled, drawDepth, LastEntityBuckledTo, DontCollide);