Water tint + bug fixes

Removed extra star atmosphere
This commit is contained in:
Nick J. Connors 2022-01-08 17:44:05 -05:00
parent 6398eec560
commit 5518297fec
10 changed files with 38 additions and 15 deletions

View File

@ -61,10 +61,12 @@ namespace NewHorizons.Builder.Body
sunAudio.name = "Audio_Star"; sunAudio.name = "Audio_Star";
/*
var sunAtmosphere = GameObject.Instantiate(GameObject.Find("Sun_Body/Atmosphere_SUN"), starGO.transform); var sunAtmosphere = GameObject.Instantiate(GameObject.Find("Sun_Body/Atmosphere_SUN"), starGO.transform);
sunAtmosphere.transform.localPosition = Vector3.zero; sunAtmosphere.transform.localPosition = Vector3.zero;
sunAtmosphere.transform.localScale = Vector3.one; sunAtmosphere.transform.localScale = Vector3.one;
sunAtmosphere.name = "Atmosphere_Star"; sunAtmosphere.name = "Atmosphere_Star";
*/
var ambientLightGO = GameObject.Instantiate(GameObject.Find("Sun_Body/AmbientLight_SUN"), starGO.transform); var ambientLightGO = GameObject.Instantiate(GameObject.Find("Sun_Body/AmbientLight_SUN"), starGO.transform);
ambientLightGO.transform.localPosition = Vector3.zero; ambientLightGO.transform.localPosition = Vector3.zero;
@ -82,7 +84,7 @@ namespace NewHorizons.Builder.Body
deathVolume.GetComponent<SphereCollider>().radius = 1f; deathVolume.GetComponent<SphereCollider>().radius = 1f;
deathVolume.name = "DestructionVolume"; deathVolume.name = "DestructionVolume";
PlanetaryFogController fog = sunAtmosphere.transform.Find("FogSphere").GetComponent<PlanetaryFogController>(); //PlanetaryFogController fog = sunAtmosphere.transform.Find("FogSphere").GetComponent<PlanetaryFogController>();
TessellatedSphereRenderer surface = sunSurface.GetComponent<TessellatedSphereRenderer>(); TessellatedSphereRenderer surface = sunSurface.GetComponent<TessellatedSphereRenderer>();
Light ambientLight = ambientLightGO.GetComponent<Light>(); Light ambientLight = ambientLightGO.GetComponent<Light>();
@ -101,12 +103,12 @@ namespace NewHorizons.Builder.Body
light.color = lightColour; light.color = lightColour;
ambientLight.color = lightColour; ambientLight.color = lightColour;
fog.fogRadius = starModule.Size * 1.2f; //fog.fogRadius = starModule.Size * 1.2f;
if(starModule.Tint != null) if(starModule.Tint != null)
{ {
var colour = starModule.Tint.ToColor32(); var colour = starModule.Tint.ToColor32();
//sunLightController.sunColor = colour; //sunLightController.sunColor = colour;
fog.fogTint = colour; //fog.fogTint = colour;
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>().GetValue<Material>("_startSurfaceMaterial");
@ -117,6 +119,7 @@ namespace NewHorizons.Builder.Body
surface.sharedMaterial.color = new Color(colour.r * mod, colour.g * mod, colour.b * mod); surface.sharedMaterial.color = new Color(colour.r * mod, colour.g * mod, colour.b * mod);
surface.sharedMaterial.SetTexture("_ColorRamp", ImageUtilities.TintImage(_colorOverTime, colour)); surface.sharedMaterial.SetTexture("_ColorRamp", ImageUtilities.TintImage(_colorOverTime, colour));
/*
sunAtmosphere.transform.Find("AtmoSphere").transform.localScale = Vector3.one * (starModule.Size + 1000)/starModule.Size; sunAtmosphere.transform.Find("AtmoSphere").transform.localScale = Vector3.one * (starModule.Size + 1000)/starModule.Size;
foreach (var lod in sunAtmosphere.transform.Find("AtmoSphere").GetComponentsInChildren<MeshRenderer>()) foreach (var lod in sunAtmosphere.transform.Find("AtmoSphere").GetComponentsInChildren<MeshRenderer>())
{ {
@ -124,6 +127,7 @@ namespace NewHorizons.Builder.Body
lod.material.SetFloat("_InnerRadius", starModule.Size); lod.material.SetFloat("_InnerRadius", starModule.Size);
lod.material.SetFloat("_OuterRadius", starModule.Size + 1000); lod.material.SetFloat("_OuterRadius", starModule.Size + 1000);
} }
*/
} }
if(starModule.SolarFlareTint != null) if(starModule.SolarFlareTint != null)

