[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>
This commit is contained in:
46
Content.Shared/Traits/Assorted/LegsParalyzedSystem.cs
Normal file
46
Content.Shared/Traits/Assorted/LegsParalyzedSystem.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user