Fix 'Hypopen shouldn't display solution examine text' (#26453)
* stealthy hypo * ExaminableSolution hand check when in covert implement. ExaminableSolution now has 'hidden' datafield to enable chemical inspection only in hand. * cleaning code * more cleaning * Hidden datafield renamed to HeldOnly * review --------- Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -13,6 +13,8 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Dependency = Robust.Shared.IoC.DependencyAttribute;
|
||||
|
||||
namespace Content.Shared.Chemistry.EntitySystems;
|
||||
@@ -53,6 +55,7 @@ public abstract partial class SharedSolutionContainerSystem : EntitySystem
|
||||
[Dependency] protected readonly ChemicalReactionSystem ChemicalReactionSystem = default!;
|
||||
[Dependency] protected readonly ExamineSystemShared ExamineSystem = default!;
|
||||
[Dependency] protected readonly SharedAppearanceSystem AppearanceSystem = default!;
|
||||
[Dependency] protected readonly SharedHandsSystem Hands = default!;
|
||||
[Dependency] protected readonly SharedContainerSystem ContainerSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
@@ -729,6 +732,9 @@ public abstract partial class SharedSolutionContainerSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CanSeeHiddenSolution(entity,args.Examiner))
|
||||
return;
|
||||
|
||||
var primaryReagent = solution.GetPrimaryReagentId();
|
||||
|
||||
if (string.IsNullOrEmpty(primaryReagent?.Prototype))
|
||||
@@ -825,6 +831,9 @@ public abstract partial class SharedSolutionContainerSystem : EntitySystem
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CanSeeHiddenSolution(entity,args.User))
|
||||
return;
|
||||
|
||||
var target = args.Target;
|
||||
var user = args.User;
|
||||
var verb = new ExamineVerb()
|
||||
@@ -874,5 +883,22 @@ public abstract partial class SharedSolutionContainerSystem : EntitySystem
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if examinable solution requires you to hold the item in hand.
|
||||
/// </summary>
|
||||
private bool CanSeeHiddenSolution(Entity<ExaminableSolutionComponent> entity, EntityUid examiner)
|
||||
{
|
||||
// If not held-only then it's always visible.
|
||||
if (!entity.Comp.HeldOnly)
|
||||
return true;
|
||||
|
||||
if (TryComp(examiner, out HandsComponent? handsComp))
|
||||
{
|
||||
return Hands.IsHolding(examiner, entity, out _, handsComp);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion Event Handlers
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user