ElWanderer / kOS_scripts

kOS scripts and libraries
28 stars 8 forks source link

Determine final stage automatically #124

Closed ElWanderer closed 4 years ago

ElWanderer commented 7 years ago

Currently, we require a decoupler to be tagged "FINAL" to indicate what to stage off during a launch abort or prior to re-entry. It's very easy to forget to do this...

However, pretty much every single one of my designs that would need this is the same - below the payload we have a heat shield then a decoupler, such that the 'final' decoupler is always the child of the heat shield. Technically, if we have re-rooted a craft, the parent-child relationship could be the other way around, but if we have a heat shield, chances are any attached decoupler is one we would want to trigger.

So, if any parts are tagged "FINAL", we should decouple them. If we start with no such parts, we could check for a heat shield & decoupler.

Note - firing any decoupler attached to a pod is problematic. While this is likely to be the correct thing to do before re-entry, during a launch abort it may jettison the launch escape system just when we actually need it!

ElWanderer commented 6 years ago

We can already identify decouplers with the isDecoupler function, that looks for certain part modules.

Identifying a heat shield... we could check the part name/title. The presence of the "ModuleAblator" module would also imply a part is a heat shield, but it is not necessarily definitive.

We could try to determine this when needed, though for a launch abort to work well, we'd probably want to check this up front - we could actually tag the parts we think we need to activate as FINAL.

ElWanderer commented 4 years ago

The solution implemented requires a heat shield attached to the last decoupler, but I'm okay with that for now.