Merge branch 'dev' into ring-opacity

This commit is contained in:
Noah Pilarski 2022-08-25 20:12:52 -04:00
commit 1c6a8c47ad
9 changed files with 76 additions and 42 deletions

View File

@ -85,19 +85,7 @@ namespace NewHorizons.Builder.Atmosphere
fluidCLFV._layer = 5;
fluidCLFV._priority = 1;
fluidCLFV._density = 1.2f;
var fluidType = FluidVolume.Type.CLOUD;
try
{
fluidType = (FluidVolume.Type)Enum.Parse(typeof(FluidVolume.Type), Enum.GetName(typeof(CloudFluidType), atmo.clouds.fluidType).ToUpper());
}
catch (Exception ex)
{
Logger.LogError($"Couldn't parse fluid volume type [{atmo.clouds.fluidType}]:\n{ex}");
}
fluidCLFV._fluidType = fluidType;
fluidCLFV._fluidType = atmo.clouds.fluidType.ConvertToOW(FluidVolume.Type.CLOUD);
fluidCLFV._allowShipAutoroll = true;
fluidCLFV._disableOnStart = false;

View File

@ -45,18 +45,7 @@ namespace NewHorizons.Builder.Body
trigger._shape = ringShape;
var sfv = ringVolume.AddComponent<RingFluidVolume>();
var fluidType = FluidVolume.Type.NONE;
try
{
fluidType = (FluidVolume.Type)Enum.Parse(typeof(FluidVolume.Type), Enum.GetName(typeof(CloudFluidType), ring.fluidType).ToUpper());
}
catch (Exception ex)
{
Logger.LogError($"Couldn't parse fluid volume type [{ring.fluidType}]:\n{ex}");
}
sfv._fluidType = fluidType;
sfv._fluidType = ring.fluidType.ConvertToOW();
sfv._density = 5f;
if (ringGO.TryGetComponent<RingOpacityController>(out var ringOC)) ringOC.SetRingFluidVolume(sfv);

View File

@ -208,6 +208,8 @@ namespace NewHorizons.Builder.Props
component._nomaiTexts[i] = wallText;
}
if (info.disableWall) whiteboard.FindChild("Props_NOM_Whiteboard_Shared").SetActive(false);
whiteboard.SetActive(true);
}
@ -251,6 +253,14 @@ namespace NewHorizons.Builder.Props
component._visualSector = sector;
component._dataPointID = info.reveals;
if (info.disableStructure)
{
platform.FindChild("Structure_NOM_RemoteViewer").SetActive(false);
platform.FindChild("RemoteViewer_FadeGeo").SetActive(false);
}
if (info.disablePool) platform.FindChild("RemoteViewer_Pool").SetActive(false);
platform.SetActive(true);
}

View File

