the boxening (#22643)

This commit is contained in:
Ilya246
2023-12-17 13:55:40 +04:00
committed by GitHub
parent b6fe072c33
commit 6c688a53dc

View File

@@ -1,5 +1,6 @@
using Content.Server.Storage.Components;
using Content.Server.Storage.EntitySystems;
using Content.Shared.Access.Components;
using Content.Shared.CardboardBox;
using Content.Shared.CardboardBox.Components;
using Content.Shared.Damage;
@@ -33,6 +34,7 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
SubscribeLocalEvent<CardboardBoxComponent, StorageAfterOpenEvent>(AfterStorageOpen);
SubscribeLocalEvent<CardboardBoxComponent, StorageBeforeOpenEvent>(BeforeStorageOpen);
SubscribeLocalEvent<CardboardBoxComponent, StorageAfterCloseEvent>(AfterStorageClosed);
SubscribeLocalEvent<CardboardBoxComponent, GetAdditionalAccessEvent>(OnGetAdditionalAccess);
SubscribeLocalEvent<CardboardBoxComponent, ActivateInWorldEvent>(OnInteracted);
SubscribeLocalEvent<CardboardBoxComponent, InteractedNoHandEvent>(OnNoHandInteracted);
SubscribeLocalEvent<CardboardBoxComponent, EntInsertedIntoContainerMessage>(OnEntInserted);
@@ -65,6 +67,13 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
_storage.OpenStorage(uid);
}
private void OnGetAdditionalAccess(EntityUid uid, CardboardBoxComponent component, ref GetAdditionalAccessEvent args)
{
if (component.Mover == null)
return;
args.Entities.Add(component.Mover.Value);
}
private void BeforeStorageOpen(EntityUid uid, CardboardBoxComponent component, ref StorageBeforeOpenEvent args)
{
if (component.Quiet)