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

Refunding is not working on 1.12.x!!!! #77

Closed Lisias closed 4 months ago

Lisias commented 4 months ago

Fellow Kerbonaut byHOY complained about the pricing of scaled parts being wrong:

image image

Problem: The costs I'm getting are not exactly the same!

screenshot65

So I created this Untitled Space Craft, costing 44680F (from a budget of 50.000F):

screenshot68

Launched it, and recovered it:

Screen Shot 2024-05-05 at 23 26 20

And voilá, funds are screwed. 😢

The special resource I use to recover the loses from the crappy KSP recovering funds calculation is missing!!

Lisias commented 4 months ago

Damn. The think is working on 1.11.2. So it's something related to KSP itself that changed something later. 😠

Screen Shot 2024-05-05 at 23 43 35

Lisias commented 4 months ago

Things are borking from KSP 1.12.x and newer, bothered to check from 1.12.2 to 1.12.5 . 💩

Now... Why this is being detected just now? I remember testing Refunding on KSP 1.12.2

https://forum.kerbalspaceprogram.com/topic/192048-143/?do=findComment&comment=4202573

Lisias commented 4 months ago

~Crap. O think I found the reason. Aparently OnEditorShipModified is not being called by Editor.~

Lisias commented 4 months ago

Nope. I misconfigured the Log level on Refunding. I'm too tired, time to give this a break.

Lisias commented 4 months ago

Humm... I think I found it this time. FundsKeeper.UpdateResource is not being called by Refunding. 😞

Interesting, StealBacoMyFunds is working as expected...

[LOG 07:47:50.671] [KSP-Recall.StealBackMyFunds] TRACE: UpdateResource solidBooster.sm.v2:FFF925F2

Why just Refunding is getting screwed?

Lisias commented 4 months ago

Jesus Christ! It's because Refunding is not being applied into the part!!!!

savegame: bug.zip KSP.log: KSP.log ConfigCache: ConfigCache.cfg.zip

On the Untitled Craft craft file on VAB's Ship's directory, you will find that the craft is being saved without the Refunding module!

FundsKeeper and TweakScale are there, just Refunding is missing. But the KSP.log says the patch was applied, and the thing is there on the ConfigCache...

Lisias commented 4 months ago

Changing this to KSP-Recall, as it's a problem related to it.

Lisias commented 4 months ago

It's odd. StealBackMyFunds is working, and it uses essentially the same mechanisms.

I managed to make the damned Refunding to be loaded by renaming it, besides it didn't recovered any funds. It's like the name "Refunding" became cursed somehow.

DayJob© is calling now, but I will go back to this issue ASAP. I think I need to do some regression tests using previous KSP-Recall releases to see what I find.

Lisias commented 4 months ago

Humm, ok. It's a self infringed problem: Refunding is working on KSP-Recall 0.3.0.12 .

Lisias commented 4 months ago

The fault of Schrödinger: it's not my fault, but it's my fault.

Lisias commented 4 months ago

This mess started to happen on KSP-Recall 0.4.0.3.

Lisias commented 4 months ago

This is the exact commit that triggered the problem. I don't have the slightest idea on how in hell this caused so much damaged.

https://github.com/net-lisias-ksp/KSP-Recall/commit/f8afb62c25f7045e44121dc6e8ce81e9bbde7309

Lisias commented 4 months ago

This is the most unsettling...

It looks like Refunding is being killed on the OnLoad. Look the StealBackMyFunds log sequence, it Refunding should be having a similar sequence.

[LOG 16:00:09.819] [KSP-Recall.FundsKeeper] TRACE: OnAwake <NO VESSEL>-probeCoreOcto.v2(Clone):FFF9352A
[LOG 16:00:09.819] [KSP-Recall.StealBackMyFunds] TRACE: OnAwake <NO VESSEL>-probeCoreOcto.v2(Clone):FFF9352A
[LOG 16:00:09.823] [KSP-Recall.FundsKeeper] TRACE: OnLoad <NO VESSEL>-probeCoreOcto.v2:FFF9352A True
[LOG 16:00:09.823] [KSP-Recall.StealBackMyFunds] TRACE: OnLoad <NO VESSEL>-probeCoreOcto.v2:FFF9352A True
[LOG 16:00:09.823] [KSP-Recall.StealBackMyFunds] TRACE: HighLogic.LoadedScene FLIGHT
[LOG 16:00:09.823] [KSP-Recall.StealBackMyFunds] TRACE: Resetting StealBackMyFunds on part <NO VESSEL>-probeCoreOcto.v2:FFF9352A
[LOG 16:00:09.831] [KSP-Recall.FundsKeeper] TRACE: OnAwake <NO VESSEL>-solidBooster.sm.v2(Clone):FFF934E2
[LOG 16:00:09.832] [KSP-Recall.StealBackMyFunds] TRACE: OnAwake <NO VESSEL>-solidBooster.sm.v2(Clone):FFF934E2
[LOG 16:00:09.834] [KSP-Recall.FundsKeeper] TRACE: OnLoad <NO VESSEL>-solidBooster.sm.v2:FFF934E2 True
[LOG 16:00:09.834] [KSP-Recall.StealBackMyFunds] TRACE: OnLoad <NO VESSEL>-solidBooster.sm.v2:FFF934E2 True
[LOG 16:00:09.834] [KSP-Recall.StealBackMyFunds] TRACE: HighLogic.LoadedScene FLIGHT
[LOG 16:00:09.834] [KSP-Recall.StealBackMyFunds] TRACE: Resetting StealBackMyFunds on part <NO VESSEL>-solidBooster.sm.v2:FFF934E2
Lisias commented 4 months ago

I quit trying to understand this crap 💩 for now. RealLife™ is bitting.

I rolled back the codebase to the point where the problem didn't happened, backported some fixes, and will publish the damned thing based on branch https://github.com/net-lisias-ksp/KSP-Recall/tree/emergencial/0.5.0.0 .

kraken knows what in hell is happening here.

Once I have some time available (what will be a fight by itself for while), I will try to add back the changes that caused the problem in 1.12.x (and only on 1.12.x) one by one to see if I figure out exactly what happened.