diff --git a/.mod_data.yml b/.mod_data.yml index 51e0a04..01ad065 100644 --- a/.mod_data.yml +++ b/.mod_data.yml @@ -11,13 +11,13 @@ dependencies: # Configure dependencies version: 4.1.3 location: s3 B9PartSwitch: - version: 2.17.0 + version: 2.18.0 location: s3 CommunityResourcePack: version: 1.4.2 location: s3 DynamicBatteryStorage: - tag: 2.2.2 + tag: 2.2.4 location: github repository: post-kerbin-mining-corporation/DynamicBatteryStorage deploy: diff --git a/GameData/NearFutureElectrical/Parts/NuclearFuel/nuclearfuel-25-n.dds b/GameData/NearFutureElectrical/Parts/NuclearFuel/nuclearfuel-25-n.dds index 66cd9e4..b8f0a67 100644 Binary files a/GameData/NearFutureElectrical/Parts/NuclearFuel/nuclearfuel-25-n.dds and b/GameData/NearFutureElectrical/Parts/NuclearFuel/nuclearfuel-25-n.dds differ diff --git a/GameData/NearFutureElectrical/Parts/NuclearFuel/nuclearfuel-25.mu b/GameData/NearFutureElectrical/Parts/NuclearFuel/nuclearfuel-25.mu index bb9cb43..09d1d63 100644 Binary files a/GameData/NearFutureElectrical/Parts/NuclearFuel/nuclearfuel-25.mu and b/GameData/NearFutureElectrical/Parts/NuclearFuel/nuclearfuel-25.mu differ diff --git a/GameData/NearFutureElectrical/Plugins/NearFutureElectrical.dll b/GameData/NearFutureElectrical/Plugins/NearFutureElectrical.dll index 44431c7..8c47be4 100644 Binary files a/GameData/NearFutureElectrical/Plugins/NearFutureElectrical.dll and b/GameData/NearFutureElectrical/Plugins/NearFutureElectrical.dll differ diff --git a/GameData/NearFutureElectrical/Versioning/NearFutureElectrical.version b/GameData/NearFutureElectrical/Versioning/NearFutureElectrical.version index 8dc3d60..cbc6070 100644 --- a/GameData/NearFutureElectrical/Versioning/NearFutureElectrical.version +++ b/GameData/NearFutureElectrical/Versioning/NearFutureElectrical.version @@ -6,14 +6,14 @@ { "MAJOR":1, "MINOR":2, - "PATCH":2, + "PATCH":3, "BUILD":0 }, "KSP_VERSION": { "MAJOR":1, - "MINOR":11, - "PATCH":2 + "MINOR":12, + "PATCH":1 }, "KSP_VERSION_MIN":{ "MAJOR":1, @@ -22,7 +22,7 @@ }, "KSP_VERSION_MAX":{ "MAJOR":1, - "MINOR":11, + "MINOR":12, "PATCH":99 } } diff --git a/README.md b/README.md index 9470a1d..ef546b1 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,9 @@ Ever wanted some futuristic energy generation that wasn't too... futuristic? I h ### Required These components are required for the mod to function and are bundled as part of any download: * [ModuleManager (4.1.4)](https://github.com/sarbian/ModuleManager) -* [B9PartSwitch (2.17.0)](https://github.com/blowfishpro/B9PartSwitch) +* [B9PartSwitch (2.18.0)](https://github.com/blowfishpro/B9PartSwitch) * [Community Resource Pack (1.4.2)](https://github.com/BobPalmer/CommunityResourcePack) -* [DynamicBatteryStorage (2.2.2)](https://github.com/ChrisAdderley/DynamicBatteryStorage) +* [DynamicBatteryStorage (2.2.4)](https://github.com/ChrisAdderley/DynamicBatteryStorage) ## Installation diff --git a/Source/NearFutureElectrical/FissionGenerator.cs b/Source/NearFutureElectrical/FissionGenerator.cs index 4caa946..6f2ab1e 100644 --- a/Source/NearFutureElectrical/FissionGenerator.cs +++ b/Source/NearFutureElectrical/FissionGenerator.cs @@ -4,83 +4,90 @@ /// using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using UnityEngine; using KSP.Localization; namespace NearFutureElectrical { - public class FissionGenerator: FissionConsumer - { + public class FissionGenerator : FissionConsumer, IContractObjectiveModule + { - // Maximum power generation - [KSPField(isPersistant = false)] - public float PowerGeneration = 100f; + // Maximum power generation + [KSPField(isPersistant = false)] + public float PowerGeneration = 100f; - // Current power generation - [KSPField(isPersistant = true)] - public float CurrentGeneration = 0f; + // Current power generation + [KSPField(isPersistant = true)] + public float CurrentGeneration = 0f; - // Reactor Status string - [KSPField(isPersistant = false, guiActive = true, guiName = "Generation")] - public string GeneratorStatus; + // Reactor Status string + [KSPField(isPersistant = false, guiActive = true, guiName = "Generation")] + public string GeneratorStatus; - public override string GetInfo() - { - return Localizer.Format("#LOC_NFElectrical_ModuleFissionGenerator_PartInfo", PowerGeneration.ToString("F0")); - } - public string GetModuleTitle() - { - return "FissionGenerator"; - } - public override string GetModuleDisplayName() - { - return Localizer.Format("#LOC_NFElectrical_ModuleFissionGenerator_ModuleName"); - } - public override void OnStart(PartModule.StartState state) - { - base.OnStart(state); + public override string GetInfo() + { + return Localizer.Format("#LOC_NFElectrical_ModuleFissionGenerator_PartInfo", PowerGeneration.ToString("F0")); + } + public string GetModuleTitle() + { + return "FissionGenerator"; + } + public override string GetModuleDisplayName() + { + return Localizer.Format("#LOC_NFElectrical_ModuleFissionGenerator_ModuleName"); + } - Fields["GeneratorStatus"].guiName = Localizer.Format("#LOC_NFElectrical_ModuleFissionGenerator_Field_GeneratorStatus"); - } + public virtual string GetContractObjectiveType() + { + return "Generator"; + } + public virtual bool CheckContractObjectiveValidity() + { + return true; + } - public void FixedUpdate() - { - if (HighLogic.LoadedScene == GameScenes.FLIGHT) - { + public override void OnStart(PartModule.StartState state) + { + base.OnStart(state); + + Fields["GeneratorStatus"].guiName = Localizer.Format("#LOC_NFElectrical_ModuleFissionGenerator_Field_GeneratorStatus"); + } - if (Status) - { + public void FixedUpdate() + { + if (HighLogic.LoadedScene == GameScenes.FLIGHT) + { - double generated = (double)(Mathf.Clamp01(CurrentHeatUsed / HeatUsed) * PowerGeneration); + if (Status) + { - double delta = 0d; - for (int i = 0; i < this.vessel.parts.Count; i++) + double generated = (double)(Mathf.Clamp01(CurrentHeatUsed / HeatUsed) * PowerGeneration); - { - if (this.vessel.parts[i].Resources.Get(PartResourceLibrary.Instance.GetDefinition("ElectricCharge").id) != null) - delta += this.vessel.parts[i].Resources.Get(PartResourceLibrary.Instance.GetDefinition("ElectricCharge").id).maxAmount - - this.vessel.parts[i].Resources.Get(PartResourceLibrary.Instance.GetDefinition("ElectricCharge").id).amount; - } + double delta = 0d; + for (int i = 0; i < this.vessel.parts.Count; i++) - double generatedActual = Math.Min(delta, TimeWarp.fixedDeltaTime * generated); + { + if (this.vessel.parts[i].Resources.Get(PartResourceLibrary.Instance.GetDefinition("ElectricCharge").id) != null) + delta += this.vessel.parts[i].Resources.Get(PartResourceLibrary.Instance.GetDefinition("ElectricCharge").id).maxAmount - + this.vessel.parts[i].Resources.Get(PartResourceLibrary.Instance.GetDefinition("ElectricCharge").id).amount; + } - double amt = this.part.RequestResource("ElectricCharge", -generatedActual); + double generatedActual = Math.Min(delta, TimeWarp.fixedDeltaTime * generated); - if (double.IsNaN(generated)) - generated = 0.0; + double amt = this.part.RequestResource("ElectricCharge", -generatedActual); - CurrentGeneration = (float)generated; - GeneratorStatus = Localizer.Format("#LOC_NFElectrical_ModuleFissionGenerator_Field_GeneratorStatus_Normal", generated.ToString("F1")); - } - else - GeneratorStatus = Localizer.Format("#LOC_NFElectrical_ModuleFissionGenerator_Field_GeneratorStatus_Offline"); - } + if (double.IsNaN(generated)) + generated = 0.0; + CurrentGeneration = (float)generated; + GeneratorStatus = Localizer.Format("#LOC_NFElectrical_ModuleFissionGenerator_Field_GeneratorStatus_Normal", generated.ToString("F1")); } - + else + GeneratorStatus = Localizer.Format("#LOC_NFElectrical_ModuleFissionGenerator_Field_GeneratorStatus_Offline"); + } } + + + } } diff --git a/Source/NearFutureElectrical/RadioisotopeGenerator.cs b/Source/NearFutureElectrical/RadioisotopeGenerator.cs index ff70669..e382256 100644 --- a/Source/NearFutureElectrical/RadioisotopeGenerator.cs +++ b/Source/NearFutureElectrical/RadioisotopeGenerator.cs @@ -11,7 +11,7 @@ namespace NearFutureElectrical { - public class ModuleRadioisotopeGenerator : PartModule + public class ModuleRadioisotopeGenerator : PartModule, IContractObjectiveModule { // Power generated at max [KSPField(isPersistant = false)] @@ -40,7 +40,16 @@ public class ModuleRadioisotopeGenerator : PartModule protected double localHalfLife = 0d; - protected void Start() + public virtual string GetContractObjectiveType() + { + return "Generator"; + } + public virtual bool CheckContractObjectiveValidity() + { + return true; + } + + protected void Start() { localHalfLife = Utils.KerbinYearsToLocalYears(HalfLife); } diff --git a/changelog.txt b/changelog.txt index bb8b53e..bbcd394 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,10 @@ +v1.2.3 +------ +- KSP 1.12 +- Updated B9PartSwitch to 2.18.0 +- Updated DynamicBatteryStorage to 2.2.4 +- RadioisotopeGenerator and FissionGenerator modules now count for contract objective completion + v1.2.2 ------ - Updated DynamicBatteryStorage to 2.2.2 diff --git a/readme.txt b/readme.txt index 8786f58..a870409 100644 --- a/readme.txt +++ b/readme.txt @@ -1,6 +1,6 @@ ============================= -NEAR FUTURE ELECTRICAL v1.2.1 -============================2 +NEAR FUTURE ELECTRICAL v1.2.3 +============================= This pack contains advanced electrical parts - capacitors, nuclear reactors and new battery packs. @@ -9,10 +9,10 @@ DEPENDENCIES ============ Required: -- B9PartSwitch (2.17.0) +- B9PartSwitch (2.18.0) - Community Resource Pack (1.4.2) - ModuleManager (4.1.4) -- DynamicBatteryStorage (2.2.2) +- DynamicBatteryStorage (2.2.4) Optional - Community Tech Tree (v2.2+)