Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.15.0.1 Hotfix for KnownTech.Analyze null ref exception with custom scannables #290

Merged
merged 3 commits into from
Dec 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Example mod/Mod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private const string
MODNAME = "SMLHelper",
AUTHOR = "The SMLHelper Dev Team",
GUID = "SMLHelperExampleMod",
VERSION = "2.15.0.0";
VERSION = "2.15.0.1";

internal static ManualLogSource LogSource { get; private set; }

Expand Down
5 changes: 4 additions & 1 deletion SMLHelper/Handlers/KnownTechHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ internal void AddAnalysisTech(TechType techTypeToBeAnalysed, IEnumerable<TechTyp
unlockMessage = UnlockMessage,
unlockSound = UnlockSound,
unlockPopup = UnlockSprite,
unlockTechTypes = new List<TechType>(techTypesToUnlock)
unlockTechTypes = new List<TechType>(techTypesToUnlock),
//Secondary fix for null ref exception caused by Subnautica 2.0 moving story goal initialization
//Maybe one day we expand this to actually be able to add list of StoryGoals from mods or base game???
storyGoals = new()
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion SMLHelper/Initializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class Initializer: BaseUnityPlugin
private const string
MODNAME = "SMLHelper",
GUID = "com.ahk1221.smlhelper",
VERSION = "2.15.0.0";
VERSION = "2.15.0.1";

internal static readonly Harmony harmony = new Harmony(GUID);

Expand Down
11 changes: 6 additions & 5 deletions SMLHelper/Patchers/KnownTechPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ internal static void InitializePostfix()
}
}

foreach (KnownTech.AnalysisTech tech in techToAdd)
List<KnownTech.AnalysisTech> validatedTechsToAdd = KnownTech.ValidateAnalysisTech(new(techToAdd));
foreach (KnownTech.AnalysisTech tech in validatedTechsToAdd)
{
if (tech == null)
continue;
Expand All @@ -86,18 +87,18 @@ internal static void InitializePostfix()
analysisTech.Add(tech);
}

List<KnownTech.CompoundTech> compoundTech = KnownTech.compoundTech;
foreach (KnownTech.CompoundTech customTech in CompoundTech.Values)
List <KnownTech.CompoundTech> validatedCompoundTeches = KnownTech.ValidateCompoundTech(new(CompoundTech.Values));
foreach (KnownTech.CompoundTech customTech in validatedCompoundTeches)
{
if (customTech == null) // Safety check
continue;

// Only add the new compound tech if it isn't unlocked yet
if (!KnownTech.Contains(customTech.techType))
compoundTech.Add(customTech);
KnownTech.compoundTech.Add(customTech);

// If a compound tech already exists, set the dependencies correctly.
var foundTech = compoundTech.Find(tech => tech.techType == customTech.techType);
var foundTech = KnownTech.compoundTech.Find(tech => tech.techType == customTech.techType);
if (foundTech != null)
foundTech.dependencies = customTech.dependencies;
}
Expand Down
2 changes: 1 addition & 1 deletion SMLHelper/ThunderstoreMetadata/BZ.EXP/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SMLHelper_BZ_Experimental",
"version_number": "2.15.0000",
"version_number": "2.15.0001",
"website_url": "https://github.com/SubnauticaModding/SMLHelper/wiki",
"description": "SMLHelper is a modding library that helps making mods easier by helping with adding new items, changing items, adding models, sprites, etc.",
"dependencies": [ "Subnautica_Modding-BepInExPack-5.4.2101" ]
Expand Down
2 changes: 1 addition & 1 deletion SMLHelper/ThunderstoreMetadata/BZ.STABLE/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SMLHelper_BZ",
"version_number": "2.15.0000",
"version_number": "2.15.0001",
"website_url": "https://github.com/SubnauticaModding/SMLHelper/wiki",
"description": "SMLHelper is a modding library that helps making mods easier by helping with adding new items, changing items, adding models, sprites, etc.",
"dependencies": [ "Subnautica_Modding-BepInExPack-5.4.2101" ]
Expand Down
2 changes: 1 addition & 1 deletion SMLHelper/ThunderstoreMetadata/SN.EXP/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SMLHelper_Experimental",
"version_number": "2.15.0000",
"version_number": "2.15.0001",
"website_url": "https://github.com/SubnauticaModding/SMLHelper/wiki",
"description": "SMLHelper is a modding library that helps making mods easier by helping with adding new items, changing items, adding models, sprites, etc.",
"dependencies": [ "Subnautica_Modding-BepInExPack-5.4.2101" ]
Expand Down
2 changes: 1 addition & 1 deletion SMLHelper/ThunderstoreMetadata/SN.STABLE/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SMLHelper",
"version_number": "2.15.0000",
"version_number": "2.15.0001",
"website_url": "https://github.com/SubnauticaModding/SMLHelper/wiki",
"description": "SMLHelper is a modding library that helps making mods easier by helping with adding new items, changing items, adding models, sprites, etc.",
"dependencies": [ "Subnautica_Modding-BepInExPack-5.4.2101" ]
Expand Down
2 changes: 1 addition & 1 deletion Version.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- The assembly uses this version number. !-->
<Version>2.15.0</Version>
<Version>2.15.0.1</Version>
</PropertyGroup>
</Project>