Improve stack merging and crafting (#7105)

This commit is contained in:
Leon Friedrich
2022-03-28 17:03:14 +13:00
committed by GitHub
parent 50ea06ba72
commit 51b1535255
6 changed files with 149 additions and 82 deletions

View File

@@ -14,6 +14,7 @@ using Content.Shared.Hands.EntitySystems;
using Content.Shared.Interaction;
using Content.Shared.Inventory;
using Content.Shared.Popups;
using Content.Shared.Stacks;
using Robust.Shared.Containers;
using Robust.Shared.Players;
using Robust.Shared.Timing;
@@ -336,8 +337,12 @@ namespace Content.Server.Construction
}
}
if (await Construct(user, "item_construction", constructionGraph, edge, targetNode) is {Valid: true} item)
_handsSystem.PickupOrDrop(user, item);
if (await Construct(user, "item_construction", constructionGraph, edge, targetNode) is not { Valid: true } item)
return;
// Just in case this is a stack, attempt to merge it. If it isn't a stack, this will just normally pick up
// or drop the item as normal.
_stackSystem.TryMergeToHands(item, user);
}
// LEGACY CODE. See warning at the top of the file!