Compound stack sale moves only what the station holds (ruling no-market-absorption)

TrySellPart sells the units the station's bays take and pays for those alone; the rest stays in the seller's hold and the
trade menu says how many sold. Simple goods keep their absorb path until the station-outflow cut. CommodityRecordsTests pins
CompoundCommodityData's one key, MaxStack at 12.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-11-27 19:46:48 +01:00
commit 2a15c2f95c
4 changed files with 77 additions and 29 deletions

View file

@ -296,6 +296,19 @@ public class TradeMenu : MonoBehaviour
private void Sell(ItemInstance item)
{
if (item is CompoundCommodity compound)
{
var offered = compound.Quantity;
var sold = StationServices.TrySellPart(_targetCargo, GameManager.DockedEntity, compound, ref GameManager.Credits);
UpdateCreditsLabel();
Populate();
if (sold == offered) return;
Dialog.Clear();
Dialog.Title.text = $"Sold {sold} of {offered}: Station Cargo Full!";
Dialog.Show();
Dialog.MoveToCursor();
return;
}
if (StationServices.TrySell(_targetCargo, GameManager.DockedEntity, item, ref GameManager.Credits))
{
UpdateCreditsLabel();