Drone blocker ignores dead ghost roles (#7782)

This commit is contained in:
Rane
2022-05-03 22:41:15 -04:00
committed by GitHub
parent 6a89e0eb5d
commit bfc3203a21

View File

@@ -4,6 +4,7 @@ using Content.Server.Drone.Components;
using Content.Shared.Actions;
using Content.Server.Light.Components;
using Content.Shared.MobState;
using Content.Shared.MobState.Components;
using Content.Shared.Interaction.Events;
using Content.Shared.Interaction.Components;
using Content.Shared.Examine;
@@ -176,8 +177,12 @@ namespace Content.Server.Drone
var xform = Comp<TransformComponent>(uid);
foreach (var entity in _lookup.GetEntitiesInRange(xform.MapPosition, component.InteractionBlockRange))
{
// Return true if the entity is/was controlled by a player and is not a drone or ghost.
if (HasComp<MindComponent>(entity) && !HasComp<DroneComponent>(entity) && !HasComp<GhostComponent>(entity))
{
// Filter out dead ghost roles. Dead normal players are intended to block.
if ((TryComp<MobStateComponent>(entity, out var entityMobState) && HasComp<GhostTakeoverAvailableComponent>(entity) && entityMobState.IsDead()))
continue;
if (_gameTiming.IsFirstTimePredicted)
_popupSystem.PopupEntity(Loc.GetString("drone-too-close", ("being", entity)), uid, Filter.Entities(uid));
return true;