Beispiel #1
0
 /// <summary>
 /// Called when 2 parts couple
 /// </summary>
 /// <param name="partAction"></param>
 public void OnPartCouple(GameEvents.FromToAction <Part, Part> partAction)
 {
     if (!VesselCommon.IsSpectating)
     {
         if (partAction.from.vessel != null && partAction.to.vessel != null)
         {
             var dock = new VesselDockStructure(partAction.from.vessel.id, partAction.to.vessel.id);
             if (dock.StructureIsOk())
             {
                 if (partAction.from.Modules.Contains("KerbalSeat") || partAction.to.Modules.Contains("KerbalSeat"))
                 {
                     HandleExternalSeatBoard(dock);
                 }
                 else
                 {
                     //We add it to the event so the event is handled AFTER all the docking event in ksp is over and we can
                     //safely remove the weak vessel from the game and save the updated dominant vessel.
                     VesselDockings.Add(dock.DominantVesselId, dock);
                 }
             }
         }
     }
     else
     {
         LunaLog.Log("[LMP]: Spectator docking happened. This needs to be fixed later.");
     }
 }
Beispiel #2
0
        public void OnCrewBoard(GameEvents.FromToAction <Part, Part> partAction)
        {
            LunaLog.Log("[LMP]: Crew boarding detected!");
            if (!VesselCommon.IsSpectating)
            {
                LunaLog.Log($"[LMP]: EVA Boarding, from: {partAction.from.vessel.id }, Name: {partAction.from.vessel.vesselName}");
                LunaLog.Log($"[LMP]: EVA Boarding, to: {partAction.to.vessel.id}, Name: {partAction.to.vessel.vesselName}");

                var dock = new VesselDockStructure(partAction.from.vessel.id, partAction.to.vessel.id);
                if (dock.StructureIsOk())
                {
                    HandleDocking(dock, true);
                }
            }
        }