Jump to content

Fixed Decoupler for KSP x64 on Windows - v4 - (July 22)


sarbian

Recommended Posts

Hey sarbian, can you add a notice in the OP that you have to remove/readd decouplers to existing craft to get this to apply? Might also want to mention that craft already in flight won't work either.

Link to comment
Share on other sites

I think that mods like PF, TweakableEverythink and KAS must implement a fix like this into there mods.
Does this fix the unity decouple() bug? Will this fix the errors with KAS? If so you might want to contact the mod maker of Kerbal Attachment System.

No, this just fixes the lack of force from decouplers, not the (decouple) node. That is a separate issue that was brought about by the way x64 handles the code. Majir has brought this issue to light several times, as seen in the x64 compatibility and the KAS threads. That fix is going to have to be applied more or less likely by SQUAD or the Unity team, and is not something that the modders themselves will be able to fix.

Edited by sharpspoonful
Link to comment
Share on other sites

So the force to jettison the fairings is not related to the fix you made?

I didn't make it, but like I said, this is an issue that has been addressed by Majir in several thread. PF 3.06 probably has an issue with how its applying the the decouple mode. I have to say, I have no idea.

Link to comment
Share on other sites

was looking at differn fairings with the setup of this mod it should replace the decoupler module for kw farings since it uses the stock decoupler. procedral fairings thou use a custom decoupler so probaly wotn work on them. seems like novapunch also uses stock decoupler module. havaent tried it yet thou.

Link to comment
Share on other sites

was looking at differn fairings with the setup of this mod it should replace the decoupler module for kw farings since it uses the stock decoupler. procedral fairings thou use a custom decoupler so probaly wotn work on them. seems like novapunch also uses stock decoupler module. havaent tried it yet thou.

Any part that uses stock decoupler module will be fixed by this mod.

Sarbian, can you shed some light on this bug? Is it on Unity or Squad side? How hard exactly it was to fix it? Can Squad do the same thing in future updates?

Link to comment
Share on other sites

About >MY< replacement decoupler not working with the KerbalX : it's a bug with .24 and ship older than .24

.24 had a change in the module loading to fix a problem when the module are not in the same order in a part and in a saved ship. It seems that fix make things worse when the module count is not the same (aka old save since most part in .24 had module added to track contract).

So when you load a KerbalX the module are messed up. You can see ii in your logs with those messages : Attempting to replace PartModule 'XXX' with 'YYY'

biohazard15 : the bug (as far as I can tell) is that you can to a decouple and apply force to a part in the same physic frame (at the same time if it makes more sens to you). My decoupler wait 1 frame (about 0.04 seconds) to apply the forces.

Edited by sarbian
Link to comment
Share on other sites

All: the issue with TweakableEverything should be fixed by removing the ":FOR[DecoupleForX64]" from the @PART lines in DecoupleForX64.cfg and changing the decouplerModuleName for stack decouplers. ModuleManager doesn't allow multiple pass declarations and just uses the first; by saying ":FOR[DecoupleForX64]:AFTER[TweakableEverything]", the patch applies during the ":FOR[DecoupleForX64]" pass, long before the TweakableEverything pass. Also, the DecoupleForX64 cfg mistakenly used ModuleAnchoredDecouplerX64 for the ModuleDecoupleX64 decouplerModuleName; just a copypasta mistake.

TE and DFX64 should play nicely with this cfg:


@PART[*]:HAS[@MODULE[ModuleDecouple]]:AFTER[TweakableEverything]
{
@MODULE[ModuleDecouple]
{
@name = ModuleDecoupleX64
}

@MODULE[ModuleTweakableDecouple]
{
@decouplerModuleName = ModuleDecoupleX64
}
}

@PART[*]:HAS[@MODULE[ModuleAnchoredDecoupler]]:AFTER[TweakableEverything]
{
@MODULE[ModuleAnchoredDecoupler]
{
@name = ModuleAnchoredDecouplerX64
}

@MODULE[ModuleTweakableDecouple]
{
@decouplerModuleName = ModuleAnchoredDecouplerX64
}
}

Link to comment
Share on other sites

All: the issue with TweakableEverything should be fixed by removing the ":FOR[DecoupleForX64]" from the @PART lines in DecoupleForX64.cfg and changing the decouplerModuleName for stack decouplers. ModuleManager doesn't allow multiple pass declarations and just uses the first; by saying ":FOR[DecoupleForX64]:AFTER[TweakableEverything]", the patch applies during the ":FOR[DecoupleForX64]" pass, long before the TweakableEverything pass. Also, the DecoupleForX64 cfg mistakenly used ModuleAnchoredDecouplerX64 for the ModuleDecoupleX64 decouplerModuleName; just a copypasta mistake.

