IEnumerator <YieldInstruction> spawn_kit() { if (!Kit) { yield break; } //this.Log("Spawning kit: {}\nReqs: {}", Kit, Kit.RemainingRequirements());//debug if (vessel_spawner.LaunchInProgress) { Utils.Message("In progress..."); yield break; } if (!Kit.StageComplete(DIYKit.ASSEMBLY)) { Utils.Message("The kit is not yet assembled"); yield break; } if (Kit.StageStarted(DIYKit.CONSTRUCTION)) { Utils.Message("Kit construction is already started"); yield break; } if (HasAnimator && Opened) { Utils.Message("Need to close assembly space first"); Close(); yield break; } yield return(new WaitForEndOfFrame()); yield return(new WaitForFixedUpdate()); var kit_ship = Kit.CreateShipConstruct(KitPart, part.flagURL); if (kit_ship == null) { yield break; } GroundConstructionScenario.SaveGame(Kit.Name + "-before_spawn"); yield return(StartCoroutine(spawn_kit_vessel(kit_ship))); }
public void SpawnKit() { if (!Kit) { return; } //this.Log("Spawning kit: {}\nReqs: {}", Kit, Kit.RemainingRequirements());//debug if (vessel_spawner.LaunchInProgress) { Utils.Message("In progress..."); return; } if (!Kit.StageComplete(DIYKit.ASSEMBLY)) { Utils.Message("The kit is not yet assembled"); return; } if (Kit.StageStarted(DIYKit.CONSTRUCTION)) { Utils.Message("Kit construction is already started"); return; } if (Opened) { Utils.Message("Need to close assembly space first"); Close(); return; } var kit_ship = Kit.CreateShipConstruct(KitPart, part.flagURL); if (kit_ship != null) { Utils.SaveGame(Kit.Name + "-before_spawn"); StartCoroutine(spawn_kit_vessel(kit_ship)); } }