## Improvements
- The documentation for priority volumes is much better now
- Made gravity/cloud/air/water volumes better match base game

## Bug fixes
- Fixed "None" vine prefab causing an NRE on dimension enter (resolves
#562)
- Fixed an issue where anglerfish weren't animating properly
- Making two signals of the same name and placing one inside a cloak and
the other outside a cloak would cause both to be considered "inside the
cloak".
  - Also applied the same fix to quantum moon signals
- Fixed audio track not being applied, previously it was stuck as
`environmental` (resolves #602)
This commit is contained in:
Nick 2023-06-12 20:48:28 -04:00 committed by GitHub
commit aecf11c9df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 88 additions and 63 deletions

View File

@ -16,9 +16,10 @@ namespace NewHorizons.Builder.Atmosphere
sc.isTrigger = true;
sc.radius = config.Atmosphere.size;
// copied from gd
var sfv = airGO.AddComponent<SimpleFluidVolume>();
sfv._layer = 5;
sfv._priority = 1;
sfv._priority = 0;
sfv._density = 1.2f;
sfv._fluidType = FluidVolume.Type.AIR;
sfv._allowShipAutoroll = true;

View File

@ -126,11 +126,12 @@ namespace NewHorizons.Builder.Atmosphere
SphereCollider fluidSC = cloudsFluidGO.AddComponent<SphereCollider>();
fluidSC.isTrigger = true;
fluidSC.radius = atmo.size;
fluidSC.radius = atmo.clouds.outerCloudRadius;
OWShellCollider fluidOWSC = cloudsFluidGO.AddComponent<OWShellCollider>();
fluidOWSC._innerRadius = atmo.size * 0.9f;
fluidOWSC._innerRadius = atmo.clouds.innerCloudRadius;
// copied from gd
CloudLayerFluidVolume fluidCLFV = cloudsFluidGO.AddComponent<CloudLayerFluidVolume>();
fluidCLFV._layer = 5;
fluidCLFV._priority = 1;

View File

@ -243,13 +243,14 @@ namespace NewHorizons.Builder.Body
cloak._sectors = new Sector[] { sector };
cloak.GetComponent<Renderer>().enabled = true;
// Cull stuff
var cullController = go.AddComponent<BrambleSectorController>();
cullController.SetSector(sector);
// Do next update so other nodes can be built first
Delay.FireOnNextUpdate(() =>
{
// Cull stuff
// this in in the delay because it fixes #562
var cullController = go.AddComponent<BrambleSectorController>();
cullController.SetSector(sector);
// Prevent recursion from causing hard crash
foreach (var senderWarp in outerFogWarpVolume._senderWarps.ToList())
{

View File

@ -104,7 +104,7 @@ namespace NewHorizons.Builder.Body
buoyancyObject.layer = Layer.BasicEffectVolume;
var sphereCollider = buoyancyObject.AddComponent<SphereCollider>();
sphereCollider.radius = 1;
sphereCollider.radius = 1; // scaled by localScale
sphereCollider.isTrigger = true;
var owCollider = buoyancyObject.AddComponent<OWCollider>();
@ -114,6 +114,7 @@ namespace NewHorizons.Builder.Body
var buoyancyTriggerVolume = buoyancyObject.AddComponent<OWTriggerVolume>();
buoyancyTriggerVolume._owCollider = owCollider;
// copied from gd
var fluidVolume = buoyancyObject.AddComponent<RadialFluidVolume>();
fluidVolume._fluidType = FluidVolume.Type.WATER;
fluidVolume._attachedBody = rb;
@ -121,7 +122,10 @@ namespace NewHorizons.Builder.Body
fluidVolume._radius = waterSize;
fluidVolume._buoyancyDensity = module.buoyancy;
fluidVolume._density = module.density;
fluidVolume._layer = LayerMask.NameToLayer("BasicEffectVolume");
fluidVolume._layer = 5;
fluidVolume._priority = 3;
fluidVolume._allowShipAutoroll = true;
fluidVolume._disableOnStart = false;
var fogGO = Object.Instantiate(_oceanFog, waterGO.transform);
fogGO.name = "OceanFog";

View File

@ -35,8 +35,9 @@ namespace NewHorizons.Builder.General
var owTriggerVolume = gravityGO.AddComponent<OWTriggerVolume>();
// copied from th and qm
var gravityVolume = gravityGO.AddComponent<GravityVolume>();
gravityVolume._cutoffAcceleration = 0.1f;
gravityVolume._cutoffAcceleration = 0f;
var falloff = config.Base.gravityFallOff == GravityFallOff.Linear? GravityVolume.FalloffType.linear : GravityVolume.FalloffType.inverseSquared;

View File

@ -8,6 +8,7 @@ using OWML.Utils;
using System.Collections.Generic;
using UnityEngine;
using NewHorizons.External.Modules.Props.Audio;
using System.Linq;
namespace NewHorizons.Builder.Props.Audio
{
@ -19,8 +20,8 @@ namespace NewHorizons.Builder.Props.Audio
public static int NumberOfFrequencies;
private static List<SignalName> _qmSignals;
private static List<SignalName> _cloakedSignals;
private static List<AudioSignal> _qmSignals;
private static List<AudioSignal> _cloakedSignals;
public static bool Initialized;
@ -35,20 +36,20 @@ namespace NewHorizons.Builder.Props.Audio
};
NumberOfFrequencies = EnumUtils.GetValues<SignalFrequency>().Length;
_qmSignals = new List<SignalName>() { SignalName.Quantum_QM };
_cloakedSignals = new List<SignalName>();
_qmSignals = new List<AudioSignal>() { SearchUtilities.Find("QuantumMoon_Body/Signal_Quantum").GetComponent<AudioSignal>() };
_cloakedSignals = new List<AudioSignal>();
Initialized = true;
}
public static bool IsCloaked(this SignalName signalName)
public static bool IsCloaked(this AudioSignal signal)
{
return _cloakedSignals.Contains(signalName);
return _cloakedSignals.Contains(signal);
}
public static bool IsOnQuantumMoon(this SignalName signalName)
public static bool IsOnQuantumMoon(this AudioSignal signal)
{
return _qmSignals.Contains(signalName);
return _qmSignals.Contains(signal);
}
public static SignalFrequency AddFrequency(string str)
@ -149,8 +150,8 @@ namespace NewHorizons.Builder.Props.Audio
signalGO.SetActive(true);
// Track certain special signal things
if (planetGO.GetComponent<AstroObject>()?.GetAstroObjectName() == AstroObject.Name.QuantumMoon) _qmSignals.Add(name);
if (info.insideCloak) _cloakedSignals.Add(name);
if (planetGO.GetComponent<AstroObject>()?.GetAstroObjectName() == AstroObject.Name.QuantumMoon) _qmSignals.Add(audioSignal);
if (info.insideCloak) _cloakedSignals.Add(audioSignal);
return signalGO;
}

View File

@ -363,7 +363,7 @@ namespace NewHorizons.Builder.Props
else if(component is Shape shape) shape.enabled = true;
// If it's not a moving anglerfish make sure the anim controller is regular
else if(component is AnglerfishAnimController && component.GetComponentInParent<AnglerfishController>() == null)
else if(component is AnglerfishAnimController && component.transform.parent.GetComponent<AnglerfishController>() == null) //Manual parent chain so we can find inactive
{
component.gameObject.AddComponent<AnglerAnimFixer>();
}
@ -380,7 +380,7 @@ namespace NewHorizons.Builder.Props
public void Start()
{
var angler = GetComponent<AnglerfishAnimController>();
NHLogger.LogVerbose("Fixing anglerfish animation");
// Remove any event reference to its angler

View File

@ -120,7 +120,7 @@ namespace NewHorizons.External.Modules
/// <summary>
/// Fluid type for sounds/effects when colliding with this cloud.
/// </summary>
[DefaultValue("cloud")] public NHFluidType fluidType = NHFluidType.Cloud;
[DefaultValue("cloud")] public NHFluidType fluidType = NHFluidType.CLOUD;
/// <summary>
/// Add lightning to this planet like on Giant's Deep.

View File

@ -69,7 +69,7 @@ namespace NewHorizons.External.Modules
/// <summary>
/// Optional. You can force this planet's gravity to be felt over other gravity/zero-gravity sources by increasing this number.
/// </summary>
public int gravityVolumePriority;
[DefaultValue(0)] public int gravityVolumePriority = 0;
#region Obsolete

View File

@ -8,7 +8,8 @@ namespace NewHorizons.External.Modules.Props.Audio
public class AudioSourceInfo : BaseAudioInfo
{
/// <summary>
/// The audio track of this audio source
/// The audio track of this audio source.
/// Most of the time you'll use environment (the default) for sound effects and music for music.
/// </summary>
[DefaultValue("environment")] public NHAudioMixerTrackName track = NHAudioMixerTrackName.Environment;
}

View File

@ -68,7 +68,7 @@ namespace NewHorizons.External.Modules.Props
/// <summary>
/// Fluid type for sounds/effects when colliding with this tornado.
/// </summary>
[DefaultValue("cloud")] public NHFluidType fluidType = NHFluidType.Cloud;
[DefaultValue("cloud")] public NHFluidType fluidType = NHFluidType.CLOUD;
}
}

View File

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

View File

@ -15,12 +15,12 @@ namespace NewHorizons.External.Modules.VariableSize
/// <summary>
/// Density of the water sphere. The higher the density, the harder it is to go through this fluid.
/// </summary>
[DefaultValue(1.2f)] public float density = 1.2f;
[DefaultValue(30f)] public float density = 30f;
/// <summary>
/// Buoyancy density of the water sphere
/// </summary>
[DefaultValue(1f)] public float buoyancy = 1f;
[DefaultValue(1.1f)] public float buoyancy = 1.1f;
/// <summary>
/// Tint of the water

View File

@ -16,7 +16,8 @@ namespace NewHorizons.External.Modules.Volumes.VolumeInfos
[DefaultValue("random")] public NHClipSelectionType clipSelection = NHClipSelectionType.RANDOM;
/// <summary>
/// The audio track of this audio volume
/// The audio track of this audio volume.
/// Most of the time you'll use environment (the default) for sound effects and music for music.
/// </summary>
[DefaultValue("environment")] public NHAudioMixerTrackName track = NHAudioMixerTrackName.Environment;

View File

@ -8,12 +8,25 @@ namespace NewHorizons.External.Modules.Volumes.VolumeInfos
{
/// <summary>
/// The layer of this volume.
///
/// Layers separate the priority system. The priority of volumes in one layer will not affect or override volumes in another. The highest priority volume in each layer will stack like normal.
/// The exception is layer 0. A higher-priority volume in layer 0 will override lower-priority volumes in ALL other layers. A lower-priority volume in layer 0 will stack with other layers like normal.
///
/// Ex: A player could be affected by the sun on layer 9 priority 0 and planet gravity on layer 3 priority 2. They would experience the gravity of both volumes since they are on different layers.
/// If there was a zero-g volume on layer 0 priority 1, since it is on layer 0 it will override the gravity from the sun (priority 0 which is less than 1) but they will still feel the
/// gravity of the planet (priority 2 is greater than 1). The zero-g volume will also still be applied because it is on a different layer.
///
/// Default value here is 0 which means this volume's priority will be evaluated against all other priority volumes regardless of their layer.
/// </summary>
[DefaultValue(0)] public int layer = 0;
/// <summary>
/// The priority for this volume's effects to be applied.
/// Ex, a player in a gravity volume with priority 0, and zero-gravity volume with priority 1, will feel zero gravity.
/// The priority of this volume.
///
/// Volumes of higher priority will override volumes of lower priority. Volumes of the same priority will stack like normal.
/// Ex: A player in a gravity volume with priority 0, and zero-gravity volume with priority 1, will feel zero gravity.
///
/// Default value here is 1 instead of 0 so it automatically overrides planet gravity, which is 0 by default.
/// </summary>
[DefaultValue(1)] public int priority = 1;
}

View File

@ -7,14 +7,14 @@ namespace NewHorizons.External.SerializableEnums
[JsonConverter(typeof(StringEnumConverter))]
public enum NHFluidType
{
[EnumMember(Value = @"none")] None = 0,
[EnumMember(Value = @"none")] NONE = 0,
[EnumMember(Value = @"water")] Water = 1,
[EnumMember(Value = @"water")] WATER = 1,
[EnumMember(Value = @"cloud")] Cloud = 2,
[EnumMember(Value = @"cloud")] CLOUD = 2,
[EnumMember(Value = @"sand")] Sand = 3,
[EnumMember(Value = @"sand")] SAND = 3,
[EnumMember(Value = @"plasma")] Plasma = 4
[EnumMember(Value = @"plasma")] PLASMA = 4
}
}

View File

@ -81,8 +81,8 @@ namespace NewHorizons.Patches.SignalPatches
{
if (!SignalBuilder.Initialized) return true;
var isCloaked = __instance._name.IsCloaked();
var isOnQuantumMoon = __instance._name.IsOnQuantumMoon();
var isCloaked = __instance.IsCloaked();
var isOnQuantumMoon = __instance.IsOnQuantumMoon();
if (!isCloaked && !isOnQuantumMoon) return true;

View File

@ -484,11 +484,11 @@
"type": "string",
"description": "",
"x-enumNames": [
"None",
"Water",
"Cloud",
"Sand",
"Plasma"
"NONE",
"WATER",
"CLOUD",
"SAND",
"PLASMA"
],
"enum": [
"none",
@ -560,7 +560,8 @@
"gravityVolumePriority": {
"type": "integer",
"description": "Optional. You can force this planet's gravity to be felt over other gravity/zero-gravity sources by increasing this number.",
"format": "int32"
"format": "int32",
"default": 0
}
}
},
@ -2689,7 +2690,7 @@
"description": "An optional rename of this object"
},
"track": {
"description": "The audio track of this audio source",
"description": "The audio track of this audio source.\nMost of the time you'll use environment (the default) for sound effects and music for music. ",
"default": "environment",
"$ref": "#/definitions/NHAudioMixerTrackName"
}
@ -3225,13 +3226,13 @@
"type": "number",
"description": "Density of the water sphere. The higher the density, the harder it is to go through this fluid.",
"format": "float",
"default": 1.2
"default": 30.0
},
"buoyancy": {
"type": "number",
"description": "Buoyancy density of the water sphere",
"format": "float",
"default": 1.0
"default": 1.1
},
"tint": {
"description": "Tint of the water",
@ -3382,13 +3383,13 @@
"properties": {
"layer": {
"type": "integer",
"description": "The layer of this volume.",
"description": "The layer of this volume.\n\nLayers separate the priority system. The priority of volumes in one layer will not affect or override volumes in another. The highest priority volume in each layer will stack like normal.\nThe exception is layer 0. A higher-priority volume in layer 0 will override lower-priority volumes in ALL other layers. A lower-priority volume in layer 0 will stack with other layers like normal.\n \nEx: A player could be affected by the sun on layer 9 priority 0 and planet gravity on layer 3 priority 2. They would experience the gravity of both volumes since they are on different layers.\nIf there was a zero-g volume on layer 0 priority 1, since it is on layer 0 it will override the gravity from the sun (priority 0 which is less than 1) but they will still feel the \ngravity of the planet (priority 2 is greater than 1). The zero-g volume will also still be applied because it is on a different layer.\n \nDefault value here is 0 which means this volume's priority will be evaluated against all other priority volumes regardless of their layer.",
"format": "int32",
"default": 0
},
"priority": {
"type": "integer",
"description": "The priority for this volume's effects to be applied. \nEx, a player in a gravity volume with priority 0, and zero-gravity volume with priority 1, will feel zero gravity.",
"description": "The priority of this volume.\n\nVolumes of higher priority will override volumes of lower priority. Volumes of the same priority will stack like normal.\nEx: A player in a gravity volume with priority 0, and zero-gravity volume with priority 1, will feel zero gravity.\n \nDefault value here is 1 instead of 0 so it automatically overrides planet gravity, which is 0 by default. ",
"format": "int32",
"default": 1
},
@ -3423,7 +3424,7 @@
"$ref": "#/definitions/NHClipSelectionType"
},
"track": {
"description": "The audio track of this audio volume",
"description": "The audio track of this audio volume.\nMost of the time you'll use environment (the default) for sound effects and music for music. ",
"default": "environment",
"$ref": "#/definitions/NHAudioMixerTrackName"
},
@ -3560,13 +3561,13 @@
"properties": {
"layer": {
"type": "integer",
"description": "The layer of this volume.",
"description": "The layer of this volume.\n\nLayers separate the priority system. The priority of volumes in one layer will not affect or override volumes in another. The highest priority volume in each layer will stack like normal.\nThe exception is layer 0. A higher-priority volume in layer 0 will override lower-priority volumes in ALL other layers. A lower-priority volume in layer 0 will stack with other layers like normal.\n \nEx: A player could be affected by the sun on layer 9 priority 0 and planet gravity on layer 3 priority 2. They would experience the gravity of both volumes since they are on different layers.\nIf there was a zero-g volume on layer 0 priority 1, since it is on layer 0 it will override the gravity from the sun (priority 0 which is less than 1) but they will still feel the \ngravity of the planet (priority 2 is greater than 1). The zero-g volume will also still be applied because it is on a different layer.\n \nDefault value here is 0 which means this volume's priority will be evaluated against all other priority volumes regardless of their layer.",
"format": "int32",
"default": 0
},
"priority": {
"type": "integer",
"description": "The priority for this volume's effects to be applied. \nEx, a player in a gravity volume with priority 0, and zero-gravity volume with priority 1, will feel zero gravity.",
"description": "The priority of this volume.\n\nVolumes of higher priority will override volumes of lower priority. Volumes of the same priority will stack like normal.\nEx: A player in a gravity volume with priority 0, and zero-gravity volume with priority 1, will feel zero gravity.\n \nDefault value here is 1 instead of 0 so it automatically overrides planet gravity, which is 0 by default. ",
"format": "int32",
"default": 1
},
@ -4185,13 +4186,13 @@
"properties": {
"layer": {
"type": "integer",
"description": "The layer of this volume.",
"description": "The layer of this volume.\n\nLayers separate the priority system. The priority of volumes in one layer will not affect or override volumes in another. The highest priority volume in each layer will stack like normal.\nThe exception is layer 0. A higher-priority volume in layer 0 will override lower-priority volumes in ALL other layers. A lower-priority volume in layer 0 will stack with other layers like normal.\n \nEx: A player could be affected by the sun on layer 9 priority 0 and planet gravity on layer 3 priority 2. They would experience the gravity of both volumes since they are on different layers.\nIf there was a zero-g volume on layer 0 priority 1, since it is on layer 0 it will override the gravity from the sun (priority 0 which is less than 1) but they will still feel the \ngravity of the planet (priority 2 is greater than 1). The zero-g volume will also still be applied because it is on a different layer.\n \nDefault value here is 0 which means this volume's priority will be evaluated against all other priority volumes regardless of their layer.",
"format": "int32",
"default": 0
},
"priority": {
"type": "integer",
"description": "The priority for this volume's effects to be applied. \nEx, a player in a gravity volume with priority 0, and zero-gravity volume with priority 1, will feel zero gravity.",
"description": "The priority of this volume.\n\nVolumes of higher priority will override volumes of lower priority. Volumes of the same priority will stack like normal.\nEx: A player in a gravity volume with priority 0, and zero-gravity volume with priority 1, will feel zero gravity.\n \nDefault value here is 1 instead of 0 so it automatically overrides planet gravity, which is 0 by default. ",
"format": "int32",
"default": 1
},
@ -4239,13 +4240,13 @@
"properties": {
"layer": {
"type": "integer",
"description": "The layer of this volume.",
"description": "The layer of this volume.\n\nLayers separate the priority system. The priority of volumes in one layer will not affect or override volumes in another. The highest priority volume in each layer will stack like normal.\nThe exception is layer 0. A higher-priority volume in layer 0 will override lower-priority volumes in ALL other layers. A lower-priority volume in layer 0 will stack with other layers like normal.\n \nEx: A player could be affected by the sun on layer 9 priority 0 and planet gravity on layer 3 priority 2. They would experience the gravity of both volumes since they are on different layers.\nIf there was a zero-g volume on layer 0 priority 1, since it is on layer 0 it will override the gravity from the sun (priority 0 which is less than 1) but they will still feel the \ngravity of the planet (priority 2 is greater than 1). The zero-g volume will also still be applied because it is on a different layer.\n \nDefault value here is 0 which means this volume's priority will be evaluated against all other priority volumes regardless of their layer.",
"format": "int32",
"default": 0
},
"priority": {
"type": "integer",
"description": "The priority for this volume's effects to be applied. \nEx, a player in a gravity volume with priority 0, and zero-gravity volume with priority 1, will feel zero gravity.",
"description": "The priority of this volume.\n\nVolumes of higher priority will override volumes of lower priority. Volumes of the same priority will stack like normal.\nEx: A player in a gravity volume with priority 0, and zero-gravity volume with priority 1, will feel zero gravity.\n \nDefault value here is 1 instead of 0 so it automatically overrides planet gravity, which is 0 by default. ",
"format": "int32",
"default": 1
},
@ -4313,13 +4314,13 @@
},
"layer": {
"type": "integer",
"description": "The layer of this volume.",
"description": "The layer of this volume.\n\nLayers separate the priority system. The priority of volumes in one layer will not affect or override volumes in another. The highest priority volume in each layer will stack like normal.\nThe exception is layer 0. A higher-priority volume in layer 0 will override lower-priority volumes in ALL other layers. A lower-priority volume in layer 0 will stack with other layers like normal.\n \nEx: A player could be affected by the sun on layer 9 priority 0 and planet gravity on layer 3 priority 2. They would experience the gravity of both volumes since they are on different layers.\nIf there was a zero-g volume on layer 0 priority 1, since it is on layer 0 it will override the gravity from the sun (priority 0 which is less than 1) but they will still feel the \ngravity of the planet (priority 2 is greater than 1). The zero-g volume will also still be applied because it is on a different layer.\n \nDefault value here is 0 which means this volume's priority will be evaluated against all other priority volumes regardless of their layer.",
"format": "int32",
"default": 0
},
"priority": {
"type": "integer",
"description": "The priority for this volume's effects to be applied. \nEx, a player in a gravity volume with priority 0, and zero-gravity volume with priority 1, will feel zero gravity.",
"description": "The priority of this volume.\n\nVolumes of higher priority will override volumes of lower priority. Volumes of the same priority will stack like normal.\nEx: A player in a gravity volume with priority 0, and zero-gravity volume with priority 1, will feel zero gravity.\n \nDefault value here is 1 instead of 0 so it automatically overrides planet gravity, which is 0 by default. ",
"format": "int32",
"default": 1
}

View File

@ -255,13 +255,13 @@ namespace NewHorizons.Utility
}
public static FluidVolume.Type ConvertToOW(this NHFluidType fluidType, FluidVolume.Type @default = FluidVolume.Type.NONE)
=> EnumUtils.Parse(fluidType.ToString().ToUpper(), @default);
=> EnumUtils.Parse(fluidType.ToString(), @default);
public static OWAudioMixer.TrackName ConvertToOW(this NHAudioMixerTrackName trackName, OWAudioMixer.TrackName @default = OWAudioMixer.TrackName.Environment)
=> EnumUtils.Parse(trackName.ToString().ToUpper(), @default);
=> EnumUtils.Parse(trackName.ToString(), @default);
public static OWAudioSource.ClipSelectionOnPlay ConvertToOW(this NHClipSelectionType clipSelection, OWAudioSource.ClipSelectionOnPlay @default = OWAudioSource.ClipSelectionOnPlay.RANDOM)
=> EnumUtils.Parse(clipSelection.ToString().ToUpper(), @default);
=> EnumUtils.Parse(clipSelection.ToString(), @default);
public static void SmoothLookDir(this GameObject go, Vector3 direction, float dt, float angularVelocity)
{

View File

@ -4,7 +4,7 @@
"author": "xen, Bwc9876, clay, MegaPiggy, John, Trifid, Hawkbar, Book",
"name": "New Horizons",
"uniqueName": "xen.NewHorizons",
"version": "1.11.0",
"version": "1.11.1",
"owmlVersion": "2.9.0",
"dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_CommonResources" ],