mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Merge pull request #159 from MegaPiggy/adaptation
Miscellaneous fixes and additions
This commit is contained in:
commit
99a8a5515f
@ -24,6 +24,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
|
|
||||||
cloakFieldController._referenceFrameVolume = OWRB._attachedRFVolume;
|
cloakFieldController._referenceFrameVolume = OWRB._attachedRFVolume;
|
||||||
cloakFieldController._exclusionSector = null;
|
cloakFieldController._exclusionSector = null;
|
||||||
|
cloakFieldController._cloakSphereVolume = (sector?.transform ?? planetGO.transform).GetComponentInChildren<OWTriggerVolume>();
|
||||||
|
|
||||||
var cloakSectorController = newCloak.AddComponent<CloakSectorController>();
|
var cloakSectorController = newCloak.AddComponent<CloakSectorController>();
|
||||||
cloakSectorController.Init(newCloak.GetComponent<CloakFieldController>(), planetGO);
|
cloakSectorController.Init(newCloak.GetComponent<CloakFieldController>(), planetGO);
|
||||||
|
|||||||
@ -79,11 +79,10 @@ namespace NewHorizons.Builder.Body
|
|||||||
|
|
||||||
Light ambientLight = ambientLightGO.GetComponent<Light>();
|
Light ambientLight = ambientLightGO.GetComponent<Light>();
|
||||||
|
|
||||||
var sunLight = new GameObject();
|
var sunLight = new GameObject("StarLight");
|
||||||
sunLight.transform.parent = starGO.transform;
|
sunLight.transform.parent = starGO.transform;
|
||||||
sunLight.transform.localPosition = Vector3.zero;
|
sunLight.transform.localPosition = Vector3.zero;
|
||||||
sunLight.transform.localScale = Vector3.one;
|
sunLight.transform.localScale = Vector3.one;
|
||||||
sunLight.name = "StarLight";
|
|
||||||
|
|
||||||
var light = sunLight.AddComponent<Light>();
|
var light = sunLight.AddComponent<Light>();
|
||||||
light.CopyPropertiesFrom(GameObject.Find("Sun_Body/Sector_SUN/Effects_SUN/SunLight").GetComponent<Light>());
|
light.CopyPropertiesFrom(GameObject.Find("Sun_Body/Sector_SUN/Effects_SUN/SunLight").GetComponent<Light>());
|
||||||
@ -106,7 +105,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
proxyShadowLight._light = light;
|
proxyShadowLight._light = light;
|
||||||
|
|
||||||
StarController starController = null;
|
StarController starController = null;
|
||||||
if (starModule.solarLuminosity != 0)
|
if (starModule.solarLuminosity != 0 && starModule.hasStarController)
|
||||||
{
|
{
|
||||||
starController = planetGO.AddComponent<StarController>();
|
starController = planetGO.AddComponent<StarController>();
|
||||||
starController.Light = light;
|
starController.Light = light;
|
||||||
@ -204,8 +203,8 @@ namespace NewHorizons.Builder.Body
|
|||||||
var colour = starModule.tint.ToColor();
|
var colour = starModule.tint.ToColor();
|
||||||
|
|
||||||
var sun = GameObject.Find("Sun_Body");
|
var sun = GameObject.Find("Sun_Body");
|
||||||
var mainSequenceMaterial = sun.GetComponent<SunController>().GetValue<Material>("_startSurfaceMaterial");
|
var mainSequenceMaterial = sun.GetComponent<SunController>()._startSurfaceMaterial;
|
||||||
var giantMaterial = sun.GetComponent<SunController>().GetValue<Material>("_endSurfaceMaterial");
|
var giantMaterial = sun.GetComponent<SunController>()._endSurfaceMaterial;
|
||||||
|
|
||||||
surface.sharedMaterial = new Material(starModule.size >= 3000 ? giantMaterial : mainSequenceMaterial);
|
surface.sharedMaterial = new Material(starModule.size >= 3000 ? giantMaterial : mainSequenceMaterial);
|
||||||
var mod = Mathf.Max(1f, 2f * Mathf.Sqrt(starModule.solarLuminosity));
|
var mod = Mathf.Max(1f, 2f * Mathf.Sqrt(starModule.solarLuminosity));
|
||||||
|
|||||||
@ -51,7 +51,7 @@ namespace NewHorizons.Components.SizeControllers
|
|||||||
private float maxScale;
|
private float maxScale;
|
||||||
private static readonly int ColorRamp = Shader.PropertyToID("_ColorRamp");
|
private static readonly int ColorRamp = Shader.PropertyToID("_ColorRamp");
|
||||||
|
|
||||||
void Awake()
|
void Start()
|
||||||
{
|
{
|
||||||
var sun = GameObject.FindObjectOfType<SunController>();
|
var sun = GameObject.FindObjectOfType<SunController>();
|
||||||
_collapseStartSurfaceMaterial = new Material(sun._collapseStartSurfaceMaterial);
|
_collapseStartSurfaceMaterial = new Material(sun._collapseStartSurfaceMaterial);
|
||||||
@ -59,11 +59,13 @@ namespace NewHorizons.Components.SizeControllers
|
|||||||
_startSurfaceMaterial = new Material(sun._startSurfaceMaterial);
|
_startSurfaceMaterial = new Material(sun._startSurfaceMaterial);
|
||||||
_endSurfaceMaterial = new Material(sun._endSurfaceMaterial);
|
_endSurfaceMaterial = new Material(sun._endSurfaceMaterial);
|
||||||
|
|
||||||
|
var supernovaSurfaceColorRamp = supernova._surface.sharedMaterial.GetTexture(ColorRamp);
|
||||||
|
|
||||||
// Copy over the material that was set in star builder
|
// Copy over the material that was set in star builder
|
||||||
_collapseStartSurfaceMaterial.SetTexture(ColorRamp, supernova._surface.sharedMaterial.GetTexture(ColorRamp));
|
_collapseStartSurfaceMaterial.SetTexture(ColorRamp, supernovaSurfaceColorRamp);
|
||||||
_collapseEndSurfaceMaterial.SetTexture(ColorRamp, supernova._surface.sharedMaterial.GetTexture(ColorRamp));
|
_collapseEndSurfaceMaterial.SetTexture(ColorRamp, supernovaSurfaceColorRamp);
|
||||||
_startSurfaceMaterial.SetTexture(ColorRamp, supernova._surface.sharedMaterial.GetTexture(ColorRamp));
|
_startSurfaceMaterial.SetTexture(ColorRamp, supernovaSurfaceColorRamp);
|
||||||
_endSurfaceMaterial.SetTexture(ColorRamp, supernova._surface.sharedMaterial.GetTexture(ColorRamp));
|
_endSurfaceMaterial.SetTexture(ColorRamp, supernovaSurfaceColorRamp);
|
||||||
|
|
||||||
if (StartColour == null)
|
if (StartColour == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -18,6 +18,11 @@ namespace NewHorizons.External.Modules.VariableSize
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultValue(true)] public bool goSupernova = true;
|
[DefaultValue(true)] public bool goSupernova = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Should we add a star controller to this body? If you want clouds to work on a binary brown dwarf system, set this to false.
|
||||||
|
/// </summary>
|
||||||
|
[DefaultValue(true)] public bool hasStarController = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The default sun has its own atmosphere that is different from regular planets. If you want that, set this to
|
/// The default sun has its own atmosphere that is different from regular planets. If you want that, set this to
|
||||||
/// `true`.
|
/// `true`.
|
||||||
|
|||||||
@ -175,7 +175,7 @@ namespace NewHorizons.Handlers
|
|||||||
// Deal with proxies
|
// Deal with proxies
|
||||||
foreach (var p in GameObject.FindObjectsOfType<ProxyOrbiter>())
|
foreach (var p in GameObject.FindObjectsOfType<ProxyOrbiter>())
|
||||||
{
|
{
|
||||||
if (p.GetValue<AstroObject>("_originalBody") == ao.gameObject)
|
if (p._originalBody == ao.gameObject)
|
||||||
{
|
{
|
||||||
DisableBody(p.gameObject, true);
|
DisableBody(p.gameObject, true);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -12,21 +12,34 @@ namespace NewHorizons.Handlers
|
|||||||
public static int SUBTITLE_HEIGHT = 97;
|
public static int SUBTITLE_HEIGHT = 97;
|
||||||
public static int SUBTITLE_WIDTH = 669; // nice
|
public static int SUBTITLE_WIDTH = 669; // nice
|
||||||
|
|
||||||
Graphic graphic;
|
public Graphic graphic;
|
||||||
Image image;
|
public Image image;
|
||||||
|
|
||||||
public float fadeSpeed = 0.005f;
|
public float fadeSpeed = 0.005f;
|
||||||
float fade = 1;
|
public float fade = 1;
|
||||||
bool fadingAway = true;
|
public bool fadingAway = true;
|
||||||
|
|
||||||
static List<Sprite> possibleSubtitles = new List<Sprite>();
|
public static List<Sprite> possibleSubtitles = new List<Sprite>();
|
||||||
static bool eoteSubtitleHasBeenInserted = false;
|
public static bool eoteSubtitleHasBeenInserted = false;
|
||||||
int subtitleIndex;
|
public static Sprite eoteSprite;
|
||||||
|
public int subtitleIndex;
|
||||||
|
|
||||||
System.Random randomizer;
|
public System.Random randomizer;
|
||||||
|
|
||||||
static readonly int PAUSE_TIMER_MAX = 50;
|
public static readonly int PAUSE_TIMER_MAX = 50;
|
||||||
int pauseTimer = PAUSE_TIMER_MAX;
|
public int pauseTimer = PAUSE_TIMER_MAX;
|
||||||
|
|
||||||
|
public static void CheckForEOTE()
|
||||||
|
{
|
||||||
|
if (!eoteSubtitleHasBeenInserted)
|
||||||
|
{
|
||||||
|
if (Main.HasDLC)
|
||||||
|
{
|
||||||
|
if (eoteSprite != null) possibleSubtitles.Insert(0, eoteSprite); // ensure that the Echoes of the Eye subtitle always appears first
|
||||||
|
eoteSubtitleHasBeenInserted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
@ -39,13 +52,11 @@ namespace NewHorizons.Handlers
|
|||||||
graphic.enabled = true;
|
graphic.enabled = true;
|
||||||
image.enabled = true;
|
image.enabled = true;
|
||||||
|
|
||||||
if (!Main.HasDLC) image.sprite = null; // Just in case. I don't know how not having the dlc changes the subtitle game object
|
eoteSprite = image.sprite;
|
||||||
|
|
||||||
if (!eoteSubtitleHasBeenInserted)
|
CheckForEOTE();
|
||||||
{
|
|
||||||
if (image.sprite != null) possibleSubtitles.Insert(0, image.sprite); // ensure that the Echoes of the Eye subtitle always appears first
|
image.sprite = null; // Just in case. I don't know how not having the dlc changes the subtitle game object
|
||||||
eoteSubtitleHasBeenInserted = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddSubtitle(IModBehaviour mod, string filepath)
|
public static void AddSubtitle(IModBehaviour mod, string filepath)
|
||||||
@ -67,6 +78,10 @@ namespace NewHorizons.Handlers
|
|||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
|
CheckForEOTE();
|
||||||
|
|
||||||
|
if (possibleSubtitles.Count == 0) return;
|
||||||
|
|
||||||
if (image.sprite == null) image.sprite = possibleSubtitles[0];
|
if (image.sprite == null) image.sprite = possibleSubtitles[0];
|
||||||
|
|
||||||
// don't fade transition subtitles if there's only one subtitle
|
// don't fade transition subtitles if there's only one subtitle
|
||||||
|
|||||||
@ -1434,6 +1434,7 @@
|
|||||||
"description": "The color to apply to highlighted entries with this curiosity.",
|
"description": "The color to apply to highlighted entries with this curiosity.",
|
||||||
"$ref": "#/definitions/MColor"
|
"$ref": "#/definitions/MColor"
|
||||||
},
|
},
|
||||||
|
|
||||||
"id": {
|
"id": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The ID of the curiosity to apply the color to."
|
"description": "The ID of the curiosity to apply the color to."
|
||||||
@ -1703,6 +1704,11 @@
|
|||||||
"description": "Should this star explode after 22 minutes?",
|
"description": "Should this star explode after 22 minutes?",
|
||||||
"default": true
|
"default": true
|
||||||
},
|
},
|
||||||
|
"hasStarController": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Should we add a star controller to this body? If you want clouds to work on a binary brown dwarf system, set this to false.",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
"hasAtmosphere": {
|
"hasAtmosphere": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "The default sun has its own atmosphere that is different from regular planets. If you want that, set this to\n`true`.",
|
"description": "The default sun has its own atmosphere that is different from regular planets. If you want that, set this to\n`true`.",
|
||||||
|
|||||||
@ -49,25 +49,53 @@ namespace NewHorizons.Utility
|
|||||||
case ("ogg"):
|
case ("ogg"):
|
||||||
audioType = UnityEngine.AudioType.OGGVORBIS;
|
audioType = UnityEngine.AudioType.OGGVORBIS;
|
||||||
break;
|
break;
|
||||||
|
case ("mp3"):
|
||||||
|
audioType = UnityEngine.AudioType.MPEG;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Logger.LogError($"Invalid audio file extension ({extension}) must be .wav or .ogg");
|
Logger.LogError($"Invalid audio file extension ({extension}) must be .wav or .ogg or .mp3");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(filePath, audioType))
|
if (audioType == UnityEngine.AudioType.MPEG)
|
||||||
{
|
{
|
||||||
var result = www.SendWebRequest();
|
string fileProtocolPath = $"file://{filePath}";
|
||||||
|
DownloadHandlerAudioClip dh = new DownloadHandlerAudioClip(fileProtocolPath, UnityEngine.AudioType.MPEG);
|
||||||
while (!result.isDone) { await Task.Delay(100); }
|
dh.compressed = true;
|
||||||
|
using (UnityWebRequest www = new UnityWebRequest(fileProtocolPath, "GET", dh, null))
|
||||||
if (www.isNetworkError)
|
|
||||||
{
|
{
|
||||||
Debug.Log(www.error);
|
var result = www.SendWebRequest();
|
||||||
return null;
|
|
||||||
|
while (!result.isDone) { await Task.Delay(100); }
|
||||||
|
|
||||||
|
if (www.isNetworkError)
|
||||||
|
{
|
||||||
|
Debug.Log(www.error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return dh.audioClip;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(filePath, audioType))
|
||||||
{
|
{
|
||||||
return DownloadHandlerAudioClip.GetContent(www);
|
var result = www.SendWebRequest();
|
||||||
|
|
||||||
|
while (!result.isDone) { await Task.Delay(100); }
|
||||||
|
|
||||||
|
if (www.isNetworkError)
|
||||||
|
{
|
||||||
|
Debug.Log(www.error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return DownloadHandlerAudioClip.GetContent(www);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
using NewHorizons.Builder.Props;
|
using NewHorizons.Builder.Props;
|
||||||
using NewHorizons.External.Configs;
|
using NewHorizons.External.Configs;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -114,7 +114,7 @@ namespace NewHorizons.Utility.DebugUtilities
|
|||||||
prop.transform.localEulerAngles = alignToSurface;
|
prop.transform.localEulerAngles = alignToSurface;
|
||||||
|
|
||||||
// rotate facing dir towards player
|
// rotate facing dir towards player
|
||||||
GameObject g = new GameObject();
|
GameObject g = new GameObject("DebugProp");
|
||||||
g.transform.parent = prop.transform.parent;
|
g.transform.parent = prop.transform.parent;
|
||||||
g.transform.localPosition = prop.transform.localPosition;
|
g.transform.localPosition = prop.transform.localPosition;
|
||||||
g.transform.localRotation = prop.transform.localRotation;
|
g.transform.localRotation = prop.transform.localRotation;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user