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:
mirrorcult
2021-02-20 15:55:35 -07:00
committed by GitHub
parent f85d8435c1
commit 6c088c36b8
4 changed files with 26 additions and 16 deletions

View File

@@ -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())
{