diff --git a/Marshmallow/Main.cs b/Marshmallow/Main.cs index 281c2e73..c7d21a95 100644 --- a/Marshmallow/Main.cs +++ b/Marshmallow/Main.cs @@ -12,6 +12,7 @@ namespace Marshmallow public static OWRigidbody OWRB; public static Sector SECTOR; public static SpawnPoint SPAWN; + public static AstroObject ASTROOBJECT; public static IModHelper helper; @@ -25,14 +26,23 @@ namespace Marshmallow helper = base.ModHelper; - foreach (var file in Directory.GetFiles(ModHelper.Manifest.ModFolderPath + @"planets\")) + Main.Log("Begin load of planet config..."); + + try { - PlanetConfig config = ModHelper.Storage.Load(file.Replace(ModHelper.Manifest.ModFolderPath, "")); + foreach (var file in Directory.GetFiles(ModHelper.Manifest.ModFolderPath + @"planets\")) + { + PlanetConfig config = ModHelper.Storage.Load(file.Replace(ModHelper.Manifest.ModFolderPath, "")); - planetList.Add(config); + planetList.Add(config); - Log(config.GetSettingsValue("position").ToString()); - Log(config.GetSettingsValue("fogTint").ToString()); + Log(config.GetSettingsValue("position").ToString()); + Log(config.GetSettingsValue("fogTint").ToString()); + } + } + catch (Exception ex) + { + Main.Log("Error! - " + ex.Message); } if (planetList.Count != 0) @@ -58,6 +68,8 @@ namespace Marshmallow planet.transform.position = config.GetSettingsValue("position"); planet.SetActive(true); + + General.MakeOrbitLine.Make(planet, ASTROOBJECT); } } } @@ -70,7 +82,9 @@ namespace Marshmallow var name = config.GetSettingsValue("name"); var topCloudSize = config.GetSettingsValue("topCloudSize"); + Log("Got top cloud size as " + topCloudSize); var bottomCloudSize = config.GetSettingsValue("bottomCloudSize"); + Log("Got bottom cloud size as " + bottomCloudSize); GameObject body; @@ -79,7 +93,7 @@ namespace Marshmallow Body.MakeGeometry.Make(body, groundScale); - General.MakeOrbitingAstroObject.Make(body, 0.02f, config.GetSettingsValue("orbitAngle"), config.GetSettingsValue("hasGravity"), config.GetSettingsValue("surfaceAcceleration"), groundScale); + ASTROOBJECT = General.MakeOrbitingAstroObject.Make(body, 0.02f, config.GetSettingsValue("orbitAngle"), config.GetSettingsValue("hasGravity"), config.GetSettingsValue("surfaceAcceleration"), groundScale); General.MakeRFVolume.Make(body); if (config.GetSettingsValue("hasMapMarker")) @@ -119,7 +133,7 @@ namespace Marshmallow public static void Log(string text) { - helper.Console.WriteLine("[Marshmallow] : " + text); + helper.Console.WriteLine(text); } } } diff --git a/Marshmallow/MakeOrbitLine.cs b/Marshmallow/MakeOrbitLine.cs new file mode 100644 index 00000000..28d20d78 --- /dev/null +++ b/Marshmallow/MakeOrbitLine.cs @@ -0,0 +1,24 @@ +using OWML.ModHelper.Events; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine; + +namespace Marshmallow.General +{ + static class MakeOrbitLine + { + public static void Make(GameObject body, AstroObject astroobject) + { + GameObject orbit = new GameObject(); + orbit.transform.parent = body.transform; + + orbit.AddComponent(); + + var ol = orbit.AddComponent(); + ol.SetValue("_astroObject", astroobject); + ol.SetValue("_fade", false); + } + } +} diff --git a/Marshmallow/MakeOrbitingAstroObject.cs b/Marshmallow/MakeOrbitingAstroObject.cs index e109c066..de8dcac9 100644 --- a/Marshmallow/MakeOrbitingAstroObject.cs +++ b/Marshmallow/MakeOrbitingAstroObject.cs @@ -5,7 +5,7 @@ namespace Marshmallow.General { static class MakeOrbitingAstroObject { - public static void Make(GameObject body, float angularSpeed, float orbitAngle, bool hasGravity, float surfaceAccel, float groundSize) + public static AstroObject Make(GameObject body, float angularSpeed, float orbitAngle, bool hasGravity, float surfaceAccel, float groundSize) { Rigidbody RB = body.AddComponent(); RB.mass = 10000; @@ -25,6 +25,7 @@ namespace Marshmallow.General InitialMotion IM = body.AddComponent(); IM.SetPrimaryBody(Locator.GetAstroObject(AstroObject.Name.Sun).GetAttachedOWRigidbody()); IM.SetValue("_orbitAngle", orbitAngle); + Main.Log("Got orbit angle as " + orbitAngle); IM.SetValue("_isGlobalAxis", false); IM.SetValue("_initAngularSpeed", angularSpeed); IM.SetValue("_initLinearSpeed", 0f); @@ -47,6 +48,9 @@ namespace Marshmallow.General GravityVolume GV = MakeGravityWell.Make(body, surfaceAccel, groundSize, groundSize); AO.SetValue("_gravityVolume", GV); } + + return AO; + //General.MakeOrbitLine.Make(body, AO); } } } diff --git a/Marshmallow/Marshmallow.csproj b/Marshmallow/Marshmallow.csproj index 52da6c89..0a0ba8ce 100644 --- a/Marshmallow/Marshmallow.csproj +++ b/Marshmallow/Marshmallow.csproj @@ -31,35 +31,35 @@ 4 - - ..\packages\Lib.Harmony.1.2.0.1\lib\net35\0Harmony.dll + + ..\packages\Lib.Harmony.2.0.0.9\lib\net35\0Harmony.dll E:\Epic\Epic Games\OuterWilds\OuterWilds_Data\Managed\Assembly-CSharp.dll - ..\packages\OWML.0.3.43\lib\net35\NAudio-Unity.dll + ..\packages\OWML.0.3.44\lib\net35\NAudio-Unity.dll ..\packages\Json.Net.Unity3D.9.0.1\lib\net35\Newtonsoft.Json.dll - ..\packages\OWML.0.3.43\lib\net35\OWML.dll + ..\packages\OWML.0.3.44\lib\net35\OWML.dll - ..\packages\OWML.0.3.43\lib\net35\OWML.Common.dll + ..\packages\OWML.0.3.44\lib\net35\OWML.Common.dll - ..\packages\OWML.0.3.43\lib\net35\OWML.ModHelper.dll + ..\packages\OWML.0.3.44\lib\net35\OWML.ModHelper.dll - ..\packages\OWML.0.3.43\lib\net35\OWML.ModHelper.Assets.dll + ..\packages\OWML.0.3.44\lib\net35\OWML.ModHelper.Assets.dll - ..\packages\OWML.0.3.43\lib\net35\OWML.ModHelper.Events.dll + ..\packages\OWML.0.3.44\lib\net35\OWML.ModHelper.Events.dll - ..\packages\OWML.0.3.43\lib\net35\OWML.ModHelper.Menus.dll + ..\packages\OWML.0.3.44\lib\net35\OWML.ModHelper.Menus.dll @@ -105,6 +105,7 @@ + diff --git a/Marshmallow/packages.config b/Marshmallow/packages.config index 3cacfe77..c17af0b3 100644 --- a/Marshmallow/packages.config +++ b/Marshmallow/packages.config @@ -1,6 +1,6 @@  - - + + \ No newline at end of file