Jump to content

Alex P

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by Alex P

  1. How can I put variables in the partmodule in the .cfg file and then read them in the plugin partmodule?
  2. Diazo, The part module was assigned, the cfg looks exactly like what you posted. I tried OnUpdate instead. It worked! Now I can get to the fun coding... Thanks!
  3. Thanks for the quick response, Debug.Log("SPAM"); inside OnFixedUpdate didn't work either. Print("example") worked for the KSPEvent buttons, and part.RequestResource("Oxidizer", -10); worked also. I need to know how to get debug and part.RequestResource working in the OnFixedUpdate loop. Maybe the entire part module code would be helpful? using System; using UnityEngine; using KSP.IO; namespace MarsDirect{ public class AirCompressor : PartModule{ //declares variables public bool CompressAir = false; //these variables aren't used yet public String CurrentPlanet = ""; public float OxygenRatio = 0; public float CarbonDioxideRatio = 0; public float Oxygen = 1; public float CarbonDioxide = 0; //button to start compressing [KSPEvent(guiActive = true, guiName = "Start Compressing", active = true)] public void StartCompression(){ CompressAir = true; print ("CompressAir = true"); } //button to stop compressing [KSPEvent(guiActive = true, guiName = "Stop Compressing", active = true)] public void StopCompression(){ CompressAir = false; print ("CompressAir = false"); } //I think this should be doing something to the log, but it doesn't. public override void OnFixedUpdate(){ Debug.Log ("SPAM"); if (CompressAir == true) { print ("Should be compressing air..."); part.RequestResource("Oxidizer", -10); } } } }
  4. Hi again, For some reason, this code doesn't seem to be working. public override void OnFixedUpdate(){ print ("This should say something..."); if (CompressAir == true) { print ("Should be compressing air..."); part.RequestResource("Oxidizer", -10); } } I think that should spam the log with at least one message every FixedUpdate. But, it doesn't, even when it's OnDraw. The KSPEvent buttons are able to print things to the log, but why can't I do this OnDraw or OnFixedUpdate? Thanks in advance.
  5. It was attached to a half empty fuel tank, so I don't think that was the problem. I don't know much about KSPEvent, so I'll have to read up on that.
  6. Hi, I have this in a part module attached to an RCS block. It doesn't add any resources (I have tried Oxidizer also). I have also tried commenting out the if statement, and it still doesn't work. I've tried putting the code in OnFixedUpdate also. I got the part.RequestResource to work in another part module. What am I doing wrong here? Would OnFixedUpdate work better? private void OnDraw(){ if (CompressAir == true) { part.RequestResource("IntakeAir", -10); } } One more thing, [KSPEvent(guiActive = true, guiName = "Stop Compressing", active = true)] public void StopCompression(){ CompressAir = false; } I want to change "active = true" to "active = CompressAir" so the "Stop Compressing" button is only active when it is compressing. Instead, it gives me an error. How do I fix this?
  7. This has probably been asked many times before, but this is a big thread. How can I make a right click menu appear when I right click on a part? Like with the fuel lines, when you right click you have a button to transfer fuel. I didn't find it on the wiki. Another question - is there any way for a fuel tank to hold different mixtures of fuel? For example, a fuel tank with a 1000 capacity could hold 500 oxidizer and 500 liquid fuel, or 1000 oxidizer with 0 liquid fuel, or other combinations. Engines could take different oxidizer/liquid fuel ratios, but it would change its isp. Thanks in advance.
  8. I'm also on osx and I've never been able to update. I just re-download the entire game. The KSP launcher does look like it tries to open terminal when I click update, though.
  9. I want to make a resources plugin. How can I increase the fuel level (or any amount of resource) in a fuel tank/battery?
×
×
  • Create New...