1.11 Light updates

This commit is contained in:
Chris
2021-01-06 22:11:53 -08:00
parent d345e4e0e9
commit 135a775aab
36 changed files with 497 additions and 103 deletions

View File

@ -0,0 +1,38 @@
using UnityEngine;
namespace Restock
{
public class ModuleRestockEnhancedLight: PartModule
{
// Path to the light cookie texture
[KSPField]
public string cookiePath;
ModuleLight[] lightModules;
Texture2D cookie;
public override void OnAwake()
{
base.OnAwake();
}
public override void OnStart(StartState state)
{
base.OnStart(state);
lightModules = base.GetComponentsInChildren<ModuleLight>();
cookie = GameDatabase.Instance.GetTexture(cookiePath, false);
cookie.wrapMode = TextureWrapMode.Clamp;
if (cookie == null) { this.LogError($"Couldn't find light cookie at {cookiePath}"); return; }
foreach (ModuleLight ml in lightModules)
{
foreach (Light l in ml.lights)
{
l.cookie = cookie;
}
}
}
}
}