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

@@ -1,57 +0,0 @@
using Robust.Shared.GameStates;
using Robust.Shared.Map;
using Robust.Shared.Serialization;
namespace Content.Shared.Pulling.Components
{
// Before you try to add another type than SharedPullingStateManagementSystem, consider the can of worms you may be opening!
[NetworkedComponent, AutoGenerateComponentState]
[Access(typeof(SharedPullingStateManagementSystem))]
[RegisterComponent]
public sealed partial class SharedPullableComponent : Component
{
/// <summary>
/// The current entity pulling this component.
/// </summary>
[DataField, AutoNetworkedField]
public EntityUid? Puller { get; set; }
/// <summary>
/// The pull joint.
/// </summary>
[DataField, AutoNetworkedField]
public string? PullJointId { get; set; }
public bool BeingPulled => Puller != null;
[Access(typeof(SharedPullingStateManagementSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
public EntityCoordinates? MovingTo { get; set; }
/// <summary>
/// If the physics component has FixedRotation should we keep it upon being pulled
/// </summary>
[Access(typeof(SharedPullingSystem), Other = AccessPermissions.ReadExecute)]
[ViewVariables(VVAccess.ReadWrite), DataField("fixedRotation")]
public bool FixedRotationOnPull { get; set; }
/// <summary>
/// What the pullable's fixedrotation was set to before being pulled.
/// </summary>
[Access(typeof(SharedPullingSystem), Other = AccessPermissions.ReadExecute)]
[ViewVariables]
public bool PrevFixedRotation;
}
/// <summary>
/// Raised when a request is made to stop pulling an entity.
/// </summary>
public sealed class StopPullingEvent : CancellableEntityEventArgs
{
public EntityUid? User { get; }
public StopPullingEvent(EntityUid? uid = null)
{
User = uid;
}
}
}

View File

@@ -1,23 +0,0 @@
using Robust.Shared.GameStates;
namespace Content.Shared.Pulling.Components
{
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
[Access(typeof(SharedPullingStateManagementSystem))]
public sealed partial class SharedPullerComponent : Component
{
// 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;
[DataField, AutoNetworkedField]
public EntityUid? Pulling { get; set; }
/// <summary>
/// Does this entity need hands to be able to pull something?
/// </summary>
[DataField("needsHands")]
public bool NeedsHands = true;
}
}