From 89667ca4e765c108e05b0e934351a01e66336cf7 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 14 Sep 2026 22:29:58 +0200 Subject: [PATCH] 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 --- Assets/Scripts/UI/Menu/InventoryPanel.cs | 26 +++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Assets/Scripts/UI/Menu/InventoryPanel.cs b/Assets/Scripts/UI/Menu/InventoryPanel.cs index 1112326bc..8454b47eb 100644 --- a/Assets/Scripts/UI/Menu/InventoryPanel.cs +++ b/Assets/Scripts/UI/Menu/InventoryPanel.cs @@ -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().ToArray(); if (GameManager.DockedEntity != null && loadouts.Any())