Fix dead people standing up after being stunned (#3330)
* fix crit/dead players standing up * actually fix crit/dead players standing up * nullable + missed check Co-authored-by: cyclowns <cyclowns@protonmail.ch>
This commit is contained in:
@@ -337,7 +337,8 @@ namespace Content.Server.GameObjects.Components.Buckle
|
||||
|
||||
Appearance?.SetData(BuckleVisuals.Buckled, false);
|
||||
|
||||
if (_stunnable != null && _stunnable.KnockedDown)
|
||||
if (_stunnable != null && _stunnable.KnockedDown
|
||||
|| (_mobState?.IsIncapacitated() ?? false))
|
||||
{
|
||||
EntitySystem.Get<StandingStateSystem>().Down(Owner);
|
||||
}
|
||||
|
||||
@@ -353,14 +353,17 @@ namespace Content.Server.GameObjects.Components.Instruments
|
||||
|
||||
UserInterface?.CloseAll();
|
||||
|
||||
if(Handheld)
|
||||
if (mob != null)
|
||||
{
|
||||
if (Handheld)
|
||||
EntitySystem.Get<StandingStateSystem>().DropAllItemsInHands(mob, false);
|
||||
|
||||
if (mob != null && mob.TryGetComponent(out StunnableComponent? stun))
|
||||
if (mob.TryGetComponent(out StunnableComponent? stun))
|
||||
{
|
||||
stun.Stun(1);
|
||||
Clean();
|
||||
}
|
||||
}
|
||||
|
||||
InstrumentPlayer = null;
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
#nullable enable
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Interfaces.GameObjects;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Content.Shared.GameObjects.Components.Mobs.State;
|
||||
using Content.Shared.GameObjects.Components.Movement;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -39,7 +41,8 @@ namespace Content.Server.GameObjects.Components.Mobs
|
||||
StunnedTimer = 0f;
|
||||
SlowdownTimer = 0f;
|
||||
|
||||
if (KnockedDown)
|
||||
if (KnockedDown &&
|
||||
Owner.TryGetComponent(out IMobStateComponent? mobState) && !mobState.IsIncapacitated())
|
||||
{
|
||||
EntitySystem.Get<StandingStateSystem>().Standing(Owner);
|
||||
}
|
||||
@@ -65,7 +68,8 @@ namespace Content.Server.GameObjects.Components.Mobs
|
||||
{
|
||||
KnockdownTimer -= delta;
|
||||
|
||||
if (KnockdownTimer <= 0f)
|
||||
if (KnockdownTimer <= 0f
|
||||
&& Owner.TryGetComponent(out IMobStateComponent? mobState) && !mobState.IsIncapacitated())
|
||||
{
|
||||
EntitySystem.Get<StandingStateSystem>().Standing(Owner);
|
||||
|
||||
@@ -82,7 +86,7 @@ namespace Content.Server.GameObjects.Components.Mobs
|
||||
{
|
||||
SlowdownTimer = 0f;
|
||||
|
||||
if (Owner.TryGetComponent(out MovementSpeedModifierComponent movement))
|
||||
if (Owner.TryGetComponent(out MovementSpeedModifierComponent? movement))
|
||||
{
|
||||
movement.RefreshMovementSpeedModifiers();
|
||||
}
|
||||
@@ -92,7 +96,7 @@ namespace Content.Server.GameObjects.Components.Mobs
|
||||
}
|
||||
|
||||
if (!StunStart.HasValue || !StunEnd.HasValue ||
|
||||
!Owner.TryGetComponent(out ServerAlertsComponent status))
|
||||
!Owner.TryGetComponent(out ServerAlertsComponent? status))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Content.Server.Interfaces.GameObjects.Components.Items;
|
||||
#nullable enable
|
||||
using Content.Server.Interfaces.GameObjects.Components.Items;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.GameObjects.Components.Mobs.State;
|
||||
using Content.Shared.GameObjects.Components.Rotation;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using JetBrains.Annotations;
|
||||
@@ -13,7 +15,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
protected override bool OnDown(IEntity entity, bool playSound = true, bool dropItems = true, bool force = false)
|
||||
{
|
||||
if (!entity.TryGetComponent(out AppearanceComponent appearance))
|
||||
if (!entity.TryGetComponent(out AppearanceComponent? appearance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -37,7 +39,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
|
||||
protected override bool OnStand(IEntity entity)
|
||||
{
|
||||
if (!entity.TryGetComponent(out AppearanceComponent appearance)) return false;
|
||||
if (!entity.TryGetComponent(out AppearanceComponent? appearance)) return false;
|
||||
|
||||
appearance.TryGetData<RotationState>(RotationVisuals.RotationState, out var oldState);
|
||||
var newState = RotationState.Vertical;
|
||||
@@ -53,7 +55,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
base.DropAllItemsInHands(entity, doMobChecks);
|
||||
|
||||
if (!entity.TryGetComponent(out IHandsComponent hands)) return;
|
||||
if (!entity.TryGetComponent(out IHandsComponent? hands)) return;
|
||||
|
||||
foreach (var heldItem in hands.GetAllHeldItems())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user