TheUltimateKerbonaut

Members
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

7 Neutral

About TheUltimateKerbonaut

  • Rank
    Space Procrastinator

Profile Information

  • Location Array
  • Interests Array

Recent Profile Visitors

642 profile views
  1. Hmmm... true, the name is a bit confusing. Changing the name would be a pain, so I'll just call it "Mono Map (map audio equalizer)" (that way I don't have to rename the DLL or GitHub repo) . Thanks for the suggestion! The mod technically just disables 3D (spatial) sound when in the map view, the difference in volume is just a side-effect, most likely from the stock music being louder in one ear than the other, or Unity's audio engine just being weird. I guess I could make it so it changes the volume whilst in map view to account for that, but I don't know if it'd be worth the trial-and-error of finding the audio difference. But yeah, the mod works perfectly on 1.6, I'm using it now . Gonna change the name and version now. Also added a release on GitHub, sorry if I confused people. Thanks everyone!
  2. Oh ok, that's fine then. Would it be safe to change the forum post to say [1.6.1] instead of [1.4.4], as well as with the GitHub repo?
  3. Sorry I haven't been responding, I hardly ever check my emails. Does the mod still work for 1.6.1, or shall I recompile it for the latest version?
  4. Hmmm... tried implementing your recommended event-based system, but for some reason it didn't work. In my start function, I have the following code: void Start() { GameEvents.OnMapEntered.Add(Disable3DSound); GameEvents.OnMapExited.Add(Enable3DSound); Debug.Log(NAME + " " + VERSION + " initialized"); } and in the Enable3DSound and Disable3DSound functions respectively: void Enable3DSound() { Debug.Log(NAME + ": 3D Sound Enabled"); // Find all audio sources foreach (AudioSource a in FindObjectsOfType(typeof(AudioSource)) as AudioSource[]) { // Enable 3D sound a.spatialBlend = 1.0f; } } void Disable3DSound() { Debug.Log(NAME + ": 3D Sound Disabled"); // Find all audio sources foreach (AudioSource a in FindObjectsOfType(typeof(AudioSource)) as AudioSource[]) { // Disable 3D sound a.spatialBlend = 0.0f; } } I did a few Debug.Logs() messages inside the foreach loops and based on that I can confirm for a fact that all my code is indeed being executed, and yet the code seems to have no effect on the audio whatsoever. I'm running on a stock install, so the only explanation I can think of is that KSP enables 3D audio every frame, which unfortunately means I'll have to use my old, lazy method of just running my code in the Update() function. Am I making a really big mistake here, or am I doing everything correctly?
  5. I've never used events before (wasn't really aware of them), but now you've told me about them I'll definitely modify the code to incorporate them and save on CPU usage. Thank you ! Note: I'm currently on holiday at the moment so I will have to update the code in around 4 days time.
  6. Description MonoMap is a simple KSP mod that disabled 3D sound whilst in the map view. In other words, you get the same sound in both ears, instead of just one. Also the volume changes slightly, just a side effect. Installation The mod will most likely work with any version of KSP after 1.4.4 (don't quote me no that though). Install like any other mod; download file and drag contents to the GameData folder. Download here. (Source code can also be found on GitHub) Credit Thanks to forum user Morog for original idea License Standard MIT license. See GitHub page or download mod for details.
  7. That's a cool idea . I'd love to see that modded in to the game. Edit: I just finished making the mod. You can find it here (it needs to be approved first before the link works though).
  8. Hello everyone . I am making my first KSP mod, which simply displays a gui, with a label telling you how much science is stored on a vessel. However, I am stuck on trying to find out how much science is stored in each ModuleScienceContainer or ModuleScienceExperiment. Does someone know how this can be achieved, or is it impossible? Here is my code: using System; using System.Collections.Generic; using UnityEngine; using KspScienceCount.Extensions; using KSP; namespace KspScienceCount { public class ScienceCount : PartModule { private Rect _windowPosition = new Rect(); private GUIStyle _windowStyle, _labelStyle; private bool _hasInitStyles = false; public void OnGUI() { if (!_hasInitStyles) InitStyles(); if (Event.current.type != EventType.Repaint || Event.current.isMouse) { if (this.vessel == FlightGlobals.ActiveVessel && this.part.IsPrimary(this.vessel.parts, this.ClassID)) _windowPosition = GUILayout.Window(10, _windowPosition, OnWindow, "This is a title",_windowStyle); } } private void OnWindow(int windowId) { GUILayout.BeginHorizontal(); GUILayout.Label("Science on this vessel: " + CountScience(), _labelStyle); GUI.DragWindow(); GUILayout.EndHorizontal(); } private void InitStyles() { _windowStyle = new GUIStyle(HighLogic.Skin.window); _windowStyle.fixedWidth = 150f; _labelStyle = new GUIStyle(HighLogic.Skin.label); _labelStyle.stretchWidth = true; _hasInitStyles = true; } private float CountScience() { float count = 0; foreach (Part rocketPart in this.vessel.parts) { foreach (PartModule module in rocketPart.Modules) { if (module.GetComponent<ModuleScienceExperiment>() != null) { for (int i = 0; i == module.GetComponent<ModuleScienceContainer>().GetData().Length - 1; i++) { //count += module.GetComponent<ModuleScienceExperiment>().GetData()[i]. <-- this bit here } } } } return count; } } } Many thanks in advance, TheUltimateKerbonaut