Fix aghosts not being able to interact with chess

Fixes #4719
This commit is contained in:
Kara D
2021-10-01 12:11:04 -07:00
parent 063e676eed
commit 0825f66ca8
2 changed files with 8 additions and 7 deletions

View File

@@ -18,7 +18,6 @@ namespace Content.Server.Tabletop
{ {
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly ViewSubscriberSystem _viewSubscriberSystem = default!; [Dependency] private readonly ViewSubscriberSystem _viewSubscriberSystem = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
public override void Initialize() public override void Initialize()
{ {

View File

@@ -1,9 +1,12 @@
using System; using System;
using Content.Shared.ActionBlocker;
using Content.Shared.Ghost;
using Content.Shared.Hands.Components; using Content.Shared.Hands.Components;
using Content.Shared.Interaction.Helpers; using Content.Shared.Interaction.Helpers;
using Content.Shared.MobState.Components; using Content.Shared.MobState.Components;
using Content.Shared.Stunnable; using Content.Shared.Stunnable;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Network; using Robust.Shared.Network;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
@@ -11,6 +14,8 @@ namespace Content.Shared.Tabletop
{ {
public abstract class SharedTabletopSystem : EntitySystem public abstract class SharedTabletopSystem : EntitySystem
{ {
[Dependency] protected readonly ActionBlockerSystem _actionBlockerSystem = default!;
[Serializable, NetSerializable] [Serializable, NetSerializable]
public sealed class TabletopDraggableComponentState : ComponentState public sealed class TabletopDraggableComponentState : ComponentState
{ {
@@ -25,11 +30,11 @@ namespace Content.Shared.Tabletop
#region Utility #region Utility
/// <summary> /// <summary>
/// Whether the table exists, is in range and the player is alive. /// Whether the table exists, and the player can interact with it.
/// </summary> /// </summary>
/// <param name="playerEntity">The player entity to check.</param> /// <param name="playerEntity">The player entity to check.</param>
/// <param name="table">The table entity to check.</param> /// <param name="table">The table entity to check.</param>
protected static bool CanSeeTable(IEntity playerEntity, IEntity? table) protected bool CanSeeTable(IEntity playerEntity, IEntity? table)
{ {
if (table?.Transform.Parent?.Owner is not { } parent) if (table?.Transform.Parent?.Owner is not { } parent)
{ {
@@ -41,10 +46,7 @@ namespace Content.Shared.Tabletop
return false; return false;
} }
var alive = playerEntity.TryGetComponent<MobStateComponent>(out var mob) && mob.IsAlive(); return _actionBlockerSystem.CanInteract(playerEntity.Uid);
var inRange = playerEntity.InRangeUnobstructed(table);
return alive && inRange;
} }
protected static bool StunnedOrNoHands(IEntity playerEntity) protected static bool StunnedOrNoHands(IEntity playerEntity)