AliceTheGorgon Posted January 13, 2017 Share Posted January 13, 2017 (edited) [removed] Edited August 24, 2017 by AliceTheGorgon Pruning old internet accounts. Quote Link to comment Share on other sites More sharing options...
sarbian Posted January 13, 2017 Share Posted January 13, 2017 On 1/13/2017 at 7:50 AM, AliceTheGorgon said: I don't suppose there's any simple way to display a message box in the middle of the screen with some text and a close button? Expand PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), "Title", "Text", "OK", false, HighLogic.UISkin); Quote Link to comment Share on other sites More sharing options...
AliceTheGorgon Posted January 13, 2017 Share Posted January 13, 2017 (edited) [removed] Edited August 24, 2017 by AliceTheGorgon Pruning old internet accounts. Quote Link to comment Share on other sites More sharing options...
JuhaJGamer Posted January 13, 2017 Share Posted January 13, 2017 (edited) On 1/9/2017 at 6:34 PM, JuhaJGamer said: Has anyone got any idea of how to make a vessel rendezvous with another vessel, and then set the velocity relative to the target at ~50m/s. Rendezvous in kind of like the in-game cheat rendezvous which sets the vessel 150m away from the target. Expand Help please? Edited January 13, 2017 by JuhaJGamer Quote Link to comment Share on other sites More sharing options...
0111narwhalz Posted January 13, 2017 Share Posted January 13, 2017 On 1/9/2017 at 6:34 PM, JuhaJGamer said: Has anyone got any idea of how to make a vessel rendezvous with another vessel, and then set the velocity relative to the target at ~50m/s. Rendezvous in kind of like the in-game cheat rendezvous which sets the vessel 150m away from the target. Expand Now, I don't know much about plugin work (read: I'm a complete neophyte), but it seems like you could do it in two steps: 1. Rendezvous: Either trigger the stock debug tool, or copy the data from one to the other via save-file or vessel data. 2. Velocity: Add a velocity to the vessel. Probably done through the vessel data and some trig. Quote Link to comment Share on other sites More sharing options...
JuhaJGamer Posted January 13, 2017 Share Posted January 13, 2017 On 1/13/2017 at 6:39 PM, 0111narwhalz said: Now, I don't know much about plugin work (read: I'm a complete neophyte), but it seems like you could do it in two steps: 1. Rendezvous: Either trigger the stock debug tool, or copy the data from one to the other via save-file or vessel data. 2. Velocity: Add a velocity to the vessel. Probably done through the vessel data and some trig. Expand Ok, these are the two methods that I have tried. Directly editing the "quicksave" file takes time. There could be more vessels of the same name. And after that you must load it which may give you a quick fps-spike. The stock debug tool I cant find. Anywhere. No docs, no classes, no functions, It's like it doesn't exist. Velocity, I learned it actually today so that's great Quote Link to comment Share on other sites More sharing options...
0111narwhalz Posted January 13, 2017 Share Posted January 13, 2017 @JuhaJGamer Some things that might be useful: Vessel.obt_velocity Vessel.SetPosition() Vessel.GetWorldPos3D() And the Vector3d and Orbit classes. Quote Link to comment Share on other sites More sharing options...
JuhaJGamer Posted January 13, 2017 Share Posted January 13, 2017 On 1/13/2017 at 7:01 PM, 0111narwhalz said: @JuhaJGamer Some things that might be useful: Vessel.obt_velocity Vessel.SetPosition() Vessel.GetWorldPos3D() And the Vector3d and Orbit classes. Expand Vessel.obt_velocity is of the type Vector3d. for some reason VS2015 wants KSPUtil for this (KSP cant recognise KSPUtil.dll anymore, because it was all moved to Assembly-CSharp.dll) Quote Link to comment Share on other sites More sharing options...
blowfish Posted January 13, 2017 Share Posted January 13, 2017 On 1/13/2017 at 7:07 PM, JuhaJGamer said: Vessel.obt_velocity is of the type Vector3d. for some reason VS2015 wants KSPUtil for this (KSP cant recognise KSPUtil.dll anymore, because it was all moved to Assembly-CSharp.dll) Expand It was moved back into Assembly-CSharp. Remove the reference to KSPUtil and make sure your reference to Assembly-CSharp points to an up-to-date DLL Quote Link to comment Share on other sites More sharing options...
JuhaJGamer Posted January 13, 2017 Share Posted January 13, 2017 (edited) On 1/13/2017 at 7:08 PM, blowfish said: It was moved back into Assembly-CSharp. Remove the reference to KSPUtil and make sure your reference to Assembly-CSharp points to an up-to-date DLL Expand I have the newest version of KSP and its Assembly-CSharp. VS still insists on the KSPUtil refrence http://imgur.com/gallery/GJlMq Edited January 13, 2017 by JuhaJGamer Pic Quote Link to comment Share on other sites More sharing options...
blowfish Posted January 13, 2017 Share Posted January 13, 2017 On 1/13/2017 at 7:11 PM, JuhaJGamer said: I have the newest version of KSP and its Assembly-CSharp. VS still insists on the KSPUtil refrence Expand Might try quitting and re-starting Visual Studio. Also verify that when you click on the Assembly-CSharp reference, it actually points to where you think it should (it'll show the path in the bottom right pane) Quote Link to comment Share on other sites More sharing options...
JuhaJGamer Posted January 13, 2017 Share Posted January 13, 2017 On 1/13/2017 at 7:17 PM, blowfish said: Might try quitting and re-starting Visual Studio. Also verify that when you click on the Assembly-CSharp reference, it actually points to where you think it should (it'll show the path in the bottom right pane) Expand Tried it. It points to "J:\Ohjelmat\Pelit\Kerbal Space Program\KSP_Data\Managed\Assembly-CSharp.dll" which is my KSP Install. It is up-to-date(Steam) and rebooting VS didn't really help. Quote Link to comment Share on other sites More sharing options...
blowfish Posted January 13, 2017 Share Posted January 13, 2017 On 1/13/2017 at 7:20 PM, JuhaJGamer said: Tried it. It points to "J:\Ohjelmat\Pelit\Kerbal Space Program\KSP_Data\Managed\Assembly-CSharp.dll" which is my KSP Install. It is up-to-date(Steam) and rebooting VS didn't really help. Expand Okay, maybe try removing the Assembly-CSharp reference and re-adding it. Also, if you open the .csproj file in a text editor, can you find KSPUtil in it anywhere? Quote Link to comment Share on other sites More sharing options...
JuhaJGamer Posted January 13, 2017 Share Posted January 13, 2017 On 1/13/2017 at 7:26 PM, blowfish said: Okay, maybe try removing the Assembly-CSharp reference and re-adding it. Also, if you open the .csproj file in a text editor, can you find KSPUtil in it anywhere? Expand None of this helped, even rebooted my computer(dont know why I did that tbh.) hello? Quote Link to comment Share on other sites More sharing options...
JuhaJGamer Posted January 13, 2017 Share Posted January 13, 2017 Is anyone here. VS is still doing it Quote Link to comment Share on other sites More sharing options...
sarbian Posted January 13, 2017 Share Posted January 13, 2017 If VS insist then your Assembly-CSharp is not the 1.2 one because KSPUtil is not in 1.2 anymore. Now if it still does not work can you create a thread for your problem ? Quote Link to comment Share on other sites More sharing options...
rsparkyc Posted January 15, 2017 Share Posted January 15, 2017 Have you tried right clicking on that dependency and clicking "remove"? In a separate topic, I'm trying to help upgrade RP-0. Looks like there was some old code like this: protected double ResourceRate() { if (part.Modules.Contains("ModuleCommand")) { ModuleCommand mC = (ModuleCommand)part.Modules["ModuleCommand"]; foreach(ModuleResource r in mC.inputResources) { if(r.name.Equals("ElectricCharge")) { commandChargeResource = r; if (enabledkW < 0) enabledkW = (float)r.rate; return r.rate; } } } return -1; } However, ModuleCommand no longer has inputResources. I can do mC.part.resources, and filter where mC.flowMode is FlowMode.In, but 1) I don't know if that's the right way to do it, and 2) those objects still don't have a rate field. Suggestions? Quote Link to comment Share on other sites More sharing options...
sarbian Posted January 16, 2017 Share Posted January 16, 2017 On 1/15/2017 at 8:47 PM, rsparkyc said: However, ModuleCommand no longer has inputResources. I can do mC.part.resources, and filter where mC.flowMode is FlowMode.In, but 1) I don't know if that's the right way to do it, and 2) those objects still don't have a rate field. Suggestions? Expand The ModuleCommand has a resHandler of type ModuleResourceHandler. It contains the inputResources. So : protected double ResourceRate() { ModuleCommand mC = part.FindModuleImplementing<ModuleCommand>() if (mC != null) { foreach(ModuleResource r in mC.resHandler.inputResources) { if(r.id == PartResourceLibrary.ElectricityHashcode) { commandChargeResource = r; if (enabledkW < 0) enabledkW = (float)r.rate; return r.rate; } } } return -1; } Quote Link to comment Share on other sites More sharing options...
rsparkyc Posted January 16, 2017 Share Posted January 16, 2017 On 1/16/2017 at 9:29 AM, sarbian said: The ModuleCommand has a resHandler of type ModuleResourceHandler. It contains the inputResources. So : protected double ResourceRate() { ModuleCommand mC = part.FindModuleImplementing<ModuleCommand>() if (mC != null) { foreach(ModuleResource r in mC.resHandler.inputResources) { if(r.id == PartResourceLibrary.ElectricityHashcode) { commandChargeResource = r; if (enabledkW < 0) enabledkW = (float)r.rate; return r.rate; } } } return -1; } Expand Gotta love one line changes Quote Link to comment Share on other sites More sharing options...
sarbian Posted January 16, 2017 Share Posted January 16, 2017 On 1/16/2017 at 3:24 PM, rsparkyc said: Gotta love one line changes Expand I may have optimized it a bit Quote Link to comment Share on other sites More sharing options...
rsparkyc Posted January 16, 2017 Share Posted January 16, 2017 On 1/16/2017 at 3:58 PM, sarbian said: I may have optimized it a bit Expand Oh, heh, yeah, it's more than one line, but no more Magic Strings Quote Link to comment Share on other sites More sharing options...
rsparkyc Posted January 16, 2017 Share Posted January 16, 2017 Are Bill and Val hardcoded into KSP somewhere? I'm trying to update KerbalRenamer, but get a NRE after I try to update their names: NullReferenceException: Object reference not set to an instance of an object at regexKSP.IconChanger.changeKerbalIcon (KSP.UI.CrewListItem cic) [0x00000] in <filename unknown>:0 at regexKSP.IconChanger.BuildCrewAssignmentDialogue () [0x00000] in <filename unknown>:0 at CallbackUtil+<DelayedCallback>c__IteratorEC.MoveNext () [0x00000] in <filename unknown>:0 at UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00000] in <filename unknown>:0 You can see what I'm doing here: https://github.com/rsparkyc/KerbalRenamer/blob/JebBillBobValRename/Renamer/Renamer.cs#L137 Quote Link to comment Share on other sites More sharing options...
JeanLucJ Posted January 17, 2017 Share Posted January 17, 2017 Hello, I'm new to ksp modding, but have done quite a lot of personnal mods in other games, in various technical environnements. A simple question : are there some ground explanations on the principles behind ksp code? Obviously, in modding there is always some thinking and trial-and-error needed find things out (and forum help :p), especially for the most obscure and rarely used stuff. On the other hand, I spent time digging in the various classes in Assembly-CSharp.dll, https://kerbalspaceprogram.com/api/, the wiki, ... and I found no entry-level explanations. For example : are there any high level explanations of the logic of the flight model ? Vessel class has quite a lot of 3dvectors (acceleration, gravitic_acceleration, angular velocity, east...), some are probably computed from others and / or taking other factors into account (atmosphere and so on). Obviously, describing the complete logic is a daunting (if not impossible without the source code) task, yet, I'm sure the community has a working knowledge of it. I don't mind doing research, for now I understand already quite a lot (not counting the flight model :p), there are a lot of mod sources code available to help, but if something exist, it would help. Thanks Quote Link to comment Share on other sites More sharing options...
sarbian Posted January 17, 2017 Share Posted January 17, 2017 On 1/17/2017 at 8:11 PM, JeanLucJ said: For example : are there any high level explanations of the logic of the flight model ? Vessel class has quite a lot of 3dvectors (acceleration, gravitic_acceleration, angular velocity, east...), some are probably computed from others and / or taking other factors into account (atmosphere and so on). Expand No, there are no documentation of the inner working of most stuff. The best doc is usually the community API wiki, a few post laying around and IRC talks. As for your example most of the flight model is done in the FlightIntegrator Quote Link to comment Share on other sites More sharing options...
garwel Posted January 21, 2017 Share Posted January 21, 2017 (edited) I have a trouble updating the contents of a PopupDialog. I have a PopupDialog monitorWindow field in my class, which I create and fill with a MultiOptionDialog. It works ok. Then I use this code in Update(): if ((monitorWindow != null) && (monitorWindow.isActiveAndEnabled)) monitorWindow.dialogToDisplay = new MultiOptionDialog("a dynamically generated message here", "Health Monitor", HighLogic.UISkin); However, the message doesn't update on-screen. I don't see monitorWindow.Update() or anything like that. I could destroy the window and create a new one, but doing it every tick or every frame sounds bad. UPD: The only way to update the popup window I found is to destroy and draw it again every Update. But then it becomes undraggable because it always spawns in the same location and I couldn't figure out how to access window's position. Edited January 21, 2017 by garwel Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.