private void RecordLaunch(Vessel vessel)
        {
            LaunchEvent launch = new LaunchEvent();

            launch.shipName = vessel.protoVessel.vesselName;
            if (launch.shipName == null)
            {
                launch.shipName = "Just decoupled";
            }
            launch.shipID     = vessel.id.ToString();
            launch.rootPartID = vessel.rootPart.flightID.ToString();
            launch.time       = GetTimeInTicks();
            launch.parts      = new List <StatisticVehiclePart>();
            float sumCost    = 0;
            float launchMass = 0;

            foreach (var part in vessel.parts)
            {
                sumCost    += part.partInfo.cost;
                launchMass += part.GetResourceMass() + part.mass;
                StatisticVehiclePart vehiclePart = new StatisticVehiclePart();
                vehiclePart.partID = part.flightID.ToString();

                var modules = part.Modules.GetModules <ModuleCommand>();
                if (modules.Count > 0)
                {
                    vehiclePart.partType = PartType.CommandPod;
                    launch.parts.Add(vehiclePart);
                }
                else
                {
                    vehiclePart.partType = PartType.Other;
                    //launch.parts.Add(vehiclePart);
                }
            }
            launch.crewMembers = new List <string>();
            foreach (ProtoCrewMember kerbal in vessel.GetVesselCrew())
            {
                launch.crewMembers.Add(kerbal.name);
            }
            launch.launchCost = sumCost;
            launch.launchMass = launchMass;

            SOIChangeEvent soiInitial = new SOIChangeEvent();

            soiInitial.mass    = launchMass;
            soiInitial.soiName = vessel.mainBody.name;
            launch.AddEvent(soiInitial);

            launches.Add(launch);
        }
        public void OnVesselSOIChanged(GameEvents.HostedFromToAction <Vessel, CelestialBody> data)
        {
            SOIChangeEvent soiChange = new SOIChangeEvent();

            soiChange.mass = 0;
            foreach (var part in data.host.parts)
            {
                soiChange.mass += part.GetResourceMass() + part.mass;
            }
            soiChange.soiName = data.host.mainBody.name;
            LaunchEvent launch = GetLaunch(data.host);

            if (launch != null)
            {
                launch.AddEvent(soiChange);
            }
        }