Jump to content

[1.4] StageRecovery - Recover Funds+ from Dropped Stages - v1.8.0 (March 11, 2018)


magico13

Recommended Posts

On the curse and Kerbal Stuff pages there's a list of features that this has that DebRefund doesn't, but it is made by me so it's somewhat biased. The short list is that this has powered recovery, a helper in the editor, and a GUI in flight which is much nicer to use when you're dropping a lot of things than the messages (which will pop up one message for EVERY piece of debris). StageRecovery has similar messages which can be easily disabled from the in-game settings menu if they're too annoying.

Link to comment
Share on other sites

On the curse and Kerbal Stuff pages there's a list of features that this has that DebRefund doesn't, but it is made by me so it's somewhat biased. The short list is that this has powered recovery, a helper in the editor, and a GUI in flight which is much nicer to use when you're dropping a lot of things than the messages (which will pop up one message for EVERY piece of debris). StageRecovery has similar messages which can be easily disabled from the in-game settings menu if they're too annoying.

Got it, thanks! Will try StageRecovery now :)

Link to comment
Share on other sites

@magico13: it looks like your plug-in doesn't take care of launchclamps left behind (of course we can recover... I guess one by one, very nice, with tracking station or switching back to them but it's even worth).

Any plan to include them too ?

Look at you wrapper, not very experienced in coding but an example could be helpful to others.

I'm currently dealing with these launchclamps and for now, they are just destroyed, which is not very good for career play (they are still not free !).

In fact, looking at available classes, I'm surprised there is nothing as simple as part.recover(distance, ...) like the few other thing we can do with them.

Any tips regarding this ?

Thanks.

Link to comment
Share on other sites

Launch clamps are handled automatically by KSP when you launch a new vessel. There is actually a function in KSP for recovering vessels, at least when they're on the launchpad or runway, never had to do it anywhere else. An example of that can be found in the crew selection GUI code of KCT. KCT also has an example for using SR's API, specifically the StageRecoverySuccessEvent in KCT_Events.cs. All it needs is a method passed to it that meets certain criteria, which are covered in the OP (with the KCT example it should hopefully clear things up). Perhaps I will add the KCT code to the OP as an example. If you still have questions let me know.

I'm on my phone right now but I should be near a computer soon, where I can perhaps provide better assistance.

Edit: Functions I use in KCT for finding vessels at the launch site and then recovering them:


List<ProtoVessel> list = ShipConstruction.FindVesselsAtLaunchSite(HighLogic.CurrentGame.flightState, KCT_GameStates.launchedVessel.launchSite);
foreach (ProtoVessel pv in list)
ShipConstruction.RecoverVesselFromFlight(pv, HighLogic.CurrentGame.flightState);

Edit2: And now I've provided an example in the OP of how KCT uses the API (with slight modifications to remove excess information).

Edit3: Proof that launch clamps get recovered by KSP

Javascript is disabled. View full album
Edited by magico13
Link to comment
Share on other sites

Of course you're the only one. I would never obsess about recovering every single piece and part and feel bad about dumping even a fairing. >.>

uhhh... I put chutes on my fairings.. :/ Though, in my defense I use procedural fairings and the bigger ones can be rather expensive.

Link to comment
Share on other sites

Launch clamps are handled automatically by KSP when you launch a new vessel. There is actually a function in KSP for recovering vessels, at least when they're on the launchpad or runway, never had to do it anywhere else. An example of that can be found in the crew selection GUI code of KCT. KCT also has an example for using SR's API, specifically the StageRecoverySuccessEvent in KCT_Events.cs. All it needs is a method passed to it that meets certain criteria, which are covered in the OP (with the KCT example it should hopefully clear things up). Perhaps I will add the KCT code to the OP as an example. If you still have questions let me know.

[...]

Thanks for taking the time to answer, I just work on a plug-in to remove those launch clamps which were so annoying before 0.24, especially with kerbtown launch sites which don't include site cleaning before launch, but it's now pointless.

Link to comment
Share on other sites

I was kidding around. I do my best to recover every bit of my spacecraft, even the fairings.

Heh, yeah I know. I just think it is funny to recover a fairing as you can't technically reuse it (suppose you could melt it down).

Didn't even realize for a long time that I could put chutes on them. :)

Link to comment
Share on other sites

  • 4 weeks later...

Very small update for 0.25 compatibility. Let me know of any issues! There's one known issue where it doesn't change the recovery percentage when using the strategy that normally increases recovery. I couldn't figure out how to access that in a convenient way. I may have to manually check the "commitment" on that particular strategy and manually compute the change, but that's lame.

Download is on the first post. KerbalStuff and mediafire should be updated, Curse should be soon.

Edit: You know, I haven't tested it, but since I define the addition of funds as being for vessel recovery, it MIGHT add the extra percentage in already. I haven't figured out the nuances of the Strategies system yet, that parameter might just be for record keeping later on in career mode.

Edited by magico13
Link to comment
Share on other sites

I've been wondering... I read that if the orbit of an object on rails enters the upper atmosphere of a planet, it gets unloaded (presumed crashed).

Does SR handle this currently? Or is it possible to make it handle it? :) (Depending, of course, on the reentry-capability and landability of said craft.)

Link to comment
Share on other sites

