Climbing refactor (#20516)
This commit is contained in:
46
Content.Shared/Climbing/Components/BonkableComponent.cs
Normal file
46
Content.Shared/Climbing/Components/BonkableComponent.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using Content.Shared.Damage;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Climbing.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Makes entity do damage and stun entities with ClumsyComponent
|
||||
/// upon DragDrop or Climb interactions.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, Access(typeof(Systems.BonkSystem))]
|
||||
public sealed partial class BonkableComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Chance of bonk triggering if the user is clumsy.
|
||||
/// </summary>
|
||||
[DataField("bonkClumsyChance")]
|
||||
public float BonkClumsyChance = 0.75f;
|
||||
|
||||
/// <summary>
|
||||
/// Sound to play when bonking.
|
||||
/// </summary>
|
||||
/// <seealso cref="Bonk"/>
|
||||
[DataField("bonkSound")]
|
||||
public SoundSpecifier? BonkSound;
|
||||
|
||||
/// <summary>
|
||||
/// How long to stun players on bonk, in seconds.
|
||||
/// </summary>
|
||||
/// <seealso cref="Bonk"/>
|
||||
[DataField("bonkTime")]
|
||||
public float BonkTime = 2;
|
||||
|
||||
/// <summary>
|
||||
/// How much damage to apply on bonk.
|
||||
/// </summary>
|
||||
/// <seealso cref="Bonk"/>
|
||||
[DataField("bonkDamage")]
|
||||
public DamageSpecifier? BonkDamage;
|
||||
|
||||
/// <summary>
|
||||
/// How long it takes to bonk.
|
||||
/// </summary>
|
||||
[DataField("bonkDelay")]
|
||||
public float BonkDelay = 0.8f;
|
||||
}
|
||||
36
Content.Shared/Climbing/Components/ClimbableComponent.cs
Normal file
36
Content.Shared/Climbing/Components/ClimbableComponent.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Content.Shared.Interaction;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Climbing.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates this entity can be vaulted on top of.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class ClimbableComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The range from which this entity can be climbed.
|
||||
/// </summary>
|
||||
[DataField("range")] public float Range = SharedInteractionSystem.InteractionRange / 1.4f;
|
||||
|
||||
/// <summary>
|
||||
/// The time it takes to climb onto the entity.
|
||||
/// </summary>
|
||||
[DataField("delay")]
|
||||
public float ClimbDelay = 1.5f;
|
||||
|
||||
/// <summary>
|
||||
/// Sound to be played when a climb is started.
|
||||
/// </summary>
|
||||
[DataField("startClimbSound")]
|
||||
public SoundSpecifier? StartClimbSound = null;
|
||||
|
||||
/// <summary>
|
||||
/// Sound to be played when a climb finishes.
|
||||
/// </summary>
|
||||
[DataField("finishClimbSound")]
|
||||
public SoundSpecifier? FinishClimbSound = null;
|
||||
}
|
||||
}
|
||||
36
Content.Shared/Climbing/Components/ClimbingComponent.cs
Normal file
36
Content.Shared/Climbing/Components/ClimbingComponent.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Numerics;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||
|
||||
namespace Content.Shared.Climbing.Components;
|
||||
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class ClimbingComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether the owner is climbing on a climbable entity.
|
||||
/// </summary>
|
||||
[AutoNetworkedField, DataField]
|
||||
public bool IsClimbing;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the owner is being moved onto the climbed entity.
|
||||
/// </summary>
|
||||
[AutoNetworkedField, DataField(customTypeSerializer:typeof(TimeOffsetSerializer))]
|
||||
public TimeSpan? NextTransition;
|
||||
|
||||
/// <summary>
|
||||
/// Direction to move when transition.
|
||||
/// </summary>
|
||||
[AutoNetworkedField, DataField]
|
||||
public Vector2 Direction;
|
||||
|
||||
/// <summary>
|
||||
/// How fast the entity is moved when climbing.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float TransitionRate = 5f;
|
||||
|
||||
[AutoNetworkedField, DataField]
|
||||
public Dictionary<string, int> DisabledFixtureMasks = new();
|
||||
}
|
||||
35
Content.Shared/Climbing/Components/GlassTableComponent.cs
Normal file
35
Content.Shared/Climbing/Components/GlassTableComponent.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Content.Shared.Damage;
|
||||
|
||||
namespace Content.Shared.Climbing.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Glass tables shatter and stun you when climbed on.
|
||||
/// This is a really entity-specific behavior, so opted to make it
|
||||
/// not very generalized with regards to naming.
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(Systems.ClimbSystem))]
|
||||
public sealed partial class GlassTableComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// How much damage should be given to the climber?
|
||||
/// </summary>
|
||||
[DataField("climberDamage")]
|
||||
public DamageSpecifier ClimberDamage = default!;
|
||||
|
||||
/// <summary>
|
||||
/// How much damage should be given to the table when climbed on?
|
||||
/// </summary>
|
||||
[DataField("tableDamage")]
|
||||
public DamageSpecifier TableDamage = default!;
|
||||
|
||||
/// <summary>
|
||||
/// How much mass should be needed to break the table?
|
||||
/// </summary>
|
||||
[DataField("tableMassLimit")]
|
||||
public float MassLimit;
|
||||
|
||||
/// <summary>
|
||||
/// How long should someone who climbs on this table be stunned for?
|
||||
/// </summary>
|
||||
public float StunTime = 2.0f;
|
||||
}
|
||||
Reference in New Issue
Block a user