fixed fog lights and planet staticPosition setting

This commit is contained in:
FreezeDriedMangoes 2022-07-08 18:13:29 -04:00
parent 7bfaadb3a9
commit ca391a1458
4 changed files with 23 additions and 3 deletions

View File

@ -89,6 +89,9 @@ namespace NewHorizons.Builder.Body
fog.fogTint = body.Config.Bramble.dimension.fogTint.ToColor(); fog.fogTint = body.Config.Bramble.dimension.fogTint.ToColor();
} }
// clear base game fog lights
dimensionSector.GetComponent<Sector>()._fogLightsInSector = null;
dimension.SetActive(true); dimension.SetActive(true);
return dimension; return dimension;

View File

@ -51,7 +51,7 @@ namespace NewHorizons.Builder.General
{ {
Logger.Log($"Setting center of universe to {config.name}"); Logger.Log($"Setting center of universe to {config.name}");
// By the time it runs we'll be able to get the OWRB with the method // By the time it runs we'll be able to get the OWRB with the method
Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => Locator.GetCenterOfTheUniverse()._staticReferenceFrame = astroObject.GetAttachedOWRigidbody(), 2); Locator.GetCenterOfTheUniverse()._staticReferenceFrame = astroObject.gameObject.GetComponent<OWRigidbody>();
} }
return astroObject; return astroObject;

View File

@ -142,6 +142,9 @@ namespace NewHorizons.Builder.Props
nodeWarp._linkedOuterWarpVolume = destination; nodeWarp._linkedOuterWarpVolume = destination;
destination.RegisterSenderWarp(nodeWarp); destination.RegisterSenderWarp(nodeWarp);
var fogLight = nodeWarp.GetComponent<FogLight>();
fogLight._linkedSector = destinationAO._rootSector;
return true; return true;
} }
@ -176,6 +179,19 @@ namespace NewHorizons.Builder.Props
GameObject.Destroy(brambleNode.FindChild("Signal_Harmonica")); GameObject.Destroy(brambleNode.FindChild("Signal_Harmonica"));
//
// Fix some components
//
var fogLight = brambleNode.GetComponent<FogLight>();
fogLight._parentBody = go.GetComponent<OWRigidbody>();
fogLight._sector = sector;
fogLight._linkedFogLights.Clear();
fogLight._linkedLightData.Clear();
fogLight._linkedSector = null;
sector.RegisterFogLight(fogLight);
// //
// Set the scale // Set the scale
// //

View File

@ -411,8 +411,9 @@ namespace NewHorizons.Handlers
DetectorBuilder.Make(go, owRigidBody, primaryBody, ao, body.Config); DetectorBuilder.Make(go, owRigidBody, primaryBody, ao, body.Config);
} }
else if (body.Config.Orbit.staticPosition != null) else if (body.Config.Orbit.staticPosition != null)
{ {
ao.transform.position = body.Config.Orbit.staticPosition; // NH doesn't set the value of _centerOfTheUniverse for a few frames
ao.transform.position = body.Config.Orbit.staticPosition + Locator._centerOfTheUniverse._staticReferenceFrame._lastPosition;
} }
if (ao.GetAstroObjectName() == AstroObject.Name.CustomString) if (ao.GetAstroObjectName() == AstroObject.Name.CustomString)