ItemToggle + slots stuff (#31312)
* ItemToggle + slots stuff - Add component for itemslot locks to match LockComponent (surprised this didn't exist). - Add thing for pointlight to match itemtoggle. In future should be used for PDAs and stuff but need to fix some other stuff first. * Also this * grill
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.Power.Components;
|
||||
|
||||
namespace Content.Shared.Power.EntitySystems;
|
||||
|
||||
public sealed class ItemSlotRequiresPowerSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user