Throw error when making signal without name or frequency #660

This commit is contained in:
Nick 2023-07-21 19:53:29 -04:00
parent 4565e50d37
commit 53f7bc0b67
2 changed files with 12 additions and 1 deletions

View File

@ -5,6 +5,7 @@ using NewHorizons.Utility.OWML;
using OWML.Common;
using OWML.Utils;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using UnityEngine;
using UnityEngine.SceneManagement;
@ -134,6 +135,9 @@ namespace NewHorizons.Builder.Props.Audio
public static GameObject Make(GameObject planetGO, Sector sector, SignalInfo info, IModBehaviour mod)
{
if (string.IsNullOrEmpty(info.frequency)) throw new System.Exception("Cannot make a signal without a frequency");
if (string.IsNullOrEmpty(info.name)) throw new System.Exception("Cannot make a signal without a name");
var owAudioSource = GeneralAudioBuilder.Make(planetGO, sector, info, mod);
var signalGO = owAudioSource.gameObject;

View File

@ -225,7 +225,14 @@ namespace NewHorizons.Builder.Props
{
foreach (var signal in config.Props.signals)
{
SignalBuilder.Make(go, sector, signal, mod);
try
{
SignalBuilder.Make(go, sector, signal, mod);
}
catch (Exception ex)
{
NHLogger.LogError($"Couldn't make signal on planet [{config.name}] - {ex}");
}
}
}
if (config.Props.remotes != null)