That is actually what SR is designed for. When the vessel gets unloaded from reaching about 22km (0.01 atm) SR does some checks to determine what the landing speed would be, and if it falls below a certain value then it recovers it. The Variable Rate model (which is the default one) recovers it at a rate dependent on the landing speed (7 m/s may be 90% or something like that, but 10 m/s might only be 10%. Note, not actual values, but I believe the defaults are around that). SR also checks if Deadly Reentry is installed, and if so does some very very basic checks to make sure you can't throw things into the atmosphere at 6 km/s. It also can do checks based on if the unloaded craft is controlled (I still need to check if having kerbals works properly, but I know probes do) and it will try to burn fuel to land, if parachutes aren't installed or aren't enough.

In short, yes SR handles that, since that's exactly how SR works ;) It's just not 100% accurate because I have to make assumptions.

Link to comment
Share on other sites

What happens if the vehicle on rails enters an extra-kerbinal atmosphere? :)

Ah, I see what you're getting at! SR will totally ignore it and it will be destroyed. I don't personally want to change that, since if you're gonna be landing on another planet you should probably actually do the landing :P FMRS may make that easier if you have to land a bunch of things at once (assuming FMRS works on other planets. I recommend it to people a lot because its implementation is pretty cool, but I have not used it myself yet). So unfortunately for some, SR will not be taking its adventures extraplanetary. We're a Kerbin only corporation :)

Link to comment
Share on other sites

Hi there,

i like this mod very much. Thanks for it.

Anyway, it seems that the distance - Calulation is broken, causing the payout way to high:

zzVwYBd.png

In this picture are 2 debris: One at the KSC, and one on a suborbital trajectory.

JomORfq.png

In this picture, the suborbital debris had recovered. Saying 200km far from KSC. But due the trajectory, it should _at_least_ 1000km far away. (Kerbin has 3769km equatorial length, two things on Kerbins surface can be ~1884km away from each other at max)

Link to comment
Share on other sites

I'm having the opposite issue. I drop a stage (fuel tank, engine, and 4 radial parachutes) right on top of KSC (detached stage at 1500m) and it shows Distance from KSC as 781.52km with only 61.51% recovered.

BTW I turned off Powered Recovery and it's doing the same thing.

Even more info, there seems to be a threshold for distance. I launched at a 45 degree angle and purposefully tried to get some distance between the discarded stage and KSC. I dropped the stage a good distance into the ocean, and when the stage was recovered the distance was 33.9km with 96.42% refunded. So it looks like once you go a certain distance from KSC the recovery distance is ok, but too close to KSC and it doesn't work correctly.

Edited by ThirdHorseman
Link to comment
Share on other sites

Hi there,

i like this mod very much. Thanks for it.

Anyway, it seems that the distance - Calulation is broken, causing the payout way to high:

In this picture, the suborbital debris had recovered. Saying 200km far from KSC. But due the trajectory, it should _at_least_ 1000km far away. (Kerbin has 3769km equatorial length, two things on Kerbins surface can be ~1884km away from each other at max)

Even though SR doesn't properly track landing sites based on predicted trajectories I agree that should have had a distance of near 1000 km. The way distance is calculated is by finding the Great Circle Distance using the latitude and longitude of the craft at deletion (as reported by KSP) from the Space Center. It seems KSP isn't correctly reporting the latitude and longitude values for some vessels. Nonphysical timewarp has been known to cause strange issues and I wouldn't be surprised if it were related some how.

I'm having the opposite issue. I drop a stage (fuel tank, engine, and 4 radial parachutes) right on top of KSC (detached stage at 1500m) and it shows Distance from KSC as 781.52km with only 61.51% recovered.

I have seen similar behavior once or twice. It's likely the same problem as above. I'll look into finding a different way of determining the latitude and longitude of the craft at destruction. I know it isn't the Great Circle Distance calculation, since that is a stock function that would affect all recoveries and no one has reported similar issues with stock games.

Powered recovery shouldn't affect this, but thank you for double checking :)

Link to comment
Share on other sites

I'll look into finding a different way of determining the latitude and longitude of the craft at destruction.

I wonder if you could do something similar to the Atmospheric Trajectories mod...it can determine the exact spot on the surface where the craft will impact. Once you know those coordinates you should be able to calculate the straight-line distance to KSC.

Powered recovery shouldn't affect this, but thank you for double checking :)

Not a problem!

Link to comment
Share on other sites

I have a suggestion/bug/not-yet-feature

when you "land" a vessel using stage recovery thats part of the "rescue" mission it shows as failed. obviosuly this is because the vessel is destroyed. interesting though is the kerbal you rescued is sitting there in KSC, is there a way that stagerecovery-ing the vessel could complete the mission?!

Link to comment
Share on other sites

I have a suggestion/bug/not-yet-feature

when you "land" a vessel using stage recovery thats part of the "rescue" mission it shows as failed. obviosuly this is because the vessel is destroyed. interesting though is the kerbal you rescued is sitting there in KSC, is there a way that stagerecovery-ing the vessel could complete the mission?!

I can try to look into it, but its likely because StageRecovery doesn't call the normal vessel recovery functions and instead has its own. I may be able to cause it to manually complete a contract, which would work for that specific case but not in the general case for all contracts.

My development time has been pretty small lately and its recently been focused on KCT (since StageRecovery in most instances just works as it is) but I do want to spend some time on StageRecovery soon. But soon could also be like, a month from now. So new features and bug fixes will come, but it may be a while. For the most part though I think everything is working mostly well right now.

Link to comment
Share on other sites

Just dropping in to express a little appreciation - trying to make as much of my rocket recoverable as possible has really added spice to my recent career mode saves :). So pleased to see this for 0.25 and looking forward to many more launches, recoveries and booms with this and DR :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...