Jump to content

[1.12.x] TAC Self Destruct Continued


linuxgurugamer

Recommended Posts

On 3/6/2017 at 10:50 PM, Mitchz95 said:

Is it possible to trigger the self-destruct by destroying the part, i.e. by hitting it above its impact tolerance?

Also, the self-destruct doesn't seem to work when the countdown is set to 'invisible'.

Can you explain how you determined the self destruct not working when countdown timer not visible?

Thanks

Link to comment
Share on other sites

9 hours ago, linuxgurugamer said:

Can you explain how you determined the self destruct not working when countdown timer not visible?

Thanks

It just doesn't go off. The part is "armed"; I have an abort option, but clicking it does nothing and the part just doesn't explode.

Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...
  • 4 weeks later...
  • 1 month later...
  • 5 months later...
  • 2 months later...
  • 2 weeks later...

New release, 1.6.7

  • Added parts to ignore for the initial part explosion, various LaunchEscapeSystem parts
  • Added yields to allow other mods to react to the initial explosions (ie:  Bob's Panic Box)

There may be some additional updates soon, as I find and add other LES parts

Link to comment
Share on other sites

  • 3 months later...
  • 1 month later...
KSP: 1.5.1 Windows 64 bit

Problem: SelfDestruct leaves the bomb part and the bomb's parent part (possibly more) when activated if the bomb is not attached to the root part of the vessel.

Mods installed:  TAC Self Destruct 1.6.7.1

Reproduction steps:

Build a simple craft with a few parts and a destruct module (not attached to the root part), on the launchpad right click and initiate "Self Destruct!"

Log: output_log.txt   (the log is not from the vessel in the pictures)

I've built this vessel on its side so parts aren't destroyed from fall damage (which would confuse the issue).

Qe0SZ3m.jpgz2WLSXK.jpg

From my testing, it seems to have the most problem with fuel tanks and SRBs. I think it might be hanging on parts with variants?

Edited by MalevolentNinja
Link to comment
Share on other sites

  • 2 weeks later...
On 10/11/2018 at 10:44 PM, icecold951 said:

Is this still working for others? Mine doesn't work right. Parts attached don't self destruct, and if it blows up a part, the bomb stays as debris.

Same for me - some things don't blow at all and even if everything goes, the self-destruct gets left behind.  Not on my game computer right now, so I can't do a log at the moment.

Link to comment
Share on other sites

  • 2 weeks later...

Would be helpful is a specific sequence of steps and vessel/parts could be provided for me to replicate.  This is relatively minor, and I"m busy with another mod, I don't have a lot of time to look into this, but if I can get a good way to replicate it, I would be able to see what's going on

Link to comment
Share on other sites

10 hours ago, linuxgurugamer said:

Would be helpful is a specific sequence of steps and vessel/parts could be provided for me to replicate.  This is relatively minor, and I"m busy with another mod, I don't have a lot of time to look into this, but if I can get a good way to replicate it, I would be able to see what's going on

It happens to me randomly even when I just have a fuel tank, X1100, and command pod.

I appreciate the time you put into keeping mods going, and working on your own; to that end I've downloaded the source and poked around - it looks like for some reason the enumeration of vessel.parts changes during the foreach on line 344 of TacSelfDestruct.cs. Changing just that line to foreach (var p in vessel.parts.ToList()) and recompiling against ksp1.5.1 seems to correct the problem on my end in multiple tests using the problematic ships.

Edited by Sidelia
Link to comment
Share on other sites

2 hours ago, Sidelia said:

It happens to me randomly even when I just have a fuel tank, X1100, and command pod.

I appreciate the time you put into keeping mods going, and working on your own; to that end I've downloaded the source and poked around - it looks like for some reason the enumeration of vessel.parts changes during the foreach on line 344 of TacSelfDestruct.cs. Changing just that line to foreach (var p in vessel.parts.ToList()) and recompiling against ksp1.5.1 seems to correct the problem on my end in multiple tests using the problematic ships.

You hit the nail on the head, thank you.

What's happening is that the next line does an explode, which destroys the part and messes up the enumeration.  Unfortunately, what you did, while working, is subject to the same issue.

The correct way to fix this is to either do another while loop, similar to the one above:

                        while (vessel.parts.Count > 0)                           
                        {
                            vessel.parts[0].explode();
                            // Do a yield here in case something else (ie:  Bob's Panic Box) needs to react to the part exploding
                            yield return null;
                        }

I could also have done this:

                        // Explode the rest of the parts
                        for (int x = vessel.parts.Count - 1; x > 0; x--)          
                        {
                            vessel.parts[x].explode();
                            // Do a yield here in case something else (ie:  Bob's Panic Box) needs to react to the part exploding
                            yield return null;
                        }

Either of these work safely, without any issue with parts disappearing from an enumerated list.  I like the first one, it's a bit more efficient

Link to comment
Share on other sites

18 hours ago, Sidelia said:

@linuxgurugamer I'm experiencing the same problem with some parts exploding fine, but others (and notably the part with the TacSelfDestruct module) not. This is in linux player 1.5.1 with v1.6.7.1 of the mod.

Attached is a log snipped from the time TacSelfDestruct activates (via staging) to end. Player.log (pastebin)

I just looked at the log, which actually shows the error:


InvalidOperationException: Collection was modified; enumeration operation may not execute.
  at System.Collections.Generic.List`1+Enumerator[Part].VerifyState () [0x00000] in <filename unknown>:0 
  at System.Collections.Generic.List`1+Enumerator[Part].MoveNext () [0x00000] in <filename unknown>:0 
  at Tac.TacSelfDestruct+<DoSelfDestruct>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0 
  at UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00000] in <filename unknown>:0 

Sorry, I was busy yesterday getting ready for my stream.  I appreciate what you did, both in posting the log and recompiling it to test your fix

Link to comment
Share on other sites

New release, 1.6.8

  • Fixed bug causing some parts to not be destroyed
  • Removed max version from .version file
  • Removed some log spam

For people who haven't yet updated to 1.5.1, you can get a compiled version of the mod for 1.4.5 at the following URL: https://github.com/linuxgurugamer/TacSelfDestruct/releases/download/1.6.8/TacSelfDestruct-1.4.5-1.6.8.zip

 

Link to comment
Share on other sites

5 hours ago, linuxgurugamer said:

You hit the nail on the head, thank you.

What's happening is that the next line does an explode, which destroys the part and messes up the enumeration.  Unfortunately, what you did, while working, is subject to the same issue.

The correct way to fix this is to either do another while loop, similar to the one above:


                        while (vessel.parts.Count > 0)                           
                        {
                            vessel.parts[0].explode();
                            // Do a yield here in case something else (ie:  Bob's Panic Box) needs to react to the part exploding
                            yield return null;
                        }

I could also have done this:


                        // Explode the rest of the parts
                        for (int x = vessel.parts.Count - 1; x > 0; x--)          
                        {
                            vessel.parts[x].explode();
                            // Do a yield here in case something else (ie:  Bob's Panic Box) needs to react to the part exploding
                            yield return null;
                        }

Either of these work safely, without any issue with parts disappearing from an enumerated list.  I like the first one, it's a bit more efficient

Awesome! Glad to contribute and thanks for the feedback.

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...