Jump to content

Greendolph

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by Greendolph

  1. I am trying to build an kRPC implementation in an iron python WPF app - but I have no idea how to implement the kRPC python client in iron python. Is there someone here more familiar than me with python and installing modules that could point me in the right direction? Thank you!
  2. When I comment out the save/load methods everything works again. Is there a way I can check the config node for validity when I load it?
  3. I changed it to if (state == StartState.Flying) and I have the same issue. I tried removing all references to the TextArea control on the _textAreaText string and nothing changed. Is there a way I can see debug output from the part compilation? - - - Updated - - - I found this, not sure exactly how to interpret it. From KSP.txt [EXC 19:29:32.749] XmlException: Document element did not appear. file:///C:/TestEnvironments/KSP/Kerbal Space Program/Plugins/PluginData/GuiWindowPlugin/config.xml Line 1, position 1. Mono.Xml2.XmlTextReader.Read () System.Xml.XmlTextReader.Read () Mono.Xml.EntityResolvingXmlReader.Read () Mono.Xml.DTDValidatingReader.ReadContent () Mono.Xml.DTDValidatingReader.Read () Mono.Xml.Schema.XsdValidatingReader.Read () System.Xml.XmlValidatingReader.Read () System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader) System.Xml.XmlDocument.ReadNode (System.Xml.XmlReader reader) System.Xml.XmlDocument.Load (System.Xml.XmlReader xmlReader) System.Xml.XmlDocument.Load (System.String filename) KSP.IO.PluginConfiguration.load () GuiWindowPlugin.GuiWindowPlugin.OnLoad (.ConfigNode node) PartModule.Load (.ConfigNode node) Part.AddModule (.ConfigNode node) PartLoader.ParsePart (.UrlConfig urlConfig, .ConfigNode node) PartLoader+.MoveNext () UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) :MoveNext() UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) PartLoader:StartLoad() :MoveNext()
  4. If you want a sea of text, here you go mate In the future it may be more practical to start form the perspective of common causes of such errors in order to provide context that would allow me to share code specific to the issue. using UnityEngine; using GuiWindowPlugin.Extentions; using KSP.IO; namespace GuiWindowPlugin { public class GuiWindowPlugin : PartModule { private Rect _windowPosition = new Rect(); private GUIStyle _windowStyle, _textAreaStyle, _buttonStyle; private bool _hasInitStyles = false; private int _drawCall = 0; private string _textAreaText = ""; public override void OnStart(StartState state) { if (state != StartState.Editor) { if (!_hasInitStyles) { InitStyles(); } RenderingManager.AddToPostDrawQueue(0, OnDraw); } } public override void OnSave(ConfigNode node) { PluginConfiguration config = PluginConfiguration.CreateForType<GuiWindowPlugin>(); config.SetValue("Window Position", _windowPosition); config.SetValue("Draw Call", _drawCall); config.SetValue("Text Area Text", _textAreaText); config.save(); } public override void OnLoad(ConfigNode node) { PluginConfiguration config = PluginConfiguration.CreateForType<GuiWindowPlugin>(); config.load(); _windowPosition = config.GetValue<Rect>("Window Position"); _drawCall = config.GetValue<int>("Draw Call"); _textAreaText = config.GetValue<string>("Text Area Text"); } private void OnDraw() { _drawCall++; if (this.vessel == FlightGlobals.ActiveVessel && this.part.IsPrimary(this.vessel.parts, this.ClassID)) { _windowPosition = GUILayout.Window(10, _windowPosition, OnWindow, "Draw Call #" + _drawCall.ToString(), _windowStyle); if (_windowPosition.x == 0f && _windowPosition.y == 0f) { _windowPosition = _windowPosition.CenterScreen(); } } } private void OnWindow(int windowId) { GUILayout.BeginVertical(); GUILayout.TextArea(_textAreaText, _textAreaStyle); GUILayout.Button("Run", _buttonStyle); GUILayout.EndVertical(); GUI.DragWindow(); } private void InitStyles() { _windowStyle = new GUIStyle(HighLogic.Skin.window); _windowStyle.fixedWidth = 250f; _textAreaStyle = new GUIStyle(HighLogic.Skin.textArea); _textAreaStyle.stretchWidth = true; _buttonStyle = new GUIStyle(HighLogic.Skin.button); _buttonStyle.fixedWidth = 100f; _hasInitStyles = true; } } } using System.Collections.Generic; using UnityEngine; namespace GuiWindowPlugin.Extentions { public static class PartExtentions { public static bool IsPrimary(this Part thisPart, List<Part> partsList, int moduleClassID) { foreach (Part part in partsList){ if (part.Modules.Contains(moduleClassID)) { if (part == thisPart) { return true; } else { break; } } } return false; } } } using UnityEngine; namespace GuiWindowPlugin.Extentions { public static class RectExtentions { public static Rect CenterScreen(this Rect thisRect) { if (Screen.width > 0f && Screen.height > 0f && thisRect.width > 0f && thisRect.height > 0f) { thisRect.x = (Screen.width / 2) - (thisRect.width / 2); thisRect.y = (Screen.height / 2) - (thisRect.height / 2); } return thisRect; } } }
  5. I was following the tutorial here and decided I wanted to add a TextArea object and a Button. When I added them KSP could no longer find any of the parts in the game and the vessel I had been testing the PartModule part on failed to load because no parts existed anymore. What could possibly have caused that? I've checked the KSP folder and everything still exists and no directory names have been changed...
  6. Hello, I'm familiar with C# but I am a complete foreigner to Unity. What resources/tutorials/source-codes can I look at to learn how to build plugins with user interfaces? I think to start off I would like to make some basic "Note taking" mod that allows users to write text and "save" it to ships.
  7. I am working on a shipping container part and would like to either iterate through a list of resources using a context menu event if it is empty, or if that is not possible instead set a mass limit on what can be stored in the container and have all the resources permanently listed in the parts cfg. Any ideas on how I could go about doing this? I can't find good documentation on it. Thank you!
  8. [*Edit: I found the error, I didn't define an angle in my attach nodes.] I have a part I would like to be stack-able, and I have the attach rules set up to allow stacking but I am not able to stack in the editor. Here is my cfg file: PART { name = SSC2TEU module = Part author = Kelson Ball mesh = model.mu rescaleFactor = 1.25 TechRequired = generalConstruction entryCost = 1000 cost = 400 category = Utility subcategory = 0 title = Standard Shipping Container 2 TEU manufacturer = Standard Shipping description = This Standard Shipping Container is a 2 TEU (6.5m x 2.5m x 2.5m) container for storring and transporting resources. node_stack_top = 0, 5.1, 0, 0, 0, 0, 0 node_stack_bottom = 0, -.1, 0, 0, 0, 0, 0 attachRules = 1,1,1,1,0 mass = 0.75 dragModelType = default maximum_drag = 0.4 minimum_drag = 0.15 angularDrag = 2 crashTolerance = 20 maxTemp = 2900 breakingForce = 350 breakingTorque = 350 } Thanks for your help!
  9. I've found two lines in the output log, Load(Texture): KerbalEmpire/ResourceTank/texture and Load(Model): KerbalEmpire/ResourceTank/model I found no related errors and there are no animations. Should there be output load lines for the config and the collider? Those did not appear.
  10. Today I tried making a part from scratch for the first time, but when I loaded up KSP it didn't appear in the editor. It has a model.mu, texture.mgm, I made the collider using unity and PartTools. It is in a directory in GameData. I've checked the cfg for any inconsistencies and couldn't find any. What are some common things that might have gone wrong?
×
×
  • Create New...