Fix storage area pickup sound playing multiple times (#32397)

This commit is contained in:
metalgearsloth
2024-09-27 17:09:17 +10:00
committed by GitHub
parent bee66eddef
commit f46f5e2835

View File

@@ -547,7 +547,7 @@ public abstract class SharedStorageSystem : EntitySystem
var angle = targetXform.LocalRotation; var angle = targetXform.LocalRotation;
if (PlayerInsertEntityInWorld((uid, component), args.Args.User, entity)) if (PlayerInsertEntityInWorld((uid, component), args.Args.User, entity, playSound: false))
{ {
successfullyInserted.Add(entity); successfullyInserted.Add(entity);
successfullyInsertedPositions.Add(position); successfullyInsertedPositions.Add(position);
@@ -1040,12 +1040,12 @@ public abstract class SharedStorageSystem : EntitySystem
/// <param name="player">The player to insert an entity with</param> /// <param name="player">The player to insert an entity with</param>
/// <param name="toInsert"></param> /// <param name="toInsert"></param>
/// <returns>true if inserted, false otherwise</returns> /// <returns>true if inserted, false otherwise</returns>
public bool PlayerInsertEntityInWorld(Entity<StorageComponent?> uid, EntityUid player, EntityUid toInsert) public bool PlayerInsertEntityInWorld(Entity<StorageComponent?> uid, EntityUid player, EntityUid toInsert, bool playSound = true)
{ {
if (!Resolve(uid, ref uid.Comp) || !_interactionSystem.InRangeUnobstructed(player, uid.Owner)) if (!Resolve(uid, ref uid.Comp) || !_interactionSystem.InRangeUnobstructed(player, uid.Owner))
return false; return false;
if (!Insert(uid, toInsert, out _, user: player, uid.Comp)) if (!Insert(uid, toInsert, out _, user: player, uid.Comp, playSound: playSound))
{ {
_popupSystem.PopupClient(Loc.GetString("comp-storage-cant-insert"), uid, player); _popupSystem.PopupClient(Loc.GetString("comp-storage-cant-insert"), uid, player);
return false; return false;