xEvilReeperx
Members-
Posts
894 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by xEvilReeperx
-
I'm working on it as we speak. It's taking a bit since I'm rolling in all the features I had planned but didn't have time for and clearing out the current list of known bugs (18 atm) as well, plus rewriting any bits in which I can take advantage of new events or methods to make things simpler or faster. If you find any problems with the current version especially when it comes to calculated report value, I'd love to know so they'll be added to my checklist
-
That was the plan, yeah. I keep meaning to ask kitoban if I can add it myself but I've been short of time the whole past month with work and other projects. The source is public domain so if anybody would care to do that or wants to build a more polished version you're of course free to do so Otherwise I'll try really hard to fit it in this weekend
-
Oh, those! Yes, those are harmless. You see that in cases where an experiment uses custom logic instead of the stock method of situation/biome mask to decide when it's available. I can see why you'd think there might be a problem though. I'll move that logic to a single check when the game loads so the log doesn't get spammed unnecessarily with them every time the experiment list is refreshed. Thanks
-
It's just a little extension I wrote to GameObject, part of a set of handy snippets I share between all projects. It's not very clean but it does the job public delegate void GameObjectVisitor(GameObject go, int indent); public static class DebugExtensions { private static void internal_PrintComponents(GameObject go, int indent) { Log.Debug("{0}{1} has components:", indent > 0 ? new string('-', indent) + ">" : "", go.name); var components = go.GetComponents<Component>(); foreach (var c in components) Log.Debug("{0}: {1}", new string('.', indent + 3) + "c", c.GetType().FullName); } public static void PrintComponents(this UnityEngine.GameObject go) { go.TraverseHierarchy(internal_PrintComponents); } public static void TraverseHierarchy(this UnityEngine.GameObject go, GameObjectVisitor visitor, int indent = 0) { visitor(go, indent); for (int i = 0; i < go.transform.childCount; ++i) go.transform.GetChild(i).gameObject.TraverseHierarchy(visitor, indent + 3); } } It comes in handy in all sorts of situations
-
PartModules inherit from MonoBehaviour which comes with some conveniences, like the member variables animation, collider, renderer, etc. They're shortcuts for components attached to the same GameObject as the script. The example assumes the simplest case: a user will create a new GO with some kind of animation on it and then attach their script directly to it. If we dump the contents of your Part ingame, you'll see this: [LOG 20:43:11.152] DebugTools, Levers has components: [B][LOG 20:43:11.152] DebugTools, ...c: UnityEngine.Transform [LOG 20:43:11.153] DebugTools, ...c: Part [LOG 20:43:11.154] DebugTools, ...c: Animate.Animate[/B] <------------ [LOG 20:43:11.154] DebugTools, --->model has components: [LOG 20:43:11.155] DebugTools, ......c: UnityEngine.Transform [LOG 20:43:11.155] DebugTools, ------>animate has components: [LOG 20:43:11.156] DebugTools, .........c: UnityEngine.Transform [LOG 20:43:11.156] DebugTools, .........c: [I][U]UnityEngine.Animation[/U][/I] [LOG 20:43:11.157] DebugTools, --------->Cube has components: [LOG 20:43:11.158] DebugTools, ............c: UnityEngine.Transform [LOG 20:43:11.158] DebugTools, ............c: UnityEngine.MeshFilter [LOG 20:43:11.159] DebugTools, ............c: UnityEngine.MeshRenderer [LOG 20:43:11.159] DebugTools, --------->Cube.001 has components: [LOG 20:43:11.160] DebugTools, ............c: UnityEngine.Transform [LOG 20:43:11.160] DebugTools, ............c: UnityEngine.MeshFilter [LOG 20:43:11.161] DebugTools, ............c: UnityEngine.MeshRenderer [LOG 20:43:11.162] DebugTools, --------->Plane has components: [LOG 20:43:11.162] DebugTools, ............c: UnityEngine.Transform [LOG 20:43:11.163] DebugTools, ............c: UnityEngine.MeshCollider [LOG 20:43:11.163] DebugTools, ............c: UnityEngine.MeshFilter [LOG 20:43:11.164] DebugTools, ............c: UnityEngine.MeshRenderer You can see that PartTools has taken the entire Unity hierarchy and moved it under a GO called "model". Your script, marked with the arrow, tries to access animation which returns null because the GameObject called "Levers" has no Animation component in it. This is where you need to follow DMagic's advice: when your PartModule starts you need to go find and store a reference to the animation; use that stored reference to play your clips
-
In the log you posted, a potential culprit is related to a contract DMagic Orbital Science is trying to save. But Windows 64 bit isn't very stable and this doesn't necessarily mean it's a bug with that mod. Lots of people have strange errors with the win64 version of ksp. If removing it solves the problem, you might want to let DMagic know just in case
-
Are you sure you're looking at the right log? I get similar exception spam if I run your code while the ship is landed: ArgumentOutOfRangeException: Argument is out of range. Parameter name: index at System.Collections.Generic.List`1[PatchRendering].get_Item (Int32 index) [0x00000] in <filename unknown>:0 at OrbitTargeter.ReferencePatchSelect () [0x00000] in <filename unknown>:0 at OrbitTargeter.LateUpdate () [0x00000] in <filename unknown>:0 But it works fine in orbit. You can also enable stack-traces in the Alt+F2 menu with a debug setting in the game's config
-
[WIP] Basic Resource V1 Karbon Edition
xEvilReeperx replied to lowaltitude's topic in KSP1 Mod Development
Redacted. Sorry lowaltitude -
[WIP] Basic Resource V1 Karbon Edition
xEvilReeperx replied to lowaltitude's topic in KSP1 Mod Development
Well, except that you can't use any art/fx (as I understand it) or make any modifications to the grid code. Karbonite or ORS are much better candidates for modding unless you're really attached to the scanning grid Kethane uses -
list of loaded shaders
xEvilReeperx replied to nli2work's topic in KSP1 C# Plugin Development Help and Support
I put it in a simple KSPAddon initialized during flight. Something like this: [KSPAddon(KSPAddon.Startup.Flight, true)] class DumpShaderList : MonoBehaviour { void Start() { HashSet<string> shaders = new HashSet<string>(); FindObjectsOfType<Shader>().ToList().ForEach(sh => shaders.Add(sh.name)); Resources.FindObjectsOfTypeAll<Shader>().ToList().ForEach(sh => shaders.Add(sh.name)); Log.Normal("{0} loaded shaders", shaders.Count); List<string> sorted = new List<string>(shaders); sorted.Sort(); using (System.IO.StreamWriter file = new System.IO.StreamWriter(KSPUtil.ApplicationRootPath + "/shaders.txt")) foreach (var sh in sorted) file.WriteLine(sh); } } Writes to a text file instead of the log to avoid having every line timestamped -
Part categories
xEvilReeperx replied to Thalassicus's topic in KSP1 C# Plugin Development Help and Support
Depending on how much work you're willing to do, you can go anywhere from changing the button textures to totally ripping out all of the existing logic and doing whatever you want with your own -
list of loaded shaders
xEvilReeperx replied to nli2work's topic in KSP1 C# Plugin Development Help and Support
Here's what I get with a very simple dump... Maybe it'll be helpful AtmosphereFromGround Bumped Diffuse Bumped Specular Decal/Blended Depth Mask DepthMask Diffuse Diffuse Detail Diffuse Detail (Alpha) Diffuse Multiply Diffuse Wrapped Emissive Multi Ramp Sunspots GUI/3D Text Shader GUI/Text Shader Hidden/Blend Hidden/BlendModesOverlay Hidden/BlendOneOne Hidden/BrightPassFilterForBloom Hidden/ChromaticAberrationShader Hidden/ColorCorrectionCurves Hidden/ColorCorrectionCurvesSimple Hidden/ColorCorrectionSelective Hidden/ContrastComposite Hidden/ConvertDepth Hidden/CreaseApply Hidden/Dof/DepthOfField34 Hidden/Dof/DepthOfFieldHdr Hidden/EdgeDetectGeometry Hidden/FisheyeShader Hidden/GlobalFog Hidden/InternalErrorShader Hidden/Internal-Flare Hidden/Internal-GUITexture Hidden/Internal-GUITextureClip Hidden/Internal-GUITextureClipText Hidden/LensFlareCreate Hidden/MultipassHollywoodFlares Hidden/Noise Shader RGB Hidden/Noise Shader YUV Hidden/NoiseAndGrain Hidden/SeparableBlur Hidden/SeparableBlurPlus Hidden/SeparableWeightedBlurDof34 Hidden/Shadow-ScreenBlur Hidden/Shadow-ScreenBlurRotated Hidden/SimpleClear Hidden/SunShaftsComposite Hidden/tiltShift Hidden/Tonemapper Hidden/VignetteShader Hidden/VignettingShader KerbalSpacePart KSP/Alpha/Cutoff KSP/Alpha/Cutoff Bumped KSP/Alpha/Translucent KSP/Alpha/Translucent Specular KSP/Alpha/Unlit Transparent KSP/Bumped KSP/Bumped Specular KSP/Diffuse KSP/Emissive/Bumped Specular KSP/Emissive/Diffuse KSP/Emissive/Specular KSP/FX/Depth Projection KSP/FX/ReentryFlames 20-Pass KSP/Particles/Additive KSP/Particles/Alpha Blended KSP/Specular KSP/Sprite KSP/Unlit MaskedTexture Parallax Specular (Alpha) Particles/Additive Particles/Additive (Soft) Particles/Alpha Blended Particles/Alpha Blended Premultiply PieChart Reflective/Bumped Diffuse Reflective/VertexLit Solid Color (Alpha) Specular Sprite/Simple Texture (Unlit) Sprite/Vertex Colored Sprite/Vertex Colored, Fast Sprites/Default Terrain/PQS/Aerial Cutout Terrain/PQS/Ocean Surface Quad Terrain/PQS/Ocean Surface Quad (Fallback) Terrain/PQS/PQS Main - Optimised Terrain/PQS/PQS Main Shader Terrain/PQS/Sphere Projection SURFACE QUAD Terrain/PQS/Sphere Projection SURFACE QUAD (AP) Terrain/PQS/Sphere Projection SURFACE QUAD (Fallback) Terrain/Scaled Planet (RimAerial) Terrain/Scaled Planet (Simple) Transparent/Cutout/Bumped Diffuse Transparent/Cutout/Bumped Specular Transparent/Cutout/Diffuse Transparent/Cutout/VertexLit Transparent/Diffuse Transparent/Specular Transparent/VertexLit Unlit/Texture Unlit/Transparent Unlit/Transparent Cutout Unlit/Transparent Tint UnlitAlpha VertexLit HashSet<string> shaders = new HashSet<string>(); FindObjectsOfType<Shader>().ToList().ForEach(sh => shaders.Add(sh.name)); Resources.FindObjectsOfTypeAll<Shader>().ToList().ForEach(sh => shaders.Add(sh.name)); Log.Normal("{0} loaded shaders", shaders.Count); List<string> sorted = new List<string>(shaders); sorted.Sort(); using (System.IO.StreamWriter file = new System.IO.StreamWriter(KSPUtil.ApplicationRootPath + "/shaders.txt")) foreach (var sh in sorted) file.WriteLine(sh); -
ScenarioModules won't always be initialized when your plugin code runs. I suggest building in a delay with a coroutine. Yours is most likely throwing an exception because moduleRef is null (your code having found an uninitialized ProtoScenarioModule). Here's an example: [KSPAddon(KSPAddon.Startup.Flight, false)] class StopAnnoyingAsteroids : MonoBehaviour { IEnumerator Start() { while (ScenarioRunner.fetch.GetComponent<ScenarioDiscoverableObjects>() == null) yield return 0; ScenarioRunner.fetch.GetComponent<ScenarioDiscoverableObjects>().StopAllCoroutines(); // prevent this scenario from spawning more asteroids and spamming my debug log } }
-
A lil bug in my logic Change the prefab editor start method to this: void Start() { Debug.Log("Start EditPartListPrefab"); // edit icon prefab var iconPrefab = EditorPartList.Instance.iconPrefab.gameObject; if (iconPrefab.GetComponent<ClickListener>() == null) { GameObject labelHolder = new GameObject("CounterLabel"); var label = labelHolder.AddComponent<SpriteText>(); labelHolder.layer = LayerMask.NameToLayer("EzGUI_UI"); label.RenderCamera = Camera.allCameras.Where(c => (c.cullingMask & (1 << labelHolder.layer)) != 0).Single(); labelHolder.transform.parent = iconPrefab.transform; labelHolder.transform.localPosition = Vector3.zero; labelHolder.transform.Translate(new Vector3(EditorPartList.Instance.iconSize * 0.35f, EditorPartList.Instance.iconSize * -0.425f, label.RenderCamera.nearClipPlane - labelHolder.transform.position.z - 1f), Space.Self); label.Text = "[count]"; label.alignment = SpriteText.Alignment_Type.Right; label.font = UIManager.instance.defaultFont; label.renderer.sharedMaterial = UIManager.instance.defaultFontMaterial; label.SetColor(Color.white); label.SetAnchor(SpriteText.Anchor_Pos.Lower_Right); label.SetCharacterSize(12f); DontDestroyOnLoad(labelHolder); iconPrefab.AddComponent<ClickListener>(); } }
-
I hit a little snag that delayed me (but was solved this morning). I'm at a crossroads though. What would you guys prefer: a config file that lets you specify which type of dismissal to do when the button is clicked ("fire" - gone forever, "retrain" - back to applicant pool, "retire" - put into a new retired tab) Or, in the popup that appears after clicking the red X, put all three options into the dialog Or, instead of the red X button, add new buttons for each option directly into the list