Add uplink implant (#15728)

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-04-29 09:07:50 +00:00
committed by GitHub
parent 3e2ffcc02d
commit 2eaec2d528
12 changed files with 105 additions and 4 deletions

View File

@@ -210,8 +210,9 @@ public sealed class TraitorRuleSystem : GameRuleSystem<TraitorRuleComponent>
if (traitorRule == null) if (traitorRule == null)
{ {
//todo fuck me this shit is awful //todo fuck me this shit is awful
//no i wont fuck you, erp is against rules
GameTicker.StartGameRule("Traitor", out var ruleEntity); GameTicker.StartGameRule("Traitor", out var ruleEntity);
traitorRule = EntityManager.GetComponent<TraitorRuleComponent>(ruleEntity); traitorRule = Comp<TraitorRuleComponent>(ruleEntity);
} }
var mind = traitor.Data.ContentData()?.Mind; var mind = traitor.Data.ContentData()?.Mind;

View File

@@ -1,9 +1,13 @@
using Content.Server.Cuffs; using Content.Server.Cuffs;
using Content.Server.Store.Components;
using Content.Server.Store.Systems;
using Content.Shared.Cuffs.Components; using Content.Shared.Cuffs.Components;
using Content.Shared.Implants; using Content.Shared.Implants;
using Content.Shared.Implants.Components; using Content.Shared.Implants.Components;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events; using Content.Shared.Interaction.Events;
using Content.Shared.Mobs; using Content.Shared.Mobs;
using Content.Shared.Popups;
using Robust.Shared.Containers; using Robust.Shared.Containers;
namespace Content.Server.Implants; namespace Content.Server.Implants;
@@ -12,6 +16,8 @@ public sealed class SubdermalImplantSystem : SharedSubdermalImplantSystem
{ {
[Dependency] private readonly CuffableSystem _cuffable = default!; [Dependency] private readonly CuffableSystem _cuffable = default!;
[Dependency] private readonly SharedContainerSystem _container = default!; [Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly StoreSystem _store = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -19,7 +25,10 @@ public sealed class SubdermalImplantSystem : SharedSubdermalImplantSystem
SubscribeLocalEvent<SubdermalImplantComponent, UseFreedomImplantEvent>(OnFreedomImplant); SubscribeLocalEvent<SubdermalImplantComponent, UseFreedomImplantEvent>(OnFreedomImplant);
SubscribeLocalEvent<StoreComponent, AfterInteractUsingEvent>(OnUplinkInteractUsing);
SubscribeLocalEvent<ImplantedComponent, MobStateChangedEvent>(RelayToImplantEvent); SubscribeLocalEvent<ImplantedComponent, MobStateChangedEvent>(RelayToImplantEvent);
SubscribeLocalEvent<ImplantedComponent, AfterInteractUsingEvent>(RelayToImplantEvent);
SubscribeLocalEvent<ImplantedComponent, SuicideEvent>(RelayToImplantEvent); SubscribeLocalEvent<ImplantedComponent, SuicideEvent>(RelayToImplantEvent);
} }
@@ -32,6 +41,26 @@ public sealed class SubdermalImplantSystem : SharedSubdermalImplantSystem
args.Handled = true; 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 #region Relays
//Relays from the implanted to the implant //Relays from the implanted to the implant

View File

@@ -1,6 +1,8 @@
using Content.Server.Actions; using Content.Server.Actions;
using Content.Server.Administration.Logs; using Content.Server.Administration.Logs;
using Content.Server.Stack;
using Content.Server.Store.Components; using Content.Server.Store.Components;
using Content.Server.UserInterface;
using Content.Shared.Actions.ActionTypes; using Content.Shared.Actions.ActionTypes;
using Content.Shared.FixedPoint; using Content.Shared.FixedPoint;
using Content.Shared.Hands.EntitySystems; using Content.Shared.Hands.EntitySystems;
@@ -8,8 +10,6 @@ using Content.Shared.Store;
using Content.Shared.Database; using Content.Shared.Database;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using System.Linq; using System.Linq;
using Content.Server.Stack;
using Content.Server.UserInterface;
namespace Content.Server.Store.Systems; namespace Content.Server.Store.Systems;

View File

@@ -2,6 +2,7 @@ using Content.Server.Mind.Components;
using Content.Server.Store.Components; using Content.Server.Store.Components;
using Content.Server.UserInterface; using Content.Server.UserInterface;
using Content.Shared.FixedPoint; using Content.Shared.FixedPoint;
using Content.Shared.Implants.Components;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using Content.Shared.Popups; using Content.Shared.Popups;
using Content.Shared.Stacks; using Content.Shared.Stacks;
@@ -32,6 +33,7 @@ public sealed partial class StoreSystem : EntitySystem
SubscribeLocalEvent<StoreComponent, MapInitEvent>(OnMapInit); SubscribeLocalEvent<StoreComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<StoreComponent, ComponentStartup>(OnStartup); SubscribeLocalEvent<StoreComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<StoreComponent, ComponentShutdown>(OnShutdown); SubscribeLocalEvent<StoreComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<StoreComponent, OpenUplinkImplantEvent>(OnImplantActivate);
InitializeUi(); InitializeUi();
InitializeCommand(); 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> /// <summary>
/// Gets the value from an entity's currency component. /// Gets the value from an entity's currency component.
/// Scales with stacks. /// Scales with stacks.

View 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
{
}

View 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-name = Break Free
use-freedom-implant-action-description = Activating your freedom implant will free you from any hand restraints 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

View File

@@ -1,4 +1,5 @@
store-currency-inserted = {CAPITALIZE(THE($used))} is inserted into the {THE($target)}. 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-free = Free
store-currency-display-debugdollar = {$amount -> store-currency-display-debugdollar = {$amount ->

View 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-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-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 # Bundles
uplink-c20r-bundle-name = C-20r Bundle uplink-c20r-bundle-name = C-20r Bundle
uplink-c20r-bundle-desc = Old faithful: The classic C-20r Submachine Gun, bundled with three magazines. uplink-c20r-bundle-desc = Old faithful: The classic C-20r Submachine Gun, bundled with three magazines.

View File

@@ -58,6 +58,17 @@
state: freedom state: freedom
event: !type:UseFreedomImplantEvent 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 - type: instantAction
id: ToggleSuitHelmet id: ToggleSuitHelmet
name: action-name-hardsuit name: action-name-hardsuit

View File

@@ -397,6 +397,17 @@
components: components:
- SurplusBundle - 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 # Bundles
- type: listing - type: listing

View File

@@ -125,6 +125,15 @@
- type: Implanter - type: Implanter
implant: FreedomImplant 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 #Nuclear Operative/Special implanters
- type: entity - type: entity

View File

@@ -113,6 +113,24 @@
- type: SubdermalImplant - type: SubdermalImplant
implantAction: ActivateFreedomImplant 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 #Nuclear Operative/Special Exclusive implants
- type: entity - type: entity