diff --git a/Content.Client/Overlays/ShowMindShieldIconsSystem.cs b/Content.Client/Overlays/ShowMindShieldIconsSystem.cs index cdb9c54fdf..8f8b8e6407 100644 --- a/Content.Client/Overlays/ShowMindShieldIconsSystem.cs +++ b/Content.Client/Overlays/ShowMindShieldIconsSystem.cs @@ -15,6 +15,16 @@ public sealed class ShowMindShieldIconsSystem : EquipmentHudSystem(OnGetStatusIconsEvent); + SubscribeLocalEvent(OnGetStatusIconsEventFake); + } + // TODO: Probably need to get this OFF of client since this can be read by bad actors rather easily + // ...imagine cheating in a game about silly paper dolls + private void OnGetStatusIconsEventFake(EntityUid uid, FakeMindShieldComponent component, ref GetStatusIconsEvent ev) + { + if(!IsActive) + return; + if (component.IsEnabled && _prototype.TryIndex(component.MindShieldStatusIcon, out var fakeStatusIconPrototype)) + ev.StatusIcons.Add(fakeStatusIconPrototype); } private void OnGetStatusIconsEvent(EntityUid uid, MindShieldComponent component, ref GetStatusIconsEvent ev) diff --git a/Content.Server/Implants/ImplanterSystem.cs b/Content.Server/Implants/ImplanterSystem.cs index e441574213..5efd5dc6fb 100644 --- a/Content.Server/Implants/ImplanterSystem.cs +++ b/Content.Server/Implants/ImplanterSystem.cs @@ -58,17 +58,6 @@ public sealed partial class ImplanterSystem : SharedImplanterSystem return; } - // Check if we are trying to implant a implant which is already implanted - if (implant.HasValue && !component.AllowMultipleImplants && CheckSameImplant(target, implant.Value)) - { - var name = Identity.Name(target, EntityManager, args.User); - var msg = Loc.GetString("implanter-component-implant-already", ("implant", implant), ("target", name)); - _popup.PopupEntity(msg, target, args.User); - args.Handled = true; - return; - } - - //Implant self instantly, otherwise try to inject the target. if (args.User == target) Implant(target, target, uid, component); @@ -79,14 +68,7 @@ public sealed partial class ImplanterSystem : SharedImplanterSystem args.Handled = true; } - public bool CheckSameImplant(EntityUid target, EntityUid implant) - { - if (!TryComp(target, out var implanted)) - return false; - var implantPrototype = Prototype(implant); - return implanted.ImplantContainer.ContainedEntities.Any(entity => Prototype(entity) == implantPrototype); - } /// /// Attempt to implant someone else. diff --git a/Content.Shared/Implants/SharedImplanterSystem.cs b/Content.Shared/Implants/SharedImplanterSystem.cs index 44803e721c..6f394fb932 100644 --- a/Content.Shared/Implants/SharedImplanterSystem.cs +++ b/Content.Shared/Implants/SharedImplanterSystem.cs @@ -52,7 +52,14 @@ public abstract class SharedImplanterSystem : EntitySystem args.PushMarkup(Loc.GetString("implanter-contained-implant-text", ("desc", component.ImplantData.Item2))); } + public bool CheckSameImplant(EntityUid target, EntityUid implant) + { + if (!TryComp(target, out var implanted)) + return false; + var implantPrototype = Prototype(implant); + return implanted.ImplantContainer.ContainedEntities.Any(entity => Prototype(entity) == implantPrototype); + } //Instantly implant something and add all necessary components and containers. //Set to draw mode if not implant only public void Implant(EntityUid user, EntityUid target, EntityUid implanter, ImplanterComponent component) @@ -60,6 +67,16 @@ public abstract class SharedImplanterSystem : EntitySystem if (!CanImplant(user, target, implanter, component, out var implant, out var implantComp)) return; + // Check if we are trying to implant a implant which is already implanted + // Check AFTER the doafter to prevent "is it a fake?" metagaming against deceptive implants + if (!component.AllowMultipleImplants && CheckSameImplant(target, implant.Value)) + { + var name = Identity.Name(target, EntityManager, user); + var msg = Loc.GetString("implanter-component-implant-already", ("implant", implant), ("target", name)); + _popup.PopupEntity(msg, target, user); + return; + } + //If the target doesn't have the implanted component, add it. var implantedComp = EnsureComp(target); var implantContainer = implantedComp.ImplantContainer; diff --git a/Content.Shared/Mindshield/Components/FakeMindShieldImplantComponent.cs b/Content.Shared/Mindshield/Components/FakeMindShieldImplantComponent.cs new file mode 100644 index 0000000000..788de804f4 --- /dev/null +++ b/Content.Shared/Mindshield/Components/FakeMindShieldImplantComponent.cs @@ -0,0 +1,8 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.Mindshield.Components; + +[RegisterComponent, NetworkedComponent] +public sealed partial class FakeMindShieldImplantComponent : Component +{ +} diff --git a/Content.Shared/Mindshield/Components/FakeMindshieldComponent.cs b/Content.Shared/Mindshield/Components/FakeMindshieldComponent.cs new file mode 100644 index 0000000000..106f43367e --- /dev/null +++ b/Content.Shared/Mindshield/Components/FakeMindshieldComponent.cs @@ -0,0 +1,22 @@ +using Content.Shared.StatusIcon; +using Robust.Shared.GameStates; +using Robust.Shared.Prototypes; + +namespace Content.Shared.Mindshield.Components; + +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +public sealed partial class FakeMindShieldComponent : Component +{ + + /// + /// The state of the Fake mindshield, if true the owning entity will display a mindshield effect on their job icon + /// + [DataField, AutoNetworkedField] + public bool IsEnabled { get; set; } = false; + + /// + /// The Security status icon displayed to the security officer. Should be a duplicate of the one the mindshield uses since it's spoofing that + /// + [DataField, AutoNetworkedField] + public ProtoId MindShieldStatusIcon = "MindShieldIcon"; +} diff --git a/Content.Shared/Mindshield/FakeMindShield/SharedFakeMindShieldImplantSystem.cs b/Content.Shared/Mindshield/FakeMindShield/SharedFakeMindShieldImplantSystem.cs new file mode 100644 index 0000000000..8887025e3a --- /dev/null +++ b/Content.Shared/Mindshield/FakeMindShield/SharedFakeMindShieldImplantSystem.cs @@ -0,0 +1,36 @@ +using Content.Shared.Actions; +using Content.Shared.Implants; +using Content.Shared.Implants.Components; +using Content.Shared.Mindshield.Components; + +namespace Content.Shared.Mindshield.FakeMindShield; + +public sealed class SharedFakeMindShieldImplantSystem : EntitySystem +{ + [Dependency] private readonly SharedActionsSystem _actionsSystem = default!; + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnFakeMindShieldToggle); + SubscribeLocalEvent(ImplantCheck); + } + /// + /// Raise the Action of a Implanted user toggling their implant to the FakeMindshieldComponent on their entity + /// + private void OnFakeMindShieldToggle(Entity entity, ref FakeMindShieldToggleEvent ev) + { + ev.Handled = true; + if (entity.Comp.ImplantedEntity is not { } ent) + return; + + if (!TryComp(ent, out var comp)) + return; + _actionsSystem.SetToggled(ev.Action, !comp.IsEnabled); // Set it to what the Mindshield component WILL be after this + RaiseLocalEvent(ent, ev); //this reraises the action event to support an eventual future Changeling Antag which will also be using this component for it's "mindshield" ability + } + private void ImplantCheck(EntityUid uid, FakeMindShieldImplantComponent component ,ref ImplantImplantedEvent ev) + { + if (ev.Implanted != null) + EnsureComp(ev.Implanted.Value); + } +} diff --git a/Content.Shared/Mindshield/FakeMindShield/SharedFakeMindshieldSystem.cs b/Content.Shared/Mindshield/FakeMindShield/SharedFakeMindshieldSystem.cs new file mode 100644 index 0000000000..0a7c974200 --- /dev/null +++ b/Content.Shared/Mindshield/FakeMindShield/SharedFakeMindshieldSystem.cs @@ -0,0 +1,21 @@ +using Content.Shared.Actions; +using Content.Shared.Mindshield.Components; + +namespace Content.Shared.Mindshield.FakeMindShield; + +public sealed class SharedFakeMindShieldSystem : EntitySystem +{ + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnToggleMindshield); + } + + private void OnToggleMindshield(EntityUid uid, FakeMindShieldComponent comp, FakeMindShieldToggleEvent toggleEvent) + { + comp.IsEnabled = !comp.IsEnabled; + Dirty(uid, comp); + } +} + +public sealed partial class FakeMindShieldToggleEvent : InstantActionEvent; diff --git a/Resources/Locale/en-US/implant/implant.ftl b/Resources/Locale/en-US/implant/implant.ftl index 073757f53c..813ed3e7a9 100644 --- a/Resources/Locale/en-US/implant/implant.ftl +++ b/Resources/Locale/en-US/implant/implant.ftl @@ -17,6 +17,9 @@ implanter-label = [color=green]{$implantName}[/color] implanter-contained-implant-text = [color=green]{$desc}[/color] +action-name-toggle-fake-mindshield = [color=green]Toggle Fake Mindshield[/color] +action-description-toggle-fake-mindshield = Turn the Fake Mindshield implants transmission on/off + ## Implant Popups scramble-implant-activated-popup = Your appearance shifts and changes! diff --git a/Resources/Locale/en-US/store/uplink-catalog.ftl b/Resources/Locale/en-US/store/uplink-catalog.ftl index 82c80dab1f..655c620e30 100644 --- a/Resources/Locale/en-US/store/uplink-catalog.ftl +++ b/Resources/Locale/en-US/store/uplink-catalog.ftl @@ -451,3 +451,6 @@ uplink-combat-bakery-desc = A kit of clandestine baked weapons. Contains a bague uplink-business-card-name = Syndicate Business Card uplink-business-card-desc = A business card that you can give to someone to demonstrate your involvement in the syndicate or leave at the crime scene in order to make fun of the detective. You can buy no more than three of them. + +uplink-fake-mindshield-name = Fake Mindshield +uplink-fake-mindshield-desc = A togglable implant capable of mimicking the same transmissions a real mindshield puts out when on, tricking capable Heads-up displays into thinking you have a mindshield (Nanotrasen brand implanter not provided.) diff --git a/Resources/Prototypes/Actions/types.yml b/Resources/Prototypes/Actions/types.yml index a9ac169d3c..89c8e56b78 100644 --- a/Resources/Prototypes/Actions/types.yml +++ b/Resources/Prototypes/Actions/types.yml @@ -328,3 +328,15 @@ itemIconStyle: NoItem useDelay: 1 # emote spam event: !type:ToggleActionEvent + +- type: entity + id: FakeMindShieldToggleAction + name: action-name-toggle-fake-mindshield + description: action-description-toggle-fake-mindshield + components: + - type: InstantAction + icon: { sprite: Interface/Actions/actions_fakemindshield.rsi, state: icon } + iconOn: { sprite: Interface/Actions/actions_fakemindshield.rsi, state: icon-on } + itemIconStyle: NoItem + useDelay: 1 + event: !type:FakeMindShieldToggleEvent diff --git a/Resources/Prototypes/Catalog/thief_toolbox_sets.yml b/Resources/Prototypes/Catalog/thief_toolbox_sets.yml index f9ea34b389..06328870fc 100644 --- a/Resources/Prototypes/Catalog/thief_toolbox_sets.yml +++ b/Resources/Prototypes/Catalog/thief_toolbox_sets.yml @@ -17,6 +17,7 @@ - ClothingShoesChameleon - BarberScissors - ChameleonProjector + - FakeMindShieldImplanter - AgentIDCard - type: thiefBackpackSet diff --git a/Resources/Prototypes/Catalog/uplink_catalog.yml b/Resources/Prototypes/Catalog/uplink_catalog.yml index f31d85414d..f3ace5b0bb 100644 --- a/Resources/Prototypes/Catalog/uplink_catalog.yml +++ b/Resources/Prototypes/Catalog/uplink_catalog.yml @@ -1422,6 +1422,20 @@ components: - SurplusBundle +- type: listing + id: UplinkFakeMindshield + name: uplink-fake-mindshield-name + description: uplink-fake-mindshield-desc + icon: { sprite: Interface/Actions/actions_fakemindshield.rsi, state: icon-on } + productEntity: FakeMindShieldImplanter + discountDownTo: + Telecrystal: 2 + cost: + Telecrystal: 4 + categories: + - UplinkImplants + + # Wearables - type: listing diff --git a/Resources/Prototypes/Entities/Objects/Misc/implanters.yml b/Resources/Prototypes/Entities/Objects/Misc/implanters.yml index beffe8959a..b8ab92e5e9 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/implanters.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/implanters.yml @@ -245,6 +245,14 @@ - type: Implanter implant: DeathAcidifierImplant +- type: entity + id: FakeMindShieldImplanter + suffix: fake mindshield + parent: BaseImplantOnlyImplanterSyndi + components: + - type: Implanter + implant: FakeMindShieldImplant + # Security and Command implanters - type: entity diff --git a/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml b/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml index 28788e9a13..5d93cefd5d 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml @@ -311,6 +311,17 @@ - Dead - type: Rattle +- type: entity + parent: BaseSubdermalImplant + id: FakeMindShieldImplant + name: fake mindshield implant + description: This implant allows the implanter to produce a fake signal that NT security huds use to identify individuals implanted with a mindshield. + categories: [ HideSpawnMenu ] + components: + - type: SubdermalImplant + implantAction: FakeMindShieldToggleAction + - type: FakeMindShieldImplant + # Sec and Command implants - type: entity diff --git a/Resources/Textures/Interface/Actions/actions_fakemindshield.rsi/icon-on.png b/Resources/Textures/Interface/Actions/actions_fakemindshield.rsi/icon-on.png new file mode 100644 index 0000000000..19b4e13ec1 Binary files /dev/null and b/Resources/Textures/Interface/Actions/actions_fakemindshield.rsi/icon-on.png differ diff --git a/Resources/Textures/Interface/Actions/actions_fakemindshield.rsi/icon.png b/Resources/Textures/Interface/Actions/actions_fakemindshield.rsi/icon.png new file mode 100644 index 0000000000..9eb33d5350 Binary files /dev/null and b/Resources/Textures/Interface/Actions/actions_fakemindshield.rsi/icon.png differ diff --git a/Resources/Textures/Interface/Actions/actions_fakemindshield.rsi/meta.json b/Resources/Textures/Interface/Actions/actions_fakemindshield.rsi/meta.json new file mode 100644 index 0000000000..31f288131f --- /dev/null +++ b/Resources/Textures/Interface/Actions/actions_fakemindshield.rsi/meta.json @@ -0,0 +1,17 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Created by Ubaser (Discord) for SS14, Modified for purpose by brassicaprime69 (Discord)", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + }, + { + "name": "icon-on" + } + ] +}