Jump to content

JoePatrick1

Members
  • Posts

    400
  • Joined

  • Last visited

Everything posted by JoePatrick1

  1. I have this module and I would like it to be added to all parts with the "vesselType = Probe" line but only if ProbeLowPower mod is installed. MODULE { name = ProbeLowPower lowPowerRatio = 0.005 } I think the MM cfg has to look something like this but not sure, can someone tell me if this is right/what the right cfg would be. @PART:NEEDS[ProbeLowPower], :HAS[vesselType[Probe]] MODULE { name = ProbeLowPower lowPowerRatio = 0.005 } Thanks
  2. I am writing a plugin to add a lower power mode to probe cores and need away to disable control whilst it's enabled then allow control when it is then disabled. So I need to be able to enable/disable control but the gui button needs to still be accessible Here is my code currently up to this point using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ProbeLowPower { public class ProbeLowPower : PartModule { [KSPField(isPersistant = true)] public bool lowPowerMode; [KSPField(isPersistant = false)] public float lowPowerRatio; public double normalRate; public double lowPowerRate; public ModuleResource moduleResource; public override void OnLoad(ConfigNode node) { if (HighLogic.LoadedSceneIsFlight) { foreach (ModuleResource modres in this.part.GetComponent<ModuleCommand>().inputResources) { if (modres.name == "ElectricCharge") { moduleResource = modres; normalRate = modres.rate; lowPowerRate = normalRate * lowPowerRatio; } } print("AWAKE, Low Power Mode: " + lowPowerMode); if (lowPowerMode) moduleResource.rate = lowPowerRate; else moduleResource.rate = normalRate; } } [KSPEvent(active = true, guiActive = true, guiActiveEditor = false, guiActiveUnfocused = false, guiName = "Low Power Mode: Disabled")] public void activateLPM() { lowPowerMode = true; moduleResource.rate = lowPowerRate; this.part.isControlSource = false; //This doesn't work as the stock ModuleCommand overites it every frame Events["activateLPM"].active = false; Events["deactivateLPM"].active = true; } [KSPEvent(active = false, guiActive = true, guiActiveEditor = false, guiActiveUnfocused = false, guiName = "Low Power Mode: Enabled")] public void deactivateLPM() { lowPowerMode = false; moduleResource.rate = normalRate; this.part.isControlSource = true; //This doesn't work as the stock ModuleCommand overites it every frame Events["activateLPM"].active = true; Events["deactivateLPM"].active = false; } } }
  3. Accidental Duplicate - Ignore Link to actual thread
  4. I just tried changing onAwake to onLoad and now it works perfectly. The state is saved with isPersistent but I cannot save the rate of power drain as this is saved in the part files and is loaded reloaded by the stock modules each time. I have to load the state, then set the rate accordingly
  5. I know that it's not just the debug log because it still uses the normal rate, rather than the low power rate but would it work if I put it in OnLoad as this is where it toggles the low power mode based on whether or not the variable is true/false?
  6. I am trying to save 'lowPowerMode' so that if I load the craft it will be whatever it was when I was last flying that vessel but it always seems to reset to false when I re-load it. Here is the code using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ProbeLowPower { public class ProbeLowPower : PartModule { [KSPField(isPersistant = true)] public bool lowPowerMode; [KSPField(isPersistant = false)] public float lowPowerRatio; public double normalRate; public double lowPowerRate; public ModuleResource moduleResource; public override void OnAwake() { if (HighLogic.LoadedSceneIsFlight) { foreach (ModuleResource modres in this.part.GetComponent<ModuleCommand>().inputResources) { if (modres.name == "ElectricCharge") { moduleResource = modres; normalRate = modres.rate; lowPowerRate = normalRate * lowPowerRatio; } } print("AWAKE, Low Power Mode: " + lowPowerMode); if (lowPowerMode) moduleResource.rate = lowPowerRate; else moduleResource.rate = normalRate; } } [KSPEvent(active = true, guiActive = true, guiActiveEditor = false, guiActiveUnfocused = false, guiName = "Low Power Mode: Disabled")] public void activateLPM() { lowPowerMode = true; moduleResource.rate = lowPowerRate; Events["activateLPM"].active = false; Events["deactivateLPM"].active = true; } [KSPEvent(active = false, guiActive = true, guiActiveEditor = false, guiActiveUnfocused = false, guiName = "Low Power Mode: Enabled")] public void deactivateLPM() { lowPowerMode = false; moduleResource.rate = normalRate; Events["activateLPM"].active = true; Events["deactivateLPM"].active = false; } } }
  7. Thanks. Trying to get v0.4 out with the official 1.1 release if I can.
  8. I'l try and take a look at this this weekend. Probably just needs recompiling.
  9. KerBalloons has been updated to v0.3.1 You can now set a lift limit so that you can carry smaller payloads with the bigger balloons without it accelerating to the speed of light. v0.4 is still under development but I wanted to get this feature out before then. Enjoy
  10. They do that anyway? The balloon inflates, goes up and bursts when the air pressure is too low - this is the max height. If you remove the min pressure limit, it should't burst and therefore keep rising until it doesn't produce enough lift You can reduce how high it can lift a payload by reducing its min and max lift in the config
  11. Errr yes....if the balloon doesn't burst then it can go higher....is that not obvious?
  12. You could try setting min pressure to -1, that might work
  13. I want to add a feature to my KerBalloons mod where the balloon will not accelerate faster than a predetermined value, e.g. 10ms-2 How would I go about doing this? I am using rigidbody.AddForceAtPosition to accelerate the balloon currently. If you use a suitable payload it works fine but if you use a small payload on one of the bigger balloons, it will accelerate so quickly that it will just explode. Will something like this work? lift = (payload mass/recommended payload mass) * lift for recommended payload I am not sure it will because of the force required vs the ship mass not being a linear relationship? The full source code for the mod can be found here if it helps. Thanks
  14. He is planning on making a few other mods with my help, though not necessarily in the same pack. They don't currently work as science parts, just a camera. Some sort of science experiment may be built into it in the future though. Yes, check the original post for a video Same again, check original post for video. Zoom etc. not currently integrated but possibly in the future Just added it
  15. This is something I am looking at working towards in the next update. Thanks, I am not sure if I will add balloons like this but I will certainly look into it. As for wind, I won't be adding it because if people want it then they can use one of the wind mods that already exist. Such as this one
  16. Not a bad idea, I'll look into something like this and see what I can come up with When the balloon reaches an altitude where the external pressure is too low - it will burst I have submitted it to be hosted on CKAN, it should be up in the next week. Also if you use kerbal.curseforge.com it is really no different to any other site - people just hold a grudge when it is unnecessary.
  17. Haha, I haven't tested it but it might work in 1.0.4 edit: just did a quick test and seems to work fine
  18. Reserved for Updates 06/12/15 -Recompiled for KSP 1.0.5 -Fixed issue where when a balloon bursts, all other balloons also burst regardless of whether or not they should -Fixed issue where some cfg values could not be edited
  19. v0.3 is almost ready for release. Here is a sneak peak.
×
×
  • Create New...