TE and DFX64 should play nicely with this cfg:


@PART
[*]:HAS[@MODULE[ModuleDecouple]]:AFTER[TweakableEverything]
{
@MODULE[ModuleDecouple]
{
@name = ModuleDecoupleX64
}

@MODULE[ModuleTweakableDecouple]
{
@decouplerModuleName = ModuleDecoupleX64
}
}

@PART
[*]:HAS[@MODULE[ModuleAnchoredDecoupler]]:AFTER[TweakableEverything]
{
@MODULE[ModuleAnchoredDecoupler]
{
@name = ModuleAnchoredDecouplerX64
}

@MODULE[ModuleTweakableDecouple]
{
@decouplerModuleName = ModuleAnchoredDecouplerX64
}
}

Thank you! :P

Link to comment
Share on other sites

All: the issue with TweakableEverything should be fixed by removing the ":FOR[DecoupleForX64]" from the @PART lines in DecoupleForX64.cfg and changing the decouplerModuleName for stack decouplers. ModuleManager doesn't allow multiple pass declarations and just uses the first; by saying ":FOR[DecoupleForX64]:AFTER[TweakableEverything]", the patch applies during the ":FOR[DecoupleForX64]" pass, long before the TweakableEverything pass. Also, the DecoupleForX64 cfg mistakenly used ModuleAnchoredDecouplerX64 for the ModuleDecoupleX64 decouplerModuleName; just a copypasta mistake.

Thanks for writing better MM patch than me toadicus :)

I'll update the zip when I can.

Link to comment
Share on other sites

Great idea :)

Problem... it Crashed KSP in the VAB while trying to load a Ship (it's a ship i made before the mod. it's nothing fancy only stock parts....

Now the savegame is wrecked and will crash KSP... sight.. gone are my 10 mil funds ^^

Link to comment
Share on other sites

So, would this work?

No, it does not. We need to fork Fixed Decoupler into this:

[KSPEvent(name = "Jettison", active=true, guiActive=true, guiActiveUnfocused=false, guiName="Jettison")]

public void Jettison()

{

if (part.parent)

{

foreach (var p in part.parent.children)

foreach (var joint in p.GetComponents<ConfigurableJoint>())

if (joint!=null && (joint.rigidbody==part.Rigidbody || joint.connectedBody==part.Rigidbody))

Destroy(joint);

part.decouple(0);

var tr=part.FindModelTransform(transformName);

if (tr)

{

part.Rigidbody.AddForce(tr.TransformDirection(forceVector)

*Mathf.Lerp(ejectionLowDv, ejectionDv, ejectionPower),

ForceMode.VelocityChange);

part.Rigidbody.AddTorque(tr.TransformDirection(torqueVector)

*Mathf.Lerp(ejectionLowTorque, ejectionTorque, torqueAmount),

ForceMode.VelocityChange);

}

else

Debug.LogError("[ProceduralFairingDecoupler] no '"+transformName+"' transform in part", part);

ejectFx.audio.Play();

}

}

I have tried adding a loop with frame count, but it didn't work. Any help from some actual coder?

EDIT: Also atm using Fixed Decoupler messes with launch stability enhancers, might be good idea to make exception to them.

Edited by koksny
Link to comment
Share on other sites

No, it does not. We need to fork Fixed Decoupler into this:

I have tried adding a loop with frame count, but it didn't work. Any help from some actual coder?

EDIT: Also atm using Fixed Decoupler messes with launch stability enhancers, might be good idea to make exception to them.

You know, I'm no coder either, but just to be safe anyone wanting to take a shot at this, here's the whole thing:

https://github.com/e-dog/ProceduralFairings/blob/master/Source/FairingDecoupler.cs

And just to add some context; the original creator is refusing to fix it because Squad didn't implement procedural cost generation...

Make of that what you will, but for someone who knows what he's doing this is probably rather simple.

And just so everybody is aware of what exactly you're dealing with here:

The mod in question: http://forum.kerbalspaceprogram.com/threads/39512-0-24-Procedural-Fairings-3-06-%28July-20%29

It's liscence: http://creativecommons.org/licenses/by/3.0/

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...