Decide loadout affordability in Materialize and test weapon-group unequip (Cut 10 fix)

Materialize, which already charges, now also owns affordability: when credits
are below Price it lists "cannot afford <price> credits" and builds nothing.
The restore menu's separate price < Credits check is deleted; the menu still
shows Loadouts.Price and lists Materialize's failures.

Tests: one credit short builds nothing, leaves credits unchanged and lists the
failure. A fixture gun with an InstantWeapon behavior proves TryUnequip removes
the weapon and its item from every weapon group.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-14 22:38:16 +02:00
commit 1cd6170d7a
3 changed files with 45 additions and 6 deletions

View file

@ -189,7 +189,7 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
loadouts.Select<Loadout, (string text, Action action, bool enabled)>(loadout =>
{
var price = Loadouts.Price(GameManager.ItemManager, loadout);
return ($"{loadout.Name} - {price:n0}", () => RestoreLoadout(loadout), price < GameManager.Credits);
return ($"{loadout.Name} - {price:n0}", () => RestoreLoadout(loadout), true);
}));
}