mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* IoC source gen compatibility Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter. * Missed a spot
23 lines
689 B
C#
23 lines
689 B
C#
using Content.Shared.Containers.ItemSlots;
|
|
using Content.Shared.Power.Components;
|
|
|
|
namespace Content.Shared.Power.EntitySystems;
|
|
|
|
public sealed partial class ItemSlotRequiresPowerSystem : EntitySystem
|
|
{
|
|
[Dependency] private SharedPowerReceiverSystem _receiver = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<ItemSlotRequiresPowerComponent, ItemSlotInsertAttemptEvent>(OnInsertAttempt);
|
|
}
|
|
|
|
private void OnInsertAttempt(Entity<ItemSlotRequiresPowerComponent> ent, ref ItemSlotInsertAttemptEvent args)
|
|
{
|
|
if (!_receiver.IsPowered(ent.Owner))
|
|
{
|
|
args.Cancelled = true;
|
|
}
|
|
}
|
|
}
|