Give and ItemUsage count a stack's units, not a compound unit as a crafted item

A compound commodity is a CraftedItemInstance, so a give order for a compound stack was clamped to one unit and an item use
removed the whole stack. Both now read ICommodityStack.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-11-27 19:09:19 +01:00
commit 60bd14337d
2 changed files with 5 additions and 7 deletions

View file

@ -45,10 +45,8 @@ public class ItemUsage : Behavior
if (cargo == null) return false;
var item = cargo.ItemsOfType[_data.Item.Key][0];
if (item is SimpleCommodity simpleCommodity)
cargo.Remove(simpleCommodity, 1);
if (item is CraftedItemInstance craftedItemInstance)
cargo.Remove(craftedItemInstance);
// One unit of a stack, or the unit itself.
cargo.Remove(item, 1);
return true;
}