Files
wwdpublic/Content.Shared/_Goobstation/Wires/Systems/RequirePanelSystem.cs
ilmenwe bfe577b9c7 Unused Varibles and Localization Fixes (#2424)
Removed all unused variables i could find, built and tested on a simple
upstart and clicking trough most systems.
Change Loc references to localization.

<!--
This is default collapsed, readers click to expand it and see all your
media
The PR media section can get very large at times, so this is a good way
to keep it clean
The title is written using HTML tags
The title must be within the <summary> tags or you won't see it
-->

<details><summary><h1>Media</h1></summary>
<p>

"using Robust.Shared.Prototypes;"
to
""

"[dependency] private readonly ISpriteComponent"
to
""

</p>
</details>

---

No CL this isn't player facing.

---------

Co-authored-by: ilmenwe <no@mail.com>
2025-07-12 02:20:02 +10:00

36 lines
1.4 KiB
C#

using Content.Shared._Goobstation.Wires.Components;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Wires;
namespace Content.Shared._Goobstation.Wires.Systems;
public sealed partial class RequirePanelSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ItemSlotsRequirePanelComponent, ItemSlotInsertAttemptEvent>(ItemSlotInsertAttempt);
SubscribeLocalEvent<ItemSlotsRequirePanelComponent, ItemSlotEjectAttemptEvent>(ItemSlotEjectAttempt);
}
private void ItemSlotInsertAttempt(Entity<ItemSlotsRequirePanelComponent> entity, ref ItemSlotInsertAttemptEvent args)
=> args.Cancelled = !CheckPanelStateForItemSlot(entity, args.Slot.ID);
private void ItemSlotEjectAttempt(Entity<ItemSlotsRequirePanelComponent> entity, ref ItemSlotEjectAttemptEvent args)
=> args.Cancelled = !CheckPanelStateForItemSlot(entity, args.Slot.ID);
public bool CheckPanelStateForItemSlot(Entity<ItemSlotsRequirePanelComponent> entity, string? slot)
{
var (uid, comp) = entity;
if (slot == null
// If slot doesn't require a wire panel - don't cancel interaction
|| !comp.Slots.TryGetValue(slot, out var isRequireOpen)
|| !TryComp<WiresPanelComponent>(uid, out var wiresPanel))
return false;
return wiresPanel.Open == isRequireOpen;
}
}