Files
tbd-station-14/Content.Shared/Traits/Assorted/LegsParalyzedSystem.cs
Morb 8187e00072 [Trait] Wheelchair bound (#18785)
* Init commit

* move to shared and remove all from component

* maybe that

* Use SharedBuckleSystem

* Rename to WheelchairBound

* Move Carriage to prototype

* Update sprite to TG, add folded sprite, rename carriage to wheelchair

* Fix wheelchair rsi path

* Add stand & down for buckling

* Add wheelchair inhand sprites

* Move wheelchair down in file & fix fold sprite & add suffix Vehicle

* Use new wheelchair id

* Add standing & speed reset on component remove

* Split system to leg paralyzed and wheelchair bound

* Rename to LegsParalyzed

* Rename in prototype

* Move LegsParalyzed to shared

---------

Co-authored-by: Ray <vigersray@gmail.com>
2023-08-07 18:28:59 -06:00

47 lines
1.7 KiB
C#

using Content.Shared.Body.Systems;
using Content.Shared.Buckle.Components;
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Systems;
using Content.Shared.Standing;
namespace Content.Shared.Traits.Assorted;
public sealed class LegsParalyzedSystem : EntitySystem
{
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifierSystem = default!;
[Dependency] private readonly StandingStateSystem _standingSystem = default!;
[Dependency] private readonly SharedBodySystem _bodySystem = default!;
public override void Initialize()
{
SubscribeLocalEvent<LegsParalyzedComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<LegsParalyzedComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<LegsParalyzedComponent, BuckleChangeEvent>(OnBuckleChange);
}
private void OnStartup(EntityUid uid, LegsParalyzedComponent component, ComponentStartup args)
{
// TODO: In future probably must be surgery related wound
var movementSpeed = EnsureComp<MovementSpeedModifierComponent>(uid);
_movementSpeedModifierSystem.ChangeBaseSpeed(uid, 0, 0, 20, movementSpeed);
}
private void OnShutdown(EntityUid uid, LegsParalyzedComponent component, ComponentShutdown args)
{
_standingSystem.Stand(uid);
_bodySystem.UpdateMovementSpeed(uid);
}
private void OnBuckleChange(EntityUid uid, LegsParalyzedComponent component, ref BuckleChangeEvent args)
{
if (args.Buckling)
{
_standingSystem.Stand(args.BuckledEntity);
}
else
{
_standingSystem.Down(args.BuckledEntity);
}
}
}