Exemplo n.º 1
0
        void vessel_selected(ConfigNode node, CraftBrowserDialog.LoadType t)
        {
            vessel_selector = null;
            //load vessel config
            var construct = new ShipConstruct();

            if (!construct.LoadShip(node))
            {
                var shipName = node.GetValue("ship");
                Utils.Error($"Unable to load ShipConstruct '{shipName}'. " +
                            "This usually means that some parts are missing " +
                            "or some modules failed to initialize.");
                Utils.Message("Unable to load {0}", shipName);
                return;
            }
            //check if it's possible to launch such vessel
            bool cant_launch    = false;
            var  preFlightCheck = new PreFlightCheck(new Callback(() => cant_launch = false), new Callback(() => cant_launch = true));

            preFlightCheck.AddTest(new PreFlightTests.ExperimentalPartsAvailable(construct));
            preFlightCheck.RunTests();
            //cleanup loaded parts and try to store construct
            if (cant_launch)
            {
                construct.Unload();
            }
            else
            {
                StartCoroutine(delayed_process_construct(construct));
            }
        }
Exemplo n.º 2
0
 protected virtual void store_construct(ShipConstruct construct)
 {
     Facility = construct.shipFacility;
     StoreKit(new VesselKit(this, construct));
     construct.Unload();
     if (kit.AdditionalResources.Count > 0)
     {
         resource_manifest_view.Show(true);
     }
 }
Exemplo n.º 3
0
        public ShipConstruct LoadConstruct()
        {
            var ship = new ShipConstruct();

            if (!ship.LoadShip(Blueprint))
            {
                ship.Unload();
                return(null);
            }
            return(ship);
        }
        protected virtual void process_construct(ShipConstruct construct)
        {
            var kit = new VesselKit(this, construct, false);
            var selected_space_module = selected_space as PartModule;

            if (selected_space_module != null)
            {
                float ratio;
                if (!selected_space.Empty)
                {
                    Utils.Message("Selected assembly space is occupied");
                }
                else if (!selected_space.CheckKit(kit, kit_part, out ratio))
                {
                    if (ratio > 0)
                    {
                        Utils.Message("Selected assembly space is too small");
                    }
                    else
                    {
                        Utils.Message("Selected container is not suitable for construction of this kit");
                    }
                }
                else
                {
                    selected_space.SetKit(kit, kit_part);
                }
            }
            else if (find_assembly_space(kit, false) != null)
            {
                kit.Host = this;
                Kits.Add(kit);
                Queue.Enqueue(new AssemblyKitInfo(kit));
            }
            else
            {
                Utils.Message("No suitable assembly space was found.");
            }
            construct.Unload();
        }