mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Allow comet tails on vanilla bodies
This commit is contained in:
parent
b779d6e3d5
commit
d759f1843b
@ -60,14 +60,22 @@ namespace NewHorizons.Builder.Body
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Make(GameObject planetGO, Sector sector, CometTailModule cometTailModule, PlanetConfig config)
|
public static void Make(GameObject planetGO, Sector sector, CometTailModule cometTailModule, PlanetConfig config, AstroObject ao)
|
||||||
{
|
{
|
||||||
if (config.Orbit.primaryBody == null)
|
var primaryBody = ao.GetPrimaryBody();
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(config.Orbit.primaryBody)) primaryBody = AstroObjectLocator.GetAstroObject(config.Orbit.primaryBody);
|
||||||
|
|
||||||
|
if (primaryBody == null)
|
||||||
{
|
{
|
||||||
NHLogger.LogError($"Comet {planetGO.name} does not orbit anything. That makes no sense");
|
NHLogger.LogError($"Comet {planetGO.name} does not orbit anything. That makes no sense");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(cometTailModule.primaryBody))
|
||||||
|
cometTailModule.primaryBody = !string.IsNullOrEmpty(config.Orbit.primaryBody) ? config.Orbit.primaryBody
|
||||||
|
: (primaryBody._name == AstroObject.Name.CustomString ? primaryBody.GetCustomName() : primaryBody._name.ToString());
|
||||||
|
|
||||||
var rootObj = new GameObject("CometRoot");
|
var rootObj = new GameObject("CometRoot");
|
||||||
rootObj.SetActive(false);
|
rootObj.SetActive(false);
|
||||||
rootObj.transform.parent = sector?.transform ?? planetGO.transform;
|
rootObj.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
@ -79,13 +87,11 @@ namespace NewHorizons.Builder.Body
|
|||||||
|
|
||||||
if (cometTailModule.rotationOverride != null) controller.SetRotationOverride(cometTailModule.rotationOverride);
|
if (cometTailModule.rotationOverride != null) controller.SetRotationOverride(cometTailModule.rotationOverride);
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(cometTailModule.primaryBody)) cometTailModule.primaryBody = config.Orbit.primaryBody;
|
|
||||||
|
|
||||||
Delay.FireOnNextUpdate(() =>
|
Delay.FireOnNextUpdate(() =>
|
||||||
{
|
{
|
||||||
controller.SetPrimaryBody(
|
controller.SetPrimaryBody(
|
||||||
AstroObjectLocator.GetAstroObject(cometTailModule.primaryBody).transform,
|
AstroObjectLocator.GetAstroObject(cometTailModule.primaryBody).transform,
|
||||||
AstroObjectLocator.GetAstroObject(config.Orbit.primaryBody).GetAttachedOWRigidbody()
|
primaryBody.GetAttachedOWRigidbody()
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -203,7 +203,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
|
|
||||||
if (body.Config.CometTail != null)
|
if (body.Config.CometTail != null)
|
||||||
{
|
{
|
||||||
CometTailBuilder.Make(proxy, null, body.Config.CometTail, body.Config);
|
CometTailBuilder.Make(proxy, null, body.Config.CometTail, body.Config, planetGO.GetComponent<AstroObject>());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body.Config.Props?.proxyDetails != null)
|
if (body.Config.Props?.proxyDetails != null)
|
||||||
|
|||||||
@ -657,7 +657,7 @@ namespace NewHorizons.Handlers
|
|||||||
|
|
||||||
if (body.Config.CometTail != null)
|
if (body.Config.CometTail != null)
|
||||||
{
|
{
|
||||||
CometTailBuilder.Make(go, sector, body.Config.CometTail, body.Config);
|
CometTailBuilder.Make(go, sector, body.Config.CometTail, body.Config, go.GetComponent<AstroObject>());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body.Config.Lava != null)
|
if (body.Config.Lava != null)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user