using Content.Shared.Movement.Events; using Content.Shared.Movement.Systems; using Content.Shared.Standing; namespace Content.Server._Stalker.Lay; public sealed partial class STLaySystem { [Dependency] private readonly StandingStateSystem _standingState = default!; [Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifier = default!; private void InitializeLaid() { SubscribeLocalEvent(OnLaidInit); SubscribeLocalEvent(OnLaidShutdown); SubscribeLocalEvent(OnLaidStandAttempt); SubscribeLocalEvent(OnLaidTileFriction); SubscribeLocalEvent(OnRefreshMovementSpeedModifiers); } private void OnLaidInit(Entity laid, ref ComponentInit args) { _standingState.Down(laid, dropHeldItems: false, fixtureAttempt: false); _movementSpeedModifier.RefreshMovementSpeedModifiers(laid); } private void OnLaidShutdown(Entity laid, ref ComponentShutdown args) { laid.Comp.Standing = true; _standingState.Stand(laid); laid.Comp.Standing = true; _movementSpeedModifier.RefreshMovementSpeedModifiers(laid); } private void OnLaidStandAttempt(Entity laid, ref StandAttemptEvent args) { var standing = laid.Comp.Standing; laid.Comp.Standing = false; if (args.Cancelled) return; if (standing) return; args.Cancel(); } private void OnLaidTileFriction(Entity laid, ref TileFrictionEvent args) { args.Modifier *= laid.Comp.TileFrictionModifier; } private void OnRefreshMovementSpeedModifiers(Entity laid, ref RefreshMovementSpeedModifiersEvent args) { if (laid.Comp.Standing) return; args.ModifySpeed(laid.Comp.MovementSpeedModifier, laid.Comp.MovementSpeedModifier); } }