

Codapop
Members-
Posts
79 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by Codapop
-
Sorry if this is a crazy necro post, but I'm a bit hung up on a mod I'm working on and nearing completion, and I really think this code is close to what I'm looking for in order to finish. However, my understanding of editing prefabs is very limited. Is there a way to change this code slightly to prevent the "Research" button in the TechTree screen from researching a given tech node unless other conditions have been met?
-
Is it possible to make it so the "Research" button in the RnD Facility doesn't work? Like if you press it, it doesn't spend the science and research the tech node? Would anyone be able to point me in the right direction as to where I might find more about this in the API docs or in a mod that might do something similar?
-
I'm sure I'm missing something, but could someone please explain the logic behind this mod? In Remote Tech you can have an antenna that points at the active vessel, but this antenna won't connect to other satellites, keeping everything separate. With this mod, each satellite would need an "active vessel" channel, and it would connect with other satellites via this channel, making their other frequencies pointless. Do I just need to forget the "Active vessel" channel and manually switch channels every time I switch SOIs? How do other people use this mod?
-
[1.12.x] Parallax - PBR Terrain and Surface Objects [2.0.8]
Codapop replied to Gameslinx's topic in KSP1 Mod Releases
Does anyone know about this mod conflicting with Distance Object Enhancement? My DOE planet flairs don't show up unless I remove Paralax from the GameData folder. Also, is there a way to make the terrain textures remain even at long distances away from the body?- 3,166 replies
-
How can I get a UI to show up in the RnD facility? I've copied this tutorial exactly and have managed to create the UI panel and get it to appear using a part module. However, despite everything loading properly (or so I think, using debug logging), nothing shows up when I attempt to modify the code for showing up in RnD. Here's what I'm using from the tutorial, stripped down to be as simple as possible: using System.Collections.Generic; using System.IO; using System.Reflection; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; namespace TestAddon { [KSPAddon(KSPAddon.Startup.Instantly, true)] public class CoolUILoader : MonoBehaviour { private static GameObject panelPrefab; public static GameObject PanelPrefab { get { return panelPrefab; } } private void Awake() { AssetBundle prefabs = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "mycoolui.dat")); panelPrefab = prefabs.LoadAsset("MyCoolUIPanel") as GameObject; } } [KSPAddon(KSPAddon.Startup.FlightEditorAndKSC, true)] public class CoolUI : MonoBehaviour { public static GameObject CoolUICanvas = null; public static GameObject CoolUIText = null; public static void Destroy() { CoolUICanvas.DestroyGameObject(); CoolUICanvas = null; } public static void ShowGUI() { if (CoolUICanvas != null) return; CoolUICanvas = (GameObject)Instantiate(CoolUILoader.PanelPrefab); CoolUICanvas.transform.SetParent(MainCanvasUtil.MainCanvas.transform); CoolUICanvas.AddComponent<CoolUI>(); CoolUIText = (GameObject)GameObject.Find("ImportantText"); GameObject checkToggle = (GameObject)GameObject.Find("CheckThisOUt"); } } } And here is the addon that should show the UI. Again, I know it "works" and the functions call at the right times (via debug logging), but the UI does not appear. using UnityEngine; namespace TestAddon { [KSPAddon(KSPAddon.Startup.AllGameScenes, false)] public class RnDButton : MonoBehaviour { private void Start() { GameEvents.onGUIRnDComplexSpawn.Add(SpawnButton); GameEvents.onGUIRnDComplexDespawn.Add(HideButton); } private void OnDestroy() { GameEvents.onGUIRnDComplexSpawn.Remove(SpawnButton); GameEvents.onGUIRnDComplexDespawn.Remove(HideButton); } private void SpawnButton() { CoolUI.ShowGUI(); } private void HideButton() { CoolUI.Destroy(); } } } I'm pretty stumped at this point, not sure where to go from here. Any help would be greatly appreciated.
-
Thanks for the quick feedback! I guess I should explain that I am eventually trying to keep track of science or other resources, so the code will eventually have a "onScienceReceived" function, which I don't believe is attached to a vessel/part module. So far I can get it to record the science properly, but after one save it goes back to 0. I stripped down the code into this test program to see if I could locate the issue, and I can't get it to do a simple count up. The config node also gets loaded in the same monobehavior, and so far that seems to be working (though it of course always loads in 0).
-
Does anyone know how to make a simple counter using config nodes? I've been working at this project for ages and can't seem to figure it out. [KSPAddon(KSPAddon.Startup.FlightAndKSC, false)] public class TestCounter : MonoBehaviour { void SaveTest(ConfigNode node) { bool flag = node.HasNode("TEST-NODE"); if (!flag) { node.AddNode("TEST-NODE"); ConfigNode node2 = node.GetNode("TEST-NODE"); node2.AddValue("VALUE", number); Debug.Log("[--------TEST--------]: Save " + number); } else { ConfigNode node2 = node.GetNode("TEST-NODE"); node2.SetValue("VALUE", 5); Debug.Log("[--------TEST--------]: Save 5"); } } void LoadTest(ConfigNode node) { ConfigNode node2 = node.GetNode("TEST-NODE"); int test = int.Parse(node2.GetValue("VALUE")); Debug.Log("[--------TEST--------]: Load " + test); number = number + 1; } private void Start() { GameEvents.onGameStateSave.Add(SaveTest); GameEvents.onGameStateLoad.Add(LoadTest); } private void OnDestroy() { GameEvents.onGameStateSave.Remove(SaveTest); GameEvents.onGameStateSave.Remove(LoadTest); } public int number = 0; } No matter what I do the config file only ever says 0 for the value. It creates the config node and the value, but I can't find a way to get it to update. EDIT: Found the answer! I was using KSPAddon rather than Scenario. Config nodes don't work very nicely without scenario modules.
-
Hey I know it's been a while, but would you happen to know why this won't work? No matter what it writes 0 to the config file for the value. void SaveTest(ConfigNode node) { bool flag = node.HasNode("TEST-NODE"); if (!flag) { node.AddNode("TEST-NODE"); ConfigNode node2 = node.GetNode("TEST-NODE"); node2.AddValue("VALUE", 0); Debug.Log("[--------TEST--------]: Save 0"); } else { ConfigNode node2 = node.GetNode("TEST-NODE"); node2.SetValue("VALUE", 5); Debug.Log("[--------TEST--------]: Save 5"); } } I've realized that the issue is I'm not actually getting the saved node but rather creating a new one, but I can't figure out a way to get the config file to check if my node is already there. I've tried this: ConfigNode saveNode = ConfigNode.Load(KSPUtil.ApplicationRootPath + "saves/" + HighLogic.SaveFolder + "/persistent.sfs"); saveNode = saveNode.GetNode("GAME"); bool flag = saveNode.HasNode("TEST-NODE"); if (!flag) { Debug.Log("[--------TEST--------]: " ); node.AddNode("TEST-NODE"); ConfigNode node2 = node.GetNode("TEST-NODE"); node2.AddValue("VALUE", number); Debug.Log("[--------TEST--------]: Save " + number); number = number + 1; } else { ConfigNode node2 = node.GetNode("TEST-NODE"); node2.SetValue("VALUE", 5); Debug.Log("[--------TEST--------]: Save 5"); } Still just getting 0. Not really sure what to do. I've tried opening up the file using System.IO and checking it for the String, but it doesn't seem to like that. How do people actually save and retrieve things from nodes?
-
You can use the built-in LED in most arduinos (LED_BUILTIN) and have it turn on/off depending on where it is in the code. Alternatively, if you have any other LED indicators or displays (like a 7 segment display) you could have the arduino send debug messages there.
-
Hey, I'm having a similar issue. The config nodes save properly, but they don't load. If I do "if (node.HasNode("myNode"))" sometimes it is true and sometimes it's false and just resets everything to the default new settings. I'm looking at the config file, and the node is clearly there, so it should never show "false" unless it's a brand new save. Have you had any luck with your issue? If you have any advice I'd love to hear how you solved your issue.
-
I'm looking to retrieve all science data upon recovery of vessel/transmission of science and then get info as to what CelestialBody the science came from. I'm thinking I can accomplish this using "OnScienceRecieved" or "onVesselRecoveryRequested/OnVesselRecoveryProcessing", but I'm not sure how to extract those parameters. Can anyone give me any advice? EDIT: I figured it out. Here's the code in case anyone else needs. private void Start() { GameEvents.OnScienceRecieved.Add(ScienceProcessingCallback); } private void OnDestroy() { GameEvents.OnScienceRecieved.Remove(ScienceProcessingCallback); } void ScienceProcessingCallback(float sciValue, ScienceSubject sub, ProtoVessel pv, bool test) { Debug.Log("Science Data: " + sub.title); Debug.Log("Science Value: " + sub.science); if (celestialBodyName in sub.title) { //code here } } EDIT2: Second question: How can I retrieve data from ConfigNode? Here's what I have so far: public override void OnSave(ConfigNode node) { string oldValue = 0.ToString(); key = name; if (node.Contains(key)) { value = node.GetValue(key); oldValue = float.Parse(value); newValue = oldValue + addedValue; node.SetValue(key, newValue); addedValue = 0; } else { node.AddValue(key, addedValue); } Using debugging, it doesn't get past the "if node.Contains(key)" , but if I don't use the if statement, then it crashes at the "GetValue(key)" code. I've been looking at other people's code and looking for online tutorials, but there always seems to be something missing, either in their example or in my brain.
-
I believe Laythe is supposed to look like that due to the bio-luminescent clouds. I'm pretty sure there's a simple way to get rid of it, as I accidentally did the reverse (added these clouds) to Duna when messing around with the Duna configs. IIRC it's one of the True/False boolean settings in Scatterer.
-
1. Absolutely, though I'm not 100% sure how to do it. I'm pretty sure it has something to do with Texture Replacer. You could try just deleting that folder. You could also download a separate skybox mod and then add the stock skybox to it. 2. I have the same problem and can't figure out how to fix it. Scatterer and EVE aren't playing well together, but changing the configs doesn't seem to help.
-
After editing every parameter in the config for Duna, in all relevant visual mods, and even trying to patch in Kerbin's textures to try to get Duna to look reasonable, I ended up giving in and using the Duna scatterer config/textures from SVE, but keeping the EVE configs from AVP. I think the texture files for Duna in AVP are messed up somehow. If you're dead set on using full AVP, then using the planet textures from KSPRC helps Duna a lot, though still not 100%. Personally, I find SVE Duna + AVP everything else is the way to go.
-
[1.4.0 - 1.6.x] CollisionFX-Updated [0.8.3.1]
Codapop replied to Grigetio's topic in KSP1 Mod Releases
I get a ton of lag when the sparks come out, and I'm on a very beefy system. I tried to edit the config, but turning "scrapeSparks = true" to false causes the scrape sound to not work, either. Is there a way to get the sounds to work without the sparks? -
That sounds like Distant Object shenanigans. Are you sure those brightest stars aren't just planets? Did you mess with the"Darken Skybox" option and the % darken slider? Sounds like you have multiple EVE CLOUDS {} functions. Or one mod is trying to make an edit in an unsupported way (like @Scatterer_config or whatever it's supposed to be). Can you list the mods you have installed?
-
Duna is the only one I can't seem to fix. That lower layer is just too bright. Probably could benefit by using a config from a different planet. I'll try the one for OPM's Tekto from Pood's OPMVO. Does anyone have a fix for buggy volumetric clouds? It's a problem with EVE, and my clouds are in very defined lines, and they glitch in and out as I manipulate the camera. EDIT: Also does anyone else get red clouds in the middle of the night? It looks like sunset clouds but completely opposite of the sun.
-
I managed to get density in Eve back by deleting the atmo config in AVP/Scatterer/Planets/config and by deleting all the lines of code in Game Data/scatterer/config/Planets/Jool/atmo.cfg that come after line 59. For some reason the scatterer Jool config also has a config for Eve, which conflicts with the normal one in the scatterer folder. To put it simply, a clean install of AVP has 3 scatterer configs for Eve, two of which are bugged. You only want the one in Game Data/scatterer/config/Planets/Eve. Edit: I also fixed Eve's aurora by going into the AVP aurora.cfg, deleting the Eve aurora lines, replacing it with the entirety of Kerbin's aurora, then changing _MainTex from "{value = AstronomersVisualPack/EVE/Textures/Aurorasoft" to "{value = AstronomersVisualPack/EVE/Textures/aurora2}" and adding "_Color = 3825,638,3825,127" to settings. I'm not really sure what it was supposed to look like, but using that gives it a nice animated aurora like the other planets but colored yellow.
-
I feel like that's how Duna is supposed to look, kinda dusty/hazy, but I could be wrong. Eve seems to have lost some density, but it actually looks a little weird in timewarp. I feel like this might be due to the EVE configs rather than scatterer. Then again, there's something funky going on. AVP scatterer folder has a config for planet Eve, as does the main Scatterer folder, and the Jool atmo config in the Scatterer folder also has configs for planet Eve inside it. It might be worth it to delete one or two of these, as they might be fighting each other.