Damocles Posted December 20, 2013 Share Posted December 20, 2013 There is a big static class GameEvents full of good stuff. Try OnVesselRecovered and OnVesselRecoveryRequested. Good luck.Thx. Exactly what I was looking for. Quote Link to comment Share on other sites More sharing options...
NathanKell Posted December 20, 2013 Share Posted December 20, 2013 Damocles: For futher howto, see MissionControllerEvents.cs in MCE (in signature). That does lots of stuff on recovery. Quote Link to comment Share on other sites More sharing options...
XanderTek Posted December 20, 2013 Share Posted December 20, 2013 Does anyone know if there's a way to create a custom slider tweakable like the engines have for throttle limiting? So far, the only tweakables i've seen in mods are buttons that execute functions. Quote Link to comment Share on other sites More sharing options...
TaranisElsu Posted December 20, 2013 Share Posted December 20, 2013 Does anyone know if there's a way to create a custom slider tweakable like the engines have for throttle limiting? So far, the only tweakables i've seen in mods are buttons that execute functions.Yes, like this: https://github.com/taraniselsu/TacSelfDestruct/blob/master/Source/TacSelfDestruct.cs#L38Look at the UI_* attributes. Quote Link to comment Share on other sites More sharing options...
XanderTek Posted December 20, 2013 Share Posted December 20, 2013 (edited) Thanks! How do you guys find these new features? There doesn't seem to be any new documentation, yet almost without fail someone has figured out all the latest tricks. Edited December 20, 2013 by XanderTek Quote Link to comment Share on other sites More sharing options...
stupid_chris Posted December 21, 2013 Share Posted December 21, 2013 Thanks! How do you guys find these new features? There doesn't seem to be any new documentation, yet almost without fail someone has figured out all the latest tricks.I passed on the info to Taranis myself, super sicret stuff. Quote Link to comment Share on other sites More sharing options...
XanderTek Posted December 21, 2013 Share Posted December 21, 2013 Hmm... very sneaky! Between RealChutes and TAC I now have some good examples for UI_Toggle and UI_Floatrange, but in my autocomplete list I see there are some others. Any idea if UI_Label, and UI_Vector2 are designed to be used similarly? They don't seem to show up in game for me, but I could certainly be missing something. Quote Link to comment Share on other sites More sharing options...
stupid_chris Posted December 21, 2013 Share Posted December 21, 2013 Hmm... very sneaky! Between RealChutes and TAC I now have some good examples for UI_Toggle and UI_Floatrange, but in my autocomplete list I see there are some others. Any idea if UI_Label, and UI_Vector2 are designed to be used similarly? They don't seem to show up in game for me, but I could certainly be missing something.I believe UI_Label doesn't do much in this situation. As for UI_Vector2, I've tried to use it, but it doesn'T seem to be operational with tweakables unfortunately. I think only UI_FloatRange and UI_Toggle currently work. Quote Link to comment Share on other sites More sharing options...
BioSehnsucht Posted December 21, 2013 Share Posted December 21, 2013 Has anyone figured out a way to add items to the list of science received after a vessel is recovered ? Would it be possible to trigger that to pop up even if the vessel was destroyed (with an added science entry) ? I'm trying to set up a plugin that will give science when something blows up in view of KSC, in view of a crewed vessel / EVA, or "lands" (destructively or as debris) on Kerbin (small amounts, with diminishing returns per part type, but enough to "learn from your mistakes" and be useful in the earlier stages of career). I think I can just add to the science directly by adding to ResearchAndDevelopment.Instance.Science, but I'd rather have it be listed like normal science data gathering after a mission is completed. Quote Link to comment Share on other sites More sharing options...
BioSehnsucht Posted December 22, 2013 Share Posted December 22, 2013 I've gotten part way there I think, science is increased but it doesn't show on the recovery screen as an individual entry (just in the total science at the bottom).ScienceSubject subj = new ScienceSubject("recovery@KerbinFlew", "Failure Analysis of flight components", 1.0f, (float)newScience, 10);ResearchAndDevelopment.Instance.SubmitScienceData((float)newScience,subj); Quote Link to comment Share on other sites More sharing options...
BioSehnsucht Posted December 23, 2013 Share Posted December 23, 2013 After looking at KSP's code with ILSpy (which can get some variable names, others it fails and instead of giving a nice human readable name outputs numbers but not as text.. i.e. the text view interprets them with symbols like [sOH] and [bS] and so forth), I may have a clue what I have to do. It looks like if instead of doing SubmitScienceData myself, I get my science into ScienceData and slap it as a certain kind of config node on a vessel that is being recovered (creating a fake one from scratch to handle the case where it has been destroyed but I want to show some failure analysis gain from it, perhaps), the recovery screen will work right... probably. Just have to figure out HOW to do it Quote Link to comment Share on other sites More sharing options...
TriggerAu Posted December 23, 2013 Share Posted December 23, 2013 I'm wondering if it will actually display for you, if the results window is using the Squad list of Subjects for its display it might not be possible to get a display, even if you get the data in there. Similarly for the Subjects in the Science Archive Quote Link to comment Share on other sites More sharing options...
mic_e Posted December 23, 2013 Share Posted December 23, 2013 Hi, how can I read the physics delta time of the current frame (needed for numerical integration of g-forces)? Quote Link to comment Share on other sites More sharing options...
Themohawkninja Posted December 23, 2013 Share Posted December 23, 2013 Where do I get the API's to make plugins, and (aside from Unity and KSP) do I need any other program(s)? Quote Link to comment Share on other sites More sharing options...
Magion Posted December 23, 2013 Share Posted December 23, 2013 Where do I get the API's to make plugins, and (aside from Unity and KSP) do I need any other program(s)?Lots of documentation you can find at http://wiki.kerbalspaceprogram.com/wiki/Community_API_Documentation or at https://github.com/Anatid/XML-Documentation-for-the-KSP-API. You don't need Unity for making plugins (maybe for GUI testing - launching KSP five times per minute after small tweaks is really annoying). But you will need Visual Studio or MonoDevelop for writing a code. Quote Link to comment Share on other sites More sharing options...
mic_e Posted December 23, 2013 Share Posted December 23, 2013 You will need Visual Studio or MonoDevelop for writing a code.Not neccesarily I've developed my NavballDockingAlignmentIndicator mod completely with a bare text editor (vim) and a Makefile. Quote Link to comment Share on other sites More sharing options...
Themohawkninja Posted December 23, 2013 Share Posted December 23, 2013 Lots of documentation you can find at http://wiki.kerbalspaceprogram.com/wiki/Community_API_Documentation or at https://github.com/Anatid/XML-Documentation-for-the-KSP-API. You don't need Unity for making plugins (maybe for GUI testing - launching KSP five times per minute after small tweaks is really annoying). But you will need Visual Studio or MonoDevelop for writing a code.I got VS 2010, so that's a given.Thanks for the class code link. Knowing what classes to use has been why I haven't modded any games past .cfg edits yet. Quote Link to comment Share on other sites More sharing options...
Themohawkninja Posted December 23, 2013 Share Posted December 23, 2013 Okay, so where are the classes to give players science? Quote Link to comment Share on other sites More sharing options...
mic_e Posted December 23, 2013 Share Posted December 23, 2013 I've searched the MechJeb sources and found that the following field contains the delta time of the current phys frame: TimeWarp.fixedDeltaTimeHowever, I still need to find out whether the game is currently paused. Any help? Quote Link to comment Share on other sites More sharing options...
TriggerAu Posted December 23, 2013 Share Posted December 23, 2013 I've searched the MechJeb sources and found that the following field contains the delta time of the current phys frame: TimeWarp.fixedDeltaTimeHowever, I still need to find out whether the game is currently paused. Any help?FlightDriver.Pause is the one that tells you if times paused - this one is useful sometimes too - PauseMenu.isOpen Quote Link to comment Share on other sites More sharing options...
stupid_chris Posted December 24, 2013 Share Posted December 24, 2013 I've searched the MechJeb sources and found that the following field contains the delta time of the current phys frame: TimeWarp.fixedDeltaTimeHowever, I still need to find out whether the game is currently paused. Any help?I wouldn't use TimeWarp in that case. Time.fixedDeltaTime is most likely what will do the job in your case. Quote Link to comment Share on other sites More sharing options...
BioSehnsucht Posted December 24, 2013 Share Posted December 24, 2013 Okay, so where are the classes to give players science?Look at ResearchandDevelopement, ScienceSubject, ScienceData, etc... (i.e. things with research or science in the name).If you're using Visual Studio you can start typing and let the auto complete suggest things and look through the list. When you find something interesting, F12 on it to jump to it's definition in the assembly.If you're feeling more adventurous, google ILSpy and use that on the assembly... but while it gives you basically full source disassembly, a lot of the variable names are borked ... I think we can define new ScienceSubject objects via cfg (see http://forum.kerbalspaceprogram.com/threads/56137-Probe-Science-config-files , probe_science_definitions.cfg ), which we can then generate ScienceData objects referencing the ScienceSubject objects, just shove their config node onto the vessel somewhere (I don't think it matters where, I hacked up a few ScienceData nodes into my persistence file in several places in the vessel hierarchy and got debug log errors about the science subjects not existing when it tried to show the dialog - I haven't yet tried to create them via cfg and haven't figured out how to add them during runtime myself programmatically)... Quote Link to comment Share on other sites More sharing options...
Themohawkninja Posted December 24, 2013 Share Posted December 24, 2013 Look at ResearchandDevelopement, ScienceSubject, ScienceData, etc... (i.e. things with research or science in the name).If you're using Visual Studio you can start typing and let the auto complete suggest things and look through the list. When you find something interesting, F12 on it to jump to it's definition in the assembly.If you're feeling more adventurous, google ILSpy and use that on the assembly... but while it gives you basically full source disassembly, a lot of the variable names are borked ... I think we can define new ScienceSubject objects via cfg (see http://forum.kerbalspaceprogram.com/threads/56137-Probe-Science-config-files , probe_science_definitions.cfg ), which we can then generate ScienceData objects referencing the ScienceSubject objects, just shove their config node onto the vessel somewhere (I don't think it matters where, I hacked up a few ScienceData nodes into my persistence file in several places in the vessel hierarchy and got debug log errors about the science subjects not existing when it tried to show the dialog - I haven't yet tried to create them via cfg and haven't figured out how to add them during runtime myself programmatically)...Got it.One more question. In VS2010, what project type do I select? Quote Link to comment Share on other sites More sharing options...
Faark Posted December 24, 2013 Share Posted December 24, 2013 It has to create a DLL. Don't have 2010 installed atm, but 2012 calls it "Class Library" and can be found in Visual C#. Quote Link to comment Share on other sites More sharing options...
Trueborn Posted December 24, 2013 Share Posted December 24, 2013 is a good guide for getting your development environment all set up. 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.