Add uplink implant (#15728)
Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user