net-lisias-ksp / KSP-Recall

Recall for KSP blunders, screw ups and borks.
GNU General Public License v2.0
25 stars 2 forks source link

`AttachedOnEditor` is being screwed up when Merging crafts #61

Closed Lisias closed 1 year ago

Lisias commented 1 year ago

Somehow I screwed up something when merging crafts.

[EDIT]: NOPE. It's a new (old) bug on KSP Editor, since 1.4.x

Consider this craft:

Screen Shot 2023-03-19 at 02 44 49

Now, let's merge it with itself :

Screen Shot 2023-03-19 at 02 47 36

And save it with a different name:

Screen Shot 2023-03-19 at 02 48 06

Note the gap between the two subassemblies:

Screen Shot 2023-03-19 at 02 48 06

This misbehaviour is consistent downto KSP 1.4.3 - so it's something on me for sure.

Now things start to get instesting:

On TweakScale 2.4.6.25 (the current mainstream latest), by detaching the lower half of the craft and attaching it again, we still get the gap. By saving the craft and loading it again, this misbehaviour doesn't changes.

Screen Shot 2023-03-19 at 02 54 05

On TweakScale 2.5 beta (latest), detaching and reattaching the thing doesn't solves the problem, but if you save the craft and load it again, by trying the stunt, you get things tight again!

Screen Shot 2023-03-19 at 02 54 24

This confirms that TweakScale is the source of the problem, with KSP-Recall just doing what its being told to do. We fix TweakScale, we have this problem solved.

Lisias commented 1 year ago

hellboy_aw_crap_by_superkitty27_d7lybil-pre

The behaviour is not consistent. It changes depending of the part!!!

On MK1 cockpits, there's no gap - but clipping inside!!!!

Screen Shot 2023-03-20 at 00 57 43

DAMN!!

The behaviour is consistent with the Mk2, saving and reattaching solving the glitch. But, again, DAMN!!!

Lisias commented 1 year ago

IT'S A FSKCING ROUNDING PROBLEM!!!

Screen Shot 2023-03-20 at 03 37 45

When we save the AA vessel (the two A ones merged), the vessel Y size is being set to 10.49992 M.

When I saved AA again as AA2, the Y size is now 10 M, the correct size because now I can deatach and reattach the damned thing into the right place.

On the A file, the Y size is correctly set to 5 M.

Lisias commented 1 year ago

Removing TweskScale from the GameData "solves" the issue, so this is really some misbehaviour caused (or induced) by TweakScale.

Lisias commented 1 year ago

Interesting:

Screen Shot 2023-03-20 at 04 00 22

When you load the craft file, everything works fine. When you "load for merge", things are completely screwed.

Screen Shot 2023-03-20 at 04 00 22

If TweakScale would be at fault, loading the resized A craft would trigger the problem too.

So it's not something TweakScale is doing wrong. It's something someone (TweakScale or Recall) is not doing right.

Time to mess with AttachedOnEditor to see what I get.

Lisias commented 1 year ago

HA!! I found two problems!

The gap on unscaled parts is something on KSP-Recall. But the clipping parts it's something else. Since the original problem is the gap, I'm transferring back this issue to KSP-Recall.

Lisias commented 1 year ago

HOLY KRAP. Again.

KSP's Editor behaviour differs when loading a subassembly from loading a craft for merge. This is completely bonkers.

Whoever wrote that code for KSP 1.4.x, he/she/it/whatever didn't programmed a feature. he/she/it/whatever hacked and sliced and butchered the way out of the task. (sigh)

Damn… How I was naive a couple years ago...

Lisias commented 1 year ago

The misbehaviour is consistent from KSP 1.4.3 to KSP 1.12.5 :

When using a subassembly, everything works fine.

When merging a craft, that crappy gap happens.

Oukey, this is not a bug on TweskScale neither Recall. Is a new bug from KSP that I only realised today.

Lisias commented 1 year ago

It's a BUG on KSP, so it's not my fault.

Lisias commented 1 year ago

(almost) fixed on commit https://github.com/net-lisias-ksp/KSP-Recall/commit/9649697ba67e6a5ac875dbac735c435e87331766

There's still a gap, however. Still digging.

Lisias commented 1 year ago

Oukey, we still have the misbehaviour - it only happens to be smaller now.

Still the same effect, only smaller:

Screen Shot 2023-03-20 at 13 03 56

Screen Shot 2023-03-20 at 13 07 33

Lisias commented 1 year ago

Apparently commit https://github.com/net-lisias-ksp/KSP-Recall/commit/8d58433dcb7550cd24657c6bbe0e14f46267b6d2 fixes this second misbehaviour (smaller gap).

But I'm pretty unsatisfied with this stunt. I think there's a float wounding lurking somewhere in TweakScale - but where it would be it's beyound me right now. This issue was also happening with unscaled parts, and TweakScale just don't do any math on unscaled parts! (or should not)

Lisias commented 1 year ago

Additional instrumentation on TweakScale just confirmed what I already now - that TweakScale does not do any math on the part when it is not scaled, so the original misbehaviour is still unexplained at this time.

So I don't really know why it happened at first place.

So I don't know why the changes made for this issue solved the issue.

(deep sigh)

I'm counting my blesses know. I will push this thing into production and then hire a priest to execute an exorcism on this damned thing.

Lisias commented 5 months ago

I'm counting my blesses know. I will push this thing into production and then hire a priest to execute an exorcism on this damned thing.

The priest was fired. We are hiring!