sarbian

Members
  • Content count

    4636
  • Joined

  • Last visited

Community Reputation

5044 Excellent

About sarbian

  • Rank
    Purveyor of Nyan Cat and King of Cheaters

Profile Information

  • Location Paris, France
  1. KPS.IO and The Stream Class

    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
  2. Since you are deleting the PartStatsUpgradeModule first I doubt the @RESOURCE can find anything to patch. Try without the @
  3. 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
  4. 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.
  5. Hum, have a look at MJ code there (in other line about drag in that file) and see if th result is more in line with expectation.
  6. You used the proper values & call. Why are you surprised that parts with surfaces parallel to the air flow reports small surfaces ?
  7. The new landing bug from 1.3.1 should be fixed in the dev build. I do not really have much time to look into any of my mods ATM (lot of work and I need something a bit less intellectual to relax) so you ll have to hope that some of the other contributors have more time.
  8. vessel.patchedConicSolver.maneuverNodes[0].nextPatch.ApA or ApR should do it.
  9. Parenting attach the object to it s parent and localPosition is the position relative to the parent. So if you want your object to be where the parent is then you need to set localPosition to Vector3.zero.
  10. 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) }
  11. I know what is going on and how you can fix it but you ll have to wait for me to get back home so I have my code around. It s a matter of timing.
  12. yep, you need the fetch Also Planetarium.fetch.Home points to Kerbin.
  13. It s a Vector3. It can be a constant like Vector3.right but it could be the position of the sun ( Planetarium.Sun.MapObject.trf.position ), the parent body (cb.parent.MapObject.trf.position), ...
  14. All of KSP modding is "potentially confusing". Even for an ex member of the team