Jumpability collisions (#39710)

This commit is contained in:
ScarKy0
2025-08-18 14:22:36 +02:00
committed by GitHub
parent 2ecc3b85c4
commit 14f949c311
5 changed files with 126 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ using Content.Shared.Actions;
using Content.Shared.Movement.Systems;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared.Movement.Components;
@@ -13,6 +14,18 @@ namespace Content.Shared.Movement.Components;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(SharedJumpAbilitySystem))]
public sealed partial class JumpAbilityComponent : Component
{
/// <summary>
/// The action prototype that allows you to jump.
/// </summary>
[DataField]
public EntProtoId Action = "ActionGravityJump";
/// <summary>
/// Entity to hold the action prototype.
/// </summary>
[DataField, AutoNetworkedField]
public EntityUid? ActionEntity;
/// <summary>
/// How far you will jump (in tiles).
/// </summary>
@@ -25,11 +38,29 @@ public sealed partial class JumpAbilityComponent : Component
[DataField, AutoNetworkedField]
public float JumpThrowSpeed = 10f;
/// <summary>
/// Whether this entity can collide with another entity, leading to it getting knocked down.
/// </summary>
[DataField, AutoNetworkedField]
public bool CanCollide = false;
/// <summary>
/// The duration of the knockdown in case of a collision from CanCollide.
/// </summary>
[DataField, AutoNetworkedField]
public TimeSpan CollideKnockdown = TimeSpan.FromSeconds(2);
/// <summary>
/// This gets played whenever the jump action is used.
/// </summary>
[DataField, AutoNetworkedField]
public SoundSpecifier? JumpSound;
/// <summary>
/// The popup to show if the entity is unable to perform a jump.
/// </summary>
[DataField, AutoNetworkedField]
public LocId? JumpFailedPopup = "jump-ability-failure";
}
public sealed partial class GravityJumpEvent : InstantActionEvent;