![](https://forum.kerbalspaceprogram.com/uploads/set_resources_17/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
![](https://forum.kerbalspaceprogram.com/uploads/set_resources_17/84c1e40ea0e759e3f1505eb1788ddf3c_default_photo.png)
xEvilReeperx
Members-
Posts
894 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by xEvilReeperx
-
Kerbal Space Program Sound Track
xEvilReeperx replied to Sneekit's topic in KSP1 Suggestions & Development Discussion
Sounds great! I like it a lot. -
You recognize how hypocritical this is, right? His plugin was released precisely because people have trouble editing config files. And here you are criticizing him for not having a UI in his user-opted-in-so-why-does-it-need-a-ui addon while defending your UI-less, "must edit config to opt out", might-be-unintentionally-installed self-replicating plugin. I don't care if you're planning a UI now after community backlash, until/if it's done is when it counts.
-
It actually sounds like it's working as intended. If you have SCANsat integration enabled, ScienceAlert won't alert you about biome-dependent experiments if you don't have the experiment area's biome scanned yet. That said, I haven't tested ScienceAlert against SCANsat in 0.24 and I'm still updating (taking the opportunity to refactor a bit) so it's possible something broke. I'll check it out
-
RDNodes are the actual GOs that make up the tech tree. Is that what you're after? They only exist if the R&D window is open. Luckily there's an event that lets you know when that's about to happen, so you can use this: [KSPAddon(KSPAddon.Startup.SpaceCentre, false)] public class UbioCountNodes : MonoBehaviour { void Start() { GameEvents.onGUIRnDComplexSpawn.Add(() => StartCoroutine(CountNodes())); } System.Collections.IEnumerator CountNodes() { yield return null; Debug.Log("Counting RD nodes ..."); var nodes = GameObject.FindObjectsOfType<RDNode>(); if (nodes == null || nodes.Length == 0) { Debug.LogError("No RDnodes found!"); } else Debug.Log("Found " + nodes.Length + " RD nodes!"); } } If you're instead trying to find out what the state of the player's tech tree is, you want to be working with ResearchAndDevelopment.PartTechAvailable/PartModelPurchased etc
-
Science Collection Revamp
xEvilReeperx replied to Stratzenblitz75's topic in KSP1 Suggestions & Development Discussion
Watching that part of the video with you doing the EVA report shuffle is exactly the situation that led to me Alt+F4ing and starting work on ScienceAlert. No exaggeration. If you don't mind mods, it will at least make science less tedious and frustrating, although not more engaging. -
No, it returns the right value. There are a couple of less obvious things to watch out for. First, are you getting the subject correctly? If you're using just ScienceUtil.GetExperimentBiome to get the biome, that won't work if the vessel is landed on a static object like the launchpad, sph, runway, or other non-biomes that still qualify as valid locations. Second, when are you testing the value? I say this because I spent at least 10 minutes trying to figure out why the values printed in my Start (or Awake? I forget which now) method were wrong while on the launchpad when first writing ScienceAlert. If the vessel hasn't been placed to pad yet, you might get a bogus result. Here is a snippet you can test. In a game without a crewReport recovered yet, launch a command pod. Check value while on launchpad var vessel = FlightGlobals.ActiveVessel; var situation = ScienceUtil.GetExperimentSituation(vessel); var experiment = ResearchAndDevelopment.GetExperiment("crewReport"); string biome = string.Empty; if (experiment.BiomeIsRelevantWhile(situation)) biome = vessel.landedAt != string.Empty ? vessel.landedAt : ScienceUtil.GetExperimentBiome(vessel.mainBody, vessel.latitude, vessel.longitude); var subject = ResearchAndDevelopment.GetExperimentSubject(experiment, situation, vessel.mainBody, biome); float scienceValue = ResearchAndDevelopment.GetScienceValue(experiment.baseValue * experiment.dataScale, subject); Log.Write("Science Value of crewReport: {0}", scienceValue); I get this: Now recover the pod. Launch another pod check results again. I get this: If you just want to see if the player has gathered any science for that experiment + situation + biome combination at all, it's just a simple subject.science > 0 check
-
I tried both a raycast method and the (what sounded like to me) crazy move-the-collider-under-you method. I had a hard time getting the right amount of force with the first method but the second method turned out surprisingly well... public class OceanTest : MonoBehaviour { void Start() { FlightGlobals.ActiveVessel.rootPart.AddModule("ModuleWaterSlider"); } } public class ModuleWaterSlider : PartModule { GameObject _collider = new GameObject("ModuleWaterSlider.Collider", typeof(BoxCollider), typeof(Rigidbody)); float triggerDistance = 50f; // avoid moving every frame void Start() { Log.Write("WaterSlider start"); var box = _collider.collider as BoxCollider; box.size = new Vector3(200f, 5f, 200f); // probably should encapsulate other colliders in real code var rb = _collider.rigidbody; rb.isKinematic = true; _collider.SetActive(true); var visible = GameObject.CreatePrimitive(PrimitiveType.Cube); visible.transform.parent = _collider.transform; visible.transform.localScale = box.size; visible.renderer.enabled = false; // enable to see collider // Debug stuff Action<Vector3, Color> createAxis = delegate(Vector3 axis, Color c) { var go = new GameObject(); go.transform.parent = _collider.transform; go.transform.position = _collider.transform.position + axis * 25f; var line = DebugVisualizer.Line(new List<Transform> { go.transform, _collider.transform }, 0.2f, 0.1f); line.renderer.material = ResourceUtil.LocateMaterial("DebugTools.XrayShader.shader", "Particles/Additive"); line.renderer.material.color = c; }; createAxis(Vector3.up, Color.red); createAxis(Vector3.right, Color.blue); createAxis(Vector3.forward, Color.green); UpdatePosition(); } void UpdatePosition() { Log.Write("Moving plane"); var oceanNormal = part.vessel.mainBody.GetSurfaceNVector(vessel.latitude, vessel.longitude); _collider.rigidbody.position = (vessel.ReferenceTransform.position - oceanNormal * (FlightGlobals.getAltitudeAtPos(vessel.ReferenceTransform.position) + 2.6f)); _collider.rigidbody.rotation = Quaternion.LookRotation(oceanNormal) * Quaternion.AngleAxis(90f, Vector3.right); } void FixedUpdate() { if (Vector3.Distance(_collider.transform.position, vessel.ReferenceTransform.position) > triggerDistance) UpdatePosition(); } }[KSPAddon(KSPAddon.Startup.Flight, false)] So it could be made to work
-
Getting a Kerbal Mesh WITH Suit
xEvilReeperx replied to ximrm's topic in KSP1 Modelling and Texturing Discussion
This might help you, then (post with fbx download) (post with obj download) -
Getting a Kerbal Mesh WITH Suit
xEvilReeperx replied to ximrm's topic in KSP1 Modelling and Texturing Discussion
I meant that you can access the mesh data with a plugin. The problem is that it's probably not permissible to distribute it if you do export it to disk. -
Getting a Kerbal Mesh WITH Suit
xEvilReeperx replied to ximrm's topic in KSP1 Modelling and Texturing Discussion
There is (with a plugin) but it's probably against the EULA to just tear out the model and post it online. You could model your own or have a plugin swap in the model for you at runtime -
ScienceAlert uses the following (experiment being a simple ResearchAndDevelopment.GetExperiment(expid)): float CalculateNextReportValue(ScienceSubject subject, List<ScienceData> stored) { if (stored.Count == 0) return ResearchAndDevelopment.GetScienceValue(experiment.baseValue * experiment.dataScale, subject); float experimentValue = ResearchAndDevelopment.GetNextScienceValue(experiment.baseValue * experiment.dataScale, subject); if (stored.Count == 1) return experimentValue; // for two or more, we'll have to estimate. Presumably there's some // kind of interpolation going on. I've found that just dividing the previous // value by four is a good estimate. return experimentValue / Mathf.Pow(4f, stored.Count - 1); } As to the second question, I think a couple of DMagic's experiments change the results dialog callbacks and do the dialog display on their own. That'd be a great place to start
-
How to make a NON-PART plugin?
xEvilReeperx replied to greg12's topic in KSP1 C# Plugin Development Help and Support
Your plugin is never loaded because it uses System.Diagnostics.Process, which is blacklisted (could be used for evil). Unity has the Application.LoadURL method that you can use instead -
Which alert? Chances are good you're missing an EVA report from the LaunchPad. When your vessel is ready to be launched, it's considered "landed" but when you first hop out on EVA and are holding onto a ladder, the Kerbal looks as if it's flying instead which is a different set of conditions. Go for a walk on the launchpad and see if the alert reappears. If it does, do the eva report and then recover your Kerbal. You should no longer be alerted for that particular combination after that. If that doesn't work, post back and we'll track it down
-
Are you absolutely certain? Could you have a older export in the zip? Here's what I get with a little debug test: var pT = DebugVisualizer.Point(part.transform, 0.25f); var modelT = DebugVisualizer.Point(part.transform.FindChild("model"), 0.25f); var cylT = DebugVisualizer.Point(part.FindModelTransform("Cylinder_002"), 0.25f); pT.renderer.material = modelT.renderer.material = cylT.renderer.material = ResourceTools.ResourceUtil.LocateMaterial("DebugTools.XrayShader.shader"); pT.renderer.material.color = Color.red; modelT.renderer.material.color = Color.blue; cylT.renderer.material.color = Color.green; Log.Write("Finished adding debug spheres");Part part = FlightGlobals.ActiveVessel.parts.Find(p => p.partInfo.name == "GundamBeamSaber"); So, Part top-level GameObject in red, model transform in blue, and the point my previous snippet will find in green: No question that in the model provided in the zip the MeshRenderers and MeshColliders are displaced. Maybe you intended it to export this way? But then why make it radial-attachable if you only want it to attach at a single point? Hmmm
-
Look at its parent GameObject
-
Your Unity GameObject seems to be displaced slightly from the actual meshes. Make sure you zero out its position (and center the meshes again) before you export it. It looks like philotical was on the right track to figuring it out though: swordTransform = this.part.transform; //swordTransform = this.part.transform.Find("Cylinder.002"); //swordTransform = this.part.transform.Find("GundamBeamSaber"); So close It should work with the existing model with this little change: swordTransform = part.FindModelTransform("Cylinder_002");