Reorganize obsolete config options

This commit is contained in:
Nick 2022-05-19 17:50:14 -04:00
parent baf3b6a39c
commit 8075577430
8 changed files with 32 additions and 24 deletions

View File

@ -7,7 +7,6 @@ namespace NewHorizons.Builder.Atmosphere
public static void Make(GameObject planetGO, PlanetConfig config, float sphereOfInfluence) public static void Make(GameObject planetGO, PlanetConfig config, float sphereOfInfluence)
{ {
var innerRadius = config.Base.SurfaceSize; var innerRadius = config.Base.SurfaceSize;
var useMiniMap = !config.Base.IsSatellite;
GameObject volumesGO = new GameObject("Volumes"); GameObject volumesGO = new GameObject("Volumes");
volumesGO.SetActive(false); volumesGO.SetActive(false);
@ -29,8 +28,8 @@ namespace NewHorizons.Builder.Atmosphere
PlanetoidRuleset PR = rulesetGO.AddComponent<PlanetoidRuleset>(); PlanetoidRuleset PR = rulesetGO.AddComponent<PlanetoidRuleset>();
PR._altitudeFloor = innerRadius; PR._altitudeFloor = innerRadius;
PR._altitudeCeiling = sphereOfInfluence; PR._altitudeCeiling = sphereOfInfluence;
PR._useMinimap = useMiniMap; PR._useMinimap = config.Base.ShowMinimap;
PR._useAltimeter = useMiniMap; PR._useAltimeter = config.Base.ShowMinimap;
rulesetGO.AddComponent<AntiTravelMusicRuleset>(); rulesetGO.AddComponent<AntiTravelMusicRuleset>();

View File

@ -3,7 +3,7 @@ namespace NewHorizons.Builder.General
{ {
public static class AmbientLightBuilder public static class AmbientLightBuilder
{ {
public static void Make(GameObject planetGO, Sector sector, float scale, float intensity = 0.5f) public static void Make(GameObject planetGO, Sector sector, float scale, float intensity)
{ {
GameObject lightGO = GameObject.Instantiate(GameObject.Find("BrittleHollow_Body/AmbientLight_BH_Surface"), sector?.transform ?? planetGO.transform); GameObject lightGO = GameObject.Instantiate(GameObject.Find("BrittleHollow_Body/AmbientLight_BH_Surface"), sector?.transform ?? planetGO.transform);
lightGO.transform.position = planetGO.transform.position; lightGO.transform.position = planetGO.transform.position;

View File

@ -15,7 +15,7 @@ namespace NewHorizons.Builder.General
var type = AstroObject.Type.Planet; var type = AstroObject.Type.Planet;
if (config.Orbit.IsMoon) type = AstroObject.Type.Moon; if (config.Orbit.IsMoon) type = AstroObject.Type.Moon;
else if (config.Base.IsSatellite) type = AstroObject.Type.Satellite; // else if (config.Base.IsSatellite) type = AstroObject.Type.Satellite;
else if (config.Base.HasCometTail) type = AstroObject.Type.Comet; else if (config.Base.HasCometTail) type = AstroObject.Type.Comet;
else if (config.Star != null) type = AstroObject.Type.Star; else if (config.Star != null) type = AstroObject.Type.Star;
else if (config.FocalPoint != null) type = AstroObject.Type.None; else if (config.FocalPoint != null) type = AstroObject.Type.None;

View File

@ -24,10 +24,12 @@ namespace NewHorizons.Builder.General
{ {
markerType = MapMarker.MarkerType.HourglassTwins; markerType = MapMarker.MarkerType.HourglassTwins;
} }
/*
else if (config.Base.IsSatellite) else if (config.Base.IsSatellite)
{ {
markerType = MapMarker.MarkerType.Probe; markerType = MapMarker.MarkerType.Probe;
} }
*/
mapMarker._markerType = markerType; mapMarker._markerType = markerType;
} }

View File

@ -60,12 +60,14 @@ namespace NewHorizons.Builder.Orbital
if (config.Orbit.Tint != null) color = config.Orbit.Tint.ToColor32(); if (config.Orbit.Tint != null) color = config.Orbit.Tint.ToColor32();
else if (config.Star != null) color = config.Star.Tint.ToColor32(); else if (config.Star != null) color = config.Star.Tint.ToColor32();
else if (config.Atmosphere != null && config.Atmosphere.CloudTint != null) color = config.Atmosphere.CloudTint.ToColor32(); else if (config.Atmosphere != null && config.Atmosphere.CloudTint != null) color = config.Atmosphere.CloudTint.ToColor32();
else if (config.Base.BlackHoleSize != 0 || config.Singularity != null) color = new Color(1f, 0.5f, 1f); else if (config.Singularity != null) color = new Color(1f, 0.5f, 1f);
else if (config.Base.WaterSize != 0) color = new Color(0.5f, 0.5f, 1f); else if (config.Water != null) color = new Color(0.5f, 0.5f, 1f);
else if (config.Base.LavaSize != 0) color = new Color(1f, 0.5f, 0.5f); else if (config.Lava != null) color = new Color(1f, 0.5f, 0.5f);
else if (config.Atmosphere != null && config.Atmosphere.FogTint != null) color = config.Atmosphere.FogTint.ToColor32(); else if (config.Atmosphere != null && config.Atmosphere.FogTint != null) color = config.Atmosphere.FogTint.ToColor32();
var fade = isMoon; var fade = isMoon;
/*
if (config.Base.IsSatellite) if (config.Base.IsSatellite)
{ {
if (config.Orbit.Tint != null) color = new Color(0.4082f, 0.516f, 0.4469f, 1f); if (config.Orbit.Tint != null) color = new Color(0.4082f, 0.516f, 0.4469f, 1f);
@ -73,6 +75,7 @@ namespace NewHorizons.Builder.Orbital
orbitLine._fadeEndDist = 5000; orbitLine._fadeEndDist = 5000;
orbitLine._fadeStartDist = 3000; orbitLine._fadeStartDist = 3000;
} }
*/
orbitLine._color = color; orbitLine._color = color;

View File

@ -32,9 +32,9 @@ namespace NewHorizons.External.Configs
public SandModule Sand { get; set; } public SandModule Sand { get; set; }
public FunnelModule Funnel { get; set; } public FunnelModule Funnel { get; set; }
// Obsolete #region Obsolete
public string[] ChildrenToDestroy { get; set; } [System.Obsolete("ChildrenToDestroy is deprecated, please use RemoveChildren instead")] public string[] ChildrenToDestroy { get; set; }
#endregion Obsolete
public PlanetConfig() public PlanetConfig()
{ {
@ -48,6 +48,9 @@ namespace NewHorizons.External.Configs
{ {
if (Base.CenterOfSolarSystem) Orbit.IsStatic = true; if (Base.CenterOfSolarSystem) Orbit.IsStatic = true;
// Backwards compatability
// Should be the only place that obsolete things are referenced
#pragma warning disable 612, 618
if (Base.WaterSize != 0) if (Base.WaterSize != 0)
{ {
Water = new WaterModule(); Water = new WaterModule();
@ -77,6 +80,12 @@ namespace NewHorizons.External.Configs
{ {
RemoveChildren = ChildrenToDestroy; RemoveChildren = ChildrenToDestroy;
} }
if (Base.HasAmbientLight)
{
Base.AmbientLight = 0.5f;
}
#pragma warning restore 612, 618
} }
} }
} }

View File

@ -4,8 +4,6 @@ namespace NewHorizons.External.Modules
public class BaseModule public class BaseModule
{ {
public bool HasMapMarker { get; set; } public bool HasMapMarker { get; set; }
[System.Obsolete("HasAmbientLight is deprecated, please use AmbientLight instead")]
public bool HasAmbientLight { get; set; }
public float AmbientLight { get; set; } public float AmbientLight { get; set; }
public float SurfaceGravity { get; set; } public float SurfaceGravity { get; set; }
public string GravityFallOff { get; set; } = "linear"; public string GravityFallOff { get; set; } = "linear";
@ -20,12 +18,13 @@ namespace NewHorizons.External.Modules
public bool InvulnerableToSun { get; set; } public bool InvulnerableToSun { get; set; }
public bool ShowMinimap { get; set; } = true; public bool ShowMinimap { get; set; } = true;
#region Obsolete
// Obsolete [System.Obsolete("IsSatellite is deprecated, please use ShowMinimap instead")] public bool IsSatellite { get; set; }
public bool IsSatellite { get; set; } [System.Obsolete("BlackHoleSize is deprecated, please use SingularityModule instead")] public float BlackHoleSize { get; set; }
public float BlackHoleSize { get; set; } [System.Obsolete("LavaSize is deprecated, please use LavaModule instead")] public float LavaSize { get; set; }
public float LavaSize { get; set; } [System.Obsolete("WaterTint is deprecated, please use WaterModule instead")] public float WaterSize { get; set; }
public float WaterSize { get; set; } [System.Obsolete("WaterTint is deprecated, please use WaterModule instead")] public MColor WaterTint { get; set; }
public MColor WaterTint { get; set; } [System.Obsolete("HasAmbientLight is deprecated, please use AmbientLight instead")] public bool HasAmbientLight { get; set; }
#endregion Obsolete
} }
} }

View File

@ -382,10 +382,6 @@ namespace NewHorizons.Handlers
{ {
AmbientLightBuilder.Make(go, sector, sphereOfInfluence, body.Config.Base.AmbientLight); AmbientLightBuilder.Make(go, sector, sphereOfInfluence, body.Config.Base.AmbientLight);
} }
else if (body.Config.Base.HasAmbientLight)
{
AmbientLightBuilder.Make(go, sector, sphereOfInfluence);
}
if (body.Config.Base.GroundSize != 0) if (body.Config.Base.GroundSize != 0)
{ {