KSP Interstellar Extended

KSP Interstellar Extended

1M Downloads

Antimatter Container as root part explodes when ship unloades

X4n01 opened this issue ยท 4 comments

commented

When ship with root Antimatter Container is reaching 2.5km away it gets unloaded.
It shows the message from :

void OnJustAboutToBeDestroyed()             
(...)
else
                doExplode("Antimatter container exploded for unknown reason");

than whole ship is than "collapsed"/unloaded and basically destroyed.
When same ship has different root element it gets normally unloaded.
Tested on same ship launched twice with different root element.
Poor image of ship exploding when reaching 2.5km with some snapshot of logs:
bez tytulu

I guess that when unloading it sends signal and OnJustAboutToBeDestroyed catches it (wrongly) and later ExplodeContainer(); is called

commented

probably solution will be to add additional OR here:
if (!HighLogic.LoadedSceneIsFlight || antimatterResource.amount <= minimimAnimatterAmount || !FlightGlobals.VesselsLoaded.Contains(this.vessel)) return;

commented

The problem is to distinguish between being destroyed by an event (collision, overheating or stress) or when unloading. In both cases the OnJustAboutToBeDestroyed is called

Also don't post any issues here but at https://github.com/sswelm/KSP-Interstellar-Extended/issues

commented

I discovered the OnJustAboutToDie is called just before OnJustAboutToBeDestroyed is called, but exploding on the OnJustAboutToDie appers to cause infinate loop, so I simply take it along to OnJustAboutToBeDestroyed as an extra condition.

I implemented the fix in
339c5f4 and added additional debugging code

You have to verify yourself but at least in my own tests it explodes when it should (when it is destroyed) and doesn't when it shouldn't (when unloaded).

commented

Ok Thanks
I will check it.