diff --git a/boot/boot.ks b/boot/boot.ks index 363e702..813c5f5 100644 --- a/boot/boot.ks +++ b/boot/boot.ks @@ -1,6 +1,3 @@ wait until ship:unpacked. -runPath("0:/scripts/basic.ks"). -//if addons:RT:hasKSCConnection(ship) { -//} else { -// print "No connection to the KSC". -//} + +runPath("0:/scripts/basic.ks"). \ No newline at end of file diff --git a/boot/bootRunner.ks b/boot/bootRunner.ks new file mode 100644 index 0000000..1395be6 --- /dev/null +++ b/boot/bootRunner.ks @@ -0,0 +1,3 @@ +wait until ship:unpacked. + +runPath("0:/scripts/stayRunner.ks"). diff --git a/boot/heloBoot.ks b/boot/heloBoot.ks deleted file mode 100644 index 632255b..0000000 --- a/boot/heloBoot.ks +++ /dev/null @@ -1,2 +0,0 @@ -wait until ship:unpacked. -runPath("0:/scripts/helo.ks"). diff --git a/boot/testing.ks b/boot/testing.ks index 02e3594..3161bd2 100644 --- a/boot/testing.ks +++ b/boot/testing.ks @@ -1,3 +1,7 @@ wait until ship:unpacked. core:part:getmodule("kOSProcessor"):doevent("Open Terminal"). -runPath("0:/scripts/transfer.ks"). \ No newline at end of file + +switch to 0. +cd("scripts"). +runPath("transfer"). +runPath("doManeuver"). \ No newline at end of file diff --git a/modpack.ckan b/modpack.ckan new file mode 100644 index 0000000..62dce66 --- /dev/null +++ b/modpack.ckan @@ -0,0 +1,227 @@ +{ + "spec_version": "v1.6", + "identifier": "installed-Kerbal-Space-Program", + "name": "installed-Kerbal Space Program", + "abstract": "A list of modules installed on the Kerbal Space Program KSP instance", + "author": "Kyle", + "version": "2026.06.27.12.43.24", + "ksp_version_min": "1.8", + "ksp_version_max": "1.12", + "license": "unknown", + "depends": [ + { + "name": "ContractConfigurator", + "suppress_recommendations": true + }, + { + "name": "ClickThroughBlocker", + "suppress_recommendations": true + }, + { + "name": "ReStock", + "suppress_recommendations": true + }, + { + "name": "EnvironmentalVisualEnhancements", + "suppress_recommendations": true + }, + { + "name": "Kerbalism", + "suppress_recommendations": true + }, + { + "name": "AtmosphereAutopilot", + "suppress_recommendations": true + }, + { + "name": "ContractConfigurator-CareerEvolution", + "suppress_recommendations": true + }, + { + "name": "Chatterer", + "suppress_recommendations": true + }, + { + "name": "ContractConfigurator-CommNetRelays", + "suppress_recommendations": true + }, + { + "name": "ConfigurableContainers", + "suppress_recommendations": true + }, + { + "name": "ContractConfigurator-AnomalySurveyor", + "suppress_recommendations": true + }, + { + "name": "ContractConfigurator-KerbinSpaceStation", + "suppress_recommendations": true + }, + { + "name": "ContractConfigurator-CleverSats", + "suppress_recommendations": true + }, + { + "name": "ContractConfigurator-ExplorationPlus", + "suppress_recommendations": true + }, + { + "name": "ContractConfigurator-FieldResearch", + "suppress_recommendations": true + }, + { + "name": "ContractConfigurator-KerbalAcademy", + "suppress_recommendations": true + }, + { + "name": "ContractConfigurator-RoverMissionsRedux", + "suppress_recommendations": true + }, + { + "name": "ContractConfigurator-Tourism", + "suppress_recommendations": true + }, + { + "name": "ContractsWindowPlus", + "suppress_recommendations": true + }, + { + "name": "DecouplerShroud", + "suppress_recommendations": true + }, + { + "name": "Deferred", + "suppress_recommendations": true + }, + { + "name": "EnvironmentalVisualEnhancements-HR", + "suppress_recommendations": true + }, + { + "name": "HeatControl", + "suppress_recommendations": true + }, + { + "name": "HideEmptyTechNodes", + "suppress_recommendations": true + }, + { + "name": "KerbalAlarmClock", + "suppress_recommendations": true + }, + { + "name": "KerbalChangelog", + "suppress_recommendations": true + }, + { + "name": "KerbalEngineerRedux", + "suppress_recommendations": true + }, + { + "name": "KerbalismCompanionCalculator", + "suppress_recommendations": true + }, + { + "name": "kOS", + "suppress_recommendations": true + }, + { + "name": "KRASH", + "suppress_recommendations": true + }, + { + "name": "MinAmbLightUpd", + "suppress_recommendations": true + }, + { + "name": "NavballDockAlignIndCE", + "suppress_recommendations": true + }, + { + "name": "NearFutureElectrical", + "suppress_recommendations": true + }, + { + "name": "OPMAllinOneKSPediaDeltaVMap", + "suppress_recommendations": true + }, + { + "name": "ParallaxContinued", + "suppress_recommendations": true + }, + { + "name": "PatchManager", + "suppress_recommendations": true + }, + { + "name": "PlanetInfoPlus", + "suppress_recommendations": true + }, + { + "name": "ProbesBeforeCrew", + "suppress_recommendations": true + }, + { + "name": "RCSBuildAid", + "suppress_recommendations": true + }, + { + "name": "RestockWaterfallExpansion", + "suppress_recommendations": true + }, + { + "name": "ReStockPlus", + "suppress_recommendations": true + }, + { + "name": "SCANsat", + "suppress_recommendations": true + }, + { + "name": "Scatterer", + "suppress_recommendations": true + }, + { + "name": "SmartParts", + "suppress_recommendations": true + }, + { + "name": "Strategia", + "suppress_recommendations": true + }, + { + "name": "TextureReplacer", + "suppress_recommendations": true + }, + { + "name": "JanitorsCloset", + "suppress_recommendations": true + }, + { + "name": "Trajectories", + "suppress_recommendations": true + }, + { + "name": "TransferWindowPlannerFork", + "suppress_recommendations": true + }, + { + "name": "TriggerAu-Flags", + "suppress_recommendations": true + }, + { + "name": "TUFX", + "suppress_recommendations": true + }, + { + "name": "UtilityWeight", + "suppress_recommendations": true + }, + { + "name": "WaypointManager", + "suppress_recommendations": true + } + ], + "release_date": "2026-06-27T00:43:24.0386872Z", + "kind": "metapackage" +} diff --git a/scripts/ascent.ks b/scripts/ascent.ks index 6bbc075..fad1cb5 100644 --- a/scripts/ascent.ks +++ b/scripts/ascent.ks @@ -83,7 +83,7 @@ function basicAscent { gravityTurn(targetHeading). - when ship:q < 0.01 then { + when ship:altitude > body:atm:height then { for f in fairings { // get the module and deploy it set m to f:getmodule("ModuleProceduralFairing"). @@ -96,10 +96,11 @@ function basicAscent { panels on. radiators on. for a in antennas { - set m to a:getmodule("ModuleDeployableAntenna"). - if m:hasevent("extend antenna") m:doevent("extend antenna"). + if a:hasmodule("ModuleDeployableAntenna") { + set m to a:getmodule("ModuleDeployableAntenna"). + if m:hasevent("extend antenna") m:doevent("extend antenna"). + } } - } // try to limit the throttle to get a good ascent diff --git a/scripts/basic.ks b/scripts/basic.ks index fdc3d08..37d5ea4 100644 --- a/scripts/basic.ks +++ b/scripts/basic.ks @@ -55,3 +55,6 @@ if ship:bounds:bottomaltradar > 5 { // core:part:getmodule("kOSProcessor"):doevent("Close Terminal"). } + +// wait for more input +runpath("0:/scripts/stayRunner.ks"). diff --git a/scripts/lander.ks b/scripts/lander.ks index b35191e..9fe8870 100644 --- a/scripts/lander.ks +++ b/scripts/lander.ks @@ -1,3 +1,5 @@ +run once maneuver. + function groundSlope { parameter xOffset is 0, yOffset is 0. local east is vCrs(north:vector, up:vector). @@ -30,60 +32,55 @@ function groundSlope { return slope. } -wait until not hasNode. +lock h to ship:bounds:bottomaltradar. +lock velVec to ship:velocity:surface. +lock speed to velVec:mag. +lock vSpeed to ship:verticalspeed. +lock g to body:mu / ((body:radius + ship:altitude)^2). +lock maxA to ship:maxthrust / ship:mass. +lock vertFrac to max(abs(vSpeed) / max(speed, 0.001), 0.05). + +set margin to 30. // safety buffer, meters +set gateRatio to 0.9. // start burn when required decel hits this fraction of max +set targetV to -3. // final drift speed, m/s +set burning to false. +set finalPhase to false. + +lock maxDecel to max(maxA * vertFrac - g, 0.01). +lock requiredDecel to vSpeed^2 / (2 * max(h - margin, 0.1)). +lock neededA to (requiredDecel / vertFrac) + g. +lock hoverA to g / vertFrac. // accel needed to hold current vertical speed constant -// Suicide burn calcs set tval to 0. lock throttle to tval. -lock steering to ship:srfretrograde. +lock steering to srfretrograde. -lock h to ship:bounds:bottomaltradar. -lock v0 to ship:verticalspeed. -lock g to (body:mu / ((body:radius + ship:altitude)^2)). -lock a to ship:maxthrust / ship:mass. -lock d to (v0^2) / (2 * (a - g)). - - -// wait for burn -until h <= (1.1 * d) { - clearscreen. - print "Altitude AGL : " + round(h) at (4, 0). - print "Vertical Speed : " + round(v0, 1) at (4, 1). - print "Gravity : " + round(g, 2) at (4, 2). - print "Acceleration : " + round(a, 2) at (4, 3). - print "Distance : " + round(d, 2) at (4, 4). - wait 0. -} -unlock d. -unlock a. - -set tval to 1. - -set steeringLocked to false. until h < 1 { - if v0 > -4 { - // equalize acceleration to stop downward velocity - set tval to max(0.001, ship:mass * g / ship:maxThrust). + if not burning and requiredDecel >= gateRatio * maxDecel { + set burning to true. } - else if v0 > -6 and not steeringLocked { - // slow enough that we just want to kill vertical velocity - lock steering to up. - set steeringLocked to true. + + if burning and not finalPhase and vSpeed >= targetV { + set finalPhase to true. + } + + if finalPhase { + set tval to max(0, min(1, hoverA / maxA)). + } else if burning { + set tval to max(0, min(1, neededA / maxA)). } clearscreen. - print "Altitude AGL : " + round(h) at (4, 0). - print "Vertical Speed : " + round(v0, 1) at (4, 1). - print "Gravity : " + round(g, 2) at (4, 2). - print "Throttle : " + 100 * round(tval, 3) at (4, 3). + print "Alt AGL : " + round(h, 1) at (4, 0). + print "VSpeed : " + round(vSpeed, 1) at (4, 1). + print "Burning : " + burning at (4, 2). + print "Final phase : " + finalPhase at (4, 3). + print "Throttle : " + round(tval * 100) at (4, 4). wait 0. } lock throttle to 0. unlock throttle. -clearscreen. -print "Holding position". -lock steering to lookDirUp(groundSlope(), ship:facing:upvector). -wait until ship:angularvel:mag < 0.1. -wait 5. -print "Stable". +unlock steering. +sas on. +set sasMode to "STABILITYASSIST". \ No newline at end of file diff --git a/scripts/runner.ks b/scripts/runner.ks new file mode 100644 index 0000000..4b39394 --- /dev/null +++ b/scripts/runner.ks @@ -0,0 +1,23 @@ +switch to 0. +cd("scripts"). + +local g is GUI(300). +set g:x to 100. +set g:y to 100. + +local titleLabel is g:addlabel("Scripts"). +set titleLabel:style:align to "center". +set titleLabel:style:hstretch to true. + +local popup is g:addpopupmenu(). +set popup:optionsuffix to "NAME". + +list files in localFiles. +for f in localFiles popup:addoption(f). +popup:changed. + +g:show(). +wait until popup:changed. +g:dispose(). + +runpath(popup:value). \ No newline at end of file diff --git a/scripts/stayRunner.ks b/scripts/stayRunner.ks new file mode 100644 index 0000000..49a9441 --- /dev/null +++ b/scripts/stayRunner.ks @@ -0,0 +1,6 @@ +on ag10 { + runpath("0:/scripts/runner.ks"). + preserve. +} + +wait until false. diff --git a/scripts/transfer.ks b/scripts/transfer.ks index 6101c5f..5792db9 100644 --- a/scripts/transfer.ks +++ b/scripts/transfer.ks @@ -66,4 +66,24 @@ function hohmannTransfer { // print "Wait Time (s) : " + round(waitTime, 0). } -hohmannTransfer(Mun). \ No newline at end of file +local g is GUI(300). +set g:x to 100. +set g:y to 100. + +local titleLabel is g:addlabel("Transfer to which body?"). +set titleLabel:style:align to "center". +set titleLabel:style:hstretch to true. + +local popup is g:addpopupmenu(). +set popup:optionsuffix to "NAME". +for localMoon in body:orbitingchildren popup:addoption(localMoon). +popup:changed. +// print popup:options. +// print popup:changed. + +g:show(). +wait until popup:changed. +// print popup:value. +g:dispose(). + +hohmannTransfer(popup:value). \ No newline at end of file