Fix event crashing when ghosts are present.
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
#nullable enable
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Content.Server.GameObjects.Components.Doors;
|
using Content.Server.GameObjects.Components.Doors;
|
||||||
using Content.Server.GameObjects.Components.GUI;
|
using Content.Server.GameObjects.Components.GUI;
|
||||||
@@ -39,10 +40,9 @@ namespace Content.Server.StationEvents
|
|||||||
var playerManager = IoCManager.Resolve<IPlayerManager>();
|
var playerManager = IoCManager.Resolve<IPlayerManager>();
|
||||||
foreach (var player in playerManager.GetAllPlayers())
|
foreach (var player in playerManager.GetAllPlayers())
|
||||||
{
|
{
|
||||||
var inventory = player.AttachedEntity.GetComponent<InventoryComponent>();
|
if (player.AttachedEntity == null || !player.AttachedEntity.TryGetComponent(out InventoryComponent? inventory)) return;
|
||||||
if (player.AttachedEntity == null) return;
|
if (inventory.TryGetSlotItem(EquipmentSlotDefines.Slots.BELT, out ItemComponent? item)
|
||||||
if (inventory.TryGetSlotItem(EquipmentSlotDefines.Slots.BELT, out ItemComponent item)
|
&& item?.Owner.Prototype?.ID == "UtilityBeltClothingFilledEvent") return;
|
||||||
&& item.Owner.Prototype.ID == "UtilityBeltClothingFilledEvent") return;
|
|
||||||
if (player.AttachedEntity.TryGetComponent<IDamageableComponent>(out var damageable)
|
if (player.AttachedEntity.TryGetComponent<IDamageableComponent>(out var damageable)
|
||||||
&& damageable.CurrentDamageState == DamageState.Dead) return;
|
&& damageable.CurrentDamageState == DamageState.Dead) return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user