-
Posts
5,039 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by sarbian
-
Looking to start creating mods
sarbian replied to Ambiguous Impulse's topic in KSP1 Mods Discussions
Ok, let me rewrite your answer then: C#, but C++, Lua, Python, Go, PHP, ... is possible as long as your write a wrapper for it in C#. -
Looking to start creating mods
sarbian replied to Ambiguous Impulse's topic in KSP1 Mods Discussions
Nope. -
MFI does nothing even remotely related to graphic. If you have some crash with SVT then have a look at SVT dependency that actually have error messages in your logs....
-
KPS.IO and The Stream Class
sarbian replied to HurricanKai's topic in KSP1 C# Plugin Development Help and Support
As said earlier in the thread you can use the normal System.IO class now. KSP.IO should be used only for the config serialization tricks -
Adding resources via Part Upgrades
sarbian replied to T-10a's topic in KSP1 C# Plugin Development Help and Support
Since you are deleting the PartStatsUpgradeModule first I doubt the @RESOURCE can find anything to patch. Try without the @ -
I have been doing better but I am getting there I pushed a new dev with that added. Find the GameData\MechJeb2\Plugins\PluginData\MechJeb2\mechjeb_settings_global.cfg file and edit it. In the MechJebModuleFlightRecorder section add a historySize and set it to whatever you need (it will be created on MJ first save if not already there). You also have a precision (default 0.2). The default history is 3000 x 0.2 = 600s
-
Messing with the velocity directly will always lead to strange behaviors since you will fight with the orbits and FlightIntegrator. SetWorldVelocity is one of those calls in KSP that should not be public, or even exist at all. The way it does things make me think it a a remmenant of the pre krakensbane era. If you want a constant velocity while maintaining control then write a cheat engine that provides the proper acceleration.
-
- 772 replies
-
- 1
-
- kerbal space program
- take-two
-
(and 1 more)
Tagged with:
-
So as I said earlier the problem is timming. Your code runs is most likely runs for an Update call so it runs each frame and since it s a mod code it runs a what Unity call priority 0. KSP code runs at various timing so some of KSP calls are always called before the mods and others are always called after. From memory one of the code that actually runs later is the movement of the ScaledSpace. So your mods move stuff related to the position of a planet in scaledSpace but scaledSpace move stuff after your mods, so you are lagging behind. For some code the answer is simple. Replace Update with LateUpdate. But here it won't help you because ScaledSpace already uses LateUpdate. So how do you make your code runs even later ? The "easy" solution is the TimmingManager that was added in 1.2. You can can ask it tu run your code at one of the pre set timing. If you look at the script order doc you will see that scaled space runs at timing 500 so you need something later. Luckily you can see Timing5 at the end of the list (Timing4 is at 19, too early for our needs). So how do you use that ? It requires a bit more code. A basic template would be public override void OnStart(PartModule.StartState state) // OnStart for a PartModule. "void Start()" for a MonoBehaviour { // Register our code with the timing manager and ask it to run at the last timing available (the order should be clear from the names) TimingManager.LateUpdateAdd(TimingManager.TimingStage.BetterLateThanNever, CodeWeWantToRunLate); } void OnDestroy() { // Removing the call when your object is gone is critial. TimingManager.LateUpdateRemove(TimingManager.TimingStage.BetterLateThanNever, CodeWeWantToRunLate); } // This replace our Update() or OnUpdate() void CodeWeWantToRunLate() { // We need to check if the object we run on is actually active because the timing manager does not check. if (!this.isActiveAndEnabled) return; (do stuff) }