Files
wwdpublic/Content.Shared/Movement/Pulling/Components/PullableComponent.cs
vanx c108c7c617 [Add] Pull Attempt Cooldown (#975)
* no locking

* review

* Update Resources/Locale/en-US/_white/grab/grab.ftl

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: vanx <vanxxxx@discord>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-31 15:42:56 +03:00

113 lines
3.4 KiB
C#

using Content.Shared._Goobstation.TableSlam; // Goobstation - Table SLam
using Content.Shared.Alert;
using Content.Shared.Movement.Pulling.Systems; // Goobstation
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
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), typeof(TableSlamSystem))]
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;
[DataField]
public Dictionary<GrabStage, short> PulledAlertAlertSeverity = new()
{
{ GrabStage.No, 0 },
{ GrabStage.Soft, 1 },
{ GrabStage.Hard, 2 },
{ GrabStage.Suffocate, 3 },
};
// WWDP edit start
[AutoNetworkedField, DataField]
public TimeSpan EscapeAttemptCooldown = TimeSpan.FromSeconds(2); // In seconds
[AutoNetworkedField]
public bool DisplayedCooldownPopup = true;
[AutoNetworkedField, DataField]
public TimeSpan PullAttemptCooldown = TimeSpan.FromSeconds(1.5); // no locking with spam pulls
[AutoNetworkedField, DataField]
public TimeSpan NextPullAttempt = TimeSpan.Zero;
// WWDP edit end
[AutoNetworkedField, DataField]
public GrabStage GrabStage = GrabStage.No;
[AutoNetworkedField, DataField]
public float GrabEscapeChance = 1f;
[AutoNetworkedField]
public TimeSpan NextEscapeAttempt = TimeSpan.Zero;
/// <summary>
/// If this pullable being tabled.
/// </summary>
[DataField, AutoNetworkedField]
public bool BeingTabled = false;
/// <summary>
/// Constant for tabling throw math
/// </summary>
[DataField]
public float BasedTabledForceSpeed = 5f;
/// <summary>
/// Stamina damage. taken on tabled
/// </summary>
[DataField]
public float TabledStaminaDamage = 40f;
/// <summary>
/// Damage taken on being tabled.
/// </summary>
[DataField]
public float TabledDamage = 5f;
// Goobstation end
/// <summary>
/// Whether the entity is currently being actively pushed by the puller.
/// If true, the entity will be able to enter disposals upon colliding with them, and the like.
/// </summary>
[DataField, AutoNetworkedField]
public bool BeingActivelyPushed = false;
[DataField]
public ProtoId<AlertPrototype> PulledAlert = "Pulled";
}
public sealed partial class StopBeingPulledAlertEvent : BaseAlertEvent;