Files
crystall-punk-14/Content.Server/Materials/MaterialStorageSystem.cs

28 lines
1.1 KiB
C#
Raw Normal View History

using Content.Shared.Materials;
using Content.Shared.Popups;
using Robust.Shared.Player;
namespace Content.Server.Materials;
/// <summary>
/// This handles <see cref="SharedMaterialStorageSystem"/>
/// </summary>
public sealed class MaterialStorageSystem : SharedMaterialStorageSystem
{
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
2022-10-09 14:16:10 -04:00
public override bool TryInsertMaterialEntity(EntityUid user, EntityUid toInsert, EntityUid receiver, MaterialStorageComponent? component = null)
{
2022-10-09 14:16:10 -04:00
if (!Resolve(receiver, ref component))
return false;
if (!base.TryInsertMaterialEntity(user, toInsert, receiver, component))
return false;
_audio.PlayPvs(component.InsertingSound, component.Owner);
2022-10-09 14:16:10 -04:00
_popup.PopupEntity(Loc.GetString("machine-insert-item", ("user", user), ("machine", component.Owner),
("item", toInsert)), component.Owner, Filter.Pvs(component.Owner));
QueueDel(toInsert);
2022-10-09 14:16:10 -04:00
return true;
}
}