Don't show item dropping popup when wielding. (#40032)

silence
This commit is contained in:
slarticodefast
2025-09-03 13:09:40 +02:00
committed by GitHub
parent c709d4d55c
commit 69b3df03d8
2 changed files with 7 additions and 5 deletions

View File

@@ -103,13 +103,14 @@ public abstract class SharedVirtualItemSystem : EntitySystem
/// <param name="blockingEnt">The entity we will make a virtual entity copy of</param> /// <param name="blockingEnt">The entity we will make a virtual entity copy of</param>
/// <param name="user">The entity that we want to insert the virtual entity</param> /// <param name="user">The entity that we want to insert the virtual entity</param>
/// <param name="dropOthers">Whether or not to try and drop other items to make space</param> /// <param name="dropOthers">Whether or not to try and drop other items to make space</param>
public bool TrySpawnVirtualItemInHand(EntityUid blockingEnt, EntityUid user, bool dropOthers = false) /// <param name="silent">If true this won't show a popup when dropping other items</param>
public bool TrySpawnVirtualItemInHand(EntityUid blockingEnt, EntityUid user, bool dropOthers = false, bool silent = false)
{ {
return TrySpawnVirtualItemInHand(blockingEnt, user, out _, dropOthers); return TrySpawnVirtualItemInHand(blockingEnt, user, out _, dropOthers, silent: silent);
} }
/// <inheritdoc cref="TrySpawnVirtualItemInHand(Robust.Shared.GameObjects.EntityUid,Robust.Shared.GameObjects.EntityUid,bool)"/> /// <inheritdoc cref="TrySpawnVirtualItemInHand(Robust.Shared.GameObjects.EntityUid,Robust.Shared.GameObjects.EntityUid,bool)"/>
public bool TrySpawnVirtualItemInHand(EntityUid blockingEnt, EntityUid user, [NotNullWhen(true)] out EntityUid? virtualItem, bool dropOthers = false, string? empty = null) public bool TrySpawnVirtualItemInHand(EntityUid blockingEnt, EntityUid user, [NotNullWhen(true)] out EntityUid? virtualItem, bool dropOthers = false, string? empty = null, bool silent = false)
{ {
virtualItem = null; virtualItem = null;
if (empty == null && !_handsSystem.TryGetEmptyHand(user, out empty)) if (empty == null && !_handsSystem.TryGetEmptyHand(user, out empty))
@@ -128,7 +129,7 @@ public abstract class SharedVirtualItemSystem : EntitySystem
if (!_handsSystem.TryDrop(user, hand)) if (!_handsSystem.TryDrop(user, hand))
continue; continue;
if (!TerminatingOrDeleted(held)) if (!silent && !TerminatingOrDeleted(held))
_popup.PopupClient(Loc.GetString("virtual-item-dropped-other", ("dropped", held)), user, user); _popup.PopupClient(Loc.GetString("virtual-item-dropped-other", ("dropped", held)), user, user);
empty = hand; empty = hand;

View File

@@ -314,7 +314,8 @@ public abstract class SharedWieldableSystem : EntitySystem
var virtuals = new ValueList<EntityUid>(); var virtuals = new ValueList<EntityUid>();
for (var i = 0; i < component.FreeHandsRequired; i++) for (var i = 0; i < component.FreeHandsRequired; i++)
{ {
if (_virtualItem.TrySpawnVirtualItemInHand(used, user, out var virtualItem, true)) // don't show a popup when dropping items because it will overlap with the popup for wielding
if (_virtualItem.TrySpawnVirtualItemInHand(used, user, out var virtualItem, true, silent: true))
{ {
virtuals.Add(virtualItem.Value); virtuals.Add(virtualItem.Value);
continue; continue;