Skip to content

Commit

Permalink
Merge pull request #49 from post-kerbin-mining-corporation/dev
Browse files Browse the repository at this point in the history
Release 0.4.4
  • Loading branch information
ChrisAdderley authored Jun 25, 2022
2 parents 5f11e20 + 24400ee commit a5d59da
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
Binary file modified GameData/SpaceDust/Plugins/SpaceDust.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions GameData/SpaceDust/Versioning/SpaceDust.version
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
{
"MAJOR":0,
"MINOR":4,
"PATCH":3,
"PATCH":4,
"BUILD":0
},
"KSP_VERSION":
{
"MAJOR":1,
"MINOR":12,
"PATCH":2
"PATCH":3
},
"KSP_VERSION_MIN":{
"MAJOR":1,
Expand Down
19 changes: 10 additions & 9 deletions Source/SpaceDust/Modules/ModuleSpaceDustHarvester.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,24 +219,25 @@ public override void OnStart(StartState state)
if (node != null)
OnLoad(node);
}
foreach (HarvestedResource res in resources)
if (resources != null)
{
try
foreach (HarvestedResource res in resources)
{
res.density = PartResourceLibrary.Instance.GetDefinition(res.Name).density;
}
catch (NullReferenceException)
{
Utils.LogError($"[ModuleSpaceDustHarvester] Couldn't find resource definition for {res.Name}");
try
{
res.density = PartResourceLibrary.Instance.GetDefinition(res.Name).density;
}
catch (NullReferenceException)
{
Utils.LogError($"[ModuleSpaceDustHarvester] Couldn't find resource definition for {res.Name}");
}
}
}


if (Settings.SystemHeatActive)
{
systemHeatModule = this.GetComponents<PartModule>().ToList().Find(x => x.moduleName == "ModuleSystemHeat" && x.Fields.GetValue("moduleID").ToString() == HeatModuleID);
}

}
}

Expand Down
8 changes: 4 additions & 4 deletions Source/SpaceDust/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ public static ConfigNode GetModuleConfigNode(Part part, string moduleName)
{
try
{
return GameDatabase.Instance.GetConfigs("PART").
Single(c => part.partInfo.name.Replace('_', '.') == c.name.Replace('_', '.')).config.
GetNodes("MODULE").Single(n => n.GetValue("name") == moduleName);
if (part == null || part.partInfo == null || part.partInfo.partConfig == null)
return null;
return part.partInfo.partConfig.GetNodes("MODULE").First(n => n.GetValue("name") == moduleName);
}
catch (Exception)
{
Utils.LogError($"Couldn't get module config for {moduleName} on {part.partInfo.name}");
return null;
}

}

public static string ToSI(double d, string format = null)
{
if (d == 0.0)
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v0.4.4
------
- Fixed a bug on loading when patching a space dust scanner (thanks Angel-125)

v0.4.3
------
- Fixed smaller Sift-O-Tron not being able to harvest atmospheric LF
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
================
SPACE DUST 0.4.3
SPACE DUST 0.4.4
================

This is a KSP mod designed to overhaul the atmospheric and exospheric mining experience in KSP. It functions both as a framework, providing part modules and distributions to others, and an actual gameplay mod designed to provide a set of parts focused around atmospheric ISRU in the stock system.
Expand Down

0 comments on commit a5d59da

Please sign in to comment.