-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;
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;
}
using Content.Shared.Containers.ItemSlots;
+using Content.Shared.Whitelist;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
public const string ImplanterSlotId = "implanter_slot";
public const string ImplantSlotId = "implant";
+ /// <summary>
+ /// Whitelist to check entities against before implanting.
+ /// Implants get their own whitelist which is checked afterwards.
+ /// </summary>
+ [DataField, AutoNetworkedField]
+ public EntityWhitelist? Whitelist;
+
+ /// <summary>
+ /// Blacklist to check entities against before implanting.
+ /// </summary>
+ [DataField, AutoNetworkedField]
+ public EntityWhitelist? Blacklist;
+
/// <summary>
/// Used for implanters that start with specific implants
/// </summary>
using Content.Shared.Actions;
+using Content.Shared.Whitelist;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("permanent"), AutoNetworkedField]
public bool Permanent = false;
+
+ /// <summary>
+ /// Target whitelist for this implant specifically.
+ /// Only checked if the implanter allows implanting on the target to begin with.
+ /// </summary>
+ [DataField]
+ public EntityWhitelist? Whitelist;
+
+ /// <summary>
+ /// Target blacklist for this implant specifically.
+ /// Only checked if the implanter allows implanting on the target to begin with.
+ /// </summary>
+ [DataField]
+ public EntityWhitelist? Blacklist;
}
/// <summary>
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;
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)
## Implanter Attempt Messages
implanter-component-implanting-target = {$user} is trying to implant you with something!
+implanter-component-implant-failed = The {$implant} cannot be given to {$target}!
implanter-draw-failed-permanent = The {$implant} in {$target} is fused with them and cannot be removed!
implanter-draw-failed = You tried to remove an implant but found nothing.
containers:
implanter_slot: !type:ContainerSlot { }
- type: Implanter
+ whitelist:
+ components:
+ - Body # no chair microbomb
+ blacklist:
+ components:
+ - Guardian # no holoparasite macrobomb wombo combo
currentMode: Draw
implanterSlot:
name: Implant
tags:
- Trash
+- type: entity
+ parent: Implanter
+ id: ImplanterAdmeme
+ suffix: Admeme
+ components:
+ - type: Implanter
+ # go wild with sentient chairs with macrobombs
+ whitelist: null
+ blacklist: null
+
- type: entity
id: BaseImplantOnlyImplanter
parent: Implanter
noSpawn: true
components:
- type: SubdermalImplant
+ whitelist:
+ components:
+ - MobState # admeme implanting a chair with trombone implant needs to give the chair mobstate so it can die first
- type: TriggerOnMobstateChange
mobState:
- Dead
noSpawn: true
components:
- type: SubdermalImplant
+ whitelist:
+ components:
+ - MobState # admeme implanting a chair with tracking implant needs to give the chair mobstate so it can die first
- type: SuitSensor
randomMode: false
controlsLocked: true
components:
- type: SubdermalImplant
implantAction: ActionOpenStorageImplant
+ whitelist:
+ components:
+ - Hands # no use giving a mouse a storage implant, but a monkey is another story...
- type: Item
size: 9999
- type: Storage
components:
- type: SubdermalImplant
implantAction: ActionActivateFreedomImplant
+ whitelist:
+ components:
+ - Cuffable # useless if you cant be cuffed
- type: entity
parent: BaseSubdermalImplant
components:
- type: SubdermalImplant
implantAction: ActionOpenUplinkImplant
+ whitelist:
+ components:
+ - Hands # prevent mouse buying grenade penguin since its not telepathic
- type: Store
preset: StorePresetUplink
balance:
components:
- type: SubdermalImplant
implantAction: ActionActivateDnaScramblerImplant
+ whitelist:
+ components:
+ - HumanoidAppearance # syndies cant turn hamlet into a human
#Nuclear Operative/Special Exclusive implants
components:
- type: SubdermalImplant
permanent: true
+ whitelist:
+ components:
+ - MobState # admeme implanting a chair with rattle implant needs to give the chair mobstate so it can die first
- type: TriggerOnMobstateChange
mobState:
- Critical