From 2eaec2d528a85a1cad9b50f81f0c5cba5d307c8c Mon Sep 17 00:00:00 2001 From: deltanedas <39013340+deltanedas@users.noreply.github.com> Date: Sat, 29 Apr 2023 09:07:50 +0000 Subject: [PATCH] Add uplink implant (#15728) Co-authored-by: deltanedas <@deltanedas:kde.org> --- .../GameTicking/Rules/TraitorRuleSystem.cs | 3 +- .../Implants/SubdermalImplantSystem.cs | 29 +++++++++++++++++++ .../Store/Systems/StoreSystem.Ui.cs | 4 +-- Content.Server/Store/Systems/StoreSystem.cs | 7 +++++ .../Components/SubdermalImplantComponent.cs | 8 +++++ Resources/Locale/en-US/implant/implant.ftl | 3 ++ Resources/Locale/en-US/store/currency.ftl | 3 +- .../Locale/en-US/store/uplink-catalog.ftl | 3 ++ Resources/Prototypes/Actions/types.yml | 11 +++++++ .../Prototypes/Catalog/uplink_catalog.yml | 11 +++++++ .../Entities/Objects/Misc/implanters.yml | 9 ++++++ .../Objects/Misc/subdermal_implants.yml | 18 ++++++++++++ 12 files changed, 105 insertions(+), 4 deletions(-) diff --git a/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs b/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs index 8fe483452a..0c93e0e267 100644 --- a/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs @@ -210,8 +210,9 @@ public sealed class TraitorRuleSystem : GameRuleSystem if (traitorRule == null) { //todo fuck me this shit is awful + //no i wont fuck you, erp is against rules GameTicker.StartGameRule("Traitor", out var ruleEntity); - traitorRule = EntityManager.GetComponent(ruleEntity); + traitorRule = Comp(ruleEntity); } var mind = traitor.Data.ContentData()?.Mind; diff --git a/Content.Server/Implants/SubdermalImplantSystem.cs b/Content.Server/Implants/SubdermalImplantSystem.cs index 71c5e567cc..7abafec0f6 100644 --- a/Content.Server/Implants/SubdermalImplantSystem.cs +++ b/Content.Server/Implants/SubdermalImplantSystem.cs @@ -1,9 +1,13 @@ using Content.Server.Cuffs; +using Content.Server.Store.Components; +using Content.Server.Store.Systems; using Content.Shared.Cuffs.Components; using Content.Shared.Implants; using Content.Shared.Implants.Components; +using Content.Shared.Interaction; using Content.Shared.Interaction.Events; using Content.Shared.Mobs; +using Content.Shared.Popups; using Robust.Shared.Containers; namespace Content.Server.Implants; @@ -12,6 +16,8 @@ public sealed class SubdermalImplantSystem : SharedSubdermalImplantSystem { [Dependency] private readonly CuffableSystem _cuffable = default!; [Dependency] private readonly SharedContainerSystem _container = default!; + [Dependency] private readonly SharedPopupSystem _popup = default!; + [Dependency] private readonly StoreSystem _store = default!; public override void Initialize() { @@ -19,7 +25,10 @@ public sealed class SubdermalImplantSystem : SharedSubdermalImplantSystem SubscribeLocalEvent(OnFreedomImplant); + SubscribeLocalEvent(OnUplinkInteractUsing); + SubscribeLocalEvent(RelayToImplantEvent); + SubscribeLocalEvent(RelayToImplantEvent); SubscribeLocalEvent(RelayToImplantEvent); } @@ -32,6 +41,26 @@ public sealed class SubdermalImplantSystem : SharedSubdermalImplantSystem args.Handled = true; } + private void OnUplinkInteractUsing(EntityUid uid, StoreComponent store, AfterInteractUsingEvent args) + { + // can only insert into yourself to prevent uplink checking with renault + if (args.Target != args.User) + return; + + if (!TryComp(args.Used, out var currency)) + return; + + // same as store code, but message is only shown to yourself + args.Handled = _store.TryAddCurrency(_store.GetCurrencyValue(args.Used, currency), uid, store); + + if (!args.Handled) + return; + + var msg = Loc.GetString("store-currency-inserted-implant", ("used", args.Used)); + _popup.PopupEntity(msg, args.User, args.User); + QueueDel(args.Used); + } + #region Relays //Relays from the implanted to the implant diff --git a/Content.Server/Store/Systems/StoreSystem.Ui.cs b/Content.Server/Store/Systems/StoreSystem.Ui.cs index 6136a69ec4..2ad246c290 100644 --- a/Content.Server/Store/Systems/StoreSystem.Ui.cs +++ b/Content.Server/Store/Systems/StoreSystem.Ui.cs @@ -1,6 +1,8 @@ using Content.Server.Actions; using Content.Server.Administration.Logs; +using Content.Server.Stack; using Content.Server.Store.Components; +using Content.Server.UserInterface; using Content.Shared.Actions.ActionTypes; using Content.Shared.FixedPoint; using Content.Shared.Hands.EntitySystems; @@ -8,8 +10,6 @@ using Content.Shared.Store; using Content.Shared.Database; using Robust.Server.GameObjects; using System.Linq; -using Content.Server.Stack; -using Content.Server.UserInterface; namespace Content.Server.Store.Systems; diff --git a/Content.Server/Store/Systems/StoreSystem.cs b/Content.Server/Store/Systems/StoreSystem.cs index 16a3207cc8..d596f6ac4c 100644 --- a/Content.Server/Store/Systems/StoreSystem.cs +++ b/Content.Server/Store/Systems/StoreSystem.cs @@ -2,6 +2,7 @@ using Content.Server.Mind.Components; using Content.Server.Store.Components; using Content.Server.UserInterface; using Content.Shared.FixedPoint; +using Content.Shared.Implants.Components; using Content.Shared.Interaction; using Content.Shared.Popups; using Content.Shared.Stacks; @@ -32,6 +33,7 @@ public sealed partial class StoreSystem : EntitySystem SubscribeLocalEvent(OnMapInit); SubscribeLocalEvent(OnStartup); SubscribeLocalEvent(OnShutdown); + SubscribeLocalEvent(OnImplantActivate); InitializeUi(); InitializeCommand(); @@ -85,6 +87,11 @@ public sealed partial class StoreSystem : EntitySystem } } + private void OnImplantActivate(EntityUid uid, StoreComponent component, OpenUplinkImplantEvent args) + { + ToggleUi(args.Performer, uid, component); + } + /// /// Gets the value from an entity's currency component. /// Scales with stacks. diff --git a/Content.Shared/Implants/Components/SubdermalImplantComponent.cs b/Content.Shared/Implants/Components/SubdermalImplantComponent.cs index 5a974d05db..ea0b07001d 100644 --- a/Content.Shared/Implants/Components/SubdermalImplantComponent.cs +++ b/Content.Shared/Implants/Components/SubdermalImplantComponent.cs @@ -51,3 +51,11 @@ public sealed class ActivateImplantEvent : InstantActionEvent { } + +/// +/// Used for opening the uplink implant via action. +/// +public sealed class OpenUplinkImplantEvent : InstantActionEvent +{ + +} diff --git a/Resources/Locale/en-US/implant/implant.ftl b/Resources/Locale/en-US/implant/implant.ftl index f2b8b12753..8678f4d026 100644 --- a/Resources/Locale/en-US/implant/implant.ftl +++ b/Resources/Locale/en-US/implant/implant.ftl @@ -23,3 +23,6 @@ activate-micro-bomb-action-description = Activates your internal microbomb, comp use-freedom-implant-action-name = Break Free use-freedom-implant-action-description = Activating your freedom implant will free you from any hand restraints + +open-uplink-implant-action-name = Open Uplink +open-uplink-implant-action-description = Opens the syndicate uplink embedded under your skin diff --git a/Resources/Locale/en-US/store/currency.ftl b/Resources/Locale/en-US/store/currency.ftl index a5843a84e5..d3018a84d1 100644 --- a/Resources/Locale/en-US/store/currency.ftl +++ b/Resources/Locale/en-US/store/currency.ftl @@ -1,4 +1,5 @@ store-currency-inserted = {CAPITALIZE(THE($used))} is inserted into the {THE($target)}. +store-currency-inserted-implant = {CAPITALIZE(THE($used))} is inserted into your implant. store-currency-free = Free store-currency-display-debugdollar = {$amount -> @@ -6,4 +7,4 @@ store-currency-display-debugdollar = {$amount -> *[other] Debug Dollars } store-currency-display-telecrystal = TC -store-currency-display-stolen-essence = Stolen Essence \ No newline at end of file +store-currency-display-stolen-essence = Stolen Essence diff --git a/Resources/Locale/en-US/store/uplink-catalog.ftl b/Resources/Locale/en-US/store/uplink-catalog.ftl index 807d48d2ff..02d9b6b312 100644 --- a/Resources/Locale/en-US/store/uplink-catalog.ftl +++ b/Resources/Locale/en-US/store/uplink-catalog.ftl @@ -106,6 +106,9 @@ uplink-freedom-implanter-desc = Get away from those nasty sec officers with this uplink-macro-bomb-implanter-name = Macro Bomb Implanter uplink-macro-bomb-implanter-desc = Inject this and on death you'll create a large explosion. Huge team casualty cost, use at own risk. Replaces internal micro bomb. +uplink-uplink-implanter-name = Uplink Implanter +uplink-uplink-implanter-desc = Stealthily order equipment without the need for a PDA. Swallow telecrystals to top up the uplink. + # Bundles uplink-c20r-bundle-name = C-20r Bundle uplink-c20r-bundle-desc = Old faithful: The classic C-20r Submachine Gun, bundled with three magazines. diff --git a/Resources/Prototypes/Actions/types.yml b/Resources/Prototypes/Actions/types.yml index 50817c5c5e..30e4a61c93 100644 --- a/Resources/Prototypes/Actions/types.yml +++ b/Resources/Prototypes/Actions/types.yml @@ -58,6 +58,17 @@ state: freedom event: !type:UseFreedomImplantEvent +- type: instantAction + id: OpenUplinkImplant + name: open-uplink-implant-action-name + description: open-uplink-implant-action-description + itemIconStyle: BigAction + priority: -20 + icon: + sprite: Objects/Devices/communication.rsi + state: old-radio + event: !type:OpenUplinkImplantEvent + - type: instantAction id: ToggleSuitHelmet name: action-name-hardsuit diff --git a/Resources/Prototypes/Catalog/uplink_catalog.yml b/Resources/Prototypes/Catalog/uplink_catalog.yml index f3bf002909..c5bee69643 100644 --- a/Resources/Prototypes/Catalog/uplink_catalog.yml +++ b/Resources/Prototypes/Catalog/uplink_catalog.yml @@ -397,6 +397,17 @@ components: - SurplusBundle +- type: listing + id: UplinkUplinkImplanter # uplink uplink real + name: uplink-uplink-implanter-name + description: uplink-uplink-implanter-desc + icon: { sprite: /Textures/Objects/Devices/communication.rsi, state: old-radio } + productEntity: UplinkImplanter + cost: + Telecrystal: 4 + categories: + - UplinkImplants + # Bundles - type: listing diff --git a/Resources/Prototypes/Entities/Objects/Misc/implanters.yml b/Resources/Prototypes/Entities/Objects/Misc/implanters.yml index c240be2b51..5a24c93c71 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/implanters.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/implanters.yml @@ -125,6 +125,15 @@ - type: Implanter implant: FreedomImplant +- type: entity + id: UplinkImplanter + name: uplink implanter + description: a single use implanter, the implant lets the user access a syndicate uplink at will + parent: BaseImplantOnlyImplanter + components: + - type: Implanter + implant: UplinkImplant + #Nuclear Operative/Special implanters - type: entity diff --git a/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml b/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml index ee4ffd49b7..edd208b232 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml @@ -113,6 +113,24 @@ - type: SubdermalImplant implantAction: ActivateFreedomImplant +- type: entity + parent: BaseSubdermalImplant + id: UplinkImplant + name: uplink implant + description: allows the user to open a hidden uplink at will + noSpawn: true + components: + - type: SubdermalImplant + implantAction: OpenUplinkImplant + - type: Store + preset: StorePresetUplink + balance: + Telecrystal: 0 + - type: UserInterface + interfaces: + - key: enum.StoreUiKey.Key + type: StoreBoundUserInterface + #Nuclear Operative/Special Exclusive implants - type: entity