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

@@ -4,15 +4,14 @@ using Robust.Shared.Serialization;
namespace Content.Shared.Buckle.Components;
[NetworkedComponent]
[Access(typeof(SharedBuckleSystem))]
public abstract class SharedBuckleComponent : Component
[RegisterComponent, NetworkedComponent]
public sealed class BuckleComponent : Component
{
/// <summary>
/// The range from which this entity can buckle to a <see cref="SharedStrapComponent"/>.
/// The range from which this entity can buckle to a <see cref="StrapComponent"/>.
/// </summary>
[DataField("range")]
public float Range { get; protected set; } = SharedInteractionSystem.InteractionRange / 1.4f;
public float Range = SharedInteractionSystem.InteractionRange / 1.4f;
/// <summary>
/// True if the entity is buckled, false otherwise.
@@ -22,6 +21,36 @@ public abstract class SharedBuckleComponent : Component
public EntityUid? LastEntityBuckledTo { get; set; }
public bool DontCollide { get; set; }
/// <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;
/// <summary>
/// Used for client rendering
/// </summary>
public int? OriginalDrawDepth { get; set; }
}
[Serializable, NetSerializable]

View File

@@ -1,3 +1,5 @@
using Content.Shared.Alert;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
@@ -21,9 +23,8 @@ public enum StrapPosition
Down
}
[NetworkedComponent]
[Access(typeof(SharedBuckleSystem))]
public abstract class SharedStrapComponent : Component
[RegisterComponent, NetworkedComponent]
public sealed class StrapComponent : Component
{
/// <summary>
/// The change in position to the strapped mob
@@ -58,6 +59,52 @@ public abstract class SharedStrapComponent : Component
[DataField("buckleOffset", required: false)]
[Access(Other = AccessPermissions.ReadWrite)]
public Vector2 BuckleOffsetUnclamped = Vector2.Zero;
/// <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; }
}
[Serializable, NetSerializable]