public override void OnStart(StartState state) { base.OnStart(state); if (state == StartState.Editor || state == StartState.None) { return; } if (attachMode.Docked) { Part dockedPart = KAS_Shared.GetPartByID(this.vessel.id.ToString(), dockedPartID); if (dockedPart) { KASModuleAttachCore dockedAttachModuleTmp = dockedPart.GetComponent <KASModuleAttachCore>(); if (dockedAttachModuleTmp) { KAS_Shared.DebugLog("OnLoad(Core) Re-set docking on " + dockedAttachModuleTmp.part.partInfo.title); AttachDocked(dockedAttachModuleTmp); } else { KAS_Shared.DebugError("OnLoad(Core) Unable to get docked module !"); attachMode.Docked = false; } } else { KAS_Shared.DebugError("OnLoad(Core) Unable to get saved docked part !"); attachMode.Docked = false; } } if (attachMode.Coupled) { // Todo } if (attachMode.FixedJoint) { Part attachedPart = KAS_Shared.GetPartByID(FixedAttach.savedVesselID, FixedAttach.savedPartID); if (attachedPart) { KAS_Shared.DebugLog("OnLoad(Core) Re-set fixed joint on " + attachedPart.partInfo.title); AttachFixed(attachedPart, FixedAttach.savedBreakForce); } else { KAS_Shared.DebugError("OnLoad(Core) Unable to get saved connected part of the fixed joint !"); attachMode.FixedJoint = false; } } if (attachMode.StaticJoint) { // Nothing to do (see OnVesselLoaded) } GameEvents.onVesselGoOffRails.Add(new EventData <Vessel> .OnEvent(this.OnVesselGoOffRails)); }
public override void OnStart(StartState state) { base.OnStart(state); if (state == StartState.Editor || state == StartState.None) { return; } if (attachMode.Docked) { Part dockedPart = KAS_Shared.GetPartByID(this.vessel, dockedPartID); if (dockedPart && (dockedPart == part.parent || dockedPart.parent == part)) { KASModuleAttachCore dockedAttachModuleTmp = dockedPart.GetComponent <KASModuleAttachCore>(); if (dockedAttachModuleTmp == null) { KAS_Shared.DebugError("OnLoad(Core) Unable to get docked module !"); attachMode.Docked = false; } else if (dockedAttachModuleTmp.attachMode.Docked && dockedAttachModuleTmp.dockedPartID == part.flightID.ToString() && dockedAttachModuleTmp.vesselInfo != null) { KAS_Shared.DebugLog("OnLoad(Core) Part already docked to " + dockedAttachModuleTmp.part.partInfo.title); this.dockedAttachModule = dockedAttachModuleTmp; dockedAttachModuleTmp.dockedAttachModule = this; } else { KAS_Shared.DebugLog("OnLoad(Core) Re-set docking on " + dockedAttachModuleTmp.part.partInfo.title); AttachDocked(dockedAttachModuleTmp); } } else { KAS_Shared.DebugError("OnLoad(Core) Unable to get saved docked part !"); attachMode.Docked = false; } } if (attachMode.Coupled) { // Todo } if (attachMode.FixedJoint) { StartCoroutine(WaitAndInitFixedAttach()); } if (attachMode.StaticJoint) { // Nothing to do (see OnVesselLoaded) } }
protected virtual void InitFixedAttach() { if (attachMode.FixedJoint) { Part attachedPart = KAS_Shared.GetPartByID(FixedAttach.savedVesselID, FixedAttach.savedPartID); if (attachedPart) { KAS_Shared.DebugLog("OnLoad(Core) Re-set fixed joint on " + attachedPart.partInfo.title); AttachFixed(attachedPart, FixedAttach.savedBreakForce); } else { KAS_Shared.DebugError("OnLoad(Core) Unable to get saved connected part of the fixed joint !"); attachMode.FixedJoint = false; } } }
protected override void InitFixedAttach() { base.InitFixedAttach(); // Reset link if a fixed joint exist if (attachMode.FixedJoint) { KAS_Shared.DebugLog("OnStart(strut) Docked / fixed joint detected from save, relinking..."); Part tgtStrutPart = KAS_Shared.GetPartByID(tgtStrutVesselID, tgtStrutPartID); if (tgtStrutPart) { KASModuleStrut linkedStrutModuleSavedF = tgtStrutPart.GetComponent <KASModuleStrut>(); LinkTo(linkedStrutModuleSavedF, false, true); } else { KAS_Shared.DebugError("OnStart(strut) Target strut part not found !"); } } }
protected virtual void InitFixedAttach() { if (attachMode.FixedJoint) { Part srcPart = KAS_Shared.GetPartByID( FixedAttach.savedSrcVesselID, FixedAttach.savedSrcPartID); Part tgtPart = KAS_Shared.GetPartByID( FixedAttach.savedTgtVesselID, FixedAttach.savedTgtPartID); if (tgtPart) { KAS_Shared.DebugLog(string.Format( "OnLoad(Core) Re-set fixed joint on {0}", tgtPart.partInfo.title)); AttachFixed(srcPart, tgtPart, FixedAttach.savedBreakForce); } else { KAS_Shared.DebugError( "OnLoad(Core) Unable to get saved connected part of the fixed joint !"); attachMode.FixedJoint = false; } } }