Jump to content

DMagic

Members
  • Posts

    4,180
  • Joined

  • Last visited

Everything posted by DMagic

  1. This sounds vaguely similar to something I started working on during the long gap between KSP 1.0 and 1.1. I got to the point where it needed a UI to start getting things working in-game and I stopped because I was waiting to see what kind of support 1.1 would have for the new UI system. https://github.com/DMagic1/KSP_Vessel_Manager It started out as just a new mod for making in-game notes (hence the internal name, BetterNotes) to attach to each vessel. But then it expanded based on some of the requests people had for Contracts Window +. You would be able to assign contracts to each vessel, monitor their progress, and keep a record of any assigned contracts that were completed by that vessel (I think all of the contract related code was converted to work with Contract_Parser, the same dependency used for CW+ and CapCom). I expanded it to cover something similar for science: tracking which instruments you had on board, the science results on board, the results that had been transmitted from that vessel, and allowing you to transfer data to different science containers. There were also modules for monitoring and transferring crew, some basic vessel stats, and notes. I also added a sort-of mission check list module. There are a number of pre-defined parameters, things like land, take-off, rendezvous, collect science, etc.... And all of the code for actually monitoring such events is there in some capacity (without taking into account any changes made since 1.1 or 1.2), including things like making sure that you actually pass some altitude threshold when taking off from another planet (to avoid mixing up a proper take-off with a little hop, or the kind of jumps you get while driving around). Everything was written with the intent of being used with the new UI system, though I wasn't as familiar with it as I am now. In any event, I never got around to actually doing anything with it and am unlikely to do so in the future.
  2. It looks like a duplicate experiment error, though I'm not sure where it's coming from, I didn't see any obvious duplicates during the loading process (look for Config(EXPERIMENT_DEFINITION)... during the loading stage of the log file). This one showed up at the end of loading though, it's actually from Orbital Science, but it's triggered by the presence of a duplicate experiment definition. This error looks to be fixed for KSP 1.3, but for now this breaks all subsequent experiments from being loaded. [ERR 00:39:01.711] [DM] Whoops. Something really wrong happened here, a duplicate science experiment definition may be present somewhere; stopping this contract experiment from loading...System.ArgumentException: An element with the same key already exists in the dictionary. at System.Collections.Generic.Dictionary`2[System.String,ScienceExperiment].Add (System.String key, .ScienceExperiment value) [0x00000] in <filename unknown>:0 at ResearchAndDevelopment.loadExperiments () [0x00000] in <filename unknown>:0 at ResearchAndDevelopment.GetExperiment (System.String experimentID) [0x00000] in <filename unknown>:0 at DMagic.DMConfigLoader.configLoad () [0x00000] in <filename unknown>:0
  3. Missing experiment definitions are usually a sign of duplicate experiments somewhere in the GameData folder.
  4. SCANsat does not measure altitude above the atmosphere. It measures from the surface, the same value as what you would see on the altimeter.
  5. @Rodger It looks like it's wrapping the map around the bottom so that the North Pole shows up there. What happens if you change the map projection type? Or if you change the map size? The anomaly scanner from DMOS doesn't pick up the new types of anomalies (Mohole, Kerbin ground stations). @vardicd Use the latest version:
  6. This thread will help if you are interested in the order of events and which methods are called for a PartModule.
  7. For the actual data size (in mits) the value is calculated from the base experiment score * data scalar. Both values can be found in the experiment definitions (GameData/Squad/Resource/ScienceDefs.cfg for the stock experiments). The science value itself is modified by planet- and location-specific modifiers, these are hard-coded (CelestialBody.scienceValues stores each of them, and they can be modified). Kopernicus planets have these values specified somewhere in their config files. Science values are further modified by the transmission level (specified in the part config), the CommNet connection status, and the value of any already returned science for the same experiment. This thread is a little old, but as far as I know everything still applies, only the CommNet aspect has changed.
  8. @Apollo13 There are two factors that can affect experiment time during normal use. Was the SEP vessel loaded at any time while you were waiting? Some of the experiments require power, so they can sometimes stop in the night. Is CommNet active? The connection status affects experiment time, the status is indicated in the SEP window. If neither of those apply then it's possible something is wrong. This will probably need some attention when KSP 1.3 comes around.
  9. @WeirdCulture I'm not sure how kOS works, if one event works with that method then I would expect the other to work. @4d4Garrison It's compatible with any planet pack, the experiments will work fine. Though, it doesn't contain any custom science results for those planets. There are way too many planet packs and too many experiments to try to support all of them.
  10. Yes, the dev version would be best if you need to create waypoints: There are also many options for how resource scanning works; you can preserve the stock instant scan or use SCANsat-style scanning.
  11. @Zenithas This may have to remain incompatible with Remote Tech until that updates to its new system. But I'll look at it after KSP 1.3 is out to see if there is something simple that needs to be fixed. @Boots I would need to see log files to help.
  12. @Phelan That looks like one of the CommNet ground stations. I'm not sure if Orbital Science will read those correctly for the anomaly contracts.
  13. @The White Guardian Which version of Unity are you using? As the post above yours suggests, Unity 5.4 isn't compatible with the Part Tools. Some changes were made to how Unity builds Asset Bundles which breaks the Part Tools. It's possible to create a simple script to generate the Asset Bundle, but I'm not sure if that will work correctly with KSPedia assets. It's probably best to stick with Unity 5.2 until Squad gives us new Part Tools.
  14. I have several updates made for SCANsat that I'll add here eventually, but for now I'll just add a section on how to get a Text Mesh Pro Input Field into KSP using a method similar to that used for the TextMeshProUGUI. This method follows the same basic idea as the previous entry: tag any standard Unity Input Fields that you want to replace with a small script, create a TMP_InputField extension class in the KSP Assembly, then convert the Unity Input Field into a TMP_InputField when processing the UI components. Section 1: Tagging Input Fields: Make a script for tagging of the Unity Input Fields that need replacing and to handle a few things. public class InputHandler : MonoBehaviour { private string _text; private bool _isFocused; public class OnTextEvent : UnityEvent<string> { } public class OnValueChanged: UnityEvent<string> { } private OnTextEvent _onTextUpdate = new OnTextEvent(); private OnValueChanged _onValueChanged = new OnValueChanged(); public string Text { get { return _text; } set { _text = value; } } public bool IsFocused { get { return _isFocused; } set { _isFocused = value; } } public UnityEvent<string> OnTextUpdate { get { return _onTextUpdate; } } public UnityEvent<string> OnValueChange { get { return _onValueChanged; } } } This script has two UnityEvents and a few fields. The OnTextEvent can be used to update the text for the input field; this is separate from the PlaceHolder text, which could, if needed, be updated from another similar event. The OnValueChanged event is fired whenever anything is typed into the input field You could add a listener to this event to perform some action as the text is typed in The _text string is used to store the current text entered into the input field This would be used when you have a separate button to perform an action after text is entered The _isFocused field is used to indicate when the input field is active and can be typed in This is used when locking out other KSP controls Section 2: Listening for Input Updates: A TMP_InputField extension class is used to listen for text input and a few other things. public class SCAN_TMP_InputField : TMP_InputField { private InputHandler _handler; new private void Awake() { base.Awake(); _handler = GetComponent<InputHandler>(); onValueChanged.AddListener(new UnityAction<string>(valueChanged)); _handler.OnTextUpdate.AddListener(new UnityAction<string>(UpdateText)); } private void Update() { if (_handler != null) _handler.IsFocused = isFocused; } private void valueChanged(string s) { if (_handler == null) return; _handler.Text = s; _handler.OnValueChange.Invoke(s); } private void UpdateText(string t) { text = t; } } The standard TMP_InputField onValueChanged event is used to update the text in the InputHandler and to trigger its onValueChanged event It also updates the InputHandler IsFocused field It adds a small method to the InputHandler's OnTextUpdate event to update the input field's text value. Section 3: Unity setup: The Input Field needs to be setup in Unity in a certain way to properly replace it with a TMP_InputField. First we have to make sure to add the Text-to-TextMeshProUGUI tag to the Text and the Placeholder text components And make sure to process the Text fields before processing any Input Fields; the TMP_InputField will only work with TMP_Text components Text Mesh Pro uses a Rect Mask to handle masking text that overflows the text box, rather than the string methods used by the standard Unity Input Field Add a Rect Mask 2D as a direct child of the Input Field, then add the two Text components to that object I'm using an Event Trigger and the OnInputClick event to handle control locks whenever an Input Field is clicked on, as you can see in the bottom of the Inspector Tab. Section 4: Replacing Input Field Elements: As before, we process the TMP_InputField during loading to replace all standard Input Fields. We do this by caching a few values, generating a new TMP_InputField, and assigning the required values, and assigning the TextMeshProUGUI components. private static void TMPInputFromInput(InputHandler handler) { if (handler == null) return; InputField input = handler.GetComponent<InputField>(); if (input == null) return; int limit = input.characterLimit; TMP_InputField.ContentType content = GetTMPContentType(input.contentType); float caretBlinkRate = input.caretBlinkRate; int caretWidth = input.caretWidth; Color selectionColor = input.selectionColor; GameObject obj = input.gameObject; RectTransform viewport = handler.GetComponentInChildren<RectMask2D>().rectTransform; SCAN_TextMeshPro placholder = handler.GetComponentsInChildren<SCAN_TextMeshPro>()[0]; SCAN_TextMeshPro textComponent = handler.GetComponentsInChildren<SCAN_TextMeshPro>()[1]; if (viewport == null || placholder == null || textComponent == null) return; MonoBehaviour.DestroyImmediate(input); SCAN_TMP_InputField tmp = obj.AddComponent<SCAN_TMP_InputField>(); tmp.textViewport = viewport; tmp.placeholder = placholder; tmp.textComponent = textComponent; tmp.characterLimit = limit; tmp.contentType = content; tmp.caretBlinkRate = caretBlinkRate; tmp.caretWidth = caretWidth; tmp.selectionColor = selectionColor; tmp.readOnly = false; tmp.shouldHideMobileInput = false; tmp.fontAsset = UISkinManager.TMPFont; } The first section handles caching a few values A conversion method is required for the ContentType field, but the available types for Input Fields and TMP_InputFields are the same Then we have to find the Rect Mask and the two TextMeshProUGUI components and cache these Then we Destroy the old Input Field and create a new TMP_InputField Then assign the cached values It is important to assign the TextMeshProUGUI components first, since assigning some of the others values relies on these After all of this you'll end up with Input Fields that use the much nicer Text Mesh Pro text, providing better scaling and better support for other input languages. I'll add links to the full code for this once it is online.
  15. I don't care for the Chinese font. For some reason it reminds me of Comic Sans. Maybe it's the way that there is no variation in stroke width, or maybe it's just that there is no distinction between strokes, so everything sort of smears together. The Japanese is much better in these aspects.
  16. I've been having the same problem and haven't found anything that works. And yes, I know how to switch languages and install pre-release builds, as mentioned in the thread linked below, other games change language fine, it's just KSP giving me problems.
  17. That's good to know. Though I think, assuming stock ids don't change, that it might be a good idea to keep the #autoLOC_ prefix, since it would make any localized text field instantly recognizable as such. All of the strings are loaded into a dictionary in the Localization class. You can directly access the dictionary, but it's probably best not to. Hopefully not much will need updating here. But I intend for this thread to be as much about helping with translations as it is about actually supporting localization. For mods that support localization, but are in need of translations it would help (after 1.3 is released) if authors could provide links to the text assets (presumably a config file with all of the localization fields or a folder with several such files) and an idea of what needs translating. For instance, SCANsat has 107 lines of UI text, 4 part descriptions and about 60 science results in need of translation. Contracts Window + will have about 30 lines of UI text, and another 10 or so lines for associated mods. @Luis topete This probably isn't the right place to get information about that. Presumably KSP 1.3, along with all of the localization support, will come to consoles at some point.
  18. The Air Force blowing up your crappy broken rocket part of the infrastructure.
  19. @Calvin_Maclure SCANsat hasn't really changed since KSP 1.1; nothing major has been changed or added for KSP 1.2 (it works fine in 1.2.2, even if the AVC popup complains). And it has nothing to do with Orbital Survey Plus, though there are some possible conflicts when displaying the map view planet overlays. @Loren Pechtel Yes, it will make a difference; the performance impact manifests as a little hiccup once per second, it's generally only noticeable at the highest one or two time warp levels and can be moderated by changing the scanning resolution. Handling of scanners that have finished a planet is something that I need improve. You can turn off the scanners manually or just go to the settings menu and turn off scanning for any completed planets.
  20. SpaceFlight Now still has SpaceX listed for March 29, and no date listed for the Atlas V. So maybe they just lost their spot in line. Also: Apparently it's a robot for securing a landed booster.
  21. It's creating a new texture every time it's called. Even with small textures this adds up quickly over time. If the textures are always the same size then just create a texture once and reuse it. Is the code in the first post meant to test if the texture is readable? Because the try block is just reading the texture's pixels then setting them again. If you want to test if it's readable you can just try a single GetPixel, since Get, Set and Apply are all somewhat expensive calls to be made so often. Do you mean like mods that replace the stock icons, Alternate Resource Panel, or Contracts Window + (which doesn't actually change the icon)? Those are the only two that I know of. If so maybe you can just wait for a scene change to do anything with those. It's not exactly common for a user to be toggling them on and off, and if it's the only thing preventing you from using the Object listener method (which is almost certainly a far more efficient and more reliable method) I would reconsider.
  22. @CRV-WKD Try again: And this is most likely not the correct thread if you are downloading from CKAN. As the first post says, this is the still-in-development version. Try here:
  23. @Drew Kerman You can check the code here and here. Everything is handled while the map is being drawn; it basically just draws a line across the map and checks if the current pixel's latitude is above or below that line. @OHara The background scanning tab should be fixed in the next version. I just forgot to implement that, so they were always initializing with the toggles set to true. As for CommNet, I've spent a lot of time thinking about how to handle it and I think that some of the core components of SCANsat just aren't compatible with the kind of integration that makes sense to me. Any kind of real-time connection-status check simply doesn't work at moderate time warp levels. You would end up with some segments of the planet scanned when the satellite should be out of connection, and vice versa, since the scanning mechanism relies on orbital math, not the actual vessel position. Something like what you suggest would probably work, but I'm not sure I want to deal with the data management headache and the bloating of the save file that would follow. And in any event I really don't like the idea of disrupting the way that maps instantly update. Despite seeing it happen probably thousands of times I still really like watching a map being built from three or four different satellites at the same time. I think the basic idea, scanning satellite having some kind of local storage that needs to be synced with the master record somehow, would work fine. But the end-result would, in most cases, probably be basically the same as how things are now, or would require something that breaks up the map building process, like going through to each vessel and transmitting data.
×
×
  • Create New...