Files
Delta-v/Content.Client/_NF/Interaction/Systems/HandPlaceholderVisualsSystem.cs
0f3edc0b39 port better borgs from frontier (#3110)
* BetterBorgs: droppable, swappable cyborg item interactions (#2766)

* WIP: droppable, swappable, insertable cyborg items

* Half-baked borg HandPlaceholderComponent

* cyborg: sprite representation for empty slots

* nullable prototype

---------

Co-authored-by: Dvir <39403717+dvir001@users.noreply.github.com>

* BorgSystem: check droppable items for duped mods (#2887)

* BorgSystem: check droppable items for duped mods

* Cache item comparer

* BorgSystem: Unremoveable after equip (#2854)

* raise interaction events to add fibers to things

---------

Co-authored-by: Whatstone <166147148+whatston3@users.noreply.github.com>
Co-authored-by: Dvir <39403717+dvir001@users.noreply.github.com>
Co-authored-by: deltanedas <@deltanedas:kde.org>
2025-03-04 12:10:32 +00:00

48 lines
1.6 KiB
C#

using Content.Client._NF.Hands.UI;
using Content.Client.Items;
using Content.Client.Items.Systems;
using Content.Shared._NF.Interaction.Components;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
namespace Content.Client._NF.Interaction.Systems;
/// <summary>
/// Handles interactions with items that spawn HandPlaceholder items.
/// </summary>
[UsedImplicitly]
public sealed partial class HandPlaceholderVisualsSystem : EntitySystem
{
[Dependency] ContainerSystem _container = default!;
[Dependency] ItemSystem _item = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<HandPlaceholderComponent, AfterAutoHandleStateEvent>(OnAfterAutoHandleState);
SubscribeLocalEvent<HandPlaceholderVisualsComponent, ComponentRemove>(PlaceholderRemove);
Subs.ItemStatus<HandPlaceholderVisualsComponent>(_ => new HandPlaceholderStatus());
}
private void OnAfterAutoHandleState(Entity<HandPlaceholderComponent> ent, ref AfterAutoHandleStateEvent args)
{
if (!TryComp(ent, out HandPlaceholderVisualsComponent? placeholder))
return;
if (placeholder.Dummy != EntityUid.Invalid)
QueueDel(placeholder.Dummy);
placeholder.Dummy = Spawn(ent.Comp.Prototype);
if (_container.IsEntityInContainer(ent))
_item.VisualsChanged(ent);
}
private void PlaceholderRemove(Entity<HandPlaceholderVisualsComponent> ent, ref ComponentRemove args)
{
if (ent.Comp.Dummy != EntityUid.Invalid)
QueueDel(ent.Comp.Dummy);
}
}