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._exclusionSector = null;
|
||||
cloakFieldController._cloakSphereVolume = (sector?.transform ?? planetGO.transform).GetComponentInChildren<OWTriggerVolume>();
|
||||
|
||||
var cloakSectorController = newCloak.AddComponent<CloakSectorController>();
|
||||
cloakSectorController.Init(newCloak.GetComponent<CloakFieldController>(), planetGO);
|
||||
|
||||
@ -79,11 +79,10 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
Light ambientLight = ambientLightGO.GetComponent<Light>();
|
||||
|
||||
var sunLight = new GameObject();
|
||||
var sunLight = new GameObject("StarLight");
|
||||
sunLight.transform.parent = starGO.transform;
|
||||
sunLight.transform.localPosition = Vector3.zero;
|
||||
sunLight.transform.localScale = Vector3.one;
|
||||
sunLight.name = "StarLight";
|
||||
|
||||
var light = sunLight.AddComponent<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;
|
||||
|
||||
StarController starController = null;
|
||||
if (starModule.solarLuminosity != 0)
|
||||
if (starModule.solarLuminosity != 0 && starModule.hasStarController)
|
||||
{
|
||||
starController = planetGO.AddComponent<StarController>();
|
||||
starController.Light = light;
|
||||
@ -204,8 +203,8 @@ namespace NewHorizons.Builder.Body
|
||||
var colour = starModule.tint.ToColor();
|
||||
|
||||
var sun = GameObject.Find("Sun_Body");
|
||||
var mainSequenceMaterial = sun.GetComponent<SunController>().GetValue<Material>("_startSurfaceMaterial");
|
||||
var giantMaterial = sun.GetComponent<SunController>().GetValue<Material>("_endSurfaceMaterial");
|
||||
var mainSequenceMaterial = sun.GetComponent<SunController>()._startSurfaceMaterial;
|
||||
var giantMaterial = sun.GetComponent<SunController>()._endSurfaceMaterial;
|
||||
|
||||
surface.sharedMaterial = new Material(starModule.size >= 3000 ? giantMaterial : mainSequenceMaterial);
|
||||
var mod = Mathf.Max(1f, 2f * Mathf.Sqrt(starModule.solarLuminosity));
|
||||
|
||||
@ -51,7 +51,7 @@ namespace NewHorizons.Components.SizeControllers
|
||||
private float maxScale;
|
||||
private static readonly int ColorRamp = Shader.PropertyToID("_ColorRamp");
|
||||
|
||||
void Awake()
|
||||
void Start()
|
||||
{
|
||||
var sun = GameObject.FindObjectOfType<SunController>();
|
||||
_collapseStartSurfaceMaterial = new Material(sun._collapseStartSurfaceMaterial);
|
||||
@ -59,11 +59,13 @@ namespace NewHorizons.Components.SizeControllers
|
||||
_startSurfaceMaterial = new Material(sun._startSurfaceMaterial);
|
||||
_endSurfaceMaterial = new Material(sun._endSurfaceMaterial);
|
||||
|
||||
var supernovaSurfaceColorRamp = supernova._surface.sharedMaterial.GetTexture(ColorRamp);
|
||||
|
||||
// Copy over the material that was set in star builder
|
||||
_collapseStartSurfaceMaterial.SetTexture(ColorRamp, supernova._surface.sharedMaterial.GetTexture(ColorRamp));
|
||||
_collapseEndSurfaceMaterial.SetTexture(ColorRamp, supernova._surface.sharedMaterial.GetTexture(ColorRamp));
|
||||
_startSurfaceMaterial.SetTexture(ColorRamp, supernova._surface.sharedMaterial.GetTexture(ColorRamp));
|
||||
_endSurfaceMaterial.SetTexture(ColorRamp, supernova._surface.sharedMaterial.GetTexture(ColorRamp));
|
||||
_collapseStartSurfaceMaterial.SetTexture(ColorRamp, supernovaSurfaceColorRamp);
|
||||
_collapseEndSurfaceMaterial.SetTexture(ColorRamp, supernovaSurfaceColorRamp);
|
||||
_startSurfaceMaterial.SetTexture(ColorRamp, supernovaSurfaceColorRamp);
|
||||
_endSurfaceMaterial.SetTexture(ColorRamp, supernovaSurfaceColorRamp);
|
||||
|
||||
if (StartColour == null)
|
||||
{
|
||||
|
||||
@ -18,6 +18,11 @@ namespace NewHorizons.External.Modules.VariableSize
|
||||
/// </summary>
|
||||
[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>
|
||||
/// The default sun has its own atmosphere that is different from regular planets. If you want that, set this to
|
||||
/// `true`.
|
||||
|
||||
@ -175,7 +175,7 @@ namespace NewHorizons.Handlers
|
||||
// Deal with proxies
|
||||
foreach (var p in GameObject.FindObjectsOfType<ProxyOrbiter>())
|
||||
{
|
||||
if (p.GetValue<AstroObject>("_originalBody") == ao.gameObject)
|
||||
if (p._originalBody == ao.gameObject)
|
||||
{
|
||||
DisableBody(p.gameObject, true);
|
||||
break;
|
||||
|
||||
@ -12,21 +12,34 @@ namespace NewHorizons.Handlers
|
||||
public static int SUBTITLE_HEIGHT = 97;
|
||||
public static int SUBTITLE_WIDTH = 669; // nice
|
||||
|
||||
Graphic graphic;
|
||||
Image image;
|
||||
public Graphic graphic;
|
||||
public Image image;
|
||||
|
||||
public float fadeSpeed = 0.005f;
|
||||
float fade = 1;
|
||||
bool fadingAway = true;
|
||||
public float fade = 1;
|
||||
public bool fadingAway = true;
|
||||
|
||||
static List<Sprite> possibleSubtitles = new List<Sprite>();
|
||||
static bool eoteSubtitleHasBeenInserted = false;
|
||||
int subtitleIndex;
|
||||
public static List<Sprite> possibleSubtitles = new List<Sprite>();
|
||||
public static bool eoteSubtitleHasBeenInserted = false;
|
||||
public static Sprite eoteSprite;
|
||||
public int subtitleIndex;
|
||||
|
||||
System.Random randomizer;
|
||||
public System.Random randomizer;
|
||||
|
||||
static readonly int PAUSE_TIMER_MAX = 50;
|
||||
int pauseTimer = PAUSE_TIMER_MAX;
|
||||
public static readonly int PAUSE_TIMER_MAX = 50;
|
||||
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()
|
||||
{
|
||||
@ -39,13 +52,11 @@ namespace NewHorizons.Handlers
|
||||
graphic.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)
|
||||
{
|
||||
if (image.sprite != null) possibleSubtitles.Insert(0, image.sprite); // ensure that the Echoes of the Eye subtitle always appears first
|
||||
eoteSubtitleHasBeenInserted = true;
|
||||
}
|
||||
CheckForEOTE();
|
||||
|
||||
image.sprite = null; // Just in case. I don't know how not having the dlc changes the subtitle game object
|
||||
}
|
||||
|
||||
public static void AddSubtitle(IModBehaviour mod, string filepath)
|
||||
@ -67,6 +78,10 @@ namespace NewHorizons.Handlers
|
||||
|
||||
public void Update()
|
||||
{
|
||||
CheckForEOTE();
|
||||
|
||||
if (possibleSubtitles.Count == 0) return;
|
||||
|
||||
if (image.sprite == null) image.sprite = possibleSubtitles[0];
|
||||
|
||||
// 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.",
|
||||
"$ref": "#/definitions/MColor"
|
||||
},
|
||||
|
||||
"id": {
|
||||
"type": "string",
|
||||
"description": "The ID of the curiosity to apply the color to."
|
||||
@ -1703,6 +1704,11 @@
|
||||
"description": "Should this star explode after 22 minutes?",
|
||||
"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": {
|
||||
"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`.",
|
||||
|
||||
@ -49,11 +49,38 @@ namespace NewHorizons.Utility
|
||||
case ("ogg"):
|
||||
audioType = UnityEngine.AudioType.OGGVORBIS;
|
||||
break;
|
||||
case ("mp3"):
|
||||
audioType = UnityEngine.AudioType.MPEG;
|
||||
break;
|
||||
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;
|
||||
}
|
||||
|
||||
if (audioType == UnityEngine.AudioType.MPEG)
|
||||
{
|
||||
string fileProtocolPath = $"file://{filePath}";
|
||||
DownloadHandlerAudioClip dh = new DownloadHandlerAudioClip(fileProtocolPath, UnityEngine.AudioType.MPEG);
|
||||
dh.compressed = true;
|
||||
using (UnityWebRequest www = new UnityWebRequest(fileProtocolPath, "GET", dh, null))
|
||||
{
|
||||
var result = www.SendWebRequest();
|
||||
|
||||
while (!result.isDone) { await Task.Delay(100); }
|
||||
|
||||
if (www.isNetworkError)
|
||||
{
|
||||
Debug.Log(www.error);
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return dh.audioClip;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(filePath, audioType))
|
||||
{
|
||||
var result = www.SendWebRequest();
|
||||
@ -72,4 +99,5 @@ namespace NewHorizons.Utility
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using NewHorizons.Builder.Props;
|
||||
using NewHorizons.Builder.Props;
|
||||
using NewHorizons.External.Configs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -114,7 +114,7 @@ namespace NewHorizons.Utility.DebugUtilities
|
||||
prop.transform.localEulerAngles = alignToSurface;
|
||||
|
||||
// rotate facing dir towards player
|
||||
GameObject g = new GameObject();
|
||||
GameObject g = new GameObject("DebugProp");
|
||||
g.transform.parent = prop.transform.parent;
|
||||
g.transform.localPosition = prop.transform.localPosition;
|
||||
g.transform.localRotation = prop.transform.localRotation;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user