Skip to content

Commit

Permalink
Merge pull request #268 from SpaceWarpDev/dev
Browse files Browse the repository at this point in the history
1.5.3 Hotfix
  • Loading branch information
cheese3660 authored Oct 31, 2023
2 parents c20ee9f + bee54bd commit cae3c14
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 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.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

0 comments on commit cae3c14

Please sign in to comment.