@ -2,6 +2,7 @@ using NewHorizons.Components;
using NewHorizons.External.Modules;
using NewHorizons.Handlers;
using NewHorizons.Utility;
using System;
using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
using Random = UnityEngine.Random;
@ -143,15 +144,9 @@ namespace NewHorizons.Builder.Props
tornadoGO.GetComponentInChildren<CapsuleShape>().enabled = true;
// Resize it so the force volume goes all the way up
switch (downwards)
{
case true:
tornadoGO.transform.Find("MockDownTornado_FluidCenter").localScale = new Vector3(1, 2f, 1);
break;
default:
tornadoGO.transform.Find("MockUpTornado_FluidCenter").localScale = new Vector3(1, 2f, 1);
break;
}
var fluidGO = tornadoGO.transform.Find(downwards ? "MockDownTornado_FluidCenter" : "MockUpTornado_FluidCenter");
fluidGO.GetComponent<TornadoFluidVolume>()._fluidType = info.fluidType.ConvertToOW(FluidVolume.Type.CLOUD);
fluidGO.localScale = new Vector3(1, 2f, 1);
if (info.tint != null)
{
@ -176,6 +171,7 @@ namespace NewHorizons.Builder.Props
hurricaneGO.transform.rotation = Quaternion.FromToRotation(Vector3.up, sector.transform.TransformDirection(position.normalized));
var fluidVolume = hurricaneGO.GetComponentInChildren<HurricaneFluidVolume>();
fluidVolume._fluidType = info.fluidType.ConvertToOW(FluidVolume.Type.CLOUD);
fluidVolume._density = 8;
var effects = hurricaneGO.transform.Find("Effects_GD_Hurricane").gameObject;

View File

@ -9,7 +9,7 @@ using Newtonsoft.Json.Converters;
namespace NewHorizons.External.Modules
{
[JsonConverter(typeof(StringEnumConverter))]
public enum CloudFluidType
public enum FluidType
{
[EnumMember(Value = @"none")] None = 0,
@ -126,7 +126,7 @@ namespace NewHorizons.External.Modules
/// <summary>
/// Fluid type for sounds/effects when colliding with this cloud.
/// </summary>
[DefaultValue("cloud")] public CloudFluidType fluidType = CloudFluidType.Cloud;
[DefaultValue("cloud")] public FluidType fluidType = FluidType.Cloud;
/// <summary>
/// Add lightning to this planet like on Giant's Deep.
@ -202,8 +202,8 @@ namespace NewHorizons.External.Modules
[Obsolete("CloudRamp is deprecated, please use CloudInfo instead")]
public string cloudRamp;
[Obsolete("CloudFluidType is deprecated, please use CloudInfo instead")]
public CloudFluidType fluidType;
[Obsolete("FluidType is deprecated, please use CloudInfo instead")]
public FluidType fluidType;
[Obsolete("UseBasicCloudShader is deprecated, please use CloudInfo instead")]
public bool useBasicCloudShader;

View File

@ -325,6 +325,11 @@ namespace NewHorizons.External.Modules
/// The maximum distance at which you'll hear the sounds of the cyclone. If not set it will scale relative to the size of the cyclone.
/// </summary>
public float audioDistance;
/// <summary>
/// Fluid type for sounds/effects when colliding with this tornado.
/// </summary>
[DefaultValue("cloud")] public FluidType fluidType = FluidType.Cloud;
}
[JsonObject]
@ -891,6 +896,11 @@ namespace NewHorizons.External.Modules
/// </summary>
public string rename;
/// <summary>
/// Disable the wall, leaving only the pedestal and text.
/// </summary>
public bool disableWall;
[JsonObject]
public class SharedNomaiTextInfo
{
@ -953,6 +963,16 @@ namespace NewHorizons.External.Modules
/// A ship log fact to reveal when the platform is connected to.
/// </summary>
[DefaultValue("")] public string reveals = "";
/// <summary>
/// Disable the structure, leaving only the pedestal.
/// </summary>
public bool disableStructure;
/// <summary>
/// Disable the pool that rises when you place a stone.
/// </summary>
public bool disablePool;
}
[JsonObject]

View File

@ -11,7 +11,7 @@ namespace NewHorizons.External.Modules
/// <summary>
/// Fluid type for sounds/effects when colliding with this ring.
/// </summary>
public CloudFluidType fluidType = CloudFluidType.None;
public FluidType fluidType = FluidType.None;
/// <summary>
/// Angle between the rings and the equatorial plane of the planet.

View File

@ -327,7 +327,7 @@
"fluidType": {
"description": "Fluid type for sounds/effects when colliding with this cloud.",
"default": "cloud",
"$ref": "#/definitions/CloudFluidType"
"$ref": "#/definitions/FluidType"
},
"hasLightning": {
"type": "boolean",
@ -388,7 +388,7 @@
"basic"
]
},
"CloudFluidType": {
"FluidType": {
"type": "string",
"description": "",
"x-enumNames": [
@ -1675,6 +1675,11 @@
"type": "number",
"description": "The maximum distance at which you'll hear the sounds of the cyclone. If not set it will scale relative to the size of the cyclone.",
"format": "float"
},
"fluidType": {
"description": "Fluid type for sounds/effects when colliding with this tornado.",
"default": "cloud",
"$ref": "#/definitions/FluidType"
}
}
},
@ -1973,6 +1978,10 @@
"rename": {
"type": "string",
"description": "An optional rename of this object"
},
"disableWall": {
"type": "boolean",
"description": "Disable the wall, leaving only the pedestal and text."
}
}
},
@ -2035,6 +2044,14 @@
"type": "string",
"description": "A ship log fact to reveal when the platform is connected to.",
"default": ""
},
"disableStructure": {
"type": "boolean",
"description": "Disable the structure, leaving only the pedestal."
},
"disablePool": {
"type": "boolean",
"description": "Disable the pool that rises when you place a stone."
}
}
},
@ -2105,7 +2122,7 @@
"properties": {
"fluidType": {
"description": "Fluid type for sounds/effects when colliding with this ring.",
"$ref": "#/definitions/CloudFluidType"
"$ref": "#/definitions/FluidType"
},
"inclination": {
"type": "number",

View File

@ -1,4 +1,5 @@
using NewHorizons.External.Configs;
using NewHorizons.External.Modules;
using Newtonsoft.Json;
using System;
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)}]");
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;
}
}
}
}