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

1.5.3 Hotfix #268

Merged
merged 4 commits into from
Oct 31, 2023
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 Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<SpaceWarpVersion>1.5.2</SpaceWarpVersion>
<SpaceWarpVersion>1.5.3</SpaceWarpVersion>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>SpaceWarp</RootNamespace>
<LangVersion>11</LangVersion>
Expand Down
19 changes: 19 additions & 0 deletions SpaceWarp.Core/Patching/ColorsPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using KSP.Game;
using KSP.Modules;
using KSP.OAB;
using KSP.Sim.impl;
using SpaceWarp.API.Assets;
using UnityEngine;

Expand Down Expand Up @@ -42,6 +43,24 @@ public static void Prefix(IObjectAssemblyAvailablePart obj, ref GameObject prefa
}
}

[HarmonyPrefix]
[HarmonyPatch(typeof(SimulationObjectView), nameof(SimulationObjectView.InitializeView))]
public static void UpdateColorsInFlight(GameObject instance)
{
foreach (var renderer in instance.GetComponentsInChildren<Renderer>())
{
var shaderName = renderer.material.shader.name;
if (shaderName is not ("Parts Replace" or "KSP2/Parts/Paintable")) continue;
Material material;
var mat = new Material(Shader.Find(Ksp2OpaquePath))
{
name = (material = renderer.material).name
};
mat.CopyPropertiesFromMaterial(material);
renderer.material = mat;
}
}

//Everything below this point will be removed in the next patch
private const int Diffuse = 0;
private const int Metallic = 1;
Expand Down
4 changes: 2 additions & 2 deletions SpaceWarp.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>SpaceWarp</id>
<version>1.5.2</version>
<version>1.5.3</version>
<authors>SpaceWarp contributors</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<licenseUrl>https://raw.githubusercontent.com/SpaceWarp/SpaceWarp/main/LICENSE</licenseUrl>
Expand All @@ -23,4 +23,4 @@
<file src="build\nuget_temp\*.dll" target="lib/netstandard2.1/" />
<file src="build\nuget_temp\*.xml" target="lib/netstandard2.1/" />
</files>
</package>
</package>
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.2",
"version": "1.5.3",
"dependencies": [
{
"id": "UitkForKsp2",
Expand Down