diff --git a/NewHorizons/External/Configs/TitleScreenConfig.cs b/NewHorizons/External/Configs/TitleScreenConfig.cs index ea56bc20..55c30c8e 100644 --- a/NewHorizons/External/Configs/TitleScreenConfig.cs +++ b/NewHorizons/External/Configs/TitleScreenConfig.cs @@ -50,15 +50,34 @@ namespace NewHorizons.External.Configs public string ambience; /// - /// Changes the speed the skybox rotates (and by extension the main menu planet). This is in degrees per second. + /// Edit properties of the background /// - public float rotationSpeed = 1; + public BackgroundModule Background; /// /// Edit properties of the main menu planet /// public MenuPlanetModule MenuPlanet; + [JsonObject] + public class BackgroundModule + { + /// + /// Changes the speed the background rotates (and by extension the main menu planet). This is in degrees per second. + /// + public float rotationSpeed = 1; + + /// + /// Disables the renderers of objects at the provided paths + /// + public string[] removeChildren; + + /// + /// A list of DetailInfos to populate the background with. + /// + public SimplifiedDetailInfo[] details; + } + [JsonObject] public class MenuPlanetModule { diff --git a/NewHorizons/Handlers/TitleSceneHandler.cs b/NewHorizons/Handlers/TitleSceneHandler.cs index fc020399..4d0fcf4f 100644 --- a/NewHorizons/Handlers/TitleSceneHandler.cs +++ b/NewHorizons/Handlers/TitleSceneHandler.cs @@ -127,7 +127,26 @@ namespace NewHorizons.Handlers Delay.FireOnNextUpdate(() => ambienceSource.AssignAudioLibraryClip(audioType)); } - SearchUtilities.Find("Scene/Background").GetComponent()._degreesPerSecond = config.rotationSpeed; + if (config.Background != null) + { + var background = SearchUtilities.Find("Scene/Background"); + + if (config.Background.removeChildren != null) + { + RemoveChildren(background, config.Background.removeChildren); + } + + if (config.Background.details != null) + { + foreach (var simplifiedDetail in config.Background.details) + { + DetailBuilder.Make(background, null, mod, new DetailInfo(simplifiedDetail)); + } + } + + var rotator = background.GetComponent(); + rotator._degreesPerSecond = config.Background.rotationSpeed; + } if (config.MenuPlanet != null) { @@ -152,7 +171,7 @@ namespace NewHorizons.Handlers if (config.MenuPlanet.destroyMenuPlanet) { - menuPlanet.SetActive(false); + SearchUtilities.Find("Scene/Background/PlanetPivot/PlanetRoot").SetActive(false); } } }