Fingerprint taking improvements (#31864)
* now using event to check access to fingerprint * Opps actually commiting the changes --------- Co-authored-by: YourUsername <you@example.com> Co-authored-by: beck-thompson <beck314159@hotmail.com>
This commit is contained in:
@@ -299,11 +299,9 @@ namespace Content.Server.Forensics
|
||||
{
|
||||
if (TryComp<FiberComponent>(gloves, out var fiber) && !string.IsNullOrEmpty(fiber.FiberMaterial))
|
||||
component.Fibers.Add(string.IsNullOrEmpty(fiber.FiberColor) ? Loc.GetString("forensic-fibers", ("material", fiber.FiberMaterial)) : Loc.GetString("forensic-fibers-colored", ("color", fiber.FiberColor), ("material", fiber.FiberMaterial)));
|
||||
|
||||
if (HasComp<FingerprintMaskComponent>(gloves))
|
||||
return;
|
||||
}
|
||||
if (TryComp<FingerprintComponent>(user, out var fingerprint))
|
||||
|
||||
if (TryComp<FingerprintComponent>(user, out var fingerprint) && CanAccessFingerprint(user, out _))
|
||||
component.Fingerprints.Add(fingerprint.Fingerprint ?? "");
|
||||
}
|
||||
|
||||
@@ -364,6 +362,23 @@ namespace Content.Server.Forensics
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if there's a way to access the fingerprint of the target entity.
|
||||
/// </summary>
|
||||
/// <param name="target">The entity with the fingerprint</param>
|
||||
/// <param name="blocker">The entity that blocked accessing the fingerprint</param>
|
||||
public bool CanAccessFingerprint(EntityUid target, out EntityUid? blocker)
|
||||
{
|
||||
var ev = new TryAccessFingerprintEvent();
|
||||
|
||||
RaiseLocalEvent(target, ev);
|
||||
if (!ev.Cancelled && TryComp<InventoryComponent>(target, out var inv))
|
||||
_inventory.RelayEvent((target, inv), ev);
|
||||
|
||||
blocker = ev.Blocker;
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user