Skip to content

Commit 07d5327

Browse files
Merge pull request #100 from post-kerbin-mining-corporation/dev
Release 2.3.3
2 parents d7210ac + 76498d7 commit 07d5327

File tree

10 files changed

+87
-14
lines changed

10 files changed

+87
-14
lines changed

GameData/DynamicBatteryStorage/DynamicBatteryStorageSettings.cfg

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ DYNAMICBATTERYSTORAGE
2929
module = KopernicusSolarPanel
3030
module = ModuleCurvedSolarPanel
3131
module = ModuleDeployableSolarPanel
32+
module = weatherDrivenSolarPanel
3233
}
3334
HANDLERCATEGORY
3435
{
@@ -45,7 +46,7 @@ DYNAMICBATTERYSTORAGE
4546
title = #LOC_DynamicBatteryStorage_UI_Category_Radiators
4647
module = ModuleActiveRadiator
4748
module = ModuleSystemHeatRadiator
48-
module = ModuleSystemHeatTemperatureAdjuster
49+
module = ModuleSystemHeatExchanger
4950
}
5051
HANDLERCATEGORY
5152
{
@@ -202,6 +203,18 @@ DYNAMICBATTERYSTORAGE
202203
continuous = true
203204
}
204205
PARTMODULEHANDLER
206+
{
207+
name = weatherDrivenSolarPanel
208+
handlerModuleName = WDSPPowerHandlers
209+
type = Power
210+
visible = true
211+
solarEfficiencyEffects = true
212+
producer = true
213+
consumer = false
214+
simulated = true
215+
continuous = true
216+
}
217+
PARTMODULEHANDLER
205218
{
206219
name = ModuleGenerator
207220
handlerModuleName = ModuleGeneratorPowerHandler
@@ -998,7 +1011,7 @@ DYNAMICBATTERYSTORAGE
9981011
}
9991012
PARTMODULEHANDLER
10001013
{
1001-
name = ModuleSystemHeatTemperatureAdjuster
1014+
name = ModuleSystemHeatExchanger
10021015
type = Power
10031016
handlerModuleName = GenericFieldDataHandler
10041017
// Is this shown in the UI at all?
Binary file not shown.

GameData/DynamicBatteryStorage/Versioning/DynamicBatteryStorage.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{
77
"MAJOR":2,
88
"MINOR":3,
9-
"PATCH":2,
9+
"PATCH":3,
1010
"BUILD":0
1111
},
1212
"KSP_VERSION":

Source/DynamicBatteryStorage/Data/VesselDataManager.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,30 @@ void FixedUpdate()
6262
/// </summary>
6363
protected void RefreshVesselData(Vessel eventVessel)
6464
{
65-
Utils.Log(String.Format("[{0}]: Refreshing VesselData from Vessel event", this.GetType().Name), Utils.LogType.VesselData);
66-
RefreshVesselData();
65+
if (vessel != null && vessel.loaded)
66+
{
67+
Utils.Log(String.Format("[{0}]: Refreshing VesselData from Vessel event", this.GetType().Name), Utils.LogType.VesselData);
68+
RefreshVesselData();
69+
}
6770
}
6871
/// <summary>
6972
/// Referesh the data, given a ConfigNode event
7073
/// </summary>
7174
protected void RefreshVesselData(ConfigNode node)
7275
{
73-
Utils.Log(String.Format("[{0}]: Refreshing VesselData from save node event", this.GetType().Name), Utils.LogType.VesselData);
74-
RefreshVesselData();
76+
if (vessel != null && vessel.loaded)
77+
{
78+
Utils.Log(String.Format("[{0}]: Refreshing VesselData from save node event", this.GetType().Name), Utils.LogType.VesselData);
79+
RefreshVesselData();
80+
}
7581
}
7682

7783
/// <summary>
7884
/// Referesh the data classes
7985
/// </summary>
8086
protected void RefreshVesselData()
8187
{
82-
if (vessel == null || vessel.Parts == null)
88+
if (vessel == null || vessel.Parts == null || !vessel.loaded)
8389
return;
8490

8591
electricalData = new VesselElectricalData(vessel.Parts);

Source/DynamicBatteryStorage/Data/VesselThermalData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ protected override void SetupDataHandler(PartModule pm)
2525
if (Settings.IsSupportedPartModule(pm.moduleName, ResourcesSupported.Heat))
2626
{
2727
HandlerModuleData data = Settings.GetPartModuleData(pm.moduleName, ResourcesSupported.Heat);
28-
Utils.Log(String.Format("[{0}]: Detected supported heat handler for {1}: {2}", this.GetType().Name, pm.moduleName, data.handlerModuleName), Utils.LogType.VesselData);
28+
//Utils.Log(String.Format("[{0}]: Detected supported heat handler for {1}: {2}", this.GetType().Name, pm.moduleName, data.handlerModuleName), Utils.LogType.VesselData);
2929

3030
string typeName = this.GetType().AssemblyQualifiedName;
3131
typeName = typeName.Replace("VesselThermalData", data.handlerModuleName);

Source/DynamicBatteryStorage/DynamicBatteryStorage.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ protected override void OnStart()
6969
GameEvents.onVesselWasModified.Add(new EventData<Vessel>.OnEvent(CalculateElectricalData));
7070

7171
FindDataManager();
72-
73-
Utils.Log(String.Format("[DynamicStorage] Initialization completed with buffer scale {0} and timewarp limit {1}", bufferScale, timeWarpLimit), Utils.LogType.DynamicStorage);
7472
}
7573

7674
protected override void OnSave(ConfigNode node)
@@ -207,11 +205,17 @@ protected void CalculateElectricalData()
207205

208206
protected void CalculateElectricalData(Vessel eventVessel)
209207
{
210-
CalculateElectricalData();
208+
if (vessel != null && vessel.loaded)
209+
{
210+
CalculateElectricalData();
211+
}
211212
}
212213
protected void CalculateElectricalData(ConfigNode node)
213214
{
214-
CalculateElectricalData();
215+
if (vessel != null && vessel.loaded)
216+
{
217+
CalculateElectricalData();
218+
}
215219
}
216220

217221
/// <summary>

Source/DynamicBatteryStorage/DynamicBatteryStorage.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
<Compile Include="UI\ToolbarSituation.cs" />
109109
<Compile Include="UI\Tooltips.cs" />
110110
<Compile Include="Utils.cs" />
111+
<Compile Include="Handlers\Power\WDSPPowerHandlers.cs" />
111112
</ItemGroup>
112113
<ItemGroup />
113114
<ItemGroup>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System;
2+
3+
namespace DynamicBatteryStorage
4+
{
5+
6+
/// <summary>
7+
/// Handler for Weather Driven Solar Panel
8+
/// </summary>
9+
public class WDSPPowerHandlers : ModuleDataHandler
10+
{
11+
public WDSPPowerHandlers(HandlerModuleData moduleData) : base(moduleData)
12+
{ }
13+
14+
public override bool Initialize(PartModule pm)
15+
{
16+
base.Initialize(pm);
17+
/// If kopernicus is using the multistar settings, we need to only show this thing in flight as the new handler wipes the data in editor
18+
/// We need to rely on the
19+
if (Settings.KopernicusMultiStar)
20+
{
21+
return HighLogic.LoadedSceneIsFlight;
22+
}
23+
return true;
24+
}
25+
26+
protected override double GetValueEditor()
27+
{
28+
/// Invalid in editor
29+
return 0f;
30+
}
31+
protected override double GetValueFlight()
32+
{
33+
double results = 0d;
34+
if (double.TryParse(pm.Fields.GetValue("currentOutput").ToString(), out results))
35+
{
36+
return results;
37+
}
38+
return results;
39+
40+
}
41+
}
42+
43+
}

changelog.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
v2.3.3
2+
------
3+
- Fixed SystemHeat heat exchangers not being detected correctly
4+
- Changes to debug logging to make it less verbose and easier to find problems
5+
- Added user-contibuted support for Weather Dependent Solar Panel
6+
17
v2.3.2
28
------
39
- Fixed an issue in the Kerbalism disabler patch causing the mod to be disabled all the time :D

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
==============================
2-
Dynamic Battery Storage v2.3.2
2+
Dynamic Battery Storage v2.3.3
33
==============================
44

55
A small utility mod for Kerbal Space Program, intended to support my other projects. Effectively required by Near Future Electrical, CryoEngines, KerballAtomics and CryoTanks.

0 commit comments

Comments
 (0)