Add a component that inserts the held item when no interaction happens on the stored item (#29823)
* Insert when held item has no interaction with stored item * Decouple inserting on failure * Add component that stores the used entity when no interaction happened * Add prediction
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using Content.Shared.Storage.Components;
|
||||
using Content.Shared.Storage.Events;
|
||||
|
||||
namespace Content.Shared.Storage.EntitySystems;
|
||||
|
||||
public sealed class StoreAfterFailedInteractSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedStorageSystem _storage = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<StoreAfterFailedInteractComponent, StorageInsertFailedEvent>(OnStorageInsertFailed);
|
||||
}
|
||||
|
||||
private void OnStorageInsertFailed(Entity<StoreAfterFailedInteractComponent> ent, ref StorageInsertFailedEvent args)
|
||||
{
|
||||
_storage.PlayerInsertHeldEntity(args.Storage, args.Player);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user