Skip to content

Commit

Permalink
Merge pull request #264 from SpaceWarpDev/dev
Browse files Browse the repository at this point in the history
Dev -> Main for 1.5.1 fix
  • Loading branch information
cheese3660 authored Oct 12, 2023
2 parents 3b65493 + 463a4f6 commit 693451a
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<SpaceWarpVersion>1.5.0</SpaceWarpVersion>
<SpaceWarpVersion>1.5.1</SpaceWarpVersion>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>SpaceWarp</RootNamespace>
<LangVersion>11</LangVersion>
Expand Down
1 change: 1 addition & 0 deletions SpaceWarp.Core/API/Mods/JSON/SpecVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public SpecVersion(string version = null)
public static bool operator <=(SpecVersion a, SpecVersion b) => Compare(a, b) <= 0;
public static bool operator >=(SpecVersion a, SpecVersion b) => Compare(a, b) >= 0;


private static int Compare(SpecVersion a, SpecVersion b)
{
if (a.Major != b.Major)
Expand Down
1 change: 1 addition & 0 deletions SpaceWarp.Core/API/Mods/PluginList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public static void Disable(string guid)

public static SpaceWarpErrorDescription GetErrorDescriptor(SpaceWarpPluginDescriptor plugin)
{

if (_allErroredPlugins.Any(x => x.Plugin == plugin))
{
return _allErroredPlugins.First(x => x.Plugin == plugin);
Expand Down
10 changes: 7 additions & 3 deletions SpaceWarp.Core/Backend/Modding/PluginRegister.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,10 @@ ModInfo metadata
private static string ClearPrerelease(string version)
{
var semver = new SemanticVersion(version);
return $"{semver.Major}.{semver.Minor}.{semver.Patch}{(semver.VersionNumbers.Count > 3 ? $".{semver.VersionNumbers[3]}" : "")}";
return
$"{semver.Major}.{semver.Minor}.{semver.Patch}{(semver.VersionNumbers.Count > 3 ? $".{semver.VersionNumbers[3]}" : "")}";
}

private static bool AssertMatchingVersions(
SpaceWarpPluginDescriptor descriptor,
BaseUnityPlugin plugin,
Expand Down Expand Up @@ -460,7 +461,10 @@ private static void RegisterAllErroredMods()
{
info.Location = plugin.Key;
if (PluginList.AllPlugins.Any(
x => string.Equals(x.Guid, info.Metadata.GUID, StringComparison.InvariantCultureIgnoreCase)
x => string.Equals(x.Guid, info.Metadata.GUID, StringComparison.InvariantCultureIgnoreCase) ||
(x.Plugin is BaseUnityPlugin baseUnityPlugin && string.Equals(
baseUnityPlugin.Info.Metadata.GUID, info.Metadata.GUID,
StringComparison.InvariantCultureIgnoreCase))
)) continue;

var descriptor = new SpaceWarpPluginDescriptor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ string filename
if (assetBundle == null)
{
throw new Exception(
$"Failed to load AssetBundle {internalPath}");
$"Failed to load AssetBundle {internalPath} ({filename})");
}

internalPath = internalPath.Replace(".bundle", "");
Expand Down
3 changes: 2 additions & 1 deletion SpaceWarp.Core/SpaceWarpPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public sealed class SpaceWarpPlugin : BaseSpaceWarpPlugin

public SpaceWarpPlugin()
{
// Load the type forwarders
Assembly.LoadFile(
$"{new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName}\\SpaceWarp.dll");
Logger = base.Logger;
Expand All @@ -59,6 +60,7 @@ private static void OnLanguageSourceAssetLoaded(LanguageSourceAsset asset)
}
public void Awake()
{
BepInEx.Bootstrap.Chainloader.ManagerObject.Persist();
IOProvider.Init();

Harmony.CreateAndPatchAll(typeof(SpaceWarpPlugin).Assembly, ModGuid);
Expand Down Expand Up @@ -98,7 +100,6 @@ private void SetupLuaState()
public override void OnPreInitialized()
{
// Persist all game objects so I don't need to stomp on config
BepInEx.Bootstrap.Chainloader.ManagerObject.Persist();
ModuleManager.PreInitializeAllModules();
}

Expand Down
12 changes: 11 additions & 1 deletion SpaceWarp.VersionChecking/Modules/VersionChecking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,16 @@ private IEnumerator CheckVersion(string guid, SpaceWarpPluginDescriptor info)
{
ModuleLogger.LogError($"Unable to check version for {guid} due to error {e}");
}

info.Outdated = isOutdated;
info.Unsupported = unsupported;
if (isOutdated)
{
ModuleLogger.LogWarning($"{guid} is outdated");
}
if (unsupported)
{
ModuleLogger.LogWarning($"{guid} is unsupported");
info.SWInfo.SupportedKsp2Versions = newKSP2Versions;
}
}
Expand Down Expand Up @@ -206,6 +211,11 @@ private void CheckModKspVersion(string guid, SpaceWarpPluginDescriptor info, str
ModuleLogger.LogError($"Unable to check KSP version for {guid} due to error {e}");
}

if (unsupported)
{
ModuleLogger.LogWarning($"{guid} is unsupported");
}

info.Unsupported = info.Unsupported || unsupported;
}
}
2 changes: 1 addition & 1 deletion SpaceWarpBuildTemplate/swinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"description": "Space-Warp is an API for KSP2 mod developers.",
"source": "https://github.com/SpaceWarpDev/SpaceWarp",
"version_check": "https://raw.githubusercontent.com/SpaceWarpDev/SpaceWarp/main/SpaceWarpBuildTemplate/swinfo.json",
"version": "1.5.0",
"version": "1.5.1",
"dependencies": [
{
"id": "UitkForKsp2",
Expand Down

0 comments on commit 693451a

Please sign in to comment.