diff --git a/Content.Client/Materials/MaterialStorageSystem.cs b/Content.Client/Materials/MaterialStorageSystem.cs
index 352de1a3ce..27568f4c14 100644
--- a/Content.Client/Materials/MaterialStorageSystem.cs
+++ b/Content.Client/Materials/MaterialStorageSystem.cs
@@ -9,8 +9,12 @@ namespace Content.Client.Materials;
public sealed class MaterialStorageSystem : SharedMaterialStorageSystem
{
[Dependency] private readonly TransformSystem _transform = default!;
- protected override void OnFinishInsertMaterialEntity(EntityUid toInsert, MaterialStorageComponent component)
+
+ public override bool TryInsertMaterialEntity(EntityUid user, EntityUid toInsert, EntityUid receiver, MaterialStorageComponent? component = null)
{
+ if (!base.TryInsertMaterialEntity(user, toInsert, receiver, component))
+ return false;
_transform.DetachParentToNull(Transform(toInsert));
+ return true;
}
}
diff --git a/Content.Server/Materials/MaterialStorageSystem.cs b/Content.Server/Materials/MaterialStorageSystem.cs
index 8487995278..8764ff9f77 100644
--- a/Content.Server/Materials/MaterialStorageSystem.cs
+++ b/Content.Server/Materials/MaterialStorageSystem.cs
@@ -12,12 +12,16 @@ public sealed class MaterialStorageSystem : SharedMaterialStorageSystem
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
- protected override void OnFinishInsertMaterialEntity(EntityUid toInsert, MaterialStorageComponent component)
+ public override bool TryInsertMaterialEntity(EntityUid user, EntityUid toInsert, EntityUid receiver, MaterialStorageComponent? component = null)
{
+ if (!Resolve(receiver, ref component))
+ return false;
+ if (!base.TryInsertMaterialEntity(user, toInsert, receiver, component))
+ return false;
_audio.PlayPvs(component.InsertingSound, component.Owner);
- _popup.PopupEntity(Loc.GetString("machine-insert-item", ("machine", component.Owner),
+ _popup.PopupEntity(Loc.GetString("machine-insert-item", ("user", user), ("machine", component.Owner),
("item", toInsert)), component.Owner, Filter.Pvs(component.Owner));
-
QueueDel(toInsert);
+ return true;
}
}
diff --git a/Content.Shared/Materials/SharedMaterialStorageSystem.cs b/Content.Shared/Materials/SharedMaterialStorageSystem.cs
index 6d41afd1fa..3a02410d6f 100644
--- a/Content.Shared/Materials/SharedMaterialStorageSystem.cs
+++ b/Content.Shared/Materials/SharedMaterialStorageSystem.cs
@@ -136,11 +136,12 @@ public abstract class SharedMaterialStorageSystem : EntitySystem
///
/// Tries to insert an entity into the material storage.
///
+ ///
///
///
///
/// If it was successful
- public bool TryInsertMaterialEntity(EntityUid toInsert, EntityUid receiver, MaterialStorageComponent? component = null)
+ public virtual bool TryInsertMaterialEntity(EntityUid user, EntityUid toInsert, EntityUid receiver, MaterialStorageComponent? component = null)
{
if (!Resolve(receiver, ref component))
return false;
@@ -182,7 +183,6 @@ public abstract class SharedMaterialStorageSystem : EntitySystem
TryChangeMaterialAmount(receiver, mat, vol * multiplier, component);
}
- OnFinishInsertMaterialEntity(toInsert, component);
RaiseLocalEvent(component.Owner, new MaterialEntityInsertedEvent(material._materials));
return true;
}
@@ -203,16 +203,10 @@ public abstract class SharedMaterialStorageSystem : EntitySystem
Dirty(component);
}
- ///
- /// This is done because of popup spam and not being able
- /// to do entity deletion clientside.
- ///
- protected abstract void OnFinishInsertMaterialEntity(EntityUid toInsert, MaterialStorageComponent component);
-
private void OnInteractUsing(EntityUid uid, MaterialStorageComponent component, InteractUsingEvent args)
{
if (args.Handled)
return;
- args.Handled = TryInsertMaterialEntity(args.Used, uid, component);
+ args.Handled = TryInsertMaterialEntity(args.User, args.Used, uid, component);
}
}
diff --git a/Resources/Locale/en-US/machine/machine.ftl b/Resources/Locale/en-US/machine/machine.ftl
index b6bf7862cf..858eab4f82 100644
--- a/Resources/Locale/en-US/machine/machine.ftl
+++ b/Resources/Locale/en-US/machine/machine.ftl
@@ -1 +1 @@
-machine-insert-item = You insert {THE($item)} into {THE($machine)}.
+machine-insert-item = {THE($user)} inserted {THE($item)} into {THE($machine)}.