• Content Count

  • Joined

  • Last visited

Community Reputation

5 Neutral

About TheUltimateKerbonaut

  • Rank
    Space Procrastinator

Profile Information

  • Location Isle of Man, UK, Earth
  • Interests KSP, Programming, Game Development.

Recent Profile Visitors

522 profile views
  1. TheUltimateKerbonaut

    [1.4.4] MonoMap

    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?
  2. TheUltimateKerbonaut

    [1.4.4] MonoMap

    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.
  3. TheUltimateKerbonaut

    [1.4.4] MonoMap

    Description MonoMap is a simple KSP mod that disabled 3D sound whilst in the map view. Installation 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.
  4. TheUltimateKerbonaut

    Disable Stereo and 3D sound in Map view

    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).
  5. 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.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 { 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