Jump to content

hab136

Members
  • Posts

    1,080
  • Joined

  • Last visited

Everything posted by hab136

  1. I'm just figuring that out too. Here's what I've come up with so far: if (ResearchAndDevelopment.Instance != null) { if (ResearchAndDevelopment.PartModelPurchased (availablePart)) { } if (ResearchAndDevelopment.GetTechnologyState ("techIDstring") == RDTech.State.Available) { } }
  2. That was exactly what I needed, thanks! Now I read the tooltip at the end of OnWindow() for the window, and then draw the tooltip after the GUILayout.Window() call in OnGUI(). Also set GUI.Depth=0. It works! I noticed you used a real texture file for the background, but I just made it black for now: Texture2D blackTexture = new Texture2D (1, 1); blackTexture.SetPixel(0,0,Color.black); blackTexture.Apply(); tooltipstyle.normal.background = blackTexture;
  3. Does GUI.Tooltip not work? It's always blank for me. I'm calling it from OnGUI() and checking the event type, like the example: I'm fairly certain I'm declaring my tooltips correctly: I can whip up my own detection of what control I'm over, but it seems silly that I would have to do so. Also is there any good way to shrink a window to the current content? The best I've come up with is to change the height and width to 1x1 and let it automatically resize, but that causes flicker.
  4. I tried this in a dev build; it worked pretty well. One frame was enough between creating fuel lines and connecting them, but I had to wait longer more between connecting and staging. Waiting 10 frames didn’t work, but waiting 100 did. I’ll have to play with this more. This worked wonderfully: Between these two suggestions, the next version should have a much better GUI. Now, if only I could find decent free icons for "asparagus" and "onion"!
  5. For all the people having trouble using the mod, here's a Youtube video!
  6. Maybe. I now know how to place a strut or fuel line from (x,y,z) to (x,y,z).. but figuring out those numbers is difficult. The GUI sucks, I know. There actually are instructions in the Spaceport link. I’ll copy them to this thread. I’ve also made a video. Pressing one of the “add fuel lines†buttons (asparagus or onion) will just create nubs of fuel lines; you have to press the next button “connect fuel lines†for them to show up. I suspect this is what most people are complaining about. I’ve made a video to clear it up. You have to save and re-load the craft after using the mod, or it will revert. Manually adding a stage will also fix it. Much of this will be fixed in the next version.
  7. I hadn't seen it. It's perfect, thanks! Yeah, I expect a rocket like: 1x 6x 6x 6x 6x And you have: 1x 6x 6x 6x 6x 6x 6x 6x I could treat sets of tanks that are attached to the same parent as part of the same set (so "6x 6x" would pretend to be one "12x", and "6x 6x 6x 6x" would pretend to be one "24x"), but it currently doesn't do that. The big problem is that I have no way to tell the difference between what you're doing and something like this: Hmm, your rocket is probably more common. As for the "remove fuel lines" removing tanks, I think you hit a bug I already know about - mouse clicks to the AutoAsparagus window pass through to whatever is behind it. If your AutoAsparagus window is above your outer tanks, then you're going to click on your outer tanks and remove them. I'm not sure I understand the question - the rocket in the picture should work fine. Double-stack tanks don't currently work right. Oh yeah! Even more abstract, I can just set a "nextAction" flag and process that on the next Update(). Thanks! Hmm, I could even add a delay if I need to - just check a timer on each Update(). This gives me great hope for reducing the GUI down to pushing one button. Before Christmas is my guess for v0.3. I'll have time next week to work on it. Easy enough, but I'll probably make it a checkbox. I'm thinking of Eve/Laythe landers where you might land with all your parachutes, then discard them on the way up.
  8. Whoops, I never thought of that! Hmm, I guess I could disable the plugin in career mode until fuel lines are researched. Yes, I'm going to have to go through and do a proper GUI. I didn't even know if this mod was possible, so I concentrated on seeing if it would work first and just did the bare minimum to make it work. A better GUI is at the top of my list for next version. I think you're being sarcastic, but a friend suggested exactly that once I told him what I was doing. Plug in a few parameters like crew count, destination, and a safety margin % of extra fuel, and have a mod pop out a basic ship that you can then customize. While such a thing would be possible, downloading pre-built ships makes more sense. Running fuel lines isn't exactly creative or skillful. I never thought of that. That's easily doable, and something that annoys me too. I'll add it to my list Can you share the .craft file so I can debug it? There's no artifical limit on the number of rings, and I tested up to 4. I'd love to simplify the GUI, but I haven't figured out how combine steps 1 and 2 (adding fuel lines and connecting them). The game needs to refresh or something in between, because if I just run those functions one after another it doesn't work. I haven't automated step 3 yet (adding empty stages) but I know that's doable, but again I can't combine it with step 4 (staging decouplers/sepratrons) because it doesn't work. I'd love to make it one button again (v0.1 just had one button, but only did staging and didn't create fuel lines), but that depends on discoverng if there is an API call I can make, and what that call is. Hmm.. even with multiple buttons I could maybe show the user one button at a time, or do it more like a "wizard" style like when you install programs in Windows. First I have to learn how to do GUIs properly
  9. Figuring out how to automatically place fuel lines was a nightmare, but now all the hard work is done. Automatically placing struts shouldn't be difficult. But which parts should be strutted together? I guess any fuel tanks in symmetry, plus any two fuel tanks separated by a decoupler? Strutting has always seemed more art than formula to me. Depends what you mean by two layers... multiple rings should work (6x tanks attached by decouplers to 6x tanks). Double-height tanks (6x tanks on top of 6x tanks, attached to decouplers) probably don't work. I'll tackle that in a new version.
  10. Hmm, an "AutoStrut" would be interesting. In the meantime, you might look at Kerbal Joint Reinforcement
  11. Asparagus staging is awesome, but tedious. So, I built a plugin to do it for me! The plugin can create fuel lines if you have none, or it can use your existing fuel lines. Based on the fuel lines, it will put decouplers and sepratrons into proper stages. For KSP 1.10, download: NexusMods, Github, SpaceDock, Curse or via CKAN. REQUIRED DEPENDENCIES: Toolbar Controller, ClickThrough Blocker For KSP 1.9, download old 2.3.0 version For KSP 1.7.3, download old 2.2.17 version For KSP 1.6, download old 2.2.16 version For KSP 1.5.1, download old 2.2.15 version For KSP 1.4.5, download old 2.2.14 version For KSP 1.3.1, download old 2.2.8 version For KSP 1.2.2, download old 2.2.5 version For KSP 1.1.3, download old 2.2.2 version For KSP 1.0.5, download old 2.0.0 version Source code: Github It's highly recommended that you also download SmartStage, but it's not required. HOW TO USE: Press the asparagus-looking button in the stock toolbar to show/hide the main window. Load your ship in the VAB, and then: Press "Asparagus" to create fuel lines and stage your ship in asparagus-style staging. Press "Onion" to create fuel lines and stage your ship in onion-style staging. Press "Delete fuel lines" to delete ALL your fuel lines. If you have SmartStage installed, there will be a checkbox to use SmartStage for the staging. If you don't have it installed, or you uncheck it, you will get the following options: "Stage parachutes" will stage parachutes to fire when the fuel tank it is attached to decouples. "Stage sepratrons" will stage sepratrons to fire when the fuel tank it is attached to decouples. "Stage launch clamps" will move the launch clamps into the bottom or next-to-bottom stage (selectable). Note for "thrust plate"-style ships: the center tank must be higher in the part tree than the other tanks. The easiest way to do that is to build the ship with the center tank as the main part. If you've already built your ship, use the built-in root part gizmo to change your root part. New in v2.0: Save and re-load the ship instead of refreshing it, which cures many problems. Support for Blizzy's toolbar. Option to select stock or Blizzy's toolbar. Icons for part selection (thanks xEvilReeperx) Rainbow option. Requires the selected part to have multiple textures, like when you have "Colorful Fuel Lines" installed Visualization! Highlights tanks and decouplers, shows onion ring levels, and on error highlight which tanks it couldn't connect and what parts were blocking Better support for modded decouplers Save window position and options in config file Changelog for older versions: KNOWN BUGS: * There must be some space between your boosters and the next tank; for this reason the stock "Kerbal X" ship won't work correctly.
  12. You already had how to get the parts of the ship during flight; in fact you posted it here: public Vessel craft = FlightGlobals.ActiveVessel; Debug.Log(craft.parts.ToString()); I was just giving your some functions to print out Part objects, and lists of Part objects, in a nice way. So instead of: printPartList("All parts of ship", "Part", editor.ship.parts); just do: printPartList("All parts of ship", "Part", craft.parts);
  13. Wild guess here - do you have your references to Assembly-CSharp.dll and UnityEngine.dll set correctly when you build the DLL? http://wiki.kerbalspaceprogram.com/wiki/Setting_up_MonoDevelop http://wiki.kerbalspaceprogram.com/wiki/Setting_up_Visual_Studio Do you have "using System.Collections;" in your code?
  14. Note that there is already a working multiplayer mod: http://forum.kerbalspaceprogram.com/threads/55835-Kmp-0-22-wip-alpha http://www.reddit.com/r/kmp That said, here's how to print out the parts of the ship (lifted straight from my own mod): private void printPart(string header, Part p){ if (p==null){ print (header + ": null!"); } else { print (header +": "+p.name.ToString () + ": " + p.uid.ToString () + "/" + p.symmetryMode.ToString ()+"/"+p.children.Count.ToString()); } foreach (Part child in p.children) { print ("child: "+child.name.ToString () + ": " + child.uid.ToString () + "/" + child.symmetryMode.ToString ()+"/"+child.children.Count.ToString()); } } private void printPartList(string title, string header, List<Part> parts){ print ("=== "+title+" ==="); foreach (Part p in parts) { printPart(header,p); } } EditorLogic editor = EditorLogic.fetch; printPartList("All parts of ship", "Part", editor.ship.parts); The editor.ship.parts is a List of "Part" objects. See http://msdn.microsoft.com/en-us/library/6sh2ey19(v=vs.110).aspx if you need help with Lists. You can access the list like an array (parts[0], parts[1]) or step through it with "foreach". To add a part, see my sample at http://forum.kerbalspaceprogram.com/threads/7544-The-official-unoffical-help-a-fellow-plugin-developer-thread?p=764072&viewfull=1#post764072
  15. There's no artificial limit on the symmetry it can handle. If you can get 20 tanks in symmetry around one central tank, the mod should support it. If you have a ring of 20, then a ring of 40, then a ring of 80, it should still work... but you still have to run all those fuel lines yourself (for now). The mod might work with other mod parts, depending on how they're named internally (the name in the .craft file, not the name you see in the editor). I look for: * fuel tanks: has "fueltank" or "fuselage" in the internal part name * decouplers: has "decoupler" in the internal part name * sepratrons: has "sepmotor" in the internal part name If the mod part is named similarly, it will work - for example "B9MegaFuelTank7-3extra" or "SuperDuperAwesomeDecoupler". If not, it's easy enough to add part names. Testing against part packs (B9, KW, etc) will probably happen after I finish my next update. I'm currently trying to get it to run the fuel lines automatically. Right now I can create a fuel line in the editor automatically and attach the source end, but can't seem to attach the destination end. I'm working on it, but it's slow going since there's almost no documentation on the API.
  16. Thanks! I got it working tonight. There's a little more than just ship.Add()... in particular to have to set the position and the AttachNodes. This code is rough, but it will attach a large probe core to the bottom of another large probe core (or actually the bottom of whatever the root part is, but the numbers are for large probe cores): // Get all the parts of the ship EditorLogic editor = EditorLogic.fetch; ShipConstruct ship = editor.ship; List<Part> parts = ship.parts; Part rootpart = parts [0]; // Make a new Part object AvailablePart ap = PartLoader.getPartInfoByName ("probeStackLarge"); UnityEngine.Object obj = UnityEngine.Object.Instantiate(ap.partPrefab); Part newPart = (Part)obj; newPart.gameObject.SetActive(true); newPart.gameObject.name = "probeStackLarge"; newPart.partInfo = ap; newPart.transform.localScale = rootpart.transform.localScale; newPart.transform.parent = rootpart.transform; // must be BEFORE localposition! Vector3 v = new Vector3 (); v.x = 0.0f; v.y = -0.4f; v.z = 0.0f; Quaternion q = new Quaternion (); q.x = 0.0f; q.y = 0.0f; q.z = 0.0f; q.w = 1.0f; newPart.transform.localPosition = v; newPart.transform.localRotation = q; rootpart.addChild (newPart); ship.Add (newPart); AttachNode newAN = newPart.findAttachNodes ("top") [0]; newAN.attachedPart = rootpart; AttachNode rootAN = rootpart.findAttachNodes ("bottom") [0]; rootAN.attachedPart = newPart; I'm very happy that I was able to do this much - it demonstrates that I can programmatically add parts! Now, to work out surface attachment (vs node attachment demonstrated above) and then math to figure out where in 3-D space to place the surface attachments. But that's for tomorrow.
  17. How can I programmatically add a stock part to the ship in the editor? For example, if I have a ship consisting of just a probe core, and I want to attach a stock fuel tank to it. I don't want to load something onto the cursor (EditorLogic.PartSelected()), because I need to add several parts parts at once (fuel lines, specifically). I see PartLoader.Instantiate(), EditorLogic.SpawnPart(), and part.AddChild(), but I haven't had much luck so far with those, nor can I find any documentation or examples. I've also thought about copying the current ship in memory, modifying my copy, and then saving it as a new file with ShipConstruction.SaveShip() and then loading it back, but that seems silly. Can anyone point me in the right direction?
  18. Version 0.2 is out! I've released it to a wider audience now. See http://forum.kerbalspaceprogram.com/threads/61238-AutoAsparagus-v0-2
×
×
  • Create New...