mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Merge branch 'master' into common-resources
This commit is contained in:
commit
5999e62927
@ -49,10 +49,15 @@ namespace NewHorizons.Builder.General
|
|||||||
if (config.Orbit.IsTidallyLocked)
|
if (config.Orbit.IsTidallyLocked)
|
||||||
{
|
{
|
||||||
var alignment = body.AddComponent<AlignWithTargetBody>();
|
var alignment = body.AddComponent<AlignWithTargetBody>();
|
||||||
alignment.SetTargetBody(primaryBody.GetAttachedOWRigidbody());
|
alignment.SetTargetBody(primaryBody?.GetAttachedOWRigidbody());
|
||||||
alignment.SetValue("_usePhysicsToRotate", true);
|
alignment.SetValue("_usePhysicsToRotate", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(config.Base.CenterOfSolarSystem)
|
||||||
|
{
|
||||||
|
Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => Locator.GetCenterOfTheUniverse()._staticReferenceFrame = owRigidBody, 2);
|
||||||
|
}
|
||||||
|
|
||||||
return new Tuple<AstroObject, OWRigidbody>(astroObject, owRigidBody);
|
return new Tuple<AstroObject, OWRigidbody>(astroObject, owRigidBody);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@ namespace NewHorizons.Builder.General
|
|||||||
forceDetector.SetValue("_inheritElement0", inherit);
|
forceDetector.SetValue("_inheritElement0", inherit);
|
||||||
OWRB.RegisterAttachedForceDetector(forceDetector);
|
OWRB.RegisterAttachedForceDetector(forceDetector);
|
||||||
|
|
||||||
GravityVolume parentGravityVolume = primaryBody.GetAttachedOWRigidbody().GetAttachedGravityVolume();
|
GravityVolume parentGravityVolume = primaryBody?.GetAttachedOWRigidbody()?.GetAttachedGravityVolume();
|
||||||
if (parentGravityVolume != null)
|
if (parentGravityVolume != null)
|
||||||
{
|
{
|
||||||
forceDetector.SetValue("_detectableFields", new ForceVolume[] { parentGravityVolume });
|
forceDetector.SetValue("_detectableFields", new ForceVolume[] { parentGravityVolume });
|
||||||
@ -33,7 +33,7 @@ namespace NewHorizons.Builder.General
|
|||||||
else if (astroObject != null)
|
else if (astroObject != null)
|
||||||
{
|
{
|
||||||
// It's probably a focal point (or its just broken)
|
// It's probably a focal point (or its just broken)
|
||||||
var binaryFocalPoint = primaryBody.gameObject.GetComponent<BinaryFocalPoint>();
|
var binaryFocalPoint = primaryBody?.gameObject?.GetComponent<BinaryFocalPoint>();
|
||||||
if(binaryFocalPoint != null)
|
if(binaryFocalPoint != null)
|
||||||
{
|
{
|
||||||
if(astroObject.GetCustomName().Equals(binaryFocalPoint.PrimaryName)) {
|
if(astroObject.GetCustomName().Equals(binaryFocalPoint.PrimaryName)) {
|
||||||
|
|||||||
1
NewHorizons/External/BaseModule.cs
vendored
1
NewHorizons/External/BaseModule.cs
vendored
@ -20,5 +20,6 @@ namespace NewHorizons.External
|
|||||||
public float LavaSize { get; set; }
|
public float LavaSize { get; set; }
|
||||||
public bool HasCometTail { get; set; }
|
public bool HasCometTail { get; set; }
|
||||||
public bool HasReferenceFrame { get; set; } = true;
|
public bool HasReferenceFrame { get; set; } = true;
|
||||||
|
public bool CenterOfSolarSystem { get; set; } = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
NewHorizons/External/StarModule.cs
vendored
2
NewHorizons/External/StarModule.cs
vendored
@ -12,5 +12,7 @@ namespace NewHorizons.External
|
|||||||
public float Size { get; set; }
|
public float Size { get; set; }
|
||||||
public MColor32 Tint { get; set; }
|
public MColor32 Tint { get; set; }
|
||||||
public MColor32 SolarFlareTint { get; set; }
|
public MColor32 SolarFlareTint { get; set; }
|
||||||
|
public MColor32 LightTint { get; set; }
|
||||||
|
public float SolarLuminosity { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -218,23 +218,29 @@ namespace NewHorizons
|
|||||||
|
|
||||||
public static GameObject GenerateBody(NewHorizonsBody body, bool defaultPrimaryToSun = false)
|
public static GameObject GenerateBody(NewHorizonsBody body, bool defaultPrimaryToSun = false)
|
||||||
{
|
{
|
||||||
//body.Config.Orbit.LongitudeOfAscendingNode = 0;
|
AstroObject primaryBody;
|
||||||
//body.Config.Orbit.ArgumentOfPeriapsis = 0;
|
if(body.Config.Orbit.PrimaryBody != null)
|
||||||
|
|
||||||
AstroObject primaryBody = AstroObjectLocator.GetAstroObject(body.Config.Orbit.PrimaryBody);
|
|
||||||
if (primaryBody == null)
|
|
||||||
{
|
{
|
||||||
if(defaultPrimaryToSun)
|
primaryBody = AstroObjectLocator.GetAstroObject(body.Config.Orbit.PrimaryBody);
|
||||||
|
if (primaryBody == null)
|
||||||
{
|
{
|
||||||
Logger.Log($"Couldn't find {body.Config.Orbit.PrimaryBody}, defaulting to Sun");
|
if (defaultPrimaryToSun)
|
||||||
primaryBody = AstroObjectLocator.GetAstroObject("Sun");
|
{
|
||||||
}
|
Logger.Log($"Couldn't find {body.Config.Orbit.PrimaryBody}, defaulting to Sun");
|
||||||
else
|
primaryBody = AstroObjectLocator.GetAstroObject("Sun");
|
||||||
{
|
}
|
||||||
NextPassBodies.Add(body);
|
else
|
||||||
return null;
|
{
|
||||||
|
NextPassBodies.Add(body);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
primaryBody = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Logger.Log($"Begin generation sequence of [{body.Config.Name}]");
|
Logger.Log($"Begin generation sequence of [{body.Config.Name}]");
|
||||||
|
|
||||||
@ -290,7 +296,8 @@ namespace NewHorizons
|
|||||||
|
|
||||||
// Now that we're done move the planet into place
|
// Now that we're done move the planet into place
|
||||||
go.transform.parent = Locator.GetRootTransform();
|
go.transform.parent = Locator.GetRootTransform();
|
||||||
go.transform.position = OrbitalHelper.GetCartesian(new OrbitalHelper.Gravity(1, 100), body.Config.Orbit).Item1 + primaryBody.transform.position;
|
|
||||||
|
go.transform.position = OrbitalHelper.GetCartesian(new OrbitalHelper.Gravity(1, 100), body.Config.Orbit).Item1 + (primaryBody == null ? Vector3.zero : primaryBody.transform.position);
|
||||||
|
|
||||||
if (go.transform.position.magnitude > FurthestOrbit)
|
if (go.transform.position.magnitude > FurthestOrbit)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user