remove a bunch of instances of component reference (#13164)

This commit is contained in:
Nemanja
2022-12-23 23:55:31 -05:00
committed by GitHub
parent 4a37f7b917
commit 6c04811e66
64 changed files with 355 additions and 537 deletions

View File

@@ -1,11 +0,0 @@
using Content.Shared.Buckle.Components;
namespace Content.Client.Buckle;
[RegisterComponent]
[ComponentReference(typeof(SharedBuckleComponent))]
[Access(typeof(BuckleSystem))]
public sealed class BuckleComponent : SharedBuckleComponent
{
public int? OriginalDrawDepth { get; set; }
}

View File

@@ -1,4 +1,3 @@
using Content.Client.Buckle.Strap;
using Content.Client.Rotation;
using Content.Shared.ActionBlocker;
using Content.Shared.Buckle;
@@ -12,15 +11,14 @@ namespace Content.Client.Buckle
internal sealed class BuckleSystem : SharedBuckleSystem
{
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
[Dependency] private readonly AppearanceSystem AppearanceSystem = default!;
[Dependency] private readonly RotationVisualizerSystem RotationVisualizerSystem = default!;
[Dependency] private readonly AppearanceSystem _appearanceSystem = default!;
[Dependency] private readonly RotationVisualizerSystem _rotationVisualizerSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<BuckleComponent, ComponentHandleState>(OnBuckleHandleState);
SubscribeLocalEvent<StrapComponent, ComponentHandleState>(OnStrapHandleState);
SubscribeLocalEvent<BuckleComponent, AppearanceChangeEvent>(OnAppearanceChange);
}
@@ -65,22 +63,10 @@ namespace Content.Client.Buckle
}
}
private void OnStrapHandleState(EntityUid uid, StrapComponent component, ref ComponentHandleState args)
{
if (args.Current is not StrapComponentState state)
return;
component.Position = state.Position;
component.BuckleOffsetUnclamped = state.BuckleOffsetClamped;
component.BuckledEntities.Clear();
component.BuckledEntities.UnionWith(state.BuckledEntities);
component.MaxBuckleDistance = state.MaxBuckleDistance;
}
private void OnAppearanceChange(EntityUid uid, BuckleComponent component, ref AppearanceChangeEvent args)
{
if (!AppearanceSystem.TryGetData<int>(uid, StrapVisuals.RotationAngle, out var angle, args.Component) ||
!AppearanceSystem.TryGetData<bool>(uid, BuckleVisuals.Buckled, out var buckled, args.Component) ||
if (!_appearanceSystem.TryGetData<int>(uid, StrapVisuals.RotationAngle, out var angle, args.Component) ||
!_appearanceSystem.TryGetData<bool>(uid, BuckleVisuals.Buckled, out var buckled, args.Component) ||
!buckled ||
args.Sprite == null)
{
@@ -88,7 +74,7 @@ namespace Content.Client.Buckle
}
// Animate strapping yourself to something at a given angle
RotationVisualizerSystem.AnimateSpriteRotation(args.Sprite, Angle.FromDegrees(angle), 0.125f);
_rotationVisualizerSystem.AnimateSpriteRotation(args.Sprite, Angle.FromDegrees(angle), 0.125f);
}
}
}

View File

@@ -1,10 +0,0 @@
using Content.Shared.Buckle.Components;
namespace Content.Client.Buckle.Strap;
[RegisterComponent]
[ComponentReference(typeof(SharedStrapComponent))]
[Access(typeof(BuckleSystem))]
public sealed class StrapComponent : SharedStrapComponent
{
}

View File

@@ -6,10 +6,3 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
{
//Empty client system for component replication
}
[RegisterComponent]
[ComponentReference(typeof(SharedCartridgeLoaderComponent))]
public sealed class CartridgeLoaderComponent : SharedCartridgeLoaderComponent
{
}

View File

