Sign in to follow this  
Followers 0
Red3Tango

[0.24] SafeChute v1.2.2

91 posts in this topic

I have been unable to keep up development and support of this mod.

However, hab136 has taken the reigns and continued development here!

http://forum.kerbalspaceprogram.com/threads/100855

SafeChute v1.2.2

A small plugin that slows Time-Warp when you reach an altitude when parachutes open to prevent parachutes ripping off!

Also slows Time-Warp when about to touch/splash-down. Configurable altitudes in config file.

The altitude is calculated based on height from the terrain or "sea level", depending on which is closer.

You may increase Time-Warp manually after parachutes deploy.

Now supports the RealChute Parachute Systems mod!

Thanks to stupid_chris for helping me with the code to dynamically link plugins!

Download

SafeChute v1.2.2

(BSD License)

=== CHANGE LOG ===

v1.2.2

[updated] - Compatibility with RealChute 1.0.3

[Fixed] - Broken reference to config.xml to adjust ground dewarp altitude

[Fixed] - Incorrect altitude reading above water (again)

1.2.1

[Fixed] - Null Reference error when starting up the game (thx to Llorx)

v1.2

[Changed] - Altitude buffer, now turns down timewarp based on state

[Added] - Compatibility for Real Chute mod (optional)

NOTE: uninstall first if version is v1.1 or earlier

v1.1.1

[Changed] - updated folder structure (uninstall previous versions)

v1.1

[Fixed] - should now work properly during water landings

[Fixed] - properly updates when switching vessels or docking/undocking

[Changed] - gets deploy altitudes from ModuleParachute data (should work with other mod parts)

[Changed] - does not run altitude checks if not Time Warping

[Changed] - does not run altitude checks if parachutes are not deployed

[Added] - config.xml to change altitude settings

[Added] - stop Time Warp when reaching ground

[Added] - does not run altitude checks over a max altitude

v1.0

initial release

Edited by Red3Tango
still compatible with 0.24
1 person likes this

Share this post


Link to post
Share on other sites

All chutes fully open at their stated deployment height, it's their initial deployment height that will vary with air pressure. Your system should work on all atmo planets.

Share this post


Link to post
Share on other sites

Nice idea, I've ripped off many parachutes thanks to poorly timed warps. I'm going to give it a go immediately.

Suggestion for a feature: Make the altitude variable adjustable in a cfg file. Only because some parachutes fully deploy above 650m.

Share this post


Link to post
Share on other sites

So, I don't know what method you're using (do rather do need the source and the license, as Majiir says), but I suggest, rather than just disabling warp below 650m, that you query all parts on you vessel and see if any parachutes are in state semideployed, and disable warp below the maximum deploymentaltitude of all those parachutes. Then (a) it doesn't trip when there's no parachutes and (B) no config needed.

Share this post


Link to post
Share on other sites

@Majiir: sorry looks like I uploaded the wrong file, I will update with license and source as soon as I can.

@NathanKell: It doesnt "disable" warp, it just drops it to 1x, but still lets you increase it again. So you can speed up time after they deploy and not have to wait till its touches down.

Edited by Red3Tango

Share this post


Link to post
Share on other sites

Red3Tango, go one further than including source and license in the download, put the terms in your OP for all to see.

This is a great idea, BTW, and a good starter mod. I would suggest you read the deployment altitude from the chutes on the craft (iterate over the vessels parts and find any that have a parachute PartModule) and set timewarp to x1 at each "breakpoint". It'd be nice if I could use drogues and normal chutes and have the plugin automagically know when to stop time warp.

Share this post


Link to post
Share on other sites

@regex: that is a very good idea, it may take me a bit to hash all that out properly though.

I do coding in Unity, but going off of an existing assembly doesnt flow as smoothly for me as with writing code from scratch hehe

Edited by Red3Tango

Share this post


Link to post
Share on other sites
Red3Tango, go one further than including source and license in the download, put the terms in your OP for all to see.

This is a great idea, BTW, and a good starter mod. I would suggest you read the deployment altitude from the chutes on the craft (iterate over the vessels parts and find any that have a parachute PartModule) and set timewarp to x1 at each "breakpoint". It'd be nice if I could use drogues and normal chutes and have the plugin automagically know when to stop time warp.

I'm curious if parachutes from mods, like NovaPunch, have the same identifiers so they will trigger this plugin.

Share this post


Link to post
Share on other sites
@regex: that is a very good idea, it may take me a bit to hash all that out properly though.

I do coding in Unity, but going off of an existing assembly doesnt flow as smoothly for me as with writing code from scratch hehe

foreach(Part p in FlightGlobals.ActiveVessel.parts) {
foreach(PartModule pm in p.Modules) {
if((pm.moduleName as ModuleParachute) != null) {
altitude = ((ModuleParachute)pm).deployAltitude;
}
}
}

Might be better way of doing things (and I haven't done class casts myself, even though I've looked it up, so the code might be off), but maybe that helps? Anyway, most of modding KSP is learning the KSP "API". Get yourself a good assembly browser; Xamarin is **** but it works well enough for me.

I'm curious if parachutes from mods, like NovaPunch, have the same identifiers so they will trigger this plugin.

If NovaPunch uses the stock KSP ModuleParachute there should be no problem.

Share this post


Link to post
Share on other sites

This is so useful, I always do it manually, well, not anymore.

Share this post


Link to post
Share on other sites

Another nice little addition made. Thanks, very nice plugin (even without being a 'first' plugin).

Share this post


Link to post
Share on other sites

Version 1.1 is now released, just overwrite files to update.

Changelog:

[Fixed] - should now work properly during water landings

