diff --git a/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs b/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs
index 187bff7edc..4a243dd91a 100644
--- a/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs
+++ b/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs
@@ -33,10 +33,10 @@ namespace Content.Server.GameObjects.Components.Buckle
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
- [ComponentDependency] public readonly AppearanceComponent? AppearanceComponent = null;
- [ComponentDependency] private readonly ServerAlertsComponent? _serverAlertsComponent = null;
- [ComponentDependency] private readonly StunnableComponent? _stunnableComponent = null;
- [ComponentDependency] private readonly MobStateComponent? _mobStateComponent = null;
+ [ComponentDependency] public readonly AppearanceComponent? Appearance = null;
+ [ComponentDependency] private readonly ServerAlertsComponent? _serverAlerts = null;
+ [ComponentDependency] private readonly StunnableComponent? _stunnable = null;
+ [ComponentDependency] private readonly MobStateComponent? _mobState = null;
private int _size;
@@ -60,7 +60,6 @@ namespace Content.Server.GameObjects.Components.Buckle
private StrapComponent? _buckledTo;
-
///
/// The strap that this component is buckled to.
///
@@ -92,22 +91,21 @@ namespace Content.Server.GameObjects.Components.Buckle
///
private void UpdateBuckleStatus()
{
- if (_serverAlertsComponent == null)
+ if (_serverAlerts == null)
{
return;
}
if (Buckled)
{
- _serverAlertsComponent.ShowAlert(BuckledTo?.BuckledAlertType ?? AlertType.Buckled);
+ _serverAlerts.ShowAlert(BuckledTo?.BuckledAlertType ?? AlertType.Buckled);
}
else
{
- _serverAlertsComponent.ClearAlertCategory(AlertCategory.Buckled);
+ _serverAlerts.ClearAlertCategory(AlertCategory.Buckled);
}
}
-
///
/// Reattaches this entity to the strap, modifying its position and rotation.
///
@@ -254,7 +252,7 @@ namespace Content.Server.GameObjects.Components.Buckle
return false;
}
- AppearanceComponent?.SetData(BuckleVisuals.Buckled, true);
+ Appearance?.SetData(BuckleVisuals.Buckled, true);
BuckledTo = strap;
LastEntityBuckledTo = BuckledTo.Owner.Uid;
@@ -324,9 +322,9 @@ namespace Content.Server.GameObjects.Components.Buckle
Owner.Transform.WorldRotation = oldBuckledTo.Owner.Transform.WorldRotation;
}
- AppearanceComponent?.SetData(BuckleVisuals.Buckled, false);
+ Appearance?.SetData(BuckleVisuals.Buckled, false);
- if (_stunnableComponent != null && _stunnableComponent.KnockedDown)
+ if (_stunnable != null && _stunnable.KnockedDown)
{
EntitySystem.Get().Down(Owner);
}
@@ -335,7 +333,7 @@ namespace Content.Server.GameObjects.Components.Buckle
EntitySystem.Get().Standing(Owner);
}
- _mobStateComponent?.CurrentState?.EnterState(Owner);
+ _mobState?.CurrentState?.EnterState(Owner);
UpdateBuckleStatus();
@@ -411,7 +409,6 @@ namespace Content.Server.GameObjects.Components.Buckle
drawDepth = BuckledTo.SpriteComponent.DrawDepth - 1;
}
-
return new BuckleComponentState(Buckled, drawDepth, LastEntityBuckledTo, DontCollide);
}
@@ -420,13 +417,12 @@ namespace Content.Server.GameObjects.Components.Buckle
return TryUnbuckle(eventArgs.User);
}
-
public void Update()
{
- if (!DontCollide || Body == null)
+ if (!DontCollide || Physics == null)
return;
- Body.WakeBody();
+ Physics.WakeBody();
if (!IsOnStrapEntityThisFrame && DontCollide)
{
diff --git a/Content.Server/GameObjects/Components/Strap/StrapComponent.cs b/Content.Server/GameObjects/Components/Strap/StrapComponent.cs
index c34e009225..ec84e9a200 100644
--- a/Content.Server/GameObjects/Components/Strap/StrapComponent.cs
+++ b/Content.Server/GameObjects/Components/Strap/StrapComponent.cs
@@ -108,7 +108,7 @@ namespace Content.Server.GameObjects.Components.Strap
_occupiedSize += buckle.Size;
- buckle.AppearanceComponent?.SetData(StrapVisuals.RotationAngle, _rotation);
+ buckle.Appearance?.SetData(StrapVisuals.RotationAngle, _rotation);
SendMessage(new StrapMessage(buckle.Owner, Owner));
diff --git a/Content.Shared/GameObjects/Components/Buckle/SharedBuckleComponent.cs b/Content.Shared/GameObjects/Components/Buckle/SharedBuckleComponent.cs
index 7cd82a0642..6da93700c7 100644
--- a/Content.Shared/GameObjects/Components/Buckle/SharedBuckleComponent.cs
+++ b/Content.Shared/GameObjects/Components/Buckle/SharedBuckleComponent.cs
@@ -17,8 +17,11 @@ namespace Content.Shared.GameObjects.Components.Buckle
public sealed override string Name => "Buckle";
public sealed override uint? NetID => ContentNetIDs.BUCKLE;
+
+ [ComponentDependency] protected readonly IPhysicsComponent? Physics;
+
///
- /// The range from which this entity can buckle to a .
+ /// The range from which this entity can buckle to a .
///
[ViewVariables]
public float Range { get; protected set; }
@@ -26,20 +29,22 @@ namespace Content.Shared.GameObjects.Components.Buckle
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
- serializer.DataReadWriteFunction("range", SharedInteractionSystem.InteractionRange / 1.4f, value => Range = value, () => Range);
+
+ serializer.DataField(this, x => x.Range, "range", SharedInteractionSystem.InteractionRange / 1.4f);
}
///
/// True if the entity is buckled, false otherwise.
///
public abstract bool Buckled { get; }
+
public EntityUid? LastEntityBuckledTo { get; set; }
public bool IsOnStrapEntityThisFrame { get; set; }
- public bool DontCollide { get; set; }
- public abstract bool TryBuckle(IEntity user, IEntity to);
- [ComponentDependency] protected IPhysicsComponent? Body;
+ public bool DontCollide { get; set; }
+
+ public abstract bool TryBuckle(IEntity user, IEntity to);
bool ICollideSpecial.PreventCollide(IPhysBody collidedwith)
{
@@ -56,11 +61,6 @@ namespace Content.Shared.GameObjects.Components.Buckle
{
return !Buckled;
}
- public override void Initialize()
- {
- base.Initialize();
- Owner.TryGetComponent(out Body);
- }
bool IActionBlocker.CanChangeDirection()
{