Skip to content

Commit

Permalink
feat(traits): add new trait Parkour Training
Browse files Browse the repository at this point in the history
  • Loading branch information
angelofallars committed Aug 4, 2024
1 parent 62045ff commit 4370e29
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 1 deletion.
22 changes: 22 additions & 0 deletions Content.Server/Traits/Assorted/LayingDownModifierComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Robust.Shared.GameStates;

namespace Content.Server.Traits.Assorted;

/// <summary>
/// This is used for traits that modify values related to the Laying Down system.
/// </summary>
[RegisterComponent]
public sealed partial class LayingDownModifierComponent : Component
{
/// <summary>
/// What to multiply the cooldown of laying down and standing up by.
/// </summary>
[DataField]
public float LayingDownCooldownMultiplier = 1f;

/// <summary>
/// What to multiply the speed multiplier when lying down by.
/// </summary>
[DataField]
public float DownedSpeedMultiplierMultiplier = 1f;
}
24 changes: 24 additions & 0 deletions Content.Server/Traits/Assorted/LayingDownModifierSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Content.Server.Traits.Assorted;
using Content.Server.Standing;

namespace Content.Shared.Traits.Assorted.Systems;

public sealed class LayingDownModifierSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<LayingDownModifierComponent, ComponentStartup>(OnStartup);
}

private void OnStartup(EntityUid uid, LayingDownModifierComponent component, ComponentStartup args)
{
if (!TryComp<LayingDownComponent>(uid, out var layingDown))
return;

Log.Debug("Got to on startup");

layingDown.Cooldown *= component.LayingDownCooldownMultiplier;
layingDown.DownedSpeedMultiplier *= component.DownedSpeedMultiplierMultiplier;
}
}
7 changes: 6 additions & 1 deletion Content.Shared/Climbing/Systems/ClimbSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Content.Shared.Physics;
using Content.Shared.Popups;
using Content.Shared.Stunnable;
using Content.Shared.Traits.Assorted.Components;
using Content.Shared.Verbs;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Physics;
Expand Down Expand Up @@ -216,7 +217,11 @@ public bool TryClimb(
if (ev.Cancelled)
return false;

var args = new DoAfterArgs(EntityManager, user, comp.ClimbDelay, new ClimbDoAfterEvent(),
var climbDelay = comp.ClimbDelay;
if (user == entityToMove && TryComp<ClimbDelayModifierComponent>(user, out var delayModifier))
climbDelay *= delayModifier.ClimbDelayMultiplier;

var args = new DoAfterArgs(EntityManager, user, climbDelay, new ClimbDoAfterEvent(),
entityToMove,
target: climbable,
used: entityToMove)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Robust.Shared.GameStates;

namespace Content.Shared.Traits.Assorted.Components;

/// <summary>
/// This is used for any trait that modifies climbing speed.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class ClimbDelayModifierComponent : Component
{
/// <summary>
/// What to multiply the climbing delay by.
/// </summary>
[DataField, AutoNetworkedField]
public float ClimbDelayMultiplier = 1f;
}
7 changes: 7 additions & 0 deletions Resources/Locale/en-US/traits/traits.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,10 @@ trait-name-Foreigner = Foreigner
trait-description-Foreigner =
For one reason or another you do not speak this station's primary language.
Instead, you have a translator issued to you that only you can use.
trait-name-ParkourTraining = Parkour Training
trait-description-ParkourTraining =
Whether as a hobby, lifestyle, or professional training, you are trained in the discipline of parkour.
You climb 25% faster over tables, railings, fences and other similar structures.
You crawl 25% faster.
You can lie down and stand up in succession 10% faster.
11 changes: 11 additions & 0 deletions Resources/Prototypes/Traits/skills.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,14 @@
inverted: true
species:
- Felinid

- type: trait
id: ParkourTraining
category: Physical
points: -3
components:
- type: ClimbDelayModifier
climbDelayMultiplier: 0.75
- type: LayingDownModifier
layingDownCooldownMultiplier: 0.8
downedSpeedMultiplierMultiplier: 1.25

0 comments on commit 4370e29

Please sign in to comment.