`AttachedOnEditor` is being screwed up when Merging crafts
Lisias opened this issue · 13 comments
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:
Now, let's merge it with itself :
And save it with a different name:
Note the gap between the two subassemblies:
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.
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!
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.
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!
IT'S A FSKCING ROUNDING PROBLEM!!!
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.
Removing TweskScale from the GameData
"solves" the issue, so this is really some misbehaviour caused (or induced) by TweakScale.
Interesting:
When you load the craft file, everything works fine. When you "load for merge", things are completely screwed.
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.
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.
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...
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.
(almost) fixed on commit 9649697
There's still a gap, however. Still digging.
Apparently commit 8d58433 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)
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.