mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Share function
This commit is contained in:
parent
7e728b4a56
commit
6539260f14
@ -85,19 +85,7 @@ namespace NewHorizons.Builder.Atmosphere
|
|||||||
fluidCLFV._layer = 5;
|
fluidCLFV._layer = 5;
|
||||||
fluidCLFV._priority = 1;
|
fluidCLFV._priority = 1;
|
||||||
fluidCLFV._density = 1.2f;
|
fluidCLFV._density = 1.2f;
|
||||||
|
fluidCLFV._fluidType = atmo.clouds.fluidType.ConvertToOW(FluidVolume.Type.CLOUD);
|
||||||
var fluidType = FluidVolume.Type.CLOUD;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
fluidType = (FluidVolume.Type)Enum.Parse(typeof(FluidVolume.Type), Enum.GetName(typeof(FluidType), atmo.clouds.fluidType).ToUpper());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger.LogError($"Couldn't parse fluid volume type [{atmo.clouds.fluidType}]:\n{ex}");
|
|
||||||
}
|
|
||||||
|
|
||||||
fluidCLFV._fluidType = fluidType;
|
|
||||||
fluidCLFV._allowShipAutoroll = true;
|
fluidCLFV._allowShipAutoroll = true;
|
||||||
fluidCLFV._disableOnStart = false;
|
fluidCLFV._disableOnStart = false;
|
||||||
|
|
||||||
|
|||||||
@ -46,18 +46,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
trigger._shape = ringShape;
|
trigger._shape = ringShape;
|
||||||
|
|
||||||
var sfv = ringVolume.AddComponent<RingFluidVolume>();
|
var sfv = ringVolume.AddComponent<RingFluidVolume>();
|
||||||
var fluidType = FluidVolume.Type.NONE;
|
sfv._fluidType = ring.fluidType.ConvertToOW();
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
fluidType = (FluidVolume.Type)Enum.Parse(typeof(FluidVolume.Type), Enum.GetName(typeof(FluidType), ring.fluidType).ToUpper());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger.LogError($"Couldn't parse fluid volume type [{ring.fluidType}]:\n{ex}");
|
|
||||||
}
|
|
||||||
|
|
||||||
sfv._fluidType = fluidType;
|
|
||||||
sfv._density = 5f;
|
sfv._density = 5f;
|
||||||
|
|
||||||
ringVolume.SetActive(true);
|
ringVolume.SetActive(true);
|
||||||
|
|||||||
@ -143,20 +143,9 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
tornadoGO.GetComponentInChildren<CapsuleShape>().enabled = true;
|
tornadoGO.GetComponentInChildren<CapsuleShape>().enabled = true;
|
||||||
|
|
||||||
var fluidType = FluidVolume.Type.CLOUD;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
fluidType = (FluidVolume.Type)Enum.Parse(typeof(FluidVolume.Type), Enum.GetName(typeof(FluidType), info.fluidType).ToUpper());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger.LogError($"Couldn't parse fluid volume type [{info.fluidType}]:\n{ex}");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resize it so the force volume goes all the way up
|
// Resize it so the force volume goes all the way up
|
||||||
var fluidGO = tornadoGO.transform.Find(downwards ? "MockDownTornado_FluidCenter" : "MockUpTornado_FluidCenter");
|
var fluidGO = tornadoGO.transform.Find(downwards ? "MockDownTornado_FluidCenter" : "MockUpTornado_FluidCenter");
|
||||||
fluidGO.GetComponent<TornadoFluidVolume>()._fluidType = fluidType;
|
fluidGO.GetComponent<TornadoFluidVolume>()._fluidType = info.fluidType.ConvertToOW(FluidVolume.Type.CLOUD);
|
||||||
fluidGO.localScale = new Vector3(1, 2f, 1);
|
fluidGO.localScale = new Vector3(1, 2f, 1);
|
||||||
|
|
||||||
if (info.tint != null)
|
if (info.tint != null)
|
||||||
@ -181,19 +170,8 @@ namespace NewHorizons.Builder.Props
|
|||||||
hurricaneGO.transform.position = planetGO.transform.TransformPoint(position);
|
hurricaneGO.transform.position = planetGO.transform.TransformPoint(position);
|
||||||
hurricaneGO.transform.rotation = Quaternion.FromToRotation(Vector3.up, sector.transform.TransformDirection(position.normalized));
|
hurricaneGO.transform.rotation = Quaternion.FromToRotation(Vector3.up, sector.transform.TransformDirection(position.normalized));
|
||||||
|
|
||||||
var fluidType = FluidVolume.Type.CLOUD;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
fluidType = (FluidVolume.Type)Enum.Parse(typeof(FluidVolume.Type), Enum.GetName(typeof(FluidType), info.fluidType).ToUpper());
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger.LogError($"Couldn't parse fluid volume type [{info.fluidType}]:\n{ex}");
|
|
||||||
}
|
|
||||||
|
|
||||||
var fluidVolume = hurricaneGO.GetComponentInChildren<HurricaneFluidVolume>();
|
var fluidVolume = hurricaneGO.GetComponentInChildren<HurricaneFluidVolume>();
|
||||||
fluidVolume._fluidType = fluidType;
|
fluidVolume._fluidType = info.fluidType.ConvertToOW(FluidVolume.Type.CLOUD);
|
||||||
fluidVolume._density = 8;
|
fluidVolume._density = 8;
|
||||||
|
|
||||||
var effects = hurricaneGO.transform.Find("Effects_GD_Hurricane").gameObject;
|
var effects = hurricaneGO.transform.Find("Effects_GD_Hurricane").gameObject;
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using NewHorizons.External.Configs;
|
using NewHorizons.External.Configs;
|
||||||
|
using NewHorizons.External.Modules;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -215,5 +216,18 @@ namespace NewHorizons.Utility
|
|||||||
Utility.Logger.LogVerbose($"Coordinate Check for {system}: {xCorrect}, {yCorrect}, {zCorrect} [{string.Join("-", coordinates.x)}, {string.Join("-", coordinates.y)}, {string.Join("-", coordinates.z)}]");
|
Utility.Logger.LogVerbose($"Coordinate Check for {system}: {xCorrect}, {yCorrect}, {zCorrect} [{string.Join("-", coordinates.x)}, {string.Join("-", coordinates.y)}, {string.Join("-", coordinates.z)}]");
|
||||||
return xCorrect && yCorrect && zCorrect;
|
return xCorrect && yCorrect && zCorrect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static FluidVolume.Type ConvertToOW(this FluidType fluidType, FluidVolume.Type @default = FluidVolume.Type.NONE)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return (FluidVolume.Type)Enum.Parse(typeof(FluidVolume.Type), Enum.GetName(typeof(FluidType), fluidType).ToUpper());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.LogError($"Couldn't parse fluid volume type [{fluidType}]:\n{ex}");
|
||||||
|
return @default;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user