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

@@ -14,6 +14,7 @@ using Content.Server.Prayer;
using Content.Server.Xenoarchaeology.XenoArtifacts;
using Content.Server.Xenoarchaeology.XenoArtifacts.Triggers.Components;
using Content.Shared.Administration;
using Content.Shared.Configurable;
using Content.Shared.Database;
using Content.Shared.GameTicking;
using Content.Shared.Interaction.Helpers;
@@ -27,7 +28,7 @@ using Robust.Shared.Console;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using static Content.Shared.Configurable.SharedConfigurationComponent;
using static Content.Shared.Configurable.ConfigurationComponent;
namespace Content.Server.Administration.Systems
{

View File

@@ -1,6 +1,6 @@
using Content.Server.Ensnaring;
using Content.Server.Ensnaring.Components;
using Content.Shared.Alert;
using Content.Shared.Ensnaring.Components;
using JetBrains.Annotations;
namespace Content.Server.Alert.Click;

View File

@@ -2,7 +2,6 @@ using Content.Server.Actions;
using Content.Server.Bed.Components;
using Content.Server.Bed.Sleep;
using Content.Server.Body.Systems;
using Content.Server.Buckle.Components;
using Content.Server.MobState;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;

View File

@@ -1,38 +0,0 @@
using Content.Server.Buckle.Systems;
using Content.Shared.Buckle.Components;
namespace Content.Server.Buckle.Components;
/// <summary>
/// Component that handles sitting entities into <see cref="StrapComponent"/>s.
/// </summary>
[RegisterComponent]
[ComponentReference(typeof(SharedBuckleComponent))]
[Access(typeof(BuckleSystem))]
public sealed class BuckleComponent : SharedBuckleComponent
{
/// <summary>
/// The amount of time that must pass for this entity to
/// be able to unbuckle after recently buckling.
/// </summary>
[DataField("delay")]
public TimeSpan UnbuckleDelay = TimeSpan.FromSeconds(0.25f);
/// <summary>
/// The time that this entity buckled at.
/// </summary>
[ViewVariables] public TimeSpan BuckleTime;
/// <summary>
/// The strap that this component is buckled to.
/// </summary>
[ViewVariables]
public StrapComponent? BuckledTo { get; set; }
/// <summary>
/// The amount of space that this entity occupies in a
/// <see cref="StrapComponent"/>.
/// </summary>
[DataField("size")]
public int Size = 100;
}

View File

@@ -1,57 +0,0 @@
using Content.Server.Buckle.Systems;
using Content.Shared.Alert;
using Content.Shared.Buckle.Components;
using Robust.Shared.Audio;
namespace Content.Server.Buckle.Components;
[RegisterComponent]
[ComponentReference(typeof(SharedStrapComponent))]
[Access(typeof(BuckleSystem))]
public sealed class StrapComponent : SharedStrapComponent
{
/// <summary>
/// The angle in degrees to rotate the player by when they get strapped
/// </summary>
[DataField("rotation")]
public int Rotation { get; set; }
/// <summary>
/// The size of the strap which is compared against when buckling entities
/// </summary>
[DataField("size")]
public int Size { get; set; } = 100;
/// <summary>
/// If disabled, nothing can be buckled on this object, and it will unbuckle anything that's already buckled
/// </summary>
public bool Enabled { get; set; } = true;
/// <summary>
/// You can specify the offset the entity will have after unbuckling.
/// </summary>
[DataField("unbuckleOffset", required: false)]
public Vector2 UnbuckleOffset = Vector2.Zero;
/// <summary>
/// The sound to be played when a mob is buckled
/// </summary>
[DataField("buckleSound")]
public SoundSpecifier BuckleSound { get; } = new SoundPathSpecifier("/Audio/Effects/buckle.ogg");
/// <summary>
/// The sound to be played when a mob is unbuckled
/// </summary>
[DataField("unbuckleSound")]
public SoundSpecifier UnbuckleSound { get; } = new SoundPathSpecifier("/Audio/Effects/unbuckle.ogg");
/// <summary>
/// ID of the alert to show when buckled
/// </summary>
[DataField("buckledAlertType")]
public AlertType BuckledAlertType { get; } = AlertType.Buckled;
/// <summary>
/// The sum of the sizes of all the buckled entities in this strap
/// </summary>
public int OccupiedSize { get; set; }
}

View File

@@ -1,5 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using Content.Server.Buckle.Components;
using Content.Server.Storage.Components;
using Content.Shared.Alert;
using Content.Shared.Bed.Sleep;
@@ -14,7 +13,6 @@ using Content.Shared.Stunnable;
using Content.Shared.Vehicle.Components;
using Content.Shared.Verbs;
using Robust.Shared.GameStates;
using Robust.Shared.Player;
namespace Content.Server.Buckle.Systems;

View File

@@ -1,5 +1,4 @@
using System.Linq;
using Content.Server.Buckle.Components;
using Content.Server.Construction.Completions;
using Content.Shared.Buckle.Components;
using Content.Shared.Destructible;

View File

@@ -1,18 +0,0 @@
using Content.Shared.CartridgeLoader;
using Robust.Shared.Serialization.TypeSerializers.Implementations;
namespace Content.Server.CartridgeLoader;
[RegisterComponent]
[ComponentReference(typeof(SharedCartridgeLoaderComponent))]
public sealed class CartridgeLoaderComponent : SharedCartridgeLoaderComponent
{
/// <summary>
/// The maximum amount of programs that can be installed on the cartridge loader entity
/// </summary>
[DataField("diskSpace")]
public int DiskSpace = 5;
[DataField("uiKey", readOnly: true, required: true, customTypeSerializer: typeof(EnumSerializer))]
public Enum UiKey = default!;
}

View File

@@ -241,13 +241,13 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
loader.BackgroundPrograms.Remove(cartridgeUid);
}
protected override void OnItemInserted(EntityUid uid, SharedCartridgeLoaderComponent loader, EntInsertedIntoContainerMessage args)
protected override void OnItemInserted(EntityUid uid, Shared.CartridgeLoader.CartridgeLoaderComponent loader, EntInsertedIntoContainerMessage args)
{
RaiseLocalEvent(args.Entity, new CartridgeAddedEvent(uid));
base.OnItemInserted(uid, loader, args);
}
protected override void OnItemRemoved(EntityUid uid, SharedCartridgeLoaderComponent loader, EntRemovedFromContainerMessage args)
protected override void OnItemRemoved(EntityUid uid, Shared.CartridgeLoader.CartridgeLoaderComponent loader, EntRemovedFromContainerMessage args)
{
var deactivate = loader.BackgroundPrograms.Remove(args.Entity);

View File

@@ -66,7 +66,7 @@ public sealed class ClimbSystem : SharedClimbSystem
SubscribeLocalEvent<GlassTableComponent, ClimbedOnEvent>(OnGlassClimbed);
}
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);
@@ -166,6 +166,7 @@ public sealed class ClimbSystem : SharedClimbSystem
return;
climbing.IsClimbing = true;
Dirty(climbing);
MoveEntityToward(uid, climbable, physics, climbing);
// we may potentially need additional logic since we're forcing a player onto a climbable
@@ -265,6 +266,7 @@ public sealed class ClimbSystem : SharedClimbSystem
climbing.IsClimbing = false;
climbing.OwnerIsTransitioning = false;
Dirty(climbing);
}
/// <summary>
@@ -275,7 +277,7 @@ public sealed class ClimbSystem : SharedClimbSystem
/// <param name="target">The object that is being vaulted</param>
/// <param name="reason">The reason why it cant be dropped</param>
/// <returns></returns>
private bool CanVault(SharedClimbableComponent component, EntityUid user, EntityUid target, out string reason)
private bool CanVault(ClimbableComponent component, EntityUid user, EntityUid target, out string reason)
{
if (!_actionBlockerSystem.CanInteract(user, target))
{
@@ -311,7 +313,7 @@ public sealed class ClimbSystem : SharedClimbSystem
/// <param name="target">The object that is being vaulted onto</param>
/// <param name="reason">The reason why it cant be dropped</param>
/// <returns></returns>
private bool CanVault(SharedClimbableComponent component, EntityUid user, EntityUid dragged, EntityUid target,
private bool CanVault(ClimbableComponent component, EntityUid user, EntityUid dragged, EntityUid target,
out string reason)
{
if (!_actionBlockerSystem.CanInteract(user, dragged) || !_actionBlockerSystem.CanInteract(user, target))
@@ -353,7 +355,7 @@ public sealed class ClimbSystem : SharedClimbSystem
private static void OnClimbingGetState(EntityUid uid, ClimbingComponent component, ref ComponentGetState args)
{
args.State = new SharedClimbingComponent.ClimbModeComponentState(component.IsClimbing, component.OwnerIsTransitioning);
args.State = new ClimbingComponent.ClimbModeComponentState(component.IsClimbing, component.OwnerIsTransitioning);
}
private void OnGlassClimbed(EntityUid uid, GlassTableComponent component, ClimbedOnEvent args)
@@ -401,7 +403,7 @@ public sealed class ClimbSystem : SharedClimbSystem
_actionBlockerSystem.UpdateCanMove(uid);
// Transition back to KinematicController after BufferTime
climbing.Owner.SpawnTimer((int) (SharedClimbingComponent.BufferTime * 1000), () =>
climbing.Owner.SpawnTimer((int) (ClimbingComponent.BufferTime * 1000), () =>
{
if (climbing.Deleted) return;
physics.BodyType = BodyType.KinematicController;

View File

@@ -1,49 +0,0 @@
using Content.Shared.CCVar;
using Content.Shared.Climbing;
using Content.Shared.Damage;
using Robust.Shared.Audio;
namespace Content.Server.Climbing.Components;
[RegisterComponent]
[ComponentReference(typeof(SharedClimbableComponent))]
public sealed class ClimbableComponent : SharedClimbableComponent
{
/// <summary>
/// The time it takes to climb onto the entity.
/// </summary>
[DataField("delay")]
public float ClimbDelay = 0.8f;
/// <summary>
/// If set, people can bonk on this if <see cref="CCVars.GameTableBonk"/> is set or if they are clumsy.
/// </summary>
[DataField("bonk")] public bool Bonk = false;
/// <summary>
/// Chance of bonk triggering if the user is clumsy.
/// </summary>
[DataField("bonkClumsyChance")]
public float BonkClumsyChance = 0.75f;
/// <summary>
/// Sound to play when bonking.
/// </summary>
/// <seealso cref="Bonk"/>
[DataField("bonkSound")]
public SoundSpecifier? BonkSound;
/// <summary>
/// How long to stun players on bonk, in seconds.
/// </summary>
/// <seealso cref="Bonk"/>
[DataField("bonkTime")]
public float BonkTime = 2;
/// <summary>
/// How much damage to apply on bonk.
/// </summary>
/// <seealso cref="Bonk"/>
[DataField("bonkDamage")]
public DamageSpecifier? BonkDamage;
}

View File

@@ -1,35 +0,0 @@
using Content.Shared.Climbing;
namespace Content.Server.Climbing.Components;
[RegisterComponent]
[ComponentReference(typeof(SharedClimbingComponent))]
[Access(typeof(ClimbSystem))]
public sealed class ClimbingComponent : SharedClimbingComponent
{
[ViewVariables(VVAccess.ReadWrite)]
public override bool IsClimbing
{
get => base.IsClimbing;
set
{
if (base.IsClimbing == value) return;
base.IsClimbing = value;
Dirty();
}
}
public override bool OwnerIsTransitioning
{
get => base.OwnerIsTransitioning;
set
{
if (value == base.OwnerIsTransitioning) return;
base.OwnerIsTransitioning = value;
Dirty();
}
}
[ViewVariables]
public Dictionary<string, int> DisabledFixtureMasks { get; } = new();
}

View File

@@ -1,16 +0,0 @@
using Content.Shared.Configurable;
using Content.Shared.Tools;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Configurable;
[RegisterComponent]
[ComponentReference(typeof(SharedConfigurationComponent))]
public sealed class ConfigurationComponent : SharedConfigurationComponent
{
[DataField("config")]
public readonly Dictionary<string, string> Config = new();
[DataField("qualityNeeded", customTypeSerializer: typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
public string QualityNeeded = "Pulsing";
}

View File

@@ -1,8 +1,9 @@
using Content.Shared.Configurable;
using Content.Shared.Interaction;
using Content.Shared.Tools.Components;
using Robust.Server.GameObjects;
using Robust.Shared.Containers;
using static Content.Shared.Configurable.SharedConfigurationComponent;
using static Content.Shared.Configurable.ConfigurationComponent;
namespace Content.Server.Configurable;

View File

@@ -1,6 +1,6 @@
using Content.Server.Bed.Components;
using Content.Server.Buckle.Components;
using Content.Shared.Bed.Sleep;
using Content.Shared.Buckle.Components;
using Content.Shared.Disease;
namespace Content.Server.Disease.Cures

View File

@@ -1,13 +0,0 @@
using Content.Shared.Ensnaring.Components;
using Robust.Shared.Containers;
namespace Content.Server.Ensnaring.Components;
[RegisterComponent]
[ComponentReference(typeof(SharedEnsnareableComponent))]
public sealed class EnsnareableComponent : SharedEnsnareableComponent
{
/// <summary>
/// The container where the <see cref="EnsnaringComponent"/> entity will be stored
/// </summary>
public Container Container = default!;
}

View File

@@ -1,43 +1,5 @@
using System.Threading;
using Content.Shared.Ensnaring.Components;
namespace Content.Server.Ensnaring.Components;
[RegisterComponent]
[ComponentReference(typeof(SharedEnsnaringComponent))]
public sealed class EnsnaringComponent : SharedEnsnaringComponent
{
/// <summary>
/// Should movement cancel breaking out?
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("canMoveBreakout")]
public bool CanMoveBreakout;
public CancellationTokenSource? CancelToken;
}
/// <summary>
/// Used for the do after event to free the entity that owns the <see cref="EnsnareableComponent"/>
/// </summary>
public sealed class FreeEnsnareDoAfterComplete : EntityEventArgs
{
public readonly EntityUid EnsnaringEntity;
public FreeEnsnareDoAfterComplete(EntityUid ensnaringEntity)
{
EnsnaringEntity = ensnaringEntity;
}
}
/// <summary>
/// Used for the do after event when it fails to free the entity that owns the <see cref="EnsnareableComponent"/>
/// </summary>
public sealed class FreeEnsnareDoAfterCancel : EntityEventArgs
{
public readonly EntityUid EnsnaringEntity;
public FreeEnsnareDoAfterCancel(EntityUid ensnaringEntity)
{
EnsnaringEntity = ensnaringEntity;
}
}

View File

@@ -1,12 +1,10 @@
using System.Threading;
using Content.Server.DoAfter;
using Content.Server.Ensnaring.Components;
using Content.Shared.Alert;
using Content.Shared.Ensnaring.Components;
using Content.Shared.IdentityManagement;
using Content.Shared.StepTrigger.Systems;
using Content.Shared.Throwing;
using Robust.Shared.Player;
namespace Content.Server.Ensnaring;

View File

@@ -1,11 +1,9 @@
using Content.Server.Ensnaring.Components;
using Content.Server.Popups;
using Content.Shared.Ensnaring;
using Content.Shared.Ensnaring.Components;
using Content.Shared.Popups;
using Robust.Server.Containers;
using Robust.Shared.Containers;
using Robust.Shared.Player;
namespace Content.Server.Ensnaring;

View File

@@ -1,7 +1,7 @@
using System.Linq;
using Content.Server.Buckle.Components;
using Content.Server.Buckle.Systems;
using Content.Server.Storage.Components;
using Content.Shared.Buckle.Components;
using Content.Shared.Foldable;
using Content.Shared.Verbs;
using JetBrains.Annotations;

View File

@@ -1,4 +1,3 @@
using Content.Server.Buckle.Components;
using Content.Server.Doors.Components;
using Content.Server.Doors.Systems;
using Content.Server.Shuttles.Components;
@@ -14,7 +13,7 @@ using Robust.Shared.Player;
using Robust.Shared.Utility;
using System.Diagnostics.CodeAnalysis;
using Content.Server.Shuttles.Events;
using Content.Server.Station.Components;
using Content.Shared.Buckle.Components;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Components;

View File

@@ -1,22 +0,0 @@
using Content.Shared.Singularity.Components;
namespace Content.Server.Singularity.Components;
[RegisterComponent]
[ComponentReference(typeof(SharedContainmentFieldComponent))]
public sealed class ContainmentFieldComponent : SharedContainmentFieldComponent
{
/// <summary>
/// The throw force for the field if an entity collides with it
/// The lighter the mass the further it will throw. 5 mass will go about 4 tiles out, 70 mass goes only a couple tiles.
/// </summary>
[DataField("throwForce")]
public float ThrowForce = 100f;
/// <summary>
/// This shouldn't be at 99999 or higher to prevent the singulo glitching out
/// Will throw anything at the supplied mass or less that collides with the field.
/// </summary>
[DataField("maxMass")]
public float MaxMass = 10000f;
}

View File

@@ -1,102 +0,0 @@
using Content.Shared.Physics;
using Content.Shared.Singularity.Components;
using Content.Shared.Tag;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Singularity.Components;
[RegisterComponent]
[ComponentReference(typeof(SharedContainmentFieldGeneratorComponent))]
public sealed class ContainmentFieldGeneratorComponent : SharedContainmentFieldGeneratorComponent
{
private int _powerBuffer;
/// <summary>
/// Store power with a cap. Decrease over time if not being powered from source.
/// </summary>
[DataField("powerBuffer")]
public int PowerBuffer
{
get => _powerBuffer;
set => _powerBuffer = Math.Clamp(value, 0, 25); //have this decrease over time if not hit by a bolt
}
/// <summary>
/// The minimum the field generator needs to start generating a connection
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("powerMinimum")]
public int PowerMinimum = 6;
/// <summary>
/// How much power should this field generator receive from a collision
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("power")]
public int PowerReceived = 3;
/// <summary>
/// How much power should this field generator lose if not powered?
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("powerLoss")]
public int PowerLoss = 2;
/// <summary>
/// Used to check if it's received power recently.
/// </summary>
[DataField("accumulator")]
public float Accumulator;
/// <summary>
/// How many seconds should the generators wait before losing power?
/// </summary>
[DataField("threshold")]
public float Threshold = 10f;
/// <summary>
/// How many tiles should this field check before giving up?
/// </summary>
[DataField("maxLength")]
public float MaxLength = 8F;
/// <summary>
/// What collision should power this generator?
/// It really shouldn't be anything but an emitter bolt but it's here for fun.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("idTag", customTypeSerializer: typeof(PrototypeIdSerializer<TagPrototype>))]
public string IDTag = "EmitterBolt";
/// <summary>
/// Is the generator toggled on?
/// </summary>
[ViewVariables]
public bool Enabled;
/// <summary>
/// Is this generator connected to fields?
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public bool IsConnected;
/// <summary>
/// The masks the raycast should not go through
/// </summary>
[DataField("collisionMask")]
public int CollisionMask = (int) (CollisionGroup.MobMask | CollisionGroup.Impassable | CollisionGroup.MachineMask | CollisionGroup.Opaque);
/// <summary>
/// A collection of connections that the generator has based on direction.
/// Stores a list of fields connected between generators in this direction.
/// </summary>
[ViewVariables]
public Dictionary<Direction, (ContainmentFieldGeneratorComponent, List<EntityUid>)> Connections = new();
/// <summary>
/// What fields should this spawn?
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("createdField", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string CreatedField = "ContainmentField";
}

View File

@@ -1,20 +1,15 @@
using Content.Server.Singularity.Components;
using Content.Server.Singularity.Events;
using Content.Shared.Singularity.Components;
using Content.Shared.Tag;
using Robust.Server.GameObjects;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Dynamics;
using System.Linq;
using Content.Server.Popups;
using Content.Shared.Construction.Components;
using Content.Shared.Examine;
using Content.Shared.Interaction;
using Content.Shared.Popups;
using Content.Shared.Throwing;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Events;
using Robust.Shared.Player;
namespace Content.Server.Singularity.EntitySystems;

View File

@@ -1,13 +1,11 @@
using Content.Server.Popups;
using Content.Server.Shuttles.Components;
using Content.Server.Singularity.Components;
using Content.Server.Singularity.EntitySystems;
using Content.Server.Singularity.Events;
using Content.Shared.Popups;
using Content.Shared.Singularity.Components;
using Content.Shared.Throwing;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Events;
using Robust.Shared.Player;
namespace Content.Server.Singularity.EntitySystems;

View File

@@ -1,7 +1,6 @@
using Content.Server.Cuffs.Components;
using Content.Server.DoAfter;
using Content.Server.Ensnaring;
using Content.Server.Ensnaring.Components;
using Content.Server.Hands.Components;
using Content.Shared.CombatMode;
using Content.Shared.Hands.Components;
@@ -13,10 +12,10 @@ using Content.Shared.Popups;
using Content.Shared.Strip.Components;
using Content.Shared.Verbs;
using Robust.Server.GameObjects;
using Robust.Shared.Player;
using System.Threading;
using Content.Server.Administration.Logs;
using Content.Shared.Database;
using Content.Shared.Ensnaring.Components;
namespace Content.Server.Strip
{

View File

@@ -1,5 +1,4 @@
using Content.Server.Body.Systems;
using Content.Server.Buckle.Components;
using Content.Server.Buckle.Systems;
using Content.Server.Popups;
using Content.Server.Storage.Components;
@@ -7,6 +6,7 @@ using Content.Server.Storage.EntitySystems;
using Content.Server.Tools;
using Content.Shared.Body.Components;
using Content.Shared.Body.Part;
using Content.Shared.Buckle.Components;
using Content.Shared.Examine;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;