Transfer verb: drop the redundant pre-check, let range, step length and quantity edges show in tests

TryStore already takes all of a part or none, so the pre-check in TryTransferItem changed nothing observable.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-10-22 18:22:43 +02:00
commit 70aa1ed037
3 changed files with 62 additions and 12 deletions

View file

@ -2664,17 +2664,13 @@ public class EquippedCargoBay : EquippedItem
return false;
}
// Whole or nothing: the target must be able to take the part before it leaves the stack.
var part = new SimpleCommodity { Data = item.Data, Quantity = min(quantity, item.Quantity), Rotation = item.Rotation };
if (!target.TryFindSpace(part, out _)) return false;
var oldPos = Cargo[item];
var newItem = Remove(item, quantity);
// The part removed goes across, never the stack left behind.
if (target.TryStore(newItem)) return true;
// The target refused after all: put the part back where it came from.
// Whole or nothing: TryStore takes all of the part or none of it, so a refusal puts the part back where it came from.
TryStore(newItem, oldPos);
return false;
}