Skip to content

Commit

Permalink
Merge pull request #20 from ihsoft/next
Browse files Browse the repository at this point in the history
Release v1.12
  • Loading branch information
ihsoft authored Mar 9, 2019
2 parents b0078f0 + 5f966ca commit 895e005
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 26 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.12 (March 8th, 2019):
* [Fix #19] Compatibility with ReStock mod.

# 1.11 (January 12th, 2019):
* [Enhancement] Add Portuguese localization (PT_br).
* [Fix #16] Parts without bulkheadProfiles breaks KSP 1.6.
Expand Down
Binary file removed Deps/ModuleManager.3.1.3.dll
Binary file not shown.
Binary file added Deps/ModuleManager.4.0.2.dll
Binary file not shown.
18 changes: 17 additions & 1 deletion Patches/MM-StockLights.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@PART[spotLight1,spotLight2]:NEEDS[SurfaceLights]
// Stock parts need animation patching.
@PART[spotLight1,spotLight2]:NEEDS[!ReStock]
{
@MODULE[ModuleLight]
{
Expand All @@ -10,3 +11,18 @@
}
@tags ^= :^:cck-lights
}

// ReStock'ed parts can support colored lenses naturally.
// See: https://github.com/PorktoberRevolution/ReStocked
@PART[spotLight1,spotLight2]:NEEDS[ReStock]
{
@MODULE[ModuleLight]
{
@name = ModuleColoredLensLight
%lightR = 1.0
%lightG = 0.9
%lightB = 0.8
lensBrightness = 0.4
}
@tags ^= :^:cck-lights
}
19 changes: 6 additions & 13 deletions Source/ModuleColoredLensLight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// License: Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International.

using System;
using System.Linq;
using UnityEngine;

namespace SurfaceLights {
Expand Down Expand Up @@ -43,17 +44,6 @@ namespace SurfaceLights {
/// </example>
/// <seealso cref="lensBrightness"/>
public class ModuleColoredLensLight : ModuleLight {
/// <summary>Light's material.</summary>
protected Material lightMaterial {
get {
if (!_lightMaterial) {
_lightMaterial = part.FindModelComponent<Renderer>().material;
}
return _lightMaterial;
}
}
Material _lightMaterial;

/// <summary>Defines minimum white color level.</summary>
/// <remarks>See module remarks with regard to changing this value from as script.</remarks>
/// <seealso cref="ModuleColoredLensLight"/>
Expand All @@ -80,8 +70,11 @@ public override void OnAwake() {
/// Updates the emissive color of the material so that it matches the light color.
/// </summary>
public virtual void UpdateLightTextureColor() {
var newColor = GetLightTextureColor();
lightMaterial.SetColor("_EmissiveColor", newColor);
// By default, update all the emissive materials.
part.FindModelComponents<Renderer>()
.Where(r => r.material.HasProperty("_EmissiveColor"))
.ToList()
.ForEach(r => r.material.SetColor("_EmissiveColor", GetLightTextureColor()));
}

/// <summary>Returns a color to set on the emission texture.</summary>
Expand Down
14 changes: 12 additions & 2 deletions Source/ModuleStockLightColoredLens.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ namespace SurfaceLights {
/// parts ignores color settings and resets emissive color to default.
/// </summary>
public class ModuleStockLightColoredLens : ModuleColoredLensLight {

/// <summary>The model path for animation to adjust the emission color.</summary>
/// <remarks>
/// It's the model that contains the light's lens. It may change from model to model, but this
/// module was designed specifically for the game <i>stock</i> parts! So keep this string in sync
/// with the <i>stock</i> models.
/// </remarks>
/// <seealso cref="ReplaceLigthOnOffAnimation"/>
const string EmissiveLensModelPath = "";

/// <inheritdoc/>
public override void OnLoad(ConfigNode node) {
base.OnLoad(node);
Expand All @@ -32,9 +42,9 @@ void ReplaceLigthOnOffAnimation(Animation animation) {
Debug.LogFormat("Replacing animation clip in part {0} for {1}", part, animation.clip.name);
var clip = animation.clip;
clip.ClearCurves();
clip.SetCurve("", typeof(Material), "_EmissiveColor.a",
clip.SetCurve(EmissiveLensModelPath, typeof(Material), "_EmissiveColor.a",
AnimationCurve.EaseInOut(0, 0, 1.0f, 1.0f));
clip.SetCurve("spotlight", typeof(Light), "m_Intensity",
clip.SetCurve(lightName, typeof(Light), "m_Intensity",
AnimationCurve.EaseInOut(0, 0, 1.0f, 1.0f));
}
}
Expand Down
6 changes: 3 additions & 3 deletions Source/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion ("1.11.*")]
[assembly: AssemblyInformationalVersion ("1.11 for KSP v1.6+")]
[assembly: AssemblyVersion ("1.12.*")]
[assembly: AssemblyInformationalVersion ("1.12 for KSP v1.6+")]
[assembly: Guid ("a4d0ab40-75bd-44fb-80bc-f50c194faf4c")]
[assembly: KSPAssembly ("SurfaceLights", 1, 11)]
[assembly: KSPAssembly ("SurfaceLights", 1, 12)]
[assembly: AssemblyFlags (AssemblyNameFlags.PublicKey | AssemblyNameFlags.EnableJITcompileOptimizer)]
2 changes: 1 addition & 1 deletion Source/SurfaceLights.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>IF EXIST "Q:\GameData" xcopy "$(TargetPath)" "Q:\GameData\SurfaceLights\Plugins\" /Y</PostBuildEvent>
<PostBuildEvent>IF EXIST "Q:\GameData\SurfaceLights" xcopy "$(TargetDir)*.dll" "Q:\GameData\SurfaceLights\Plugins\" /Y</PostBuildEvent>
</PropertyGroup>
</Project>
6 changes: 3 additions & 3 deletions SurfaceLights.version
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"NAME": "Surface Mounted Lights",
"URL": "https://raw.githubusercontent.com/ihsoft/SurfaceLights/master/SurfaceLights.version",
"VERSION": {
"BUILD": 3656,
"BUILD": 42726,
"MAJOR": 1,
"MINOR": 11,
"PATCH": 6951
"MINOR": 12,
"PATCH": 7006
}
}
2 changes: 1 addition & 1 deletion Tools/publish_curseforge_args.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
--changelog=../CHANGELOG.md
--versions=latest_all_builds
--title=SurfaceLights {tag}
--archive=../SurfaceLights_v1.11.zip
--archive=../SurfaceLights_v1.12.zip
2 changes: 1 addition & 1 deletion Tools/publish_github_args.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
--changelog=../CHANGELOG.md
--as_draft
--title=SurfaceLights v{tag}
--archive=../SurfaceLights_v1.11.zip
--archive=../SurfaceLights_v1.12.zip
2 changes: 1 addition & 1 deletion Tools/publish_spacedock_args.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
--login=<<SECRET>>
--changelog=../CHANGELOG.md
--ksp_version=latest
--archive=../SurfaceLights_v1.11.zip
--archive=../SurfaceLights_v1.12.zip

0 comments on commit 895e005

Please sign in to comment.