@@ -2,7 +2,7 @@
using System.Text.RegularExpressions;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using static Content.Shared.Configurable.SharedConfigurationComponent;
using static Content.Shared.Configurable.ConfigurationComponent;
namespace Content.Client.Configurable.UI
{

View File

@@ -4,7 +4,7 @@ using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using static Content.Shared.Configurable.SharedConfigurationComponent;
using static Content.Shared.Configurable.ConfigurationComponent;
using static Robust.Client.UserInterface.Controls.BaseButton;
using static Robust.Client.UserInterface.Controls.BoxContainer;

View File

@@ -1,13 +0,0 @@
using Content.Shared.Ensnaring.Components;
namespace Content.Client.Ensnaring.Components;
[RegisterComponent]
[ComponentReference(typeof(SharedEnsnareableComponent))]
public sealed class EnsnareableComponent : SharedEnsnareableComponent
{
[DataField("sprite")]
public string? Sprite;
[DataField("state")]
public string? State;
}

View File

@@ -1,9 +1,3 @@
using Content.Shared.Ensnaring.Components;
namespace Content.Client.Ensnaring.Components;
[RegisterComponent]
[ComponentReference(typeof(SharedEnsnaringComponent))]
public sealed class EnsnaringComponent : SharedEnsnaringComponent
{
}

View File

@@ -1,5 +1,5 @@
using Content.Client.Ensnaring.Components;
using Content.Shared.Ensnaring;
using Content.Shared.Ensnaring.Components;
using Robust.Client.GameObjects;
namespace Content.Client.Ensnaring.Visualizers;

View File

@@ -120,7 +120,7 @@ namespace Content.Client.Inventory
}
// snare-removal button. This is just the old button before the change to item slots. It is pretty out of place.
if (_entMan.TryGetComponent(Owner.Owner, out SharedEnsnareableComponent? snare) && snare.IsEnsnared)
if (_entMan.TryGetComponent(Owner.Owner, out EnsnareableComponent? snare) && snare.IsEnsnared)
{
var button = new Button()
{

View File

@@ -1,9 +0,0 @@
using Content.Client.Movement.Systems;
using Content.Shared.Climbing;
namespace Content.Client.Movement.Components;
[RegisterComponent]
[Access(typeof(ClimbSystem))]
[ComponentReference(typeof(SharedClimbableComponent))]
public sealed class ClimbableComponent : SharedClimbableComponent { }

View File

@@ -1,9 +0,0 @@
using Content.Client.Movement.Systems;
using Content.Shared.Climbing;
namespace Content.Client.Movement.Components;
[RegisterComponent]
[Access(typeof(ClimbSystem))]
[ComponentReference(typeof(SharedClimbingComponent))]
public sealed class ClimbingComponent : SharedClimbingComponent { }

View File

@@ -1,5 +1,4 @@
using Content.Client.Interactable;
using Content.Client.Movement.Components;
using Content.Shared.Climbing;
using Content.Shared.DragDrop;
using Robust.Shared.GameStates;
@@ -18,14 +17,14 @@ public sealed class ClimbSystem : SharedClimbSystem
private static void OnClimbingState(EntityUid uid, ClimbingComponent component, ref ComponentHandleState args)
{
if (args.Current is not SharedClimbingComponent.ClimbModeComponentState climbModeState)
if (args.Current is not ClimbingComponent.ClimbModeComponentState climbModeState)
return;
component.IsClimbing = climbModeState.Climbing;
component.OwnerIsTransitioning = climbModeState.IsTransitioning;
}
protected override void OnCanDragDropOn(EntityUid uid, SharedClimbableComponent component, CanDragDropOnEvent args)
protected override void OnCanDragDropOn(EntityUid uid, ClimbableComponent component, CanDragDropOnEvent args)
{
base.OnCanDragDropOn(uid, component, args);

View File

@@ -1,7 +0,0 @@
using Content.Shared.Singularity.Components;
namespace Content.Client.Singularity.Components;
[RegisterComponent]
[ComponentReference(typeof(SharedContainmentFieldComponent))]
public sealed class ContainmentFieldComponent : SharedContainmentFieldComponent { }

View File

@@ -1,6 +0,0 @@
using Content.Shared.Singularity.Components;
namespace Content.Client.Singularity.Components;
[RegisterComponent]
[ComponentReference(typeof(SharedContainmentFieldGeneratorComponent))]
public sealed class ContainmentFieldGeneratorComponent : SharedContainmentFieldGeneratorComponent { }