]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add uplink implant (#15728)
authordeltanedas <39013340+deltanedas@users.noreply.github.com>
Sat, 29 Apr 2023 09:07:50 +0000 (09:07 +0000)
committerGitHub <noreply@github.com>
Sat, 29 Apr 2023 09:07:50 +0000 (19:07 +1000)
Co-authored-by: deltanedas <@deltanedas:kde.org>
12 files changed:
Content.Server/GameTicking/Rules/TraitorRuleSystem.cs
Content.Server/Implants/SubdermalImplantSystem.cs
Content.Server/Store/Systems/StoreSystem.Ui.cs
Content.Server/Store/Systems/StoreSystem.cs
Content.Shared/Implants/Components/SubdermalImplantComponent.cs
Resources/Locale/en-US/implant/implant.ftl
Resources/Locale/en-US/store/currency.ftl
Resources/Locale/en-US/store/uplink-catalog.ftl
Resources/Prototypes/Actions/types.yml
Resources/Prototypes/Catalog/uplink_catalog.yml
Resources/Prototypes/Entities/Objects/Misc/implanters.yml
Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml

index 8fe483452ae61ff80bd4d9efa16e04bf5ed9a80f..0c93e0e2679ba246d69d9397e0fc0bc073c041d5 100644 (file)
@@ -210,8 +210,9 @@ public sealed class TraitorRuleSystem : GameRuleSystem<TraitorRuleComponent>
         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<TraitorRuleComponent>(ruleEntity);
+            traitorRule = Comp<TraitorRuleComponent>(ruleEntity);
         }
 
         var mind = traitor.Data.ContentData()?.Mind;
index 71c5e567cc3e47ef8210f668bda4ee383f67de75..7abafec0f6a1b958dd8a44956e2daa5313185dbf 100644 (file)
@@ -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<SubdermalImplantComponent, UseFreedomImplantEvent>(OnFreedomImplant);
 
+        SubscribeLocalEvent<StoreComponent, AfterInteractUsingEvent>(OnUplinkInteractUsing);
+
         SubscribeLocalEvent<ImplantedComponent, MobStateChangedEvent>(RelayToImplantEvent);
+        SubscribeLocalEvent<ImplantedComponent, AfterInteractUsingEvent>(RelayToImplantEvent);
         SubscribeLocalEvent<ImplantedComponent, SuicideEvent>(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<CurrencyComponent>(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
index 6136a69ec45329926fc917e56b2688a542c543eb..2ad246c290be4a3fb6989ecaa6c59f419fb664bc 100644 (file)
@@ -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;
 
index 16a3207cc874e99ba231c2b23622d8ebf3b2e48f..d596f6ac4c5198929ff2a613730eea2ef68cc76f 100644 (file)
@@ -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<StoreComponent, MapInitEvent>(OnMapInit);
         SubscribeLocalEvent<StoreComponent, ComponentStartup>(OnStartup);
         SubscribeLocalEvent<StoreComponent, ComponentShutdown>(OnShutdown);
+        SubscribeLocalEvent<StoreComponent, OpenUplinkImplantEvent>(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);
+    }
+
     /// <summary>
     /// Gets the value from an entity's currency component.
     /// Scales with stacks.
index 5a974d05db1e49b9decf665561fb282016ab34b7..ea0b07001d018c2933da56dbfd06c47d9a16b575 100644 (file)
@@ -51,3 +51,11 @@ public sealed class ActivateImplantEvent : InstantActionEvent
 {
 
 }
+
+/// <summary>
+/// Used for opening the uplink implant via action.
+/// </summary>
+public sealed class OpenUplinkImplantEvent : InstantActionEvent
+{
+
+}
index f2b8b1275351422f797f3a1d48c5d1e6c191252a..8678f4d0263187d9a293e39325292b71b97bee2d 100644 (file)
@@ -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
index a5843a84e552d3f3ee1d8248fe4b0dcf5789640c..d3018a84d15771b597327ffe570de3bb9c36f499 100644 (file)
@@ -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
index 807d48d2ff599f62bcc4bb27510050cd090f759d..02d9b6b31253f19c9dc7aaa8c5a39816293311ef 100644 (file)
@@ -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.
index 50817c5c5e3170dab79e5d8dae37b8c15aaad826..30e4a61c93eecee45972c4c548fe219d980ba2a9 100644 (file)
     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
index f3bf002909ca7263bf063efd0ed61dde55bebc25..c5bee69643604fdfcfc3f243ff464ddfb376748b 100644 (file)
         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
index c240be2b51f481507f2e0793a8af17c8d4543f16..5a24c93c71167e9fa0becd143ddcf07c75554e9d 100644 (file)
     - 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
index ee4ffd49b7f34f975f83b691d36479e56025bb27..edd208b2329600d187328e3a97c497063880376d 100644 (file)
     - 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