Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Spatison committed Aug 22, 2024
1 parent bb534ff commit 5e913b3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
17 changes: 15 additions & 2 deletions Content.Shared/_White/Standing/SharedLayingDownSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.DoAfter;
using Content.Shared.Gravity;
using Content.Shared.Input;
using Content.Shared.Mobs.Systems;
using Content.Shared.Movement.Systems;
Expand All @@ -15,7 +16,7 @@ public abstract class SharedLayingDownSystem : EntitySystem
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly StandingStateSystem _standing = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;

[Dependency] private readonly SharedGravitySystem _gravity = default!;

public override void Initialize()
{
Expand All @@ -40,8 +41,11 @@ public override void Shutdown()
private void ToggleStanding(ICommonSession? session)
{
if (session?.AttachedEntity == null ||
!HasComp<LayingDownComponent>(session.AttachedEntity))
!HasComp<LayingDownComponent>(session.AttachedEntity) ||
_gravity.IsWeightless(session.AttachedEntity.Value))
{
return;
}

RaiseNetworkEvent(new ChangeLayingDownEvent());
}
Expand All @@ -59,7 +63,9 @@ private void OnChangeState(ChangeLayingDownEvent ev, EntitySessionEventArgs args

if (!TryComp(uid, out StandingStateComponent? standing) ||
!TryComp(uid, out LayingDownComponent? layingDown))
{
return;
}

RaiseNetworkEvent(new CheckAutoGetUpEvent(GetNetEntity(uid)));

Expand All @@ -76,10 +82,13 @@ private void OnStandingUpDoAfter(EntityUid uid, StandingStateComponent component
{
if (args.Handled || args.Cancelled || HasComp<KnockedDownComponent>(uid) ||
_mobState.IsIncapacitated(uid) || !_standing.Stand(uid))
{
component.CurrentState = StandingState.Lying;
}

component.CurrentState = StandingState.Standing;
}

private void OnRefreshMovementSpeed(EntityUid uid, LayingDownComponent component, RefreshMovementSpeedModifiersEvent args)
{
if (_standing.IsDown(uid))
Expand All @@ -94,7 +103,9 @@ private void OnParentChanged(EntityUid uid, LayingDownComponent component, EntPa
if (!TryComp<StandingStateComponent>(uid, out var standingState)
|| standingState.CurrentState is StandingState.Standing
|| Transform(uid).GridUid != null)
{
return;
}

TryStandUp(uid, component, standingState);
}
Expand All @@ -106,7 +117,9 @@ public bool TryStandUp(EntityUid uid, LayingDownComponent? layingDown = null, St
standingState.CurrentState is not StandingState.Lying ||
!_mobState.IsAlive(uid) ||
TerminatingOrDeleted(uid))
{
return false;
}

var args = new DoAfterArgs(EntityManager, uid, layingDown.StandingUpTime, new StandingUpDoAfterEvent(), uid)
{
Expand Down
1 change: 0 additions & 1 deletion Resources/Locale/en-US/_white/escape-menu/options-menu.ftl
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
ui-options-function-look-up = Look up
ui-options-function-auto-get-up = Automatically get up after falling
1 change: 0 additions & 1 deletion Resources/Locale/ru-RU/_white/escape-menu/options-menu.ftl
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
ui-options-function-look-up = Присмотреться
ui-options-function-auto-get-up = Автоматически вставать при падении

0 comments on commit 5e913b3

Please sign in to comment.