Decouple interactions from hands, cleanup old events, add new fears (#28393)
* ok basic shit * second part * pretend it isn't real it can't hurt you. * 👁️ 👁️ * shadowcommander review
This commit is contained in:
@@ -36,7 +36,6 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
|
||||
SubscribeLocalEvent<CardboardBoxComponent, StorageAfterCloseEvent>(AfterStorageClosed);
|
||||
SubscribeLocalEvent<CardboardBoxComponent, GetAdditionalAccessEvent>(OnGetAdditionalAccess);
|
||||
SubscribeLocalEvent<CardboardBoxComponent, ActivateInWorldEvent>(OnInteracted);
|
||||
SubscribeLocalEvent<CardboardBoxComponent, InteractedNoHandEvent>(OnNoHandInteracted);
|
||||
SubscribeLocalEvent<CardboardBoxComponent, EntInsertedIntoContainerMessage>(OnEntInserted);
|
||||
SubscribeLocalEvent<CardboardBoxComponent, EntRemovedFromContainerMessage>(OnEntRemoved);
|
||||
|
||||
@@ -45,9 +44,18 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
|
||||
|
||||
private void OnInteracted(EntityUid uid, CardboardBoxComponent component, ActivateInWorldEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
if (!TryComp<EntityStorageComponent>(uid, out var box))
|
||||
return;
|
||||
|
||||
if (!args.Complex)
|
||||
{
|
||||
if (box.Open || !box.Contents.Contains(args.User))
|
||||
return;
|
||||
}
|
||||
|
||||
args.Handled = true;
|
||||
_storage.ToggleOpen(args.User, uid, box);
|
||||
|
||||
@@ -58,15 +66,6 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem
|
||||
}
|
||||
}
|
||||
|
||||
private void OnNoHandInteracted(EntityUid uid, CardboardBoxComponent component, InteractedNoHandEvent args)
|
||||
{
|
||||
//Free the mice please
|
||||
if (!TryComp<EntityStorageComponent>(uid, out var box) || box.Open || !box.Contents.Contains(args.User))
|
||||
return;
|
||||
|
||||
_storage.OpenStorage(uid);
|
||||
}
|
||||
|
||||
private void OnGetAdditionalAccess(EntityUid uid, CardboardBoxComponent component, ref GetAdditionalAccessEvent args)
|
||||
{
|
||||
if (component.Mover == null)
|
||||
|
||||
Reference in New Issue
Block a user