Ghosts can now always see examine details (#29404)

* Ghosts can now always see examine details

This means they bypass range and occlusion checks for getting extra detail, like the charge on an SMES.

* EntityQuery
This commit is contained in:
Pieter-Jan Briers
2024-06-24 17:36:52 +02:00
committed by GitHub
parent d9506ce3a6
commit e7bcb270e4
2 changed files with 10 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
using Content.Shared.Ghost;
using Content.Shared.Verbs; using Content.Shared.Verbs;
using Robust.Shared.Utility; using Robust.Shared.Utility;
@@ -14,6 +15,8 @@ namespace Content.Shared.Examine
base.Initialize(); base.Initialize();
SubscribeLocalEvent<GroupExamineComponent, GetVerbsEvent<ExamineVerb>>(OnGroupExamineVerb); SubscribeLocalEvent<GroupExamineComponent, GetVerbsEvent<ExamineVerb>>(OnGroupExamineVerb);
_ghostQuery = GetEntityQuery<GhostComponent>();
} }
/// <summary> /// <summary>

View File

@@ -3,6 +3,7 @@ using System.Globalization;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Content.Shared.Eye.Blinding.Components; using Content.Shared.Eye.Blinding.Components;
using Content.Shared.Ghost;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using Content.Shared.Mobs.Components; using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems; using Content.Shared.Mobs.Systems;
@@ -44,6 +45,8 @@ namespace Content.Shared.Examine
protected const float ExamineBlurrinessMult = 2.5f; protected const float ExamineBlurrinessMult = 2.5f;
private EntityQuery<GhostComponent> _ghostQuery;
/// <summary> /// <summary>
/// Creates a new examine tooltip with arbitrary info. /// Creates a new examine tooltip with arbitrary info.
/// </summary> /// </summary>
@@ -54,6 +57,10 @@ namespace Content.Shared.Examine
if (IsClientSide(entity)) if (IsClientSide(entity))
return true; return true;
// Ghosts can see everything.
if (_ghostQuery.HasComp(examiner))
return true;
// check if the mob is in critical or dead // check if the mob is in critical or dead
if (MobStateSystem.IsIncapacitated(examiner)) if (MobStateSystem.IsIncapacitated(examiner))
return false; return false;