[Fixed] - properly updates when switching vessels or docking/undocking

[Changed] - gets deploy altitudes from ModuleParachute data (should work with other mod parts)

[Changed] - does not run altitude checks if not Time Warping

[Changed] - does not run altitude checks if parachutes are not deployed

[Added] - config.xml to change altitude settings

[Added] - stop Time Warp when reaching ground

[Added] - does not run altitude checks over a max altitude

Special thanks for suggestions, ideas, code:

- scottholio, NathanKell, regex

@regex: curious with these changes, it iterates over the parts (thanks for the code snippet btw) and gets the deploy altitudes, would/does this work for your drogue chutes as well?

I still added a config file, but the altitude is "in addition" to the parts deploy height (just in case there is a PhysX skip)

Side note: I have also worked on a plugin that adds a "Crew Roster" button to the space center where you can edit/delete/add Kerbals, much like Crew Manifest, just without all the extra bits (and is done outside of a flight). Wondering if that is something else I should post for others.

Edited by Red3Tango

Share this post


Link to post
Share on other sites

Hey, really loved your mod, now my probe design with way too many chutes won't blow up up from g forces. On that topic, could you nerf the heat tolerance on the chutes to match the stock? I miss having to worry about aerodynamics with deadly reentry.

Share this post


Link to post
Share on other sites
Hey, really loved your mod, now my probe design with way too many chutes won't blow up up from g forces. On that topic, could you nerf the heat tolerance on the chutes to match the stock? I miss having to worry about aerodynamics with deadly reentry.

Me too....

Share this post


Link to post
Share on other sites

That awkward moment when you post on the wrong thread due to similar names... Well... still love your mod nonetheless :P

Share this post


Link to post
Share on other sites

haha, no problem. Glad you like the mod, was actually inspired by watching Scott Manley's videos, how he talks about the chutes ripping off if you are going too fast. Which incidentally has never happened to me, even at 4x speeds, until the other day, then fired up MonoDevelop and made the mod!

If this is similar in name to another mod, I could rename it to maybe something more appropriate if you had any suggestions.

Edited by Red3Tango

Share this post


Link to post
Share on other sites

No, it's fine really. And your mod came first so ha to them! And it has a good ring to it.

EDIT: Although, due to the RealChute mod, your mod has recently become redundant for chute reasons... Perhaps you could add to it? Dunno, but still.

Edited by Storywalker4

Share this post


Link to post
Share on other sites

Not sure what else I can really add though, was meant to be a simple plugin to prevent parachutes from ripping off.

Nothing as complex as changing stock parts, animation, and sounds. Also this theoretically should be fully compatible with any part mod that adds custom parachutes. And if Squad decided to change parts (like we all know they never do), should also still function properly.

Honestly I made the mod for myself to see if I could, and wanted to share with others. I will still keep it around for people that want a more "lite" version, and I will continue to fix if bugs arise, and possibly add features as long as they fit the mods initial purpose.

Edited by Red3Tango

Share this post


Link to post
Share on other sites

Good idea i really hate it when my Chutes get ripped off from timewarp.

Share this post


Link to post
Share on other sites

Ah hey, I'm the guy making RealChute. I haven't peaked at your code much but essentially this shouldn't work with my mod because it does not use ModuleParachute. However you could easily fix that by looking for deploymentAlt in RealChuteModule. You'd have to refer it correctly though as this is external and won't be found in C#Assembly.

Share this post


Link to post
Share on other sites
@regex: curious with these changes, it iterates over the parts (thanks for the code snippet btw) and gets the deploy altitudes, would/does this work for your drogue chutes as well?

Drogue chutes use ModuleParachute like any other stock chute, so they should work fine (as will mod parts that use ModuleParachute). The snippet I provided doesn't do everything for you; it was intended to show you how someone might go about getting the parachute deployment heights on a given craft. You'll have to do the work of getting that in your mod, and possibly optimizing it if needed (not sure how that would be done... vOv)

E: In the same loop I showed you, you could also see if the PartModule was a RealChuteModule and, if so, get its deploymentAlt. This would satisfy users of stupid_chris' RealChute mod.

I'm not exactly sure if C# can do this (in PHP you can) but you could also provide the user with a text file where they can enter in class names (like ModuleParachute and RealChuteModule) as well as variables to query (deployAltitude and deploymentAlt) in order to accommodate future parachute mods. But, again, I'm not sure if C# can derive a class from a string.

Edited by regex

Share this post


Link to post
Share on other sites

Right the snippet you gave me was just a base to start from, but was implemented into v1.1 (iterating over parts).

The optimizations so far, is that it will only run the check for parts if the active vessel has changed (so like switching with [ ] ), or the current part count has changed (docking). Then it will only check altitude if under 10k (config file), has a parachute, and chute has the state of SEMIDEPLOYED. Also it creates a List<> of unique deployment altitudes, so if you have 10 parachutes that all open at 500m, it will only test once per run.

It might not be that hard to add the ability for RealChuteModule into the code, if that is a feature people would like to see. I haven't tried out the mod, so not sure if it is effected by the same TimeWarp PhysX bug that stock chutes are. Depending on the class structure it may be really easy to make it compatible.

Edited by Red3Tango

Share this post


Link to post
Share on other sites
It might not be that hard to add the ability for RealChuteModule into the code, if that is a feature people would like to see. I haven't tried out the mod, so not sure if it is effected by the same TimeWarp PhysX bug that stock chutes are. Depending on the class structure it may be really easy to make it compatible.

I'm not sure if class casts will throw extra errors if the class doesn't exist (the mod isn't installed). If it doesn't, there's no reason not to do the check and provide support for extra mods. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0