From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sat, 19 Apr 2025 14:37:45 +0000 (+1000) Subject: Fix detailed examine mispredicts (#33814) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=39aefa04416d186bef507220b7936f8ceb3e4e09;p=space-station-14.git Fix detailed examine mispredicts (#33814) So: - Shared examine like armour, adds the button incorrectly and mispredicts it. - Server-only like damage, doesn't add it (correct) and no mispredict. We'll just prune any verbs if the server sends them in unless the verb is client-only and it should fix it unless there's client-side code not flagging it as clientexclusive. --- diff --git a/Content.Client/Examine/ExamineSystem.cs b/Content.Client/Examine/ExamineSystem.cs index 2e8d95c978..3aec394324 100644 --- a/Content.Client/Examine/ExamineSystem.cs +++ b/Content.Client/Examine/ExamineSystem.cs @@ -32,6 +32,8 @@ namespace Content.Client.Examine [Dependency] private readonly VerbSystem _verbSystem = default!; [Dependency] private readonly SpriteSystem _sprite = default!; + private List _verbList = new(); + public const string StyleClassEntityTooltip = "entity-tooltip"; private EntityUid _examinedEntity; @@ -158,13 +160,13 @@ namespace Content.Client.Examine var entity = GetEntity(ev.EntityUid); OpenTooltip(player.Value, entity, ev.CenterAtCursor, ev.OpenAtOldTooltip, ev.KnowTarget); - UpdateTooltipInfo(player.Value, entity, ev.Message, ev.Verbs); + UpdateTooltipInfo(player.Value, entity, ev.Message, ev.Verbs, getVerbs: false); } public override void SendExamineTooltip(EntityUid player, EntityUid target, FormattedMessage message, bool getVerbs, bool centerAtCursor) { - OpenTooltip(player, target, centerAtCursor, false); - UpdateTooltipInfo(player, target, message); + OpenTooltip(player, target, centerAtCursor); + UpdateTooltipInfo(player, target, message, getVerbs: getVerbs); } /// @@ -259,7 +261,7 @@ namespace Content.Client.Examine /// /// Fills the examine tooltip with a message and buttons if applicable. /// - public void UpdateTooltipInfo(EntityUid player, EntityUid target, FormattedMessage message, List? verbs=null) + public void UpdateTooltipInfo(EntityUid player, EntityUid target, FormattedMessage message, List? verbs=null, bool getVerbs = true) { var vBox = _examineTooltipOpen?.GetChild(0).GetChild(0); if (vBox == null) @@ -283,9 +285,29 @@ namespace Content.Client.Examine break; } - verbs ??= new List(); var totalVerbs = _verbSystem.GetLocalVerbs(target, player, typeof(ExamineVerb)); - totalVerbs.UnionWith(verbs); + + // We still need client-exclusive verbs even when the server sends its data in so if that's the case + // we remove any non-client-exclusive verbs. + if (!getVerbs) + { + _verbList.AddRange(totalVerbs); + + foreach (var verb in _verbList) + { + if (!verb.ClientExclusive) + { + totalVerbs.Remove(verb); + } + } + + _verbList.Clear(); + } + + if (verbs != null) + { + totalVerbs.UnionWith(verbs); + } AddVerbsToTooltip(totalVerbs); } diff --git a/Content.Shared/Examine/ExamineSystemShared.Group.cs b/Content.Shared/Examine/ExamineSystemShared.Group.cs index 64b70d0af3..7dc7877eac 100644 --- a/Content.Shared/Examine/ExamineSystemShared.Group.cs +++ b/Content.Shared/Examine/ExamineSystemShared.Group.cs @@ -80,7 +80,7 @@ namespace Content.Shared.Examine } message.AddMessage(GetFormattedMessageFromExamineEntries(group.Entries)); - SendExamineTooltip(user, target, message, false, false); + SendExamineTooltip(user, target, message, getVerbs: false, centerAtCursor: false); } /// A FormattedMessage based on all , sorted.