mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Reorganize to a volume module
This commit is contained in:
parent
890b496e7a
commit
4ae90dcc25
@ -109,20 +109,6 @@ namespace NewHorizons.Builder.Props
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.Props.reveal != null)
|
|
||||||
{
|
|
||||||
foreach (var revealInfo in config.Props.reveal)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
RevealBuilder.Make(go, sector, revealInfo, mod);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger.LogError($"Couldn't make reveal location [{revealInfo.reveals}] for [{go.name}]:\n{ex}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (config.Props.entryLocation != null)
|
if (config.Props.entryLocation != null)
|
||||||
{
|
{
|
||||||
foreach (var entryLocationInfo in config.Props.entryLocation)
|
foreach (var entryLocationInfo in config.Props.entryLocation)
|
||||||
@ -207,13 +193,6 @@ namespace NewHorizons.Builder.Props
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.Props.audioVolumes != null)
|
|
||||||
{
|
|
||||||
foreach (var audioVolume in config.Props.audioVolumes)
|
|
||||||
{
|
|
||||||
AudioVolumeBuilder.Make(go, sector, audioVolume, mod);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (config.Props.signals != null)
|
if (config.Props.signals != null)
|
||||||
{
|
{
|
||||||
foreach (var signal in config.Props.signals)
|
foreach (var signal in config.Props.signals)
|
||||||
@ -235,13 +214,6 @@ namespace NewHorizons.Builder.Props
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (config.Props.notificationVolumes != null)
|
|
||||||
{
|
|
||||||
foreach (var notificationVolume in config.Props.notificationVolumes)
|
|
||||||
{
|
|
||||||
NotificationVolumeBuilder.Make(go, sector, notificationVolume, mod);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,18 +7,18 @@ namespace NewHorizons.Builder.ShipLog
|
|||||||
{
|
{
|
||||||
public static class RevealBuilder
|
public static class RevealBuilder
|
||||||
{
|
{
|
||||||
public static void Make(GameObject go, Sector sector, PropModule.RevealInfo info, IModBehaviour mod)
|
public static void Make(GameObject go, Sector sector, VolumesModule.RevealVolumeInfo info, IModBehaviour mod)
|
||||||
{
|
{
|
||||||
var newRevealGO = MakeGameObject(go, sector, info, mod);
|
var newRevealGO = MakeGameObject(go, sector, info, mod);
|
||||||
switch (info.revealOn)
|
switch (info.revealOn)
|
||||||
{
|
{
|
||||||
case PropModule.RevealInfo.RevealVolumeType.Enter:
|
case VolumesModule.RevealVolumeInfo.RevealVolumeType.Enter:
|
||||||
MakeTrigger(newRevealGO, sector, info, mod);
|
MakeTrigger(newRevealGO, sector, info, mod);
|
||||||
break;
|
break;
|
||||||
case PropModule.RevealInfo.RevealVolumeType.Observe:
|
case VolumesModule.RevealVolumeInfo.RevealVolumeType.Observe:
|
||||||
MakeObservable(newRevealGO, sector, info, mod);
|
MakeObservable(newRevealGO, sector, info, mod);
|
||||||
break;
|
break;
|
||||||
case PropModule.RevealInfo.RevealVolumeType.Snapshot:
|
case VolumesModule.RevealVolumeInfo.RevealVolumeType.Snapshot:
|
||||||
MakeSnapshot(newRevealGO, sector, info, mod);
|
MakeSnapshot(newRevealGO, sector, info, mod);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -28,7 +28,7 @@ namespace NewHorizons.Builder.ShipLog
|
|||||||
newRevealGO.SetActive(true);
|
newRevealGO.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SphereShape MakeShape(GameObject go, PropModule.RevealInfo info, Shape.CollisionMode collisionMode)
|
private static SphereShape MakeShape(GameObject go, VolumesModule.RevealVolumeInfo info, Shape.CollisionMode collisionMode)
|
||||||
{
|
{
|
||||||
SphereShape newShape = go.AddComponent<SphereShape>();
|
SphereShape newShape = go.AddComponent<SphereShape>();
|
||||||
newShape.radius = info.radius;
|
newShape.radius = info.radius;
|
||||||
@ -36,7 +36,7 @@ namespace NewHorizons.Builder.ShipLog
|
|||||||
return newShape;
|
return newShape;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static GameObject MakeGameObject(GameObject planetGO, Sector sector, PropModule.RevealInfo info, IModBehaviour mod)
|
private static GameObject MakeGameObject(GameObject planetGO, Sector sector, VolumesModule.RevealVolumeInfo info, IModBehaviour mod)
|
||||||
{
|
{
|
||||||
GameObject revealTriggerVolume = new GameObject("Reveal Volume (" + info.revealOn + ")");
|
GameObject revealTriggerVolume = new GameObject("Reveal Volume (" + info.revealOn + ")");
|
||||||
revealTriggerVolume.SetActive(false);
|
revealTriggerVolume.SetActive(false);
|
||||||
@ -45,7 +45,7 @@ namespace NewHorizons.Builder.ShipLog
|
|||||||
return revealTriggerVolume;
|
return revealTriggerVolume;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void MakeTrigger(GameObject go, Sector sector, PropModule.RevealInfo info, IModBehaviour mod)
|
private static void MakeTrigger(GameObject go, Sector sector, VolumesModule.RevealVolumeInfo info, IModBehaviour mod)
|
||||||
{
|
{
|
||||||
var shape = MakeShape(go, info, Shape.CollisionMode.Volume);
|
var shape = MakeShape(go, info, Shape.CollisionMode.Volume);
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ namespace NewHorizons.Builder.ShipLog
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void MakeObservable(GameObject go, Sector sector, PropModule.RevealInfo info, IModBehaviour mod)
|
private static void MakeObservable(GameObject go, Sector sector, VolumesModule.RevealVolumeInfo info, IModBehaviour mod)
|
||||||
{
|
{
|
||||||
go.layer = LayerMask.NameToLayer("Interactible");
|
go.layer = LayerMask.NameToLayer("Interactible");
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ namespace NewHorizons.Builder.ShipLog
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void MakeSnapshot(GameObject go, Sector sector, PropModule.RevealInfo info, IModBehaviour mod)
|
private static void MakeSnapshot(GameObject go, Sector sector, VolumesModule.RevealVolumeInfo info, IModBehaviour mod)
|
||||||
{
|
{
|
||||||
var shape = MakeShape(go, info, Shape.CollisionMode.Manual);
|
var shape = MakeShape(go, info, Shape.CollisionMode.Manual);
|
||||||
|
|
||||||
|
|||||||
@ -9,11 +9,11 @@ using System.Threading.Tasks;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.Props
|
namespace NewHorizons.Builder.Volumes
|
||||||
{
|
{
|
||||||
public static class AudioVolumeBuilder
|
public static class AudioVolumeBuilder
|
||||||
{
|
{
|
||||||
public static AudioVolume Make(GameObject planetGO, Sector sector, PropModule.AudioVolumeInfo info, IModBehaviour mod)
|
public static AudioVolume Make(GameObject planetGO, Sector sector, VolumesModule.AudioVolumeInfo info, IModBehaviour mod)
|
||||||
{
|
{
|
||||||
var go = new GameObject("AudioVolume");
|
var go = new GameObject("AudioVolume");
|
||||||
go.SetActive(false);
|
go.SetActive(false);
|
||||||
@ -11,11 +11,11 @@ using UnityEngine;
|
|||||||
using Logger = NewHorizons.Utility.Logger;
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
using NHNotificationVolume = NewHorizons.Components.NotificationVolume;
|
using NHNotificationVolume = NewHorizons.Components.NotificationVolume;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.Props
|
namespace NewHorizons.Builder.Volumes
|
||||||
{
|
{
|
||||||
public static class NotificationVolumeBuilder
|
public static class NotificationVolumeBuilder
|
||||||
{
|
{
|
||||||
public static NHNotificationVolume Make(GameObject planetGO, Sector sector, PropModule.NotificationVolumeInfo info, IModBehaviour mod)
|
public static NHNotificationVolume Make(GameObject planetGO, Sector sector, VolumesModule.NotificationVolumeInfo info, IModBehaviour mod)
|
||||||
{
|
{
|
||||||
var go = new GameObject("NotificationVolume");
|
var go = new GameObject("NotificationVolume");
|
||||||
go.SetActive(false);
|
go.SetActive(false);
|
||||||
47
NewHorizons/Builder/Volumes/VolumesBuildManager.cs
Normal file
47
NewHorizons/Builder/Volumes/VolumesBuildManager.cs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
using NewHorizons.Builder.Body;
|
||||||
|
using NewHorizons.Builder.ShipLog;
|
||||||
|
using NewHorizons.Builder.Volumes;
|
||||||
|
using NewHorizons.External.Configs;
|
||||||
|
using OWML.Common;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
|
|
||||||
|
namespace NewHorizons.Builder.Volumes
|
||||||
|
{
|
||||||
|
public static class VolumesBuildManager
|
||||||
|
{
|
||||||
|
public static void Make(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod)
|
||||||
|
{
|
||||||
|
if (config.Volumes.revealVolumes != null)
|
||||||
|
{
|
||||||
|
foreach (var revealInfo in config.Volumes.revealVolumes)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
RevealBuilder.Make(go, sector, revealInfo, mod);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.LogError($"Couldn't make reveal location [{revealInfo.reveals}] for [{go.name}]:\n{ex}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (config.Volumes.audioVolumes != null)
|
||||||
|
{
|
||||||
|
foreach (var audioVolume in config.Volumes.audioVolumes)
|
||||||
|
{
|
||||||
|
AudioVolumeBuilder.Make(go, sector, audioVolume, mod);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (config.Volumes.notificationVolumes != null)
|
||||||
|
{
|
||||||
|
foreach (var notificationVolume in config.Volumes.notificationVolumes)
|
||||||
|
{
|
||||||
|
NotificationVolumeBuilder.Make(go, sector, notificationVolume, mod);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -32,7 +32,7 @@ namespace NewHorizons.Components
|
|||||||
|
|
||||||
public void SetPinned(bool pin) => _pin = pin;
|
public void SetPinned(bool pin) => _pin = pin;
|
||||||
|
|
||||||
public void SetTarget(NewHorizons.External.Modules.PropModule.NotificationVolumeInfo.NotificationTarget target) => SetTarget(EnumUtils.Parse<NotificationTarget>(target.ToString(), NotificationTarget.All));
|
public void SetTarget(External.Modules.VolumesModule.NotificationVolumeInfo.NotificationTarget target) => SetTarget(EnumUtils.Parse<NotificationTarget>(target.ToString(), NotificationTarget.All));
|
||||||
|
|
||||||
public void SetTarget(NotificationTarget target) => _target = target;
|
public void SetTarget(NotificationTarget target) => _target = target;
|
||||||
|
|
||||||
|
|||||||
19
NewHorizons/External/Configs/PlanetConfig.cs
vendored
19
NewHorizons/External/Configs/PlanetConfig.cs
vendored
@ -169,6 +169,11 @@ namespace NewHorizons.External.Configs
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public WaterModule Water;
|
public WaterModule Water;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add various volumes on this body
|
||||||
|
/// </summary>
|
||||||
|
public VolumesModule Volumes;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extra data that may be used by extension mods
|
/// Extra data that may be used by extension mods
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -317,6 +322,20 @@ namespace NewHorizons.External.Configs
|
|||||||
if (tornado.downwards)
|
if (tornado.downwards)
|
||||||
tornado.type = PropModule.TornadoInfo.TornadoType.Downwards;
|
tornado.type = PropModule.TornadoInfo.TornadoType.Downwards;
|
||||||
|
|
||||||
|
if (Props?.audioVolumes != null)
|
||||||
|
{
|
||||||
|
if (Volumes == null) Volumes = new VolumesModule();
|
||||||
|
if (Volumes.audioVolumes == null) Volumes.audioVolumes = new VolumesModule.AudioVolumeInfo[0];
|
||||||
|
Volumes.audioVolumes = Volumes.audioVolumes.Concat(Props.audioVolumes).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Props?.reveal != null)
|
||||||
|
{
|
||||||
|
if (Volumes == null) Volumes = new VolumesModule();
|
||||||
|
if (Volumes.revealVolumes == null) Volumes.revealVolumes = new VolumesModule.RevealVolumeInfo[0];
|
||||||
|
Volumes.revealVolumes = Volumes.revealVolumes.Concat(Props.reveal).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
if (Base.sphereOfInfluence != 0f) Base.soiOverride = Base.sphereOfInfluence;
|
if (Base.sphereOfInfluence != 0f) Base.soiOverride = Base.sphereOfInfluence;
|
||||||
|
|
||||||
// Moved a bunch of stuff off of shiplog module to star system module because it didnt exist when we made this
|
// Moved a bunch of stuff off of shiplog module to star system module because it didnt exist when we made this
|
||||||
|
|||||||
168
NewHorizons/External/Modules/PropModule.cs
vendored
168
NewHorizons/External/Modules/PropModule.cs
vendored
@ -48,11 +48,6 @@ namespace NewHorizons.External.Modules
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public RaftInfo[] rafts;
|
public RaftInfo[] rafts;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add triggers that reveal parts of the ship log on this planet
|
|
||||||
/// </summary>
|
|
||||||
public RevealInfo[] reveal;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Scatter props around this planet's surface
|
/// Scatter props around this planet's surface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -83,11 +78,6 @@ namespace NewHorizons.External.Modules
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public SingularityModule[] singularities;
|
public SingularityModule[] singularities;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add audio volumes to this planet
|
|
||||||
/// </summary>
|
|
||||||
public AudioVolumeInfo[] audioVolumes;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add signalscope signals to this planet
|
/// Add signalscope signals to this planet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -98,10 +88,9 @@ namespace NewHorizons.External.Modules
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public RemoteInfo[] remotes;
|
public RemoteInfo[] remotes;
|
||||||
|
|
||||||
/// <summary>
|
[Obsolete("reveal is deprecated. Use Volumes->revealVolumes instead.")] public VolumesModule.RevealVolumeInfo[] reveal;
|
||||||
/// Add notification volumes to this planet
|
|
||||||
/// </summary>
|
[Obsolete("audioVolumes is deprecated. Use Volumes->audioVolumes instead.")] public VolumesModule.AudioVolumeInfo[] audioVolumes;
|
||||||
public NotificationVolumeInfo[] notificationVolumes;
|
|
||||||
|
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
public class ScatterInfo
|
public class ScatterInfo
|
||||||
@ -438,55 +427,6 @@ namespace NewHorizons.External.Modules
|
|||||||
public string xmlFile;
|
public string xmlFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonObject]
|
|
||||||
public class RevealInfo
|
|
||||||
{
|
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
|
||||||
public enum RevealVolumeType
|
|
||||||
{
|
|
||||||
[EnumMember(Value = @"enter")] Enter = 0,
|
|
||||||
|
|
||||||
[EnumMember(Value = @"observe")] Observe = 1,
|
|
||||||
|
|
||||||
[EnumMember(Value = @"snapshot")] Snapshot = 2
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The max view angle (in degrees) the player can see the volume with to unlock the fact (`observe` only)
|
|
||||||
/// </summary>
|
|
||||||
public float maxAngle = 180f; // Observe Only
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The max distance the user can be away from the volume to reveal the fact (`snapshot` and `observe` only)
|
|
||||||
/// </summary>
|
|
||||||
public float maxDistance = -1f; // Snapshot & Observe Only
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The position to place this volume at
|
|
||||||
/// </summary>
|
|
||||||
public MVector3 position;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The radius of this reveal volume
|
|
||||||
/// </summary>
|
|
||||||
public float radius = 1f;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// What needs to be done to the volume to unlock the facts
|
|
||||||
/// </summary>
|
|
||||||
[DefaultValue("enter")] public RevealVolumeType revealOn = RevealVolumeType.Enter;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A list of facts to reveal
|
|
||||||
/// </summary>
|
|
||||||
public string[] reveals;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// An achievement to unlock. Optional.
|
|
||||||
/// </summary>
|
|
||||||
public string achievementID;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
public class EntryLocationInfo
|
public class EntryLocationInfo
|
||||||
{
|
{
|
||||||
@ -823,35 +763,6 @@ namespace NewHorizons.External.Modules
|
|||||||
[DefaultValue(1f)] public float probability = 1f;
|
[DefaultValue(1f)] public float probability = 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonObject]
|
|
||||||
public class AudioVolumeInfo
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The location of this audio volume. Optional (will default to 0,0,0).
|
|
||||||
/// </summary>
|
|
||||||
public MVector3 position;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The radius of this audio volume
|
|
||||||
/// </summary>
|
|
||||||
public float radius;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The audio to use. Can be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list.
|
|
||||||
/// </summary>
|
|
||||||
public string audio;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The audio track of this audio volume
|
|
||||||
/// </summary>
|
|
||||||
[DefaultValue("environment")] public AudioMixerTrackName track = AudioMixerTrackName.Environment;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether to loop this audio while in this audio volume or just play it once
|
|
||||||
/// </summary>
|
|
||||||
[DefaultValue(true)] public bool loop = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
public class RemoteInfo
|
public class RemoteInfo
|
||||||
{
|
{
|
||||||
@ -1011,78 +922,5 @@ namespace NewHorizons.External.Modules
|
|||||||
public string rename;
|
public string rename;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonObject]
|
|
||||||
public class NotificationVolumeInfo
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// What the notification will show for.
|
|
||||||
/// </summary>
|
|
||||||
[DefaultValue("all")] public NotificationTarget target = NotificationTarget.All;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The location of this notification volume. Optional (will default to 0,0,0).
|
|
||||||
/// </summary>
|
|
||||||
public MVector3 position;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The radius of this notification volume.
|
|
||||||
/// </summary>
|
|
||||||
public float radius;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The notification that will play when you enter this volume.
|
|
||||||
/// </summary>
|
|
||||||
public NotificationInfo entryNotification;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The notification that will play when you exit this volume.
|
|
||||||
/// </summary>
|
|
||||||
public NotificationInfo exitNotification;
|
|
||||||
|
|
||||||
|
|
||||||
[JsonObject]
|
|
||||||
public class NotificationInfo
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The message that will be displayed.
|
|
||||||
/// </summary>
|
|
||||||
public string displayMessage;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The duration this notification will be displayed.
|
|
||||||
/// </summary>
|
|
||||||
[DefaultValue(5f)] public float duration = 5f;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
|
||||||
public enum NotificationTarget
|
|
||||||
{
|
|
||||||
[EnumMember(Value = @"all")] All = 0,
|
|
||||||
[EnumMember(Value = @"ship")] Ship = 1,
|
|
||||||
[EnumMember(Value = @"player")] Player = 2,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
|
||||||
public enum AudioMixerTrackName
|
|
||||||
{
|
|
||||||
[EnumMember(Value = @"undefined")] Undefined = 0,
|
|
||||||
[EnumMember(Value = @"menu")] Menu = 1,
|
|
||||||
[EnumMember(Value = @"music")] Music = 2,
|
|
||||||
[EnumMember(Value = @"environment")] Environment = 4,
|
|
||||||
[EnumMember(Value = @"environmentUnfiltered")] Environment_Unfiltered = 5,
|
|
||||||
[EnumMember(Value = @"endTimesSfx")] EndTimes_SFX = 8,
|
|
||||||
[EnumMember(Value = @"signal")] Signal = 16,
|
|
||||||
[EnumMember(Value = @"death")] Death = 32,
|
|
||||||
[EnumMember(Value = @"player")] Player = 64,
|
|
||||||
[EnumMember(Value = @"playerExternal")] Player_External = 65,
|
|
||||||
[EnumMember(Value = @"ship")] Ship = 128,
|
|
||||||
[EnumMember(Value = @"map")] Map = 256,
|
|
||||||
[EnumMember(Value = @"endTimesMusic")] EndTimes_Music = 512,
|
|
||||||
[EnumMember(Value = @"muffleWhileRafting")] MuffleWhileRafting = 1024,
|
|
||||||
[EnumMember(Value = @"muffleIndoors")] MuffleIndoors = 2048,
|
|
||||||
[EnumMember(Value = @"slideReelMusic")] SlideReelMusic = 4096,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
183
NewHorizons/External/Modules/VolumesModule.cs
vendored
Normal file
183
NewHorizons/External/Modules/VolumesModule.cs
vendored
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
using NewHorizons.Utility;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace NewHorizons.External.Modules
|
||||||
|
{
|
||||||
|
[JsonObject]
|
||||||
|
public class VolumesModule
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Add audio volumes to this planet
|
||||||
|
/// </summary>
|
||||||
|
public AudioVolumeInfo[] audioVolumes;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add notification volumes to this planet
|
||||||
|
/// </summary>
|
||||||
|
public NotificationVolumeInfo[] notificationVolumes;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add triggers that reveal parts of the ship log on this planet
|
||||||
|
/// </summary>
|
||||||
|
public RevealVolumeInfo[] revealVolumes;
|
||||||
|
|
||||||
|
[JsonObject]
|
||||||
|
public class RevealVolumeInfo
|
||||||
|
{
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public enum RevealVolumeType
|
||||||
|
{
|
||||||
|
[EnumMember(Value = @"enter")] Enter = 0,
|
||||||
|
|
||||||
|
[EnumMember(Value = @"observe")] Observe = 1,
|
||||||
|
|
||||||
|
[EnumMember(Value = @"snapshot")] Snapshot = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The max view angle (in degrees) the player can see the volume with to unlock the fact (`observe` only)
|
||||||
|
/// </summary>
|
||||||
|
public float maxAngle = 180f; // Observe Only
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The max distance the user can be away from the volume to reveal the fact (`snapshot` and `observe` only)
|
||||||
|
/// </summary>
|
||||||
|
public float maxDistance = -1f; // Snapshot & Observe Only
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The position to place this volume at
|
||||||
|
/// </summary>
|
||||||
|
public MVector3 position;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The radius of this reveal volume
|
||||||
|
/// </summary>
|
||||||
|
public float radius = 1f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// What needs to be done to the volume to unlock the facts
|
||||||
|
/// </summary>
|
||||||
|
[DefaultValue("enter")] public RevealVolumeType revealOn = RevealVolumeType.Enter;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A list of facts to reveal
|
||||||
|
/// </summary>
|
||||||
|
public string[] reveals;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An achievement to unlock. Optional.
|
||||||
|
/// </summary>
|
||||||
|
public string achievementID;
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonObject]
|
||||||
|
public class AudioVolumeInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The location of this audio volume. Optional (will default to 0,0,0).
|
||||||
|
/// </summary>
|
||||||
|
public MVector3 position;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The radius of this audio volume
|
||||||
|
/// </summary>
|
||||||
|
public float radius;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The audio to use. Can be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list.
|
||||||
|
/// </summary>
|
||||||
|
public string audio;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The audio track of this audio volume
|
||||||
|
/// </summary>
|
||||||
|
[DefaultValue("environment")] public AudioMixerTrackName track = AudioMixerTrackName.Environment;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether to loop this audio while in this audio volume or just play it once
|
||||||
|
/// </summary>
|
||||||
|
[DefaultValue(true)] public bool loop = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonObject]
|
||||||
|
public class NotificationVolumeInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// What the notification will show for.
|
||||||
|
/// </summary>
|
||||||
|
[DefaultValue("all")] public NotificationTarget target = NotificationTarget.All;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The location of this notification volume. Optional (will default to 0,0,0).
|
||||||
|
/// </summary>
|
||||||
|
public MVector3 position;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The radius of this notification volume.
|
||||||
|
/// </summary>
|
||||||
|
public float radius;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The notification that will play when you enter this volume.
|
||||||
|
/// </summary>
|
||||||
|
public NotificationInfo entryNotification;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The notification that will play when you exit this volume.
|
||||||
|
/// </summary>
|
||||||
|
public NotificationInfo exitNotification;
|
||||||
|
|
||||||
|
|
||||||
|
[JsonObject]
|
||||||
|
public class NotificationInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The message that will be displayed.
|
||||||
|
/// </summary>
|
||||||
|
public string displayMessage;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The duration this notification will be displayed.
|
||||||
|
/// </summary>
|
||||||
|
[DefaultValue(5f)] public float duration = 5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public enum NotificationTarget
|
||||||
|
{
|
||||||
|
[EnumMember(Value = @"all")] All = 0,
|
||||||
|
[EnumMember(Value = @"ship")] Ship = 1,
|
||||||
|
[EnumMember(Value = @"player")] Player = 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public enum AudioMixerTrackName
|
||||||
|
{
|
||||||
|
[EnumMember(Value = @"undefined")] Undefined = 0,
|
||||||
|
[EnumMember(Value = @"menu")] Menu = 1,
|
||||||
|
[EnumMember(Value = @"music")] Music = 2,
|
||||||
|
[EnumMember(Value = @"environment")] Environment = 4,
|
||||||
|
[EnumMember(Value = @"environmentUnfiltered")] Environment_Unfiltered = 5,
|
||||||
|
[EnumMember(Value = @"endTimesSfx")] EndTimes_SFX = 8,
|
||||||
|
[EnumMember(Value = @"signal")] Signal = 16,
|
||||||
|
[EnumMember(Value = @"death")] Death = 32,
|
||||||
|
[EnumMember(Value = @"player")] Player = 64,
|
||||||
|
[EnumMember(Value = @"playerExternal")] Player_External = 65,
|
||||||
|
[EnumMember(Value = @"ship")] Ship = 128,
|
||||||
|
[EnumMember(Value = @"map")] Map = 256,
|
||||||
|
[EnumMember(Value = @"endTimesMusic")] EndTimes_Music = 512,
|
||||||
|
[EnumMember(Value = @"muffleWhileRafting")] MuffleWhileRafting = 1024,
|
||||||
|
[EnumMember(Value = @"muffleIndoors")] MuffleIndoors = 2048,
|
||||||
|
[EnumMember(Value = @"slideReelMusic")] SlideReelMusic = 4096,
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,6 +3,7 @@ using NewHorizons.Builder.Body;
|
|||||||
using NewHorizons.Builder.General;
|
using NewHorizons.Builder.General;
|
||||||
using NewHorizons.Builder.Orbital;
|
using NewHorizons.Builder.Orbital;
|
||||||
using NewHorizons.Builder.Props;
|
using NewHorizons.Builder.Props;
|
||||||
|
using NewHorizons.Builder.Volumes;
|
||||||
using NewHorizons.Components;
|
using NewHorizons.Components;
|
||||||
using NewHorizons.Components.Orbital;
|
using NewHorizons.Components.Orbital;
|
||||||
using NewHorizons.OtherMods.OWRichPresence;
|
using NewHorizons.OtherMods.OWRichPresence;
|
||||||
@ -608,6 +609,11 @@ namespace NewHorizons.Handlers
|
|||||||
PropBuildManager.Make(go, sector, rb, body.Config, body.Mod);
|
PropBuildManager.Make(go, sector, rb, body.Config, body.Mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (body.Config.Volumes != null)
|
||||||
|
{
|
||||||
|
VolumesBuildManager.Make(go, sector, body.Config, body.Mod);
|
||||||
|
}
|
||||||
|
|
||||||
if (body.Config.Funnel != null)
|
if (body.Config.Funnel != null)
|
||||||
{
|
{
|
||||||
FunnelBuilder.Make(go, go.GetComponentInChildren<ConstantForceDetector>(), rb, body.Config.Funnel);
|
FunnelBuilder.Make(go, go.GetComponentInChildren<ConstantForceDetector>(), rb, body.Config.Funnel);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user