mirror of
https://github.com/corvax-team/ss14-wl.git
synced 2026-02-15 03:31:38 +01:00
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:
@@ -1,11 +1,9 @@
|
||||
using Content.Server.Guardian;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Implants;
|
||||
using Content.Shared.Implants.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
@@ -33,28 +31,39 @@ public sealed partial class ImplanterSystem : SharedImplanterSystem
|
||||
if (args.Target == null || !args.CanReach || args.Handled)
|
||||
return;
|
||||
|
||||
//Simplemobs and regular mobs should be injectable, but only regular mobs have mind.
|
||||
//So just don't implant/draw anything that isn't living or is a guardian
|
||||
//TODO: Rework a bit when surgery is in to work with implant cases
|
||||
if (!HasComp<MobStateComponent>(args.Target.Value) || HasComp<GuardianComponent>(args.Target.Value))
|
||||
var target = args.Target.Value;
|
||||
if (!CheckTarget(target, component.Whitelist, component.Blacklist))
|
||||
return;
|
||||
|
||||
//TODO: Rework when surgery is in for implant cases
|
||||
if (component.CurrentMode == ImplanterToggleMode.Draw && !component.ImplantOnly)
|
||||
{
|
||||
TryDraw(component, args.User, args.Target.Value, uid);
|
||||
TryDraw(component, args.User, target, uid);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!CanImplant(args.User, args.Target.Value, uid, component, out _, out _))
|
||||
if (!CanImplant(args.User, target, uid, component, out var implant, out _))
|
||||
{
|
||||
// no popup if implant doesn't exist
|
||||
if (implant == null)
|
||||
return;
|
||||
|
||||
// show popup to the user saying implant failed
|
||||
var name = Identity.Name(target, EntityManager, args.User);
|
||||
var msg = Loc.GetString("implanter-component-implant-failed", ("implant", implant), ("target", name));
|
||||
_popup.PopupEntity(msg, target, args.User);
|
||||
// prevent further interaction since popup was shown
|
||||
args.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
//Implant self instantly, otherwise try to inject the target.
|
||||
if (args.User == args.Target)
|
||||
Implant(args.User, args.Target.Value, uid, component);
|
||||
if (args.User == target)
|
||||
Implant(target, target, uid, component);
|
||||
else
|
||||
TryImplant(component, args.User, args.Target.Value, uid);
|
||||
TryImplant(component, args.User, target, uid);
|
||||
}
|
||||
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user