Pulling rework (#20906)

* Pulling rework

Fixing up the FOUR systems managing pulling, all the shitcode, and also making it nicer ingame.

* More pulling cleanup

* stats

* More cleanup

* First draft

* More pulling

* weh

* Fix puller

* Pulling working

* Fix merge

* Dunked

* Self-merge time
This commit is contained in:
metalgearsloth
2024-02-03 14:36:09 +11:00
committed by GitHub
parent 79e3a6630d
commit 0d8254b2a2
53 changed files with 764 additions and 1359 deletions

View File

@@ -0,0 +1,39 @@
using Robust.Shared.GameStates;
namespace Content.Shared.Movement.Pulling.Components;
/// <summary>
/// Specifies an entity as being pullable by an entity with <see cref="PullerComponent"/>
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
[Access(typeof(Systems.PullingSystem))]
public sealed partial class PullableComponent : Component
{
/// <summary>
/// The current entity pulling this component.
/// </summary>
[AutoNetworkedField, DataField]
public EntityUid? Puller;
/// <summary>
/// The pull joint.
/// </summary>
[AutoNetworkedField, DataField]
public string? PullJointId;
public bool BeingPulled => Puller != null;
/// <summary>
/// If the physics component has FixedRotation should we keep it upon being pulled
/// </summary>
[Access(typeof(Systems.PullingSystem), Other = AccessPermissions.ReadExecute)]
[ViewVariables(VVAccess.ReadWrite), DataField("fixedRotation")]
public bool FixedRotationOnPull;
/// <summary>
/// What the pullable's fixedrotation was set to before being pulled.
/// </summary>
[Access(typeof(Systems.PullingSystem), Other = AccessPermissions.ReadExecute)]
[AutoNetworkedField, DataField]
public bool PrevFixedRotation;
}

View File

@@ -0,0 +1,41 @@
using Content.Shared.Movement.Pulling.Systems;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Movement.Pulling.Components;
/// <summary>
/// Specifies an entity as being able to pull another entity with <see cref="PullableComponent"/>
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
[Access(typeof(PullingSystem))]
public sealed partial class PullerComponent : Component
{
// My raiding guild
/// <summary>
/// Next time the puller can throw what is being pulled.
/// Used to avoid spamming it for infinite spin + velocity.
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField]
public TimeSpan NextThrow;
[DataField]
public TimeSpan ThrowCooldown = TimeSpan.FromSeconds(1);
// Before changing how this is updated, please see SharedPullerSystem.RefreshMovementSpeed
public float WalkSpeedModifier => Pulling == default ? 1.0f : 0.95f;
public float SprintSpeedModifier => Pulling == default ? 1.0f : 0.95f;
/// <summary>
/// Entity currently being pulled if applicable.
/// </summary>
[AutoNetworkedField, DataField]
public EntityUid? Pulling;
/// <summary>
/// Does this entity need hands to be able to pull something?
/// </summary>
[DataField]
public bool NeedsHands = true;
}