Examine verbs + tooltip buttons (#6489)
This commit is contained in:
@@ -12,9 +12,12 @@ namespace Content.Shared.Examine
|
||||
{
|
||||
public readonly EntityUid EntityUid;
|
||||
|
||||
public RequestExamineInfoMessage(EntityUid entityUid)
|
||||
public readonly bool GetVerbs;
|
||||
|
||||
public RequestExamineInfoMessage(EntityUid entityUid, bool getVerbs=false)
|
||||
{
|
||||
EntityUid = entityUid;
|
||||
GetVerbs = getVerbs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,10 +27,18 @@ namespace Content.Shared.Examine
|
||||
public readonly EntityUid EntityUid;
|
||||
public readonly FormattedMessage Message;
|
||||
|
||||
public ExamineInfoResponseMessage(EntityUid entityUid, FormattedMessage message)
|
||||
public readonly bool GetVerbs;
|
||||
public readonly bool CenterAtCursor;
|
||||
public readonly bool OpenAtOldTooltip;
|
||||
|
||||
public ExamineInfoResponseMessage(EntityUid entityUid, FormattedMessage message,
|
||||
bool getVerbs=false, bool centerAtCursor=true, bool openAtOldTooltip=true)
|
||||
{
|
||||
EntityUid = entityUid;
|
||||
Message = message;
|
||||
GetVerbs = getVerbs;
|
||||
CenterAtCursor = centerAtCursor;
|
||||
OpenAtOldTooltip = openAtOldTooltip;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,12 @@ namespace Content.Shared.Examine
|
||||
public const float ExamineRange = 16f;
|
||||
protected const float ExamineDetailsRange = 3f;
|
||||
|
||||
private bool IsInDetailsRange(EntityUid examiner, EntityUid entity)
|
||||
/// <summary>
|
||||
/// Creates a new examine tooltip with arbitrary info.
|
||||
/// </summary>
|
||||
public abstract void SendExamineTooltip(EntityUid player, EntityUid target, FormattedMessage message, bool getVerbs, bool centerAtCursor);
|
||||
|
||||
public bool IsInDetailsRange(EntityUid examiner, EntityUid entity)
|
||||
{
|
||||
// check if the mob is in ciritcal or dead
|
||||
if (EntityManager.TryGetComponent(examiner, out MobStateComponent mobState) && mobState.IsIncapacitated())
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Robust.Shared.Containers;
|
||||
@@ -15,6 +16,7 @@ namespace Content.Shared.Verbs
|
||||
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
|
||||
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
||||
[Dependency] protected readonly SharedContainerSystem ContainerSystem = default!;
|
||||
[Dependency] private readonly ExamineSystemShared _examineSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -112,6 +114,13 @@ namespace Content.Shared.Verbs
|
||||
verbs.UnionWith(verbEvent.Verbs);
|
||||
}
|
||||
|
||||
if (types.Contains(typeof(ExamineVerb)))
|
||||
{
|
||||
var verbEvent = new GetVerbsEvent<ExamineVerb>(user, target, @using, hands, canInteract, canAccess);
|
||||
RaiseLocalEvent(target, verbEvent);
|
||||
verbs.UnionWith(verbEvent.Verbs);
|
||||
}
|
||||
|
||||
// generic verbs
|
||||
if (types.Contains(typeof(Verb)))
|
||||
{
|
||||
|
||||
@@ -202,6 +202,7 @@ namespace Content.Shared.Verbs
|
||||
{ typeof(InteractionVerb) },
|
||||
{ typeof(AlternativeVerb) },
|
||||
{ typeof(ActivationVerb) },
|
||||
{ typeof(ExamineVerb) }
|
||||
};
|
||||
}
|
||||
|
||||
@@ -264,4 +265,12 @@ namespace Content.Shared.Verbs
|
||||
TextStyleClass = DefaultTextStyleClass;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class ExamineVerb : Verb
|
||||
{
|
||||
public override int TypePriority => 0;
|
||||
|
||||
public bool ShowOnExamineTooltip = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,9 @@ namespace Content.Shared.Verbs
|
||||
public static readonly VerbCategory Admin =
|
||||
new("verb-categories-admin", "/Textures/Interface/character.svg.192dpi.png");
|
||||
|
||||
public static readonly VerbCategory Examine =
|
||||
new("verb-categories-examine", "/Textures/Interface/VerbIcons/examine.svg.192dpi.png");
|
||||
|
||||
public static readonly VerbCategory Debug =
|
||||
new("verb-categories-debug", "/Textures/Interface/VerbIcons/debug.svg.192dpi.png");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user