New skybox module

This commit is contained in:
Joshua Thome 2022-07-23 18:18:45 -05:00
parent 84b00e58c9
commit df4c5be913

View File

@ -43,8 +43,14 @@ namespace NewHorizons.External.Configs
/// <summary> /// <summary>
/// Customize the skybox for this system /// Customize the skybox for this system
/// </summary> /// </summary>
[Obsolete("skybox is deprecated, please use Skybox instead")]
public SkyboxConfig skybox; public SkyboxConfig skybox;
/// <summary>
/// Customize the skybox for this system
/// </summary>
public SkyboxModule Skybox;
/// <summary> /// <summary>
/// Set to `true` if you want to spawn here after dying, not Timber Hearth. You can still warp back to the main star /// Set to `true` if you want to spawn here after dying, not Timber Hearth. You can still warp back to the main star
/// system. /// system.
@ -117,6 +123,7 @@ namespace NewHorizons.External.Configs
public int[] z; public int[] z;
} }
[Obsolete("SkyboxConfig is deprecated, please use SkyboxModule instead")]
[JsonObject] [JsonObject]
public class SkyboxConfig public class SkyboxConfig
{ {
@ -134,6 +141,52 @@ namespace NewHorizons.External.Configs
/// Path to the material within the asset bundle specified by `assetBundle` to use for the skybox /// Path to the material within the asset bundle specified by `assetBundle` to use for the skybox
/// </summary> /// </summary>
public string path; public string path;
}
[JsonObject]
public class SkyboxModule
{
/// <summary>
/// Whether to destroy the star field around the player
/// </summary>
public bool destroyStarField;
/// <summary>
/// Whether to use a cube for the skybox instead of a smooth sphere
/// </summary>
public bool useCube;
/// <summary>
/// Relative filepath to the texture to use for the skybox's positive X direction
/// </summary>
public string rightPath;
/// <summary>
/// Relative filepath to the texture to use for the skybox's negative X direction
/// </summary>
public string leftPath;
/// <summary>
/// Relative filepath to the texture to use for the skybox's positive Y direction
/// </summary>
public string topPath;
/// <summary>
/// Relative filepath to the texture to use for the skybox's negative Y direction
/// </summary>
public string bottomPath;
/// <summary>
/// Relative filepath to the texture to use for the skybox's positive Z direction
/// </summary>
public string frontPath;
/// <summary>
/// Relative filepath to the texture to use for the skybox's negative Z direction
/// </summary>
public string backPath;
} }
/// <summary> /// <summary>
@ -162,7 +215,10 @@ namespace NewHorizons.External.Configs
// If current one is null take the other // If current one is null take the other
factRequiredForWarp = string.IsNullOrEmpty(factRequiredForWarp) ? otherConfig.factRequiredForWarp : factRequiredForWarp; factRequiredForWarp = string.IsNullOrEmpty(factRequiredForWarp) ? otherConfig.factRequiredForWarp : factRequiredForWarp;
#pragma warning disable CS0618 // Type or member is obsolete
skybox = skybox == null ? otherConfig.skybox : skybox; skybox = skybox == null ? otherConfig.skybox : skybox;
#pragma warning restore CS0618 // Type or member is obsolete
Skybox = Skybox == null ? otherConfig.Skybox : Skybox;
travelAudio = string.IsNullOrEmpty(travelAudio) ? otherConfig.travelAudio : travelAudio; travelAudio = string.IsNullOrEmpty(travelAudio) ? otherConfig.travelAudio : travelAudio;
// False by default so if one is true go true // False by default so if one is true go true
@ -187,6 +243,14 @@ namespace NewHorizons.External.Configs
#pragma warning disable 612, 618 #pragma warning disable 612, 618
if (!string.IsNullOrEmpty(travelAudioClip)) travelAudio = travelAudioClip; if (!string.IsNullOrEmpty(travelAudioClip)) travelAudio = travelAudioClip;
if (!string.IsNullOrEmpty(travelAudioFilePath)) travelAudio = travelAudioFilePath; if (!string.IsNullOrEmpty(travelAudioFilePath)) travelAudio = travelAudioFilePath;
if (skybox != null)
{
if (Skybox == null)
{
Skybox = new SkyboxModule();
Skybox.destroyStarField = skybox.destroyStarField;
}
}
} }
} }
} }