//store vessel void store_vessel(Vessel vsl, bool perform_checks = true) { StoredVessel stored_vessel = new StoredVessel(); if (perform_checks) //for normal operation { //check momentary states if (!can_store(vsl)) { return; } //check if the vessel can be stored, if unknown, try to store bool storable; if (!probed_ids.TryGetValue(vsl.id, out storable)) { stored_vessel = try_store(vsl); storable = stored_vessel != null; probed_ids.Add(vsl.id, storable); } if (!storable) { return; } } else //for storing packed constructs upon hangar launch { stored_vessel = new StoredVessel(vsl); stored_vessels.ForceAdd(stored_vessel); } //get vessel crew on board List <ProtoCrewMember> _crew = new List <ProtoCrewMember>(stored_vessel.crew); CrewTransfer.delCrew(vsl, _crew); vsl.DespawnCrew(); //first of, add crew to the hangar if there's a place CrewTransfer.addCrew(part, _crew); //then add to other vessel parts if needed CrewTransfer.addCrew(vessel, _crew); //recalculate volume and mass change_part_params(stored_vessel.metric); //switch to hangar vessel before storing if (FlightGlobals.ActiveVessel.id == vsl.id) { FlightGlobals.ForceSetActiveVessel(vessel); } //destroy vessel vsl.Die(); ScreenMessager.showMessage("Vessel has been docked inside the hangar", 3); }
public void transferCrew() { CrewTransfer.addCrew(vessel, crew); }