Ship S2: the game composes and loads mod ships
Boot opens the derived catalog when GameData/Mods holds packages (ShipModCatalog.ResolveCatalog), preloads each hull's GLB into an assembled inactive prototype (ShipModShips), and LoadEntity clones it when the hull names a Visual. ShipModPlan decides which anchor fills which ShipInstance slot; a ShipModTemplate prefab carries the shared effects. Continue refuses a run that names a design the catalog no longer holds (RunSave.RequireDesigns). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f470c1b775
commit
460bb85ed0
16 changed files with 702 additions and 13 deletions
|
|
@ -289,10 +289,13 @@ public class ZoneRenderer : MonoBehaviour
|
|||
void LoadEntity(Entity entity)
|
||||
{
|
||||
var hullData = ItemManager.GetData(entity.Hull) as HullData;
|
||||
GameObject Body() => hullData.Visual.IsSet()
|
||||
? ShipModShips.Instantiate(hullData, ZoneRoot)
|
||||
: Instantiate(EngineAssets.Load<GameObject>(hullData.Prefab), ZoneRoot);
|
||||
EntityInstance instance;
|
||||
if (entity is Ship)
|
||||
{
|
||||
instance = Instantiate(EngineAssets.Load<GameObject>(hullData.Prefab), ZoneRoot).GetComponent<ShipInstance>();
|
||||
instance = Body().GetComponent<ShipInstance>();
|
||||
if (instance == null)
|
||||
{
|
||||
ItemManager.Log($"Failed to instantiate {hullData.Name} ship with invalid prefab: no ShipInstance component!");
|
||||
|
|
@ -301,7 +304,7 @@ public class ZoneRenderer : MonoBehaviour
|
|||
}
|
||||
else
|
||||
{
|
||||
instance = Instantiate(EngineAssets.Load<GameObject>(hullData.Prefab), ZoneRoot).GetComponent<EntityInstance>();
|
||||
instance = Body().GetComponent<EntityInstance>();
|
||||
if (instance == null)
|
||||
{
|
||||
ItemManager.Log($"Failed to instantiate {hullData.Name} entity with invalid prefab: no EntityInstance component!");
|
||||
|
|
|
|||
Loading…
Reference in a new issue