* лежать * лучше так сделать * - remove: Gravity is fine. * - add: Hit moving lying targets. * - tweak: Lie down insted of stun on FTL. * - fix: Fix double component. * - remove: Disable recoil. --------- Co-authored-by: Aviu00 <aviu00@protonmail.com>
60 lines
2.1 KiB
C#
60 lines
2.1 KiB
C#
using Content.Shared.Body.Systems;
|
|
using Content.Shared.Buckle.Components;
|
|
using Content.Shared.Movement.Events;
|
|
using Content.Shared.Movement.Systems;
|
|
using Content.Shared.Standing;
|
|
using Content.Shared.Standing.Systems;
|
|
using Content.Shared.Throwing;
|
|
|
|
namespace Content.Shared.Traits.Assorted;
|
|
|
|
public sealed class LegsParalyzedSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifierSystem = default!;
|
|
[Dependency] private readonly SharedStandingStateSystem _standingSystem = default!;
|
|
[Dependency] private readonly SharedBodySystem _bodySystem = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
SubscribeLocalEvent<LegsParalyzedComponent, ComponentStartup>(OnStartup);
|
|
SubscribeLocalEvent<LegsParalyzedComponent, ComponentShutdown>(OnShutdown);
|
|
SubscribeLocalEvent<LegsParalyzedComponent, BuckleChangeEvent>(OnBuckleChange);
|
|
SubscribeLocalEvent<LegsParalyzedComponent, ThrowPushbackAttemptEvent>(OnThrowPushbackAttempt);
|
|
SubscribeLocalEvent<LegsParalyzedComponent, UpdateCanMoveEvent>(OnUpdateCanMoveEvent);
|
|
}
|
|
|
|
private void OnStartup(EntityUid uid, LegsParalyzedComponent component, ComponentStartup args)
|
|
{
|
|
// TODO: In future probably must be surgery related wound
|
|
_movementSpeedModifierSystem.ChangeBaseSpeed(uid, 0, 0, 20);
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
|
|
private void OnUpdateCanMoveEvent(EntityUid uid, LegsParalyzedComponent component, UpdateCanMoveEvent args)
|
|
{
|
|
args.Cancel();
|
|
}
|
|
|
|
private void OnThrowPushbackAttempt(EntityUid uid, LegsParalyzedComponent component, ThrowPushbackAttemptEvent args)
|
|
{
|
|
args.Cancel();
|
|
}
|
|
}
|