Allow more than one ring

This commit is contained in:
Noah Pilarski 2022-09-10 12:11:29 -04:00
parent 2da1015620
commit 5ab727384b
6 changed files with 32 additions and 14 deletions

View File

@ -120,10 +120,13 @@ namespace NewHorizons.Builder.Body
}
}
if (body.Config.Ring != null)
if (body.Config.Rings != null)
{
RingBuilder.MakeRingGraphics(proxy, null, body.Config.Ring, body.Mod);
if (realSize < body.Config.Ring.outerRadius) realSize = body.Config.Ring.outerRadius;
foreach (var ring in body.Config.Rings)
{
RingBuilder.MakeRingGraphics(proxy, null, ring, body.Mod);
if (realSize < ring.outerRadius) realSize = ring.outerRadius;
}
}
Renderer starAtmosphere = null;

View File

@ -73,7 +73,7 @@ namespace NewHorizons.Builder.Body
return null;
}
var ringGO = new GameObject("Ring");
var ringGO = new GameObject(!string.IsNullOrEmpty(ring.rename) ? ring.rename : "Ring");
ringGO.transform.parent = sector?.transform ?? rootObject.transform;
ringGO.transform.position = rootObject.transform.position;
ringGO.transform.rotation = rootObject.transform.rotation;

View File

@ -67,6 +67,10 @@ namespace NewHorizons.External.Configs
[Obsolete("Signal is deprecated, please use Props->signals")]
public SignalModule Signal;
[Obsolete("Ring is deprecated, please use Rings")]
public RingModule Ring;
#endregion Obsolete
/// <summary>
@ -135,9 +139,9 @@ namespace NewHorizons.External.Configs
public string[] removeChildren;
/// <summary>
/// Creates a ring around the planet
/// Create rings around the planet
/// </summary>
public RingModule Ring;
public RingModule[] Rings;
/// <summary>
/// Add sand to this planet

View File

@ -62,5 +62,10 @@ namespace NewHorizons.External.Modules
/// Fade rings in/out over time. Optional. Value between 0-1, time is in minutes.
/// </summary>
public TimeValuePair[] opacityCurve;
/// <summary>
/// An optional rename of this object
/// </summary>
public string rename;
}
}

View File

@ -547,9 +547,12 @@ namespace NewHorizons.Handlers
}
}
if (body.Config.Ring != null)
if (body.Config.Rings != null)
{
RingBuilder.Make(go, sector, body.Config.Ring, body.Mod);
foreach (var ring in body.Config.Rings)
{
RingBuilder.Make(go, sector, ring, body.Mod);
}
}
if (body.Config.AsteroidBelt != null)

View File

@ -107,13 +107,16 @@ namespace NewHorizons.Handlers
}
pivot.name = "Pivot";
if (body.Config.Ring != null)
if (body.Config.Rings != null && body.Config.Rings.Length > 0)
{
foreach (var ring in body.Config.Rings)
{
RingModule newRing = new RingModule();
newRing.innerRadius = size * 1.2f;
newRing.outerRadius = size * 2f;
newRing.texture = body.Config.Ring.texture;
var ring = RingBuilder.Make(titleScreenGO, null, newRing, body.Mod);
newRing.texture = ring.texture;
RingBuilder.Make(titleScreenGO, null, newRing, body.Mod);
}
titleScreenGO.transform.localScale = Vector3.one * 0.8f;
}