Offer Save Loadout only for a displayed ship (Cut 10 fix)
The option was added for any displayed entity, stations included, and a null displayed entity threw when chosen. It is now added only when the displayed entity is a Ship, the same conditional shape as the Restore Loadout guard. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
61fc863e6b
commit
89667ca4e7
1 changed files with 14 additions and 12 deletions
|
|
@ -167,18 +167,20 @@ public class InventoryPanel : MonoBehaviour, IPointerClickHandler
|
|||
if(GameManager.DockingBay!=null && _displayedCargo!=GameManager.DockingBay)
|
||||
ContextMenu.AddOption(GameManager.DockingBay.Name, () => Display(GameManager.DockingBay));
|
||||
|
||||
ContextMenu.AddOption("Save Loadout",
|
||||
() =>
|
||||
{
|
||||
var entity = _displayedEntity;
|
||||
var loadoutName = entity.Name;
|
||||
Dialog.Clear();
|
||||
Dialog.Title.text = "Save Loadout";
|
||||
Dialog.AddField("Name", () => loadoutName, s => loadoutName = s);
|
||||
Dialog.Show(() => Loadouts.Save(ActionGameManager.CultCache,
|
||||
Loadouts.Capture(GameManager.ItemManager, entity, loadoutName)));
|
||||
Dialog.MoveToCursor();
|
||||
});
|
||||
if (_displayedEntity is Ship displayedShip)
|
||||
{
|
||||
ContextMenu.AddOption("Save Loadout",
|
||||
() =>
|
||||
{
|
||||
var loadoutName = displayedShip.Name;
|
||||
Dialog.Clear();
|
||||
Dialog.Title.text = "Save Loadout";
|
||||
Dialog.AddField("Name", () => loadoutName, s => loadoutName = s);
|
||||
Dialog.Show(() => Loadouts.Save(ActionGameManager.CultCache,
|
||||
Loadouts.Capture(GameManager.ItemManager, displayedShip, loadoutName)));
|
||||
Dialog.MoveToCursor();
|
||||
});
|
||||
}
|
||||
|
||||
var loadouts = ActionGameManager.CultCache.GetAll<Loadout>().ToArray();
|
||||
if (GameManager.DockedEntity != null && loadouts.Any())
|
||||
|
|
|
|||
Loading…
Reference in a new issue