ChrisViral / RealChute

Realistic parachutes for KSP
47 stars 38 forks source link

Make chute arm/deploy at correct stage. #15

Closed shysteph closed 9 years ago

shysteph commented 9 years ago

On my machine at least when staging happens the current stage is the stage which we are coming from not the stage we are going to so the part stage needs to be compared to CurrentStage - 1 (next stage).

Previously this was working because the code for OnActive() would call ActivateRC(). With OnActive() removed though this has to work.

ChrisViral commented 9 years ago

Except OnActive is only called once ever. Preferably we should find a way to have it work without it. Not going to merge the changes for now.

ChrisViral commented 9 years ago

Ah wait, you didn't put back OnActive. Yeah this is what I had in mind. I'll take another look when I get my laptop back, but yes, I meant to do this when I removed OnActive but seemingly forgot.

shysteph commented 9 years ago

Once I saw how things were working I figured the FixedUpdate check was what you intended and that it just was not quite working correctly. Let me guess repacked chutes never refire OnActive.

It surprises me that checking actual keypress state is better than responding to an event but then again it sounds like the whole ksp system is a bit of a hack.

Things like remote tech interact with action groups and parts directly and don't go through stages correct?

ChrisViral commented 9 years ago

OnActive is directly dependant of the staging system... and you really don't want to to start on it. It's awful bottoms up. Nothing to do with it. Really, it's better to just ignore it and have my own little staging controller.

shysteph commented 9 years ago

I added an untested change (not near my gaming machine). If the staging key is pressed and the current stage is 0 (no stages left) then any chutes that can be activated will be. This means that repacking a chute and hitting space on a fully staged craft (return vehicle?) will redeploy it without messing with the staging order. The old behavior checking inverseStage == CurrentStage gave this behavior and it seems desirable.

ChrisViral commented 9 years ago

Merged, will test here and see how it fares.