Merge branch 'dev' into audio-volume-direction

This commit is contained in:
JohnCorby 2023-06-05 17:53:12 -07:00
commit 0250265866
5 changed files with 41 additions and 26 deletions

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

@ -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,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

@ -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

@ -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
}
}
},
@ -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
},
@ -3572,13 +3573,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
},
@ -4197,13 +4198,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
},
@ -4251,13 +4252,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
},
@ -4325,13 +4326,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
}