Files
tbd-station-14/Content.Shared/Traits/Assorted/MobilityAidSystem.cs
Mora cd0cc72157 Impaired Mobility Disability (#39398)
* Implements mobility impairment

* Implements mobility impairment

* Implements mobility impairment

* Removed white cane related stuff (impaired cane replacement and removed mobility aid component)

* fix development.toml

* Implements slower standing

* Prevent speed stacking by checking if the entity is already holding a mobility aid

* Move all speed handling into ImpairedMobilitySystem, added comments, made it so wielding a mobility aid doesn't grant the recovery benefit

* Move all speed handling into ImpairedMobilitySystem, added comments, made it so wielding a mobility aid doesn't grant the recovery benefit

* remove unused file

* Shorten description

* Apply suggestions

Co-authored-by: Princess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com>

* Suggestion cleanup

* formatting fix and removed extra datafield stuff

* added comment, fixed slashes, yadda yadda

* summary comments

* removed a word

* Add trait to clone whitelist

* Fix clone.yml

* my own review

---------

Co-authored-by: Princess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com>
Co-authored-by: ScarKy0 <scarky0@onet.eu>
2025-08-20 17:43:06 -07:00

43 lines
1.5 KiB
C#

using Content.Shared.Hands;
using Content.Shared.Movement.Systems;
using Content.Shared.Wieldable;
namespace Content.Shared.Traits.Assorted;
/// <summary>
/// Handles <see cref="MobilityAidComponent"/>
/// </summary>
public sealed class MobilityAidSystem : EntitySystem
{
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifier = default!;
/// <inheritdoc/>
public override void Initialize()
{
SubscribeLocalEvent<MobilityAidComponent, GotEquippedHandEvent>(OnGotEquippedHand);
SubscribeLocalEvent<MobilityAidComponent, GotUnequippedHandEvent>(OnGotUnequippedHand);
SubscribeLocalEvent<MobilityAidComponent, ItemWieldedEvent>(OnMobilityAidWielded);
SubscribeLocalEvent<MobilityAidComponent, ItemUnwieldedEvent>(OnMobilityAidUnwielded);
}
private void OnGotEquippedHand(Entity<MobilityAidComponent> ent, ref GotEquippedHandEvent args)
{
_movementSpeedModifier.RefreshMovementSpeedModifiers(args.User);
}
private void OnGotUnequippedHand(Entity<MobilityAidComponent> ent, ref GotUnequippedHandEvent args)
{
_movementSpeedModifier.RefreshMovementSpeedModifiers(args.User);
}
private void OnMobilityAidWielded(Entity<MobilityAidComponent> ent, ref ItemWieldedEvent args)
{
_movementSpeedModifier.RefreshMovementSpeedModifiers(args.User);
}
private void OnMobilityAidUnwielded(Entity<MobilityAidComponent> ent, ref ItemUnwieldedEvent args)
{
_movementSpeedModifier.RefreshMovementSpeedModifiers(args.User);
}
}