Add oxygen volumes

This commit is contained in:
Noah Pilarski 2022-11-25 16:35:59 -05:00
parent c4a256bd20
commit 439eebd2b5
3 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,18 @@
using NewHorizons.External.Modules;
using UnityEngine;
namespace NewHorizons.Builder.Volumes
{
public static class OxygenVolumeBuilder
{
public static OxygenVolume Make(GameObject planetGO, Sector sector, VolumesModule.OxygenVolumeInfo info)
{
var volume = VolumeBuilder.Make<OxygenVolume>(planetGO, sector, info);
volume._treeVolume = info.treeVolume;
volume._playRefillAudio = info.playRefillAudio;
return volume;
}
}
}

View File

@ -92,6 +92,13 @@ namespace NewHorizons.Builder.Volumes
DestructionVolumeBuilder.Make(go, sector, destructionVolume); DestructionVolumeBuilder.Make(go, sector, destructionVolume);
} }
} }
if (config.Volumes.oxygenVolumes != null)
{
foreach (var oxygenVolume in config.Volumes.oxygenVolumes)
{
OxygenVolumeBuilder.Make(go, sector, oxygenVolume);
}
}
} }
} }
} }

View File

@ -50,6 +50,11 @@ namespace NewHorizons.External.Modules
/// </summary> /// </summary>
public NotificationVolumeInfo[] notificationVolumes; public NotificationVolumeInfo[] notificationVolumes;
/// <summary>
/// Add oxygen volumes to this planet.
/// </summary>
public OxygenVolumeInfo[] oxygenVolumes;
/// <summary> /// <summary>
/// Add triggers that reveal parts of the ship log on this planet. /// Add triggers that reveal parts of the ship log on this planet.
/// </summary> /// </summary>
@ -319,6 +324,20 @@ namespace NewHorizons.External.Modules
[EnumMember(Value = @"crushedByElevator")] CrushedByElevator [EnumMember(Value = @"crushedByElevator")] CrushedByElevator
} }
} }
[JsonObject]
public class OxygenVolumeInfo : VolumeInfo
{
/// <summary>
/// Does this volume contain trees? This will change the notification from "Oxygen tank refilled" to "Trees detected, oxygen tank refilled".
/// </summary>
public bool treeVolume;
/// <summary>
/// Whether to play the oxygen tank refill sound or just fill quietly.
/// </summary>
[DefaultValue(true)] public bool playRefillAudio = true;
}
} }
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]