Implant whitelist/blacklisting (#20678)
* add whitelist and blacklist to implant and implanter components * handle whitelist and blacklist in systems * move hardcoded whitelist/blacklist to base implanter + add admeme implanter * give implants sensible whitelists * cleaner CheckTarget and fix * remove unused imports * network lists --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -6,6 +6,7 @@ using Content.Shared.Examine;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Implants.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Whitelist;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
@@ -85,11 +86,23 @@ public abstract class SharedImplanterSystem : EntitySystem
|
||||
if (!TryComp(implant, out implantComp))
|
||||
return false;
|
||||
|
||||
if (!CheckTarget(target, component.Whitelist, component.Blacklist) ||
|
||||
!CheckTarget(target, implantComp.Whitelist, implantComp.Blacklist))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var ev = new AddImplantAttemptEvent(user, target, implant.Value, implanter);
|
||||
RaiseLocalEvent(target, ev);
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
protected bool CheckTarget(EntityUid target, EntityWhitelist? whitelist, EntityWhitelist? blacklist)
|
||||
{
|
||||
return whitelist?.IsValid(target, EntityManager) != false &&
|
||||
blacklist?.IsValid(target, EntityManager) != true;
|
||||
}
|
||||
|
||||
//Draw the implant out of the target
|
||||
//TODO: Rework when surgery is in so implant cases can be a thing
|
||||
public void Draw(EntityUid implanter, EntityUid user, EntityUid target, ImplanterComponent component)
|
||||
|
||||
Reference in New Issue
Block a user