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;
[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()
return;
}
+ if (!CanSeeHiddenSolution(entity,args.Examiner))
+ return;
+
var primaryReagent = solution.GetPrimaryReagentId();
if (string.IsNullOrEmpty(primaryReagent?.Prototype))
return;
}
+ if (!CanSeeHiddenSolution(entity,args.User))
+ return;
+
var target = args.Target;
var user = args.User;
var verb = new ExamineVerb()
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
}