Jump to content

tg626

Members
  • Posts

    1,658
  • Joined

  • Last visited

Everything posted by tg626

  1. DPSoundFX Simple as the name, it adds the sorely missing sounds of collisions docking in orbit! Motivation Simply put, I wanted to hear something when 2 ships docked. I was so used to it in Orbiter (an open source space simulator) that I sorely missed it. So much so that I jumped into coding (again) to make it happen. My effects are based on my perception that Jeb wouldn't dock so much as "participate in a controlled collision" Installation Be sure to have the latest version of ModuleManger installed! Upzip it into your GameData folder, as with most other mods. API Reference Using a ModuleManager config, like below, you can specify your own sounds for any docking port in the game. @PART[someDockingPort]:NEEDS[FP_DPSoundFX] { MODULE { name = DPSoundFX sound_docking = CustomExample/crash sound_undocking = CustomExample/radio internalSoundsOnly = false } } How-To-Use Just listen, when docking or un-docking of course!! (Now also when decoupling!) Contributors Guru's who answered my questions: Snjo CrzyRndm Authors whose plugins were studied for clues and code: Pizzaoverhead License GNU GENERAL PUBLIC LICENSE V3 dated 6/29/2007 Download / Source Download - GitHub Download - SpaceDock (CKAN enabled) Source Alternate Sounds Docking & Undocking - by Dashman (RAR archive) [Link Reported Broken: 8/22/21] Docking & Undocking - by akron
  2. Yeah, that's Firefly/Serenity. Jayne "I'll be in my bunk" Cobb. I can't make a proper bug report about it as I didn't take down the data, but I've had empty stages added simply by removing and replacing a part, or the last (stage 0) will have the chute and a space for another icon, but no icon. Last night I loaded Kerbal X, removed the chute and changed it to a docking port, and suddenly all the radial decouplers for the strap on boosters are in one stage. Another time, again Kerbal X, I go to the pad and I get all but one radial decoupler in 1 stage, a single radial in another stage below it, and the 2nd stage engine and the decoupler between stage 2 and the capsule in one stage for no reason at all (that I can tell). I wondered if it was TE, or maybe "Stock bug fix modules" - I'm think now it might be SBFM...
  3. Ok... I'll add the onDestroy bit - I forgot about it honestly but that won't happen until tomorrow evening, gotta sleep now and work in the am. This is going to nag my mind all day too...
  4. OMG! That was IT (I think... it worked just now, but it's done that before and then goobered up on me when I restarted the game later, so...) Here's what I did based on your advice (that last post I was able to follow LOL) using System;using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; namespace DockingSounds { class DPSoundFX : PartModule { [KSPField] public string sound_docking = "DPSoundFX/Sounds/dock"; [KSPField] public string sound_undocking = "DPSoundFX/Sounds/undock"; static bool eventAddedDocking = false; static bool eventAddedUndocking = false; static bool groupCreatedDocking = false; static bool groupCreatedUndocking = false; public FXGroup dockSound = null; public FXGroup undockSound = null; public bool createGroup (FXGroup group, string name, bool loop) { if (name != string.Empty) { if (!GameDatabase.Instance.ExistsAudioClip (name)) { Debug.LogError ("[DPSoundFX]ERROR - file " + name + ".* not found!"); return false; } group.audio = gameObject.AddComponent<AudioSource> (); group.audio.volume = GameSettings.SHIP_VOLUME; group.audio.rolloffMode = AudioRolloffMode.Logarithmic; group.audio.dopplerLevel = 0f; group.audio.panLevel = 1f; group.audio.clip = GameDatabase.Instance.GetAudioClip (name); group.audio.loop = loop; group.audio.playOnAwake = false; return true; } return false; } public void DPFXdock (GameEvents.FromToAction<Part, Part> partAction) { //Debug.LogError ("[DPSoundFX] Docking"); //Debug.LogError (" Docked FROM : " + partAction.from.vessel.vesselName); //Debug.LogError (" Docked TO : " + partAction.to.vessel.vesselName); //Debug.LogError (" Docked FROM ID: " + partAction.from.vessel.id.ToString ()); //Debug.LogError (" Docked TO ID : " + partAction.to.vessel.id.ToString ()); Debug.LogError ("[DPSoundFX] Playing: " + sound_docking); if (!this.dockSound.audio.isPlaying) { this.dockSound.audio.Play (); } } public void DPFXundock (Part part) { print ("[DPSoundFX] Undocking " + part.vessel); Debug.LogError ("[DPSoundFX] Playing: " + sound_undocking); if (!this.dockSound.audio.isPlaying) { this.undockSound.audio.Play (); } } public override void OnStart (PartModule.StartState state) { Debug.LogError ("[DPSoundFX] OnStart Called: State is " + state); if (HighLogic.LoadedScene != GameScenes.FLIGHT) return; base.OnStart (state); groupCreatedDocking = createGroup (dockSound, sound_docking, false); groupCreatedUndocking = createGroup (undockSound, sound_undocking, false); if (groupCreatedDocking && !eventAddedDocking) { GameEvents.onPartCouple.Add (DPFXdock); eventAddedDocking = true; } if (groupCreatedUndocking && !eventAddedUndocking) { GameEvents.onPartUndock.Add (DPFXundock); eventAddedUndocking = true; } Debug.LogError ("[DPSoundFX] OnStart Executed: State was " + state); } } } - - - Updated - - - %^&%*^@# it all... Still getting: NullReferenceException at (wrapper managed-to-native) UnityEngine.AudioSource:get_isPlaying () at DockingSounds.DPSoundFX.DPFXdock (FromToAction`2 partAction) [0x00000] in <filename unknown>:0 at EventData`1[GameEvents+FromToAction`2[Part,Part]].Fire (FromToAction`2 data) [0x00000] in <filename unknown>:0 at Part.Couple (.Part tgtPart) [0x00000] in <filename unknown>:0 at ModuleDockingNode.DockToVessel (.ModuleDockingNode node) [0x00000] in <filename unknown>:0 at ModuleDockingNode.<SetupFSM>m__166 () [0x00000] in <filename unknown>:0 at KerbalFSM.RunEvent (.KFSMEvent evt) [0x00000] in <filename unknown>:0 at KerbalFSM.updateFSM (KFSMUpdateMode mode) [0x00000] in <filename unknown>:0 at KerbalFSM.UpdateFSM () [0x00000] in <filename unknown>:0 at ModuleDockingNode.Update () [0x00000] in <filename unknown>:0 (Filename: Line: -1) in the log, only now I get NO sound and no docking, they are just sticking to each other "magnetically"... In the first test, I was getting the sound, using 2 rovers with ports. Then I launched 2 capsules and I get this magneto thing, and no sound. I know darn well there's no voodoo in coding, but it sure seems like it's possessed!!!
  5. So there is on instance of my code running for every docking port in the scene? (It's added to all ports via module manager). And every instance if the code is called when any port is docked or undocked? Beyond that, having no idea how to do what you suggested ( even with the example) just proves how out of my depth I am!!!
  6. I had really hoped to get this myself, but after getting this to (I thought) work properly, I find that it sometimes works as intended, sometimes refires the sound over and over and over forever and never lets the ports actually dock... :/ using System;using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; namespace DockingSounds { class DPSoundFX : PartModule { [KSPField] public string sound_docking = "DPSoundFX/Sounds/dock"; [KSPField] public string sound_undocking = "DPSoundFX/Sounds/undock"; public FXGroup dockSound = null; public FXGroup undockSound = null; public bool createGroup (FXGroup group, string name, bool loop) { if (name != string.Empty) { if (!GameDatabase.Instance.ExistsAudioClip (name)) return false; group.audio = gameObject.AddComponent<AudioSource> (); group.audio.volume = GameSettings.SHIP_VOLUME; group.audio.rolloffMode = AudioRolloffMode.Logarithmic; group.audio.dopplerLevel = 0f; group.audio.panLevel = 1f; group.audio.clip = GameDatabase.Instance.GetAudioClip (name); group.audio.loop = loop; group.audio.playOnAwake = false; return true; } return false; } public void DPFXdock (GameEvents.FromToAction<Part, Part> partAction) { //Debug.LogError ("[DPSoundFX] Docking"); //Debug.LogError (" Docked FROM : " + partAction.from.vessel.vesselName); //Debug.LogError (" Docked TO : " + partAction.to.vessel.vesselName); //Debug.LogError (" Docked FROM ID: " + partAction.from.vessel.id.ToString ()); //Debug.LogError (" Docked TO ID : " + partAction.to.vessel.id.ToString ()); Debug.LogError ("[DPSoundFX] Playing: " + sound_docking); if (!dockSound.audio.isPlaying){ dockSound.audio.Play (); } } public void DPFXundock (Part part) { print ("[DPSoundFX] Undocking " + part.vessel); Debug.LogError ("[DPSoundFX] Playing: " + sound_undocking); undockSound.audio.Play (); } public override void OnStart (PartModule.StartState state) { Debug.LogError ("[DPSoundFX] OnStart Called: State is " + state); if (HighLogic.LoadedScene != GameScenes.FLIGHT) return; base.OnStart (state); if (createGroup (undockSound, sound_undocking, false)) { GameEvents.onPartUndock.Add (DPFXundock); } else { Debug.LogError ("[DPSoundFX]ERROR - file " + sound_undocking + ".* not found!"); } if (createGroup (dockSound, sound_docking, false)) { GameEvents.onPartCouple.Add (DPFXdock); } else { Debug.LogError ("[DPSoundFX]ERROR - file " + sound_docking + ".* not found!"); } Debug.LogError ("[DPSoundFX] OnStart Executed: State was " + state); } } } When it goes wrong, I get NRE's in the log (below) there's only one isPlaying conditional statement because I removed them at one point as a test and then replaced the one for docking on my last try. All it did was change it from a machingun buzz of repeated playbacks to one after another after another... Output Log I'm sure this is just a matter of me being stupid, or knowing just enough to get myself into trouble, as I've never taken a single class of any kind on anything beyond BASIC programming (as in BASIC language, I'm 45)
  7. I realize this is an old post but it's still appropriate to reply here. After hours of trying to get a simple sound effect to fire in game and getting nothing but Null Reference Exceptions in the log, I found this code and after looking it over managed to incorporate some of what Snjo did (FXgroup) and finally had success. If there's a later reference for how to implement sounds in game, I never found it. Thanks Snjo!
  8. Back to the topic!! This is a great idea and just what the now expansive tantares mods needed IMHO.
  9. Good to know. I'm glad I didnt make a collider for it then
  10. No, docking behavior is unchanged, and the petals can clip through one another
  11. At present there is no display for any data, so you have no idea of your distance or angle to that target port, but I'm considering it since I've also been mucking about with DLLs a little...
  12. It's a new port that isn't... The fingers and crosshairs are a new model, which is "welded" to the stock clamp-o-tron model, making an entirely separate part in the VAB.
  13. Outside view... (NOTE Red/Green "tags" have been removed) KURS View (Requires HullCameraVDS mod)
  14. ...after transmitting data. And you should be able to manually open them after transmitting. That is all.
  15. As a separate exercise, I created a model to nest in the standard size Clamp-O-Tron port to make it resemble the "Androgynous Docking Interface" as shown in revision C of the International Docking System Standard Interface Definition Document dated 20 Nov, 2013. I did this because as I was looking the document over I was stuck by how much the proposed standard looked like a Clamp-O-Tron with "fingers" or "petals" added to it. Why am I posting this here? Well, I feel I'm among friends especially in this thread, but mostly because I could have NEVER done it without Beale's tutorials! And, because it pointed up an error in the Tantares APAS ports. Here's mine. Notice how the "petals" interleave when two identical craft are facing each other at 0º relative roll. This matches the documents mentioned above. Here's the Tantares set, again two identical craft at 0º relative roll, and the fingers collide (or clip, this is KSP after all). I know, I know I'm being an OCD twit about it but I can't help it. And yes, the Red/Green are meant to show Port/Starboard just like on a boat, or airplane.
  16. I don't think it should be tier 1. Sputnik (earliest space application of the R-7) wasn't launched from a corn field... I far more appalled by the fact that the Mk1 capsule (Mercury) is available from day 1 in the stock game...
  17. Ah, Ok then, as long as it's known. (and for me, I think that center one was the best one... Sorry. )
  18. Any idea what would cause your Tavio engines to cause Tier 2 and 3 launch pads to constantly emit launch smoke effects even when the engines are off? Process to get that screenshot - In the VAB, select the nose cone add the tank and engine, click "Launch", hit F1. I have NOT engaged the engines or done anything else.
  19. I haven't gone near the spacebar, the engines aren't "on" yet... And the rocket is sitting on a FASA Redstone launch clamp. I'll have a go at it tomorrow and see if I can isolate it. I was more or less posting to see if it was a "known" issue. EDIT: Had a chance tonight, and it is caused by Beale's "Tavio" engines on Tier 2, 3, and in Sandbox (maybe Tier 1 too, but I didn't test that.) Sorry for the false alarm.
×
×
  • Create New...