removes componentdependencies (#6160)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Content.Server.Buckle.Components
|
||||
[ComponentReference(typeof(SharedStrapComponent))]
|
||||
public class StrapComponent : SharedStrapComponent, IInteractHand, ISerializationHooks, IDestroyAct
|
||||
{
|
||||
[ComponentDependency] public readonly SpriteComponent? SpriteComponent = null;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
private readonly HashSet<EntityUid> _buckledEntities = new();
|
||||
|
||||
@@ -153,7 +153,8 @@ namespace Content.Server.Buckle.Components
|
||||
|
||||
_occupiedSize += buckle.Size;
|
||||
|
||||
buckle.Appearance?.SetData(StrapVisuals.RotationAngle, _rotation);
|
||||
if(_entityManager.TryGetComponent<AppearanceComponent>(buckle.Owner, out var appearanceComponent))
|
||||
appearanceComponent.SetData(StrapVisuals.RotationAngle, _rotation);
|
||||
|
||||
// Update the visuals of the strap object
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<AppearanceComponent>(Owner, out var appearance))
|
||||
|
||||
Reference in New Issue
Block a user