View File

@ -7,8 +7,10 @@ namespace NewHorizons.Builder.Body
{ {
static class WaterBuilder static class WaterBuilder
{ {
public static void Make(GameObject body, Sector sector, OWRigidbody rb, float waterSize) public static void Make(GameObject body, Sector sector, OWRigidbody rb, IPlanetConfig config)
{ {
var waterSize = config.Base.WaterSize;
GameObject waterGO = new GameObject("Water"); GameObject waterGO = new GameObject("Water");
waterGO.SetActive(false); waterGO.SetActive(false);
waterGO.layer = 15; waterGO.layer = 15;
@ -26,6 +28,10 @@ namespace NewHorizons.Builder.Body
for(int i = 0; i < GDSharedMaterials.Length; i++) for(int i = 0; i < GDSharedMaterials.Length; i++)
{ {
tempArray[i] = new Material(GDSharedMaterials[i]); tempArray[i] = new Material(GDSharedMaterials[i]);
if (config.Base.WaterTint != null)
{
tempArray[i].color = config.Base.WaterTint.ToColor32();
}
} }
// TODO: Make water module // TODO: Make water module
//tempArray[1].color = Color.red; //tempArray[1].color = Color.red;

View File

@ -139,6 +139,8 @@ namespace NewHorizons.Builder.General
audioSource.Stop(); audioSource.Stop();
GameObject.Destroy(audioSource); GameObject.Destroy(audioSource);
} }
GameObject.Find("SunProxy(Clone)/Sun_Proxy_Body").SetActive(false);
} }
else if(ao.GetAstroObjectName() == AstroObject.Name.DreamWorld) else if(ao.GetAstroObjectName() == AstroObject.Name.DreamWorld)
{ {

View File

@ -47,11 +47,12 @@ namespace NewHorizons.Builder.General
if(Main.IsWarping) if(Main.IsWarping)
{ {
Logger.Log("Overriding player spawn to be inside ship");
GameObject playerSpawnGO = new GameObject("PlayerSpawnPoint"); GameObject playerSpawnGO = new GameObject("PlayerSpawnPoint");
playerSpawnGO.transform.parent = ship.transform; playerSpawnGO.transform.parent = ship.transform;
playerSpawnGO.layer = 8; playerSpawnGO.layer = 8;
playerSpawnGO.transform.localPosition = Vector3.zero; playerSpawnGO.transform.localPosition = new Vector3(0, 0, 0);
playerSpawn = playerSpawnGO.AddComponent<SpawnPoint>(); playerSpawn = playerSpawnGO.AddComponent<SpawnPoint>();
playerSpawnGO.transform.localRotation = Quaternion.Euler(0,0,0); playerSpawnGO.transform.localRotation = Quaternion.Euler(0,0,0);

View File

@ -10,9 +10,16 @@ namespace NewHorizons.Components
{ {
public string TargetSolarSystem { get; set; } public string TargetSolarSystem { get; set; }
public override void Awake()
{
base.Awake();
_deathType = DeathType.Meditation;
}
public override void VanishPlayer(OWRigidbody playerBody, RelativeLocationData entryLocation) public override void VanishPlayer(OWRigidbody playerBody, RelativeLocationData entryLocation)
{ {
Main.Instance.ChangeCurrentStarSystem(TargetSolarSystem); //Main.Instance.ChangeCurrentStarSystem(TargetSolarSystem, PlayerState.AtFlightConsole());
Main.Instance.ChangeCurrentStarSystem(TargetSolarSystem, false);
} }
} }
} }

View File

@ -204,7 +204,6 @@ namespace NewHorizons.Components
if (oldIndex != _cardIndex) if (oldIndex != _cardIndex)
{ {
Logger.Log($"Moving to {_cardIndex}");
_oneShotSource.PlayOneShot(global::AudioType.ShipLogMoveBetweenPlanets, 1f); _oneShotSource.PlayOneShot(global::AudioType.ShipLogMoveBetweenPlanets, 1f);
_startPanTime = Time.unscaledTime; _startPanTime = Time.unscaledTime;
_startPanPos = _panRootPos; _startPanPos = _panRootPos;

View File

@ -16,6 +16,7 @@ namespace NewHorizons.External
public float SurfaceSize { get; set; } public float SurfaceSize { get; set; }
public float SphereOfInfluence { get; set; } public float SphereOfInfluence { get; set; }
public float WaterSize { get; set; } public float WaterSize { get; set; }
public MColor32 WaterTint { get; set; }
public float GroundSize { get; set; } public float GroundSize { get; set; }
public float LavaSize { get; set; } public float LavaSize { get; set; }
public bool HasCometTail { get; set; } public bool HasCometTail { get; set; }

View File

@ -191,9 +191,9 @@ namespace NewHorizons
Logger.Log("Done loading bodies"); Logger.Log("Done loading bodies");
// I don't know what these do but they look really weird from a distance // I don't know what these do but they look really weird from a distance
//Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => PlanetDestroyer.RemoveDistantProxyClones()); Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => PlanetDestroyer.RemoveDistantProxyClones());
if(!_currentStarSystem.Equals("SolarSystem")) Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => PlanetDestroyer.RemoveSolarSystem()); if(!_currentStarSystem.Equals("SolarSystem")) Instance.ModHelper.Events.Unity.FireInNUpdates(() => PlanetDestroyer.RemoveSolarSystem(), 2);
var map = GameObject.FindObjectOfType<MapController>(); var map = GameObject.FindObjectOfType<MapController>();
if (map != null) map._maxPanDistance = FurthestOrbit * 1.5f; if (map != null) map._maxPanDistance = FurthestOrbit * 1.5f;
@ -508,8 +508,9 @@ namespace NewHorizons
if (body.Config.Base.LavaSize != 0) if (body.Config.Base.LavaSize != 0)
LavaBuilder.Make(go, sector, rb, body.Config.Base.LavaSize); LavaBuilder.Make(go, sector, rb, body.Config.Base.LavaSize);
if (body.Config.Base.WaterSize != 0) if (body.Config.Base.WaterSize != 0)
WaterBuilder.Make(go, sector, rb, body.Config.Base.WaterSize); WaterBuilder.Make(go, sector, rb, body.Config);
if (body.Config.Atmosphere != null) if (body.Config.Atmosphere != null)
{ {
@ -547,12 +548,15 @@ namespace NewHorizons
#region Change star system #region Change star system
public void ChangeCurrentStarSystem(string newStarSystem, bool warp = false) public void ChangeCurrentStarSystem(string newStarSystem, bool warp = false)
{ {
_shipWarpController.WarpOut(); Logger.Log($"Warping to {newStarSystem}");
if(warp) _shipWarpController.WarpOut();
_currentStarSystem = newStarSystem; _currentStarSystem = newStarSystem;
_isChangingStarSystem = true; _isChangingStarSystem = true;
_isWarping = warp; _isWarping = warp;
// If the player isn't in the ship we kill them so they don't move as much
if(!warp) Locator.GetDeathManager().KillPlayer(DeathType.Meditation); // We kill them so they don't move as much
Locator.GetDeathManager().KillPlayer(DeathType.Meditation);
LoadManager.LoadSceneAsync(OWScene.SolarSystem, true, LoadManager.FadeType.ToBlack, 0.1f, true); LoadManager.LoadSceneAsync(OWScene.SolarSystem, true, LoadManager.FadeType.ToBlack, 0.1f, true);
} }

View File

@ -359,7 +359,6 @@ namespace NewHorizons.Utility
{ {
ShipLogMode currentMode = __instance._currentMode; ShipLogMode currentMode = __instance._currentMode;
string focusedEntryID = currentMode.GetFocusedEntryID(); string focusedEntryID = currentMode.GetFocusedEntryID();
Logger.Log($"[{focusedEntryID}]");
if (!focusedEntryID.Equals("")) return true; if (!focusedEntryID.Equals("")) return true;
bool flag = currentMode.Equals(__instance._mapMode); bool flag = currentMode.Equals(__instance._mapMode);
__instance._currentMode = (flag ? __instance._detectiveMode : __instance._mapMode); __instance._currentMode = (flag ? __instance._detectiveMode : __instance._mapMode);

View File

@ -3,7 +3,7 @@
"author": "xen", "author": "xen",
"name": "New Horizons", "name": "New Horizons",
"uniqueName": "xen.NewHorizons", "uniqueName": "xen.NewHorizons",
"version": "0.6.0", "version": "0.6.1",
"owmlVersion": "2.1.0", "owmlVersion": "2.1.0",
"dependencies": [ "PacificEngine.OW_CommonResources" ] "dependencies": [ "PacificEngine.OW_CommonResources" ]
} }