KSP-Recall

Recall for KSP blunders, screw ups and borks.

Aims to fix Stock misbehaviours the most seamlessly as possible, trying hard to do not introduce new ones in the process. :)

In a Hurry

Description

Tired of constantly updating your Add’Ons each time a new KSP release fsck up something?

Restless while waiting your favorite Add’On to be updated so you can play without invoking devils using dark and incomprehensible rituals?

So this Add’On is for you.

By installing this thingy, unsolved bugs and mishaps from KSP Development Team will be fixed or at least worked around, saving Add’On Authors from the hassle to handle them themselves - most of the time without introducing new ones. :)

It aims to need minimal coupling with existent code, as well to be selectively injected on the affected parts in order to prevent unholy interactions with third-party modules that decide to fix things their own way.

Currently, the following fixes are available once installed:

Fixes not needed on the current KSP instalment are not applied. So it’s safe to just install KSP-Recall on anything you have (besides wasting a tiny little bit more time on the loading).

For End Users

This is not intended to be “used” by end-users. It provides services to Add’On authors and/or fixes automatically some known problems on many different KSP versions.

But there’re some options that will allow the end user to control how the fixes works on his/machine.

Every fix can be deactivated on a given part, without affecting the other ones. This change is persisted on the craft file and on the savegame, so you can even deactivate a fix on a part on a craft and not do it on another craft. For people willing to write patches, the name of the attribute is active.

The user can also force his/her hand on how and where the fixes is installed by editing GameData/999_KSP-Recall/KSP-Recall.cfg. Changing this file will overrule the default installation decisions KSP-Recall does on startup, allowing you use fixes that usually would not be available for your rig. Use this with caution and prudence, this can royally screw up your savegames.

Currently, the following automatic fixes are available:

Automatically restores Resources changed by Fuel Switches.

As the title says, KSP-Recall detects when something changed on the craft (while Editing it) and tries to restore the Resources as intended by the Add’On authors, brute forcing the right way over the KSP 1.9.x. had brute forced its way (that breaks some Add’Ons).

However, and you as an user must be aware of it, some Fuel Switches don’t cope very well with others. It’s highly probable that you will have problems on installing more than on Fuel Switch on your KSP, because some of them install themselves on the parts without caring about any other one already there.

On a rule of thumb, it’s possible to have more than one Fuel Switch installed on KSP. What you can’t is have more than one Fuel Switch installed on the same part, and this is where most Fuel Switches authors are stomping their own toes.

Right now, this is what it’s known to the date:

Crafts at rest changes drifts the Heading by their own

On TweakScale’s Forum thread, a discussion about a problem introduced on KSP 1.8 that made the crafts to drift the heading randomly when leaved at their own, even with parking breaks or not wheels at all!

KSP-Recall introduces a new work around for this problem, detecting when the Heading drift is unwanted and canceling it.

It does not fixes, specifically, the drift induced by the wheels itself, but helps on preventing situations where the wheels problem would be triggered.

Fixing Costs refunds when Recovering Crafts on KSP 1.11.x

On TweakScale’s Forum thread, a discussion about a problem introduced on KSP 1.1.0 that made refunds on craft recovering problematic - as the user end up losing any extra costs a module implements for the part using the IPartCostModifier.

Many, many add’ons are affected by this problem.

KSP-Recall solves this by implementing a new module, Refunding, that makes use of a meta-resource (also called Refunding) to trick the game cost recovering algorithms in giving you back the Funds it miscalculates.

For Add’On Authors

Issue #1 KSP 1.9.x resets resources to prefab while cloning parts

Add’Ons that supports TweakScale using Scale_Redist.dll but do not change resources themselves will be automatically fixed - TweakScale ”calls” KSP Recall as the last step of the rescaling, anything you do on IRescalable::OnRescale(ScalingFactor factor) will be preserved.

Add’Ons that also changes the Part’s resources outside of the OnRescale callback or without direct support for/from TweakScale will need to add the following lines of code every time their Part Resources are changed:

            // send Resource Changed message to KSP Recall if needed
            if (0 != this.part.Resources.Count)
            {
                BaseEventDetails data = new BaseEventDetails (BaseEventDetails.Sender.USER);
                data.Set<int> ("InstanceID", this.part.GetInstanceID());
                data.Set<Type>("issuer", this.GetType ());
                part.SendEvent ("OnPartResourceChanged", data, 0);
            }

// note: If your part can be set to have <ZERO> resources, omit the "if" above to hint Recall that it should delete any internal cache for the part

It’s extremely important to send this event only at the last moment possible, after changing the resources. There’s no guarantee about when this Event will be handled (it can be handled right on the spot, or only next week - nobody knows). You can only be sure about when it will not be handled: before being issued. So do whatever you need, and add that lines above before the end of the function/method/procedure/whatever to avoid risking Recall caching your resources before you are done.

Add’Ons that support TweakScale by handling the OnPartScaleChanged event need to add that lines above too as the last step of their scaling tasks. Since Events are completely asynchronous, there’s a good chance that by the time TweakScale sends OnPartResourceChanged to Recall, you could not handled yet (or be in the middle of the handling!!!) your OnPartScaleChanged , and so Recall will essentially undo what you had done on your part (as it will get a snapshot of the current Resources before the change).

Installation

Detailed installation instructions are now on its own file (see the In a Hurry section) and on the distribution file.

Licensing

Please note the copyrights and trademarks in NOTICE.

UPSTREAM

There’s no upstream, I am (g)